<!DOCTYPE html><html lang=en-US-x-hixie><title>HTML Standard</title><script>
   var loadTimer = new Date();
   var current_revision = "r" + "$Revision: 8144 $".substr(11);
   current_revision = current_revision.substr(0, current_revision.length - 2);
   var last_known_revision = current_revision;
   function getCookie(name) {
     var params = location.search.substr(1).split("&");
     for (var index = 0; index < params.length; index++) {
       if (params[index] == name)
         return "1";
       var data = params[index].split("=");
       if (data[0] == name)
         return unescape(data[1]);
     }
     var cookies = document.cookie.split("; ");
     for (var index = 0; index < cookies.length; index++) {
       var data = cookies[index].split("=");
       if (data[0] == name)
         return unescape(data[1]);
     }
     return null;
   }
   var currentAlert;
   var currentAlertTimeout;
   function showAlert(s, href) {
     if (!currentAlert) {
       currentAlert = document.createElement('div');
       currentAlert.id = 'alert';
       var x = document.createElement('button');
       x.textContent = '\u2573';
       x.onclick = closeAlert2;
       currentAlert.appendChild(x);
       currentAlert.appendChild(document.createElement('span'));
       currentAlert.onmousemove = function () {
         clearTimeout(currentAlertTimeout);
         currentAlert.className = '';
         currentAlertTimeout = setTimeout(closeAlert, 10000);
       }
       document.body.appendChild(currentAlert);
     } else {
       clearTimeout(currentAlertTimeout);
       currentAlert.className = '';
     }
     currentAlert.lastChild.textContent = s + ' ';
     if (href) {
       var link = document.createElement('a');
       link.href = href;
       link.textContent = href;
       currentAlert.lastChild.appendChild(link);
     }
     currentAlertTimeout = setTimeout(closeAlert, 10000);
   }
   function closeAlert() {
     clearTimeout(currentAlertTimeout);
     if (currentAlert) {
       currentAlert.className = 'closed';
       currentAlertTimeout = setTimeout(closeAlert2, 3000);
     }
   }
   function closeAlert2() {
     clearTimeout(currentAlertTimeout);
     if (currentAlert) {
       currentAlert.parentNode.removeChild(currentAlert);
       currentAlert = null;
     }
   }
   window.addEventListener('keydown', function (event) {
     if (event.keyCode == 27) {
       if (currentAlert)
         closeAlert2();
     } else {
       closeAlert();
     }
   }, false);
   window.addEventListener('scroll', function (event) {
     closeAlert();
   }, false);
   function load(script) {
     var e = document.createElement('script');
     e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script);
     document.body.appendChild(e);
   }
  </script><link rel=stylesheet href=http://www.whatwg.org/style/specification><link rel=icon href=http://www.whatwg.org/images/icon><style>
   .proposal { border: blue solid; padding: 1em; }
   .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
   #updatesStatus { display: none; }
   #updatesStatus.relevant { display: block; position: fixed; right: 1em; top: 1em; padding: 0.5em; font: bold small sans-serif; min-width: 25em; width: 30%; max-width: 40em; height: auto; border: ridge 4px gray; background: #EEEEEE; color: black; }
   div.head .logo { width: 11em; margin-bottom: 20em; }
   #configUI { position: absolute; z-index: 20; top: 10em; right: 0; width: 11em; padding: 0 0.5em 0 0.5em; font-size: small; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 1em; -moz-border-radius: 1em 0 0 1em; }
   #configUI p { margin: 0.75em 0; padding: 0.3em; }
   #configUI p label { display: block; }
   #configUI #updateUI, #configUI .loginUI { text-align: center; }
   #configUI input[type=button] { display: block; margin: auto; }
   #configUI :link, #configUI :visited { color: white; }
   #configUI :link:hover, #configUI :visited:hover { background: transparent; }
   #reviewer { position: fixed; bottom: 0; right: 0; padding: 0.15em 0.25em 0em 0.5em; white-space: nowrap; overflow: hidden; z-index: 30; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 0; -moz-border-radius: 1em 0 0 0; max-width: 90%; }
   #reviewer input { max-width: 50%; }
   #reviewer * { font-size: small; }
   #reviewer.off > :not(:first-child) { display: none; }
   #alert { position: fixed; top: 20%; left: 20%; right: 20%; font-size: 2em; padding: 0.5em; z-index: 40; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em; -moz-border-radius: 1em; -webkit-transition: opacity 1s linear; }
   #alert.closed { opacity: 0; }
   #alert button { position: absolute; top: -1em; right: 2em; border-radius: 1em 1em 0 0; border: none; line-height: 0.9; color: white; background: rgb(64,64,64); font-size: 0.6em; font-weight: 900; cursor: pointer; }
   #alert :link, #alert :visited { color: white; }
   #alert :link:hover, #alert :visited:hover { background: transparent; }
   @media print { #configUI { display: none; } }
   .rfc2119 { font-variant: small-caps; text-shadow: 0 0 0.5em yellow; position: static; }
   .rfc2119::after { position: absolute; left: 0; width: 25px; text-align: center; color: yellow; text-shadow: 0.075em 0.075em 0.2em black; }
   .rfc2119.m\ust::after { content: '\2605'; }
   .rfc2119.s\hould::after { content: '\2606'; }
   [hidden] { display: none; }
  </style><style type=text/css>

   .fingerprint { float: right; }

   .applies thead th > * { display: block; }
   .applies thead code { display: block; }
   .applies td { text-align: center; }
   .applies .yes { background: yellow; }

   .matrix, .matrix td { border: hidden; text-align: right; }
   .matrix { margin-left: 2em; }

   .vertical-summary-table tr > th[rowspan="2"]:first-child + th,
   .vertical-summary-table tr > td[rowspan="2"]:first-child + td { border-bottom: hidden; }

   .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
   .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
   .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }

   td.eg { border-width: thin; text-align: center; }

   #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
   #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
   #table-example-1 caption { padding-bottom: 0.5em; }
   #table-example-1 thead, #table-example-1 tbody { border: none; }
   #table-example-1 th, #table-example-1 td { border: solid thin; }
   #table-example-1 th { font-weight: normal; }
   #table-example-1 td { border-style: none solid; vertical-align: top; }
   #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
   #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
   #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
   #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
   #table-example-1 tbody td:first-child::after { content: leader(". "); }
   #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
   #table-example-1 tbody td:first-child + td { width: 10em; }
   #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
   #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }

   .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
   .apple-table-examples * { font-family: "Times", serif; }
   .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
   .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
   .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
   .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
   .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
   .apple-table-examples td { text-align: right; vertical-align: top; }
   .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
   .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
   .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
   .apple-table-examples sup { line-height: 0; }

   .three-column-nowrap tr > td:first-child,
   .three-column-nowrap tr > td:first-child + td,
   .three-column-nowrap tr > td:first-child + td + td { white-space: nowrap; }

   .details-example img { vertical-align: top; }

   #base64-table {
     white-space: nowrap;
     font-size: 0.6em;
     column-width: 6em;
     column-count: 5;
     column-gap: 1em;
     -moz-column-width: 6em;
     -moz-column-count: 5;
     -moz-column-gap: 1em;
     -webkit-column-width: 6em;
     -webkit-column-count: 5;
     -webkit-column-gap: 1em;
   }
   #base64-table thead { display: none; }
   #base64-table * { border: none; }
   #base64-table tbody td:first-child:after { content: ':'; }
   #base64-table tbody td:last-child { text-align: right; }

   #named-character-references-table {
     white-space: nowrap;
     font-size: 0.6em;
     column-width: 30em;
     column-gap: 1em;
     -moz-column-width: 30em;
     -moz-column-gap: 1em;
     -webkit-column-width: 30em;
     -webkit-column-gap: 1em;
   }
   #named-character-references-table > table > tbody > tr > td:first-child + td,
   #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
   #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
   #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }

   .glyph.control { color: red; }

   @font-face {
     font-family: 'Essays1743';
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
   }
   @font-face {
     font-family: 'Essays1743';
     font-weight: bold;
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
   }
   @font-face {
     font-family: 'Essays1743';
     font-style: italic;
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
   }
   @font-face {
     font-family: 'Essays1743';
     font-style: italic;
     font-weight: bold;
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
   }

  </style><link rel=stylesheet href=data:text/css, title=Normal><link rel="stylesheet alternate" href=data:text/css,.impl%20{%20background:%20pink;%20} title="Highlight implementation-only prose"><link rel=stylesheet href=status.css><script>
   var startedInit = 0;
   function init() {
     startedInit = 1;
     if (location.search == '?slow-browser')
       return;
     var configUI = document.createElement('div');
     configUI.id = 'configUI';
     document.body.appendChild(configUI);
     load('reviewer.js');
     if (document.documentElement.className == "" || document.documentElement.className == "split index")
       load('toc.js');
     load('updater.js');
     load('dfn.js');
     load('status.js');
     if (getCookie('profile') == '1')
       document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
   }
   if (document.documentElement.className == "")
     setTimeout(function () {
       if (!startedInit)
         showAlert("Too slow? Try reading the multipage copy of the spec instead:", "http://whatwg.org/html");
     }, 6000);

   window.addEventListener('keypress', function (event) {
     if ((event.which == 114) && (event.metaKey)) {
       if (!confirm('Are you sure you want to reload this page?'))
         event.preventDefault();
     }
   }, false);

  </script><script async defer src="//survey.g.doubleclick.net/async_survey?site=52xlbs7js527m"></script><body onload=init()>

  <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
   <hgroup><h1 class=allcaps>HTML</h1>
    <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 14 August 2013</h2>
   </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
    <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
    <dt>Multiple-page version:</dt>
    <dd><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/>http://whatwg.org/html</a></dd>
    <dt>One-page version:</dt>
    <dd><a href=http://www.whatwg.org/specs/web-apps/current-work/>http://whatwg.org/c</a></dd>
    <dt>Participate:</dt>
    <dd><a href=http://www.whatwg.org/mailing-list>whatwg@whatwg.org</a></dd>
    <dd><a href=http://forums.whatwg.org/>http://forums.whatwg.org/</a></dd>
    <dd><a href=http://wiki.whatwg.org/wiki/IRC>IRC: #whatwg on Freenode</a></dd>
    <dt>FAQ:</dt>
    <dd><a href=http://wiki.whatwg.org/wiki/FAQ>http://wiki.whatwg.org/wiki/FAQ</a></dd>
    <dt>Version history:</dt>
    <dd>Twitter updates: <a href=http://twitter.com/WHATWG>http://twitter.com/WHATWG</a></dd>
    <dd>Commit-Watchers mailing list: <a href=http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org>http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org</a></dd>
    <dd>Interactive Web interface: <a href=http://html5.org/tools/web-apps-tracker>http://html5.org/tools/web-apps-tracker</a></dd>
    <dd>Subversion interface: <a href=http://svn.whatwg.org/>http://svn.whatwg.org/</a></dd>
    <dt>Issues:</dt>
    <dd>To view the open bugs: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;short_desc_type=allwordssubstr&amp;short_desc=&amp;product=WHATWG&amp;component=HTML&amp;longdesc_type=allwordssubstr&amp;longdesc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=&amp;bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;emailtype1=substring&amp;email1=&amp;emailtype2=substring&amp;email2=&amp;bug_id_type=anyexact&amp;bug_id=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;order=Reuse+same+sort+as+last+time&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">HTML bug list</a></dd>
    <dd>To file bugs, use the "submit review comments" feature at the bottom of the window</dd>
    <dd>To send feedback by e-mail: <a href=http://www.whatwg.org/mailing-list>whatwg@whatwg.org</a></dd>
    <dd>To view and vote on e-mail feedback: <a href=http://www.whatwg.org/issues/>http://www.whatwg.org/issues/</a></dd>
    <dt>Editor:</dt>
    <dd>Ian Hickson, Google, ian@hixie.ch</dd>
   </dl><p class=copyright>&copy; Copyright 2004-2011 Apple Computer, Inc.,
   Mozilla Foundation, and Opera Software ASA.</p>
   <p class=copyright>You are granted a license to use, reproduce
   and create derivative works of this document.</p>
  </header><hr><h2 class="no-num no-toc" id=contents>Table of contents</h2>
  
<!--begin-toc-->
<ol class=toc>
 <li><a href=#introduction><span class=secno>1 </span>Introduction</a>
  <ol>
   <li><a href=#abstract><span class=secno>1.1 </span>Where does this specification fit?</a></li>
   <li><a href=#is-this-html5?><span class=secno>1.2 </span>Is this HTML5?</a></li>
   <li><a href=#background><span class=secno>1.3 </span>Background</a></li>
   <li><a href=#audience><span class=secno>1.4 </span>Audience</a></li>
   <li><a href=#scope><span class=secno>1.5 </span>Scope</a></li>
   <li><a href=#history-1><span class=secno>1.6 </span>History</a></li>
   <li><a href=#design-notes><span class=secno>1.7 </span>Design notes</a>
    <ol>
     <li><a href=#serializability-of-script-execution><span class=secno>1.7.1 </span>Serializability of script execution</a></li>
     <li><a href=#compliance-with-other-specifications><span class=secno>1.7.2 </span>Compliance with other specifications</a></ol></li>
   <li><a href=#html-vs-xhtml><span class=secno>1.8 </span>HTML vs XHTML</a></li>
   <li><a href=#structure-of-this-specification><span class=secno>1.9 </span>Structure of this specification</a>
    <ol>
     <li><a href=#how-to-read-this-specification><span class=secno>1.9.1 </span>How to read this specification</a></li>
     <li><a href=#typographic-conventions><span class=secno>1.9.2 </span>Typographic conventions</a></ol></li>
   <li><a href=#fingerprint><span class=secno>1.10 </span>Privacy concerns</a></li>
   <li><a href=#a-quick-introduction-to-html><span class=secno>1.11 </span>A quick introduction to HTML</a>
    <ol>
     <li><a href=#writing-secure-applications-with-html><span class=secno>1.11.1 </span>Writing secure applications with HTML</a></li>
     <li><a href=#common-pitfalls-to-avoid-when-using-the-scripting-apis><span class=secno>1.11.2 </span>Common pitfalls to avoid when using the scripting APIs</a></ol></li>
   <li><a href=#conformance-requirements-for-authors><span class=secno>1.12 </span>Conformance requirements for authors</a>
    <ol>
     <li><a href=#presentational-markup><span class=secno>1.12.1 </span>Presentational markup</a></li>
     <li><a href=#syntax-errors><span class=secno>1.12.2 </span>Syntax errors</a></li>
     <li><a href=#restrictions-on-content-models-and-on-attribute-values><span class=secno>1.12.3 </span>Restrictions on content models and on attribute values</a></ol></li>
   <li><a href=#suggested-reading><span class=secno>1.13 </span>Suggested reading</a></ol></li>
 <li><a href=#infrastructure><span class=secno>2 </span>Common infrastructure</a>
  <ol>
   <li><a href=#terminology><span class=secno>2.1 </span>Terminology</a>
    <ol>
     <li><a href=#resources><span class=secno>2.1.1 </span>Resources</a></li>
     <li><a href=#xml><span class=secno>2.1.2 </span>XML</a></li>
     <li><a href=#dom-trees><span class=secno>2.1.3 </span>DOM trees</a></li>
     <li><a href=#scripting-0><span class=secno>2.1.4 </span>Scripting</a></li>
     <li><a href=#plugins><span class=secno>2.1.5 </span>Plugins</a></li>
     <li><a href=#encoding-terminology><span class=secno>2.1.6 </span>Character encodings</a></ol></li>
   <li><a href=#conformance-requirements><span class=secno>2.2 </span>Conformance requirements</a>
    <ol>
     <li><a href=#conformance-classes><span class=secno>2.2.1 </span>Conformance classes</a></li>
     <li><a href=#dependencies><span class=secno>2.2.2 </span>Dependencies</a></li>
     <li><a href=#extensibility><span class=secno>2.2.3 </span>Extensibility</a></ol></li>
   <li><a href=#case-sensitivity-and-string-comparison><span class=secno>2.3 </span>Case-sensitivity and string comparison</a></li>
   <li><a href=#common-microsyntaxes><span class=secno>2.4 </span>Common microsyntaxes</a>
    <ol>
     <li><a href=#common-parser-idioms><span class=secno>2.4.1 </span>Common parser idioms</a></li>
     <li><a href=#boolean-attributes><span class=secno>2.4.2 </span>Boolean attributes</a></li>
     <li><a href=#keywords-and-enumerated-attributes><span class=secno>2.4.3 </span>Keywords and enumerated attributes</a></li>
     <li><a href=#numbers><span class=secno>2.4.4 </span>Numbers</a>
      <ol>
       <li><a href=#signed-integers><span class=secno>2.4.4.1 </span>Signed integers</a></li>
       <li><a href=#non-negative-integers><span class=secno>2.4.4.2 </span>Non-negative integers</a></li>
       <li><a href=#floating-point-numbers><span class=secno>2.4.4.3 </span>Floating-point numbers</a></li>
       <li><a href=#percentages-and-dimensions><span class=secno>2.4.4.4 </span>Percentages and lengths</a></li>
       <li><a href=#lists-of-integers><span class=secno>2.4.4.5 </span>Lists of integers</a></li>
       <li><a href=#lists-of-dimensions><span class=secno>2.4.4.6 </span>Lists of dimensions</a></ol></li>
     <li><a href=#dates-and-times><span class=secno>2.4.5 </span>Dates and times</a>
      <ol>
       <li><a href=#months><span class=secno>2.4.5.1 </span>Months</a></li>
       <li><a href=#dates><span class=secno>2.4.5.2 </span>Dates</a></li>
       <li><a href=#yearless-dates><span class=secno>2.4.5.3 </span>Yearless dates</a></li>
       <li><a href=#times><span class=secno>2.4.5.4 </span>Times</a></li>
       <li><a href=#local-dates-and-times><span class=secno>2.4.5.5 </span>Local dates and times</a></li>
       <li><a href=#time-zones><span class=secno>2.4.5.6 </span>Time zones</a></li>
       <li><a href=#global-dates-and-times><span class=secno>2.4.5.7 </span>Global dates and times</a></li>
       <li><a href=#weeks><span class=secno>2.4.5.8 </span>Weeks</a></li>
       <li><a href=#durations><span class=secno>2.4.5.9 </span>Durations</a></li>
       <li><a href=#vaguer-moments-in-time><span class=secno>2.4.5.10 </span>Vaguer moments in time</a></ol></li>
     <li><a href=#colors><span class=secno>2.4.6 </span>Colors</a></li>
     <li><a href=#space-separated-tokens><span class=secno>2.4.7 </span>Space-separated tokens</a></li>
     <li><a href=#comma-separated-tokens><span class=secno>2.4.8 </span>Comma-separated tokens</a></li>
     <li><a href=#syntax-references><span class=secno>2.4.9 </span>References</a></li>
     <li><a href=#mq><span class=secno>2.4.10 </span>Media queries</a></ol></li>
   <li><a href=#urls><span class=secno>2.5 </span>URLs</a>
    <ol>
     <li><a href=#terminology-0><span class=secno>2.5.1 </span>Terminology</a></li>
     <li><a href=#resolving-urls><span class=secno>2.5.2 </span>Resolving URLs</a></li>
     <li><a href=#dynamic-changes-to-base-urls><span class=secno>2.5.3 </span>Dynamic changes to base URLs</a></ol></li>
   <li><a href=#fetching-resources><span class=secno>2.6 </span>Fetching resources</a>
    <ol>
     <li><a href=#terminology-1><span class=secno>2.6.1 </span>Terminology</a></li>
     <li><a href=#processing-model><span class=secno>2.6.2 </span>Processing model</a></li>
     <li><a href=#encrypted-http-and-related-security-concerns><span class=secno>2.6.3 </span>Encrypted HTTP and related security concerns</a></li>
     <li><a href=#content-type-sniffing><span class=secno>2.6.4 </span>Determining the type of a resource</a></li>
     <li><a href=#extracting-character-encodings-from-meta-elements><span class=secno>2.6.5 </span>Extracting character encodings from <code>meta</code> elements</a></li>
     <li><a href=#cors-settings-attributes><span class=secno>2.6.6 </span>CORS settings attributes</a></li>
     <li><a href=#cors-enabled-fetch><span class=secno>2.6.7 </span>CORS-enabled fetch</a></ol></li>
   <li><a href=#common-dom-interfaces><span class=secno>2.7 </span>Common DOM interfaces</a>
    <ol>
     <li><a href=#reflecting-content-attributes-in-idl-attributes><span class=secno>2.7.1 </span>Reflecting content attributes in IDL attributes</a></li>
     <li><a href=#collections-0><span class=secno>2.7.2 </span>Collections</a>
      <ol>
       <li><a href=#htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</a></li>
       <li><a href=#htmlformcontrolscollection-0><span class=secno>2.7.2.2 </span>HTMLFormControlsCollection</a></li>
       <li><a href=#htmloptionscollection-0><span class=secno>2.7.2.3 </span>HTMLOptionsCollection</a></li>
       <li><a href=#htmlpropertiescollection-0><span class=secno>2.7.2.4 </span>HTMLPropertiesCollection</a></ol></li>
     <li><a href=#domstringmap-0><span class=secno>2.7.3 </span>DOMStringMap</a></li>
     <li><a href=#domelementmap-0><span class=secno>2.7.4 </span>DOMElementMap</a></li>
     <li><a href=#transferable-objects><span class=secno>2.7.5 </span>Transferable objects</a></li>
     <li><a href=#safe-passing-of-structured-data><span class=secno>2.7.6 </span>Safe passing of structured data</a></li>
     <li><a href=#callbacks><span class=secno>2.7.7 </span>Callbacks</a></li>
     <li><a href=#garbage-collection><span class=secno>2.7.8 </span>Garbage collection</a></ol></li>
   <li><a href=#namespaces><span class=secno>2.8 </span>Namespaces</a></ol></li>
 <li><a href=#dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</a>
  <ol>
   <li><a href=#documents><span class=secno>3.1 </span>Documents</a>
    <ol>
     <li><a href=#the-document-object><span class=secno>3.1.1 </span>The <code>Document</code> object</a></li>
     <li><a href=#security-document><span class=secno>3.1.2 </span>Security</a></li>
     <li><a href=#resource-metadata-management><span class=secno>3.1.3 </span>Resource metadata management</a></li>
     <li><a href=#dom-tree-accessors><span class=secno>3.1.4 </span>DOM tree accessors</a></li>
     <li><a href=#loading-xml-documents><span class=secno>3.1.5 </span>Loading XML documents</a></ol></li>
   <li><a href=#elements><span class=secno>3.2 </span>Elements</a>
    <ol>
     <li><a href=#semantics-0><span class=secno>3.2.1 </span>Semantics</a></li>
     <li><a href=#elements-in-the-dom><span class=secno>3.2.2 </span>Elements in the DOM</a></li>
     <li><a href=#global-attributes><span class=secno>3.2.3 </span>Global attributes</a>
      <ol>
       <li><a href=#the-id-attribute><span class=secno>3.2.3.1 </span>The <code>id</code> attribute</a></li>
       <li><a href=#the-title-attribute><span class=secno>3.2.3.2 </span>The <code title=attr-title>title</code> attribute</a></li>
       <li><a href=#the-lang-and-xml:lang-attributes><span class=secno>3.2.3.3 </span>The <code title=attr-lang>lang</code> and <code title=attr-xml-lang>xml:lang</code> attributes</a></li>
       <li><a href=#the-translate-attribute><span class=secno>3.2.3.4 </span>The <code title=attr-translate>translate</code> attribute</a></li>
       <li><a href=#the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.5 </span>The <code>xml:base</code> attribute (XML only)</a></li>
       <li><a href=#the-dir-attribute><span class=secno>3.2.3.6 </span>The <code>dir</code> attribute</a></li>
       <li><a href=#classes><span class=secno>3.2.3.7 </span>The <code>class</code> attribute</a></li>
       <li><a href=#the-style-attribute><span class=secno>3.2.3.8 </span>The <code>style</code> attribute</a></li>
       <li><a href=#embedding-custom-non-visible-data-with-the-data-*-attributes><span class=secno>3.2.3.9 </span>Embedding custom non-visible data with the <code title=attr-data-*>data-*</code> attributes</a></ol></li>
     <li><a href=#element-definitions><span class=secno>3.2.4 </span>Element definitions</a>
      <ol>
       <li><a href=#attributes><span class=secno>3.2.4.1 </span>Attributes</a></ol></li>
     <li><a href=#content-models><span class=secno>3.2.5 </span>Content models</a>
      <ol>
       <li><a href=#kinds-of-content><span class=secno>3.2.5.1 </span>Kinds of content</a>
        <ol>
         <li><a href=#metadata-content-0><span class=secno>3.2.5.1.1 </span>Metadata content</a></li>
         <li><a href=#flow-content-0><span class=secno>3.2.5.1.2 </span>Flow content</a></li>
         <li><a href=#sectioning-content-0><span class=secno>3.2.5.1.3 </span>Sectioning content</a></li>
         <li><a href=#heading-content-0><span class=secno>3.2.5.1.4 </span>Heading content</a></li>
         <li><a href=#phrasing-content-0><span class=secno>3.2.5.1.5 </span>Phrasing content</a></li>
         <li><a href=#embedded-content-0><span class=secno>3.2.5.1.6 </span>Embedded content</a></li>
         <li><a href=#interactive-content-0><span class=secno>3.2.5.1.7 </span>Interactive content</a></li>
         <li><a href=#palpable-content-0><span class=secno>3.2.5.1.8 </span>Palpable content</a></li>
         <li><a href=#script-supporting-elements-0><span class=secno>3.2.5.1.9 </span>Script-supporting elements</a></ol></li>
       <li><a href=#transparent-content-models><span class=secno>3.2.5.2 </span>Transparent content models</a></li>
       <li><a href=#paragraphs><span class=secno>3.2.5.3 </span>Paragraphs</a></ol></li>
     <li><a href=#requirements-relating-to-bidirectional-algorithm-formatting-characters><span class=secno>3.2.6 </span>Requirements relating to bidirectional-algorithm formatting characters</a></li>
     <li><a href=#wai-aria><span class=secno>3.2.7 </span>WAI-ARIA</a></ol></li>
   <li><a href=#interactions-with-xpath-and-xslt><span class=secno>3.3 </span>Interactions with XPath and XSLT</a></li>
   <li><a href=#dynamic-markup-insertion><span class=secno>3.4 </span>Dynamic markup insertion</a>
    <ol>
     <li><a href=#opening-the-input-stream><span class=secno>3.4.1 </span>Opening the input stream</a></li>
     <li><a href=#closing-the-input-stream><span class=secno>3.4.2 </span>Closing the input stream</a></li>
     <li><a href=#document.write()><span class=secno>3.4.3 </span><code title=dom-document-write>document.write()</code></a></li>
     <li><a href=#document.writeln()><span class=secno>3.4.4 </span><code title=dom-document-writeln>document.writeln()</code></a></ol></ol></li>
 <li><a href=#semantics><span class=secno>4 </span>The elements of HTML</a>
  <ol>
   <li><a href=#the-root-element><span class=secno>4.1 </span>The root element</a>
    <ol>
     <li><a href=#the-html-element><span class=secno>4.1.1 </span>The <code>html</code> element</a></ol></li>
   <li><a href=#document-metadata><span class=secno>4.2 </span>Document metadata</a>
    <ol>
     <li><a href=#the-head-element><span class=secno>4.2.1 </span>The <code>head</code> element</a></li>
     <li><a href=#the-title-element><span class=secno>4.2.2 </span>The <code>title</code> element</a></li>
     <li><a href=#the-base-element><span class=secno>4.2.3 </span>The <code>base</code> element</a></li>
     <li><a href=#the-link-element><span class=secno>4.2.4 </span>The <code>link</code> element</a></li>
     <li><a href=#the-meta-element><span class=secno>4.2.5 </span>The <code>meta</code> element</a>
      <ol>
       <li><a href=#standard-metadata-names><span class=secno>4.2.5.1 </span>Standard metadata names</a></li>
       <li><a href=#other-metadata-names><span class=secno>4.2.5.2 </span>Other metadata names</a></li>
       <li><a href=#pragma-directives><span class=secno>4.2.5.3 </span>Pragma directives</a></li>
       <li><a href=#other-pragma-directives><span class=secno>4.2.5.4 </span>Other pragma directives</a></li>
       <li><a href=#charset><span class=secno>4.2.5.5 </span>Specifying the document's character encoding</a></ol></li>
     <li><a href=#the-style-element><span class=secno>4.2.6 </span>The <code>style</code> element</a></li>
     <li><a href=#styling><span class=secno>4.2.7 </span>Styling</a></ol></li>
   <li><a href=#scripting-1><span class=secno>4.3 </span>Scripting</a>
    <ol>
     <li><a href=#the-script-element><span class=secno>4.3.1 </span>The <code>script</code> element</a>
      <ol>
       <li><a href=#scriptingLanguages><span class=secno>4.3.1.1 </span>Scripting languages</a></li>
       <li><a href=#restrictions-for-contents-of-script-elements><span class=secno>4.3.1.2 </span>Restrictions for contents of <code>script</code> elements</a></li>
       <li><a href=#inline-documentation-for-external-scripts><span class=secno>4.3.1.3 </span>Inline documentation for external scripts</a></li>
       <li><a href=#scriptTagXSLT><span class=secno>4.3.1.4 </span>Interaction of <code>script</code> elements and XSLT</a></ol></li>
     <li><a href=#the-noscript-element><span class=secno>4.3.2 </span>The <code>noscript</code> element</a></li>
     <li><a href=#the-template-element><span class=secno>4.3.3 </span>The <code>template</code> element</a>
      <ol>
       <li><a href=#template-XSLT-XPath><span class=secno>4.3.3.1 </span>Interaction of <code>template</code> elements with XSLT and XPath</a></ol></ol></li>
   <li><a href=#sections><span class=secno>4.4 </span>Sections</a>
    <ol>
     <li><a href=#the-body-element><span class=secno>4.4.1 </span>The <code>body</code> element</a></li>
     <li><a href=#the-article-element><span class=secno>4.4.2 </span>The <code>article</code> element</a></li>
     <li><a href=#the-section-element><span class=secno>4.4.3 </span>The <code>section</code> element</a></li>
     <li><a href=#the-nav-element><span class=secno>4.4.4 </span>The <code>nav</code> element</a></li>
     <li><a href=#the-aside-element><span class=secno>4.4.5 </span>The <code>aside</code> element</a></li>
     <li><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><span class=secno>4.4.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>
     <li><a href=#the-hgroup-element><span class=secno>4.4.7 </span>The <code>hgroup</code> element</a></li>
     <li><a href=#the-header-element><span class=secno>4.4.8 </span>The <code>header</code> element</a></li>
     <li><a href=#the-footer-element><span class=secno>4.4.9 </span>The <code>footer</code> element</a></li>
     <li><a href=#the-address-element><span class=secno>4.4.10 </span>The <code>address</code> element</a></li>
     <li><a href=#headings-and-sections><span class=secno>4.4.11 </span>Headings and sections</a>
      <ol>
       <li><a href=#outlines><span class=secno>4.4.11.1 </span>Creating an outline</a></li>
       <li><a href=#sample-outlines><span class=secno>4.4.11.2 </span>Sample outlines</a></ol></li>
     <li><a href=#usage-summary-0><span class=secno>4.4.12 </span>Usage summary</a>
      <ol>
       <li><a href=#article-or-section><span class=secno>4.4.12.1 </span>Article or section?</a></ol></ol></li>
   <li><a href=#grouping-content><span class=secno>4.5 </span>Grouping content</a>
    <ol>
     <li><a href=#the-p-element><span class=secno>4.5.1 </span>The <code>p</code> element</a></li>
     <li><a href=#the-hr-element><span class=secno>4.5.2 </span>The <code>hr</code> element</a></li>
     <li><a href=#the-pre-element><span class=secno>4.5.3 </span>The <code>pre</code> element</a></li>
     <li><a href=#the-blockquote-element><span class=secno>4.5.4 </span>The <code>blockquote</code> element</a></li>
     <li><a href=#the-ol-element><span class=secno>4.5.5 </span>The <code>ol</code> element</a></li>
     <li><a href=#the-ul-element><span class=secno>4.5.6 </span>The <code>ul</code> element</a></li>
     <li><a href=#the-li-element><span class=secno>4.5.7 </span>The <code>li</code> element</a></li>
     <li><a href=#the-dl-element><span class=secno>4.5.8 </span>The <code>dl</code> element</a></li>
     <li><a href=#the-dt-element><span class=secno>4.5.9 </span>The <code>dt</code> element</a></li>
     <li><a href=#the-dd-element><span class=secno>4.5.10 </span>The <code>dd</code> element</a></li>
     <li><a href=#the-figure-element><span class=secno>4.5.11 </span>The <code>figure</code> element</a></li>
     <li><a href=#the-figcaption-element><span class=secno>4.5.12 </span>The <code>figcaption</code> element</a></li>
     <li><a href=#the-main-element><span class=secno>4.5.13 </span>The <code>main</code> element</a></li>
     <li><a href=#the-div-element><span class=secno>4.5.14 </span>The <code>div</code> element</a></ol></li>
   <li><a href=#text-level-semantics><span class=secno>4.6 </span>Text-level semantics</a>
    <ol>
     <li><a href=#the-a-element><span class=secno>4.6.1 </span>The <code>a</code> element</a></li>
     <li><a href=#the-em-element><span class=secno>4.6.2 </span>The <code>em</code> element</a></li>
     <li><a href=#the-strong-element><span class=secno>4.6.3 </span>The <code>strong</code> element</a></li>
     <li><a href=#the-small-element><span class=secno>4.6.4 </span>The <code>small</code> element</a></li>
     <li><a href=#the-s-element><span class=secno>4.6.5 </span>The <code>s</code> element</a></li>
     <li><a href=#the-cite-element><span class=secno>4.6.6 </span>The <code>cite</code> element</a></li>
     <li><a href=#the-q-element><span class=secno>4.6.7 </span>The <code>q</code> element</a></li>
     <li><a href=#the-dfn-element><span class=secno>4.6.8 </span>The <code>dfn</code> element</a></li>
     <li><a href=#the-abbr-element><span class=secno>4.6.9 </span>The <code>abbr</code> element</a></li>
     <li><a href=#the-data-element><span class=secno>4.6.10 </span>The <code>data</code> element</a></li>
     <li><a href=#the-time-element><span class=secno>4.6.11 </span>The <code>time</code> element</a></li>
     <li><a href=#the-code-element><span class=secno>4.6.12 </span>The <code>code</code> element</a></li>
     <li><a href=#the-var-element><span class=secno>4.6.13 </span>The <code>var</code> element</a></li>
     <li><a href=#the-samp-element><span class=secno>4.6.14 </span>The <code>samp</code> element</a></li>
     <li><a href=#the-kbd-element><span class=secno>4.6.15 </span>The <code>kbd</code> element</a></li>
     <li><a href=#the-sub-and-sup-elements><span class=secno>4.6.16 </span>The <code>sub</code> and <code>sup</code> elements</a></li>
     <li><a href=#the-i-element><span class=secno>4.6.17 </span>The <code>i</code> element</a></li>
     <li><a href=#the-b-element><span class=secno>4.6.18 </span>The <code>b</code> element</a></li>
     <li><a href=#the-u-element><span class=secno>4.6.19 </span>The <code>u</code> element</a></li>
     <li><a href=#the-mark-element><span class=secno>4.6.20 </span>The <code>mark</code> element</a></li>
     <li><a href=#the-ruby-element><span class=secno>4.6.21 </span>The <code>ruby</code> element</a></li>
     <li><a href=#the-rt-element><span class=secno>4.6.22 </span>The <code>rt</code> element</a></li>
     <li><a href=#the-rp-element><span class=secno>4.6.23 </span>The <code>rp</code> element</a></li>
     <li><a href=#the-bdi-element><span class=secno>4.6.24 </span>The <code>bdi</code> element</a></li>
     <li><a href=#the-bdo-element><span class=secno>4.6.25 </span>The <code>bdo</code> element</a></li>
     <li><a href=#the-span-element><span class=secno>4.6.26 </span>The <code>span</code> element</a></li>
     <li><a href=#the-br-element><span class=secno>4.6.27 </span>The <code>br</code> element</a></li>
     <li><a href=#the-wbr-element><span class=secno>4.6.28 </span>The <code>wbr</code> element</a></li>
     <li><a href=#usage-summary><span class=secno>4.6.29 </span>Usage summary</a></ol></li>
   <li><a href=#edits><span class=secno>4.7 </span>Edits</a>
    <ol>
     <li><a href=#the-ins-element><span class=secno>4.7.1 </span>The <code>ins</code> element</a></li>
     <li><a href=#the-del-element><span class=secno>4.7.2 </span>The <code>del</code> element</a></li>
     <li><a href=#attributes-common-to-ins-and-del-elements><span class=secno>4.7.3 </span>Attributes common to <code>ins</code> and <code>del</code> elements</a></li>
     <li><a href=#edits-and-paragraphs><span class=secno>4.7.4 </span>Edits and paragraphs</a></li>
     <li><a href=#edits-and-lists><span class=secno>4.7.5 </span>Edits and lists</a></li>
     <li><a href=#edits-and-tables><span class=secno>4.7.6 </span>Edits and tables</a></ol></li>
   <li><a href=#embedded-content-1><span class=secno>4.8 </span>Embedded content</a>
    <ol>
     <li><a href=#the-img-element><span class=secno>4.8.1 </span>The <code>img</code> element</a>
      <ol>
       <li><a href=#alt><span class=secno>4.8.1.1 </span>Requirements for providing text to act as an alternative for images</a>
        <ol>
         <li><a href=#general-guidelines><span class=secno>4.8.1.1.1 </span>General guidelines</a></li>
         <li><a href=#a-link-or-button-containing-nothing-but-the-image><span class=secno>4.8.1.1.2 </span>A link or button containing nothing but the image</a></li>
         <li><a href=#a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations><span class=secno>4.8.1.1.3 </span>A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrations</a></li>
         <li><a href=#a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos><span class=secno>4.8.1.1.4 </span>A short phrase or label with an alternative graphical representation: icons, logos</a></li>
         <li><a href=#text-that-has-been-rendered-to-a-graphic-for-typographical-effect><span class=secno>4.8.1.1.5 </span>Text that has been rendered to a graphic for typographical effect</a></li>
         <li><a href=#a-graphical-representation-of-some-of-the-surrounding-text><span class=secno>4.8.1.1.6 </span>A graphical representation of some of the surrounding text</a></li>
         <li><a href="#a-purely-decorative-image-that-doesn't-add-any-information"><span class=secno>4.8.1.1.7 </span>A purely decorative image that doesn't add any information</a></li>
         <li><a href=#a-group-of-images-that-form-a-single-larger-picture-with-no-links><span class=secno>4.8.1.1.8 </span>A group of images that form a single larger picture with no links</a></li>
         <li><a href=#a-group-of-images-that-form-a-single-larger-picture-with-links><span class=secno>4.8.1.1.9 </span>A group of images that form a single larger picture with links</a></li>
         <li><a href=#a-key-part-of-the-content><span class=secno>4.8.1.1.10 </span>A key part of the content</a></li>
         <li><a href=#an-image-not-intended-for-the-user><span class=secno>4.8.1.1.11 </span>An image not intended for the user</a></li>
         <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 class=secno>4.8.1.1.12 </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>
         <li><a href=#guidance-for-markup-generators><span class=secno>4.8.1.1.13 </span>Guidance for markup generators</a></li>
         <li><a href=#guidance-for-conformance-checkers><span class=secno>4.8.1.1.14 </span>Guidance for conformance checkers</a></ol></li>
       <li><a href=#adaptive-images><span class=secno>4.8.1.2 </span>Adaptive images</a></ol></li>
     <li><a href=#the-iframe-element><span class=secno>4.8.2 </span>The <code>iframe</code> element</a></li>
     <li><a href=#the-embed-element><span class=secno>4.8.3 </span>The <code>embed</code> element</a></li>
     <li><a href=#the-object-element><span class=secno>4.8.4 </span>The <code>object</code> element</a></li>
     <li><a href=#the-param-element><span class=secno>4.8.5 </span>The <code>param</code> element</a></li>
     <li><a href=#the-video-element><span class=secno>4.8.6 </span>The <code>video</code> element</a></li>
     <li><a href=#the-audio-element><span class=secno>4.8.7 </span>The <code>audio</code> element</a></li>
     <li><a href=#the-source-element><span class=secno>4.8.8 </span>The <code>source</code> element</a></li>
     <li><a href=#the-track-element><span class=secno>4.8.9 </span>The <code>track</code> element</a></li>
     <li><a href=#media-elements><span class=secno>4.8.10 </span>Media elements</a>
      <ol>
       <li><a href=#error-codes><span class=secno>4.8.10.1 </span>Error codes</a></li>
       <li><a href=#location-of-the-media-resource><span class=secno>4.8.10.2 </span>Location of the media resource</a></li>
       <li><a href=#mime-types><span class=secno>4.8.10.3 </span>MIME types</a></li>
       <li><a href=#network-states><span class=secno>4.8.10.4 </span>Network states</a></li>
       <li><a href=#loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the media resource</a></li>
       <li><a href=#offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets into the media resource</a></li>
       <li><a href=#ready-states><span class=secno>4.8.10.7 </span>Ready states</a></li>
       <li><a href=#playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the media resource</a></li>
       <li><a href=#seeking><span class=secno>4.8.10.9 </span>Seeking</a></li>
       <li><a href=#media-resources-with-multiple-media-tracks><span class=secno>4.8.10.10 </span>Media resources with multiple media tracks</a>
        <ol>
         <li><a href=#audiotracklist-and-videotracklist-objects><span class=secno>4.8.10.10.1 </span><code>AudioTrackList</code> and <code>VideoTrackList</code> objects</a></li>
         <li><a href=#selecting-specific-audio-and-video-tracks-declaratively><span class=secno>4.8.10.10.2 </span>Selecting specific audio and video tracks declaratively</a></ol></li>
       <li><a href=#synchronising-multiple-media-elements><span class=secno>4.8.10.11 </span>Synchronising multiple media elements</a>
        <ol>
         <li><a href=#introduction-0><span class=secno>4.8.10.11.1 </span>Introduction</a></li>
         <li><a href=#media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers</a></li>
         <li><a href=#assigning-a-media-controller-declaratively><span class=secno>4.8.10.11.3 </span>Assigning a media controller declaratively</a></ol></li>
       <li><a href=#timed-text-tracks><span class=secno>4.8.10.12 </span>Timed text tracks</a>
        <ol>
         <li><a href=#text-track-model><span class=secno>4.8.10.12.1 </span>Text track model</a></li>
         <li><a href=#sourcing-in-band-text-tracks><span class=secno>4.8.10.12.2 </span>Sourcing in-band text tracks</a></li>
         <li><a href=#sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sourcing out-of-band text tracks</a></li>
         <li><a href=#guidelines-for-exposing-cues-in-various-formats-as-text-track-cues><span class=secno>4.8.10.12.4 </span>Guidelines for exposing cues in various formats as text track cues</a></li>
         <li><a href=#text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</a></li>
         <li><a href=#text-tracks-describing-chapters><span class=secno>4.8.10.12.6 </span>Text tracks describing chapters</a></li>
         <li><a href=#cue-events><span class=secno>4.8.10.12.7 </span>Event definitions</a></ol></li>
       <li><a href=#user-interface><span class=secno>4.8.10.13 </span>User interface</a></li>
       <li><a href=#time-ranges><span class=secno>4.8.10.14 </span>Time ranges</a></li>
       <li><a href=#event-definitions><span class=secno>4.8.10.15 </span>Event definitions</a></li>
       <li><a href=#mediaevents><span class=secno>4.8.10.16 </span>Event summary</a></li>
       <li><a href=#security-and-privacy-considerations><span class=secno>4.8.10.17 </span>Security and privacy considerations</a></li>
       <li><a href=#best-practices-for-authors-using-media-elements><span class=secno>4.8.10.18 </span>Best practices for authors using media elements</a></li>
       <li><a href=#best-practices-for-implementors-of-media-elements><span class=secno>4.8.10.19 </span>Best practices for implementors of media elements</a></ol></li>
     <li><a href=#the-canvas-element><span class=secno>4.8.11 </span>The <code>canvas</code> element</a>
      <ol>
       <li><a href=#proxying-canvases-to-workers><span class=secno>4.8.11.1 </span>Proxying canvases to workers</a></li>
       <li><a href=#2dcontext><span class=secno>4.8.11.2 </span>The 2D rendering context</a>
        <ol>
         <li><a href=#implementation-notes><span class=secno>4.8.11.2.1 </span>Implementation notes</a></li>
         <li><a href=#the-canvas-state><span class=secno>4.8.11.2.2 </span>The canvas state</a></li>
         <li><a href=#drawingstyle-objects><span class=secno>4.8.11.2.3 </span><code>DrawingStyle</code> objects</a></li>
         <li><a href=#line-styles><span class=secno>4.8.11.2.4 </span>Line styles</a></li>
         <li><a href=#text-styles><span class=secno>4.8.11.2.5 </span>Text styles</a></li>
         <li><a href=#building-paths><span class=secno>4.8.11.2.6 </span>Building paths</a></li>
         <li><a href=#path-objects><span class=secno>4.8.11.2.7 </span><code>Path</code> objects</a></li>
         <li><a href=#transformations><span class=secno>4.8.11.2.8 </span>Transformations</a></li>
         <li><a href=#image-sources-for-2d-rendering-contexts><span class=secno>4.8.11.2.9 </span>Image sources for 2D rendering contexts</a></li>
         <li><a href=#fill-and-stroke-styles><span class=secno>4.8.11.2.10 </span>Fill and stroke styles</a></li>
         <li><a href=#drawing-rectangles-to-the-bitmap><span class=secno>4.8.11.2.11 </span>Drawing rectangles to the bitmap</a></li>
         <li><a href=#drawing-text-to-the-bitmap><span class=secno>4.8.11.2.12 </span>Drawing text to the bitmap</a></li>
         <li><a href=#drawing-paths-to-the-canvas><span class=secno>4.8.11.2.13 </span>Drawing paths to the canvas</a></li>
         <li><a href=#drawing-images><span class=secno>4.8.11.2.14 </span>Drawing images</a></li>
         <li><a href=#hit-regions><span class=secno>4.8.11.2.15 </span>Hit regions</a></li>
         <li><a href=#pixel-manipulation><span class=secno>4.8.11.2.16 </span>Pixel manipulation</a></li>
         <li><a href=#compositing><span class=secno>4.8.11.2.17 </span>Compositing</a></li>
         <li><a href=#image-smoothing><span class=secno>4.8.11.2.18 </span>Image smoothing</a></li>
         <li><a href=#shadows><span class=secno>4.8.11.2.19 </span>Shadows</a></li>
         <li><a href=#drawing-model><span class=secno>4.8.11.2.20 </span>Drawing model</a></li>
         <li><a href=#best-practices><span class=secno>4.8.11.2.21 </span>Best practices</a></li>
         <li><a href=#examples><span class=secno>4.8.11.2.22 </span>Examples</a></ol></li>
       <li><a href=#pixel-density><span class=secno>4.8.11.3 </span>Pixel density</a></li>
       <li><a href=#color-spaces-and-color-correction><span class=secno>4.8.11.4 </span>Color spaces and color correction</a></li>
       <li><a href=#serializing-bitmaps-to-a-file><span class=secno>4.8.11.5 </span>Serializing bitmaps to a file</a></li>
       <li><a href=#security-with-canvas-elements><span class=secno>4.8.11.6 </span>Security with <code>canvas</code> elements</a></ol></li>
     <li><a href=#the-map-element><span class=secno>4.8.12 </span>The <code>map</code> element</a></li>
     <li><a href=#the-area-element><span class=secno>4.8.13 </span>The <code>area</code> element</a></li>
     <li><a href=#image-maps><span class=secno>4.8.14 </span>Image maps</a>
      <ol>
       <li><a href=#authoring><span class=secno>4.8.14.1 </span>Authoring</a></li>
       <li><a href=#processing-model-0><span class=secno>4.8.14.2 </span>Processing model</a></ol></li>
     <li><a href=#mathml><span class=secno>4.8.15 </span>MathML</a></li>
     <li><a href=#svg-0><span class=secno>4.8.16 </span>SVG</a></li>
     <li><a href=#dimension-attributes><span class=secno>4.8.17 </span>Dimension attributes</a></ol></li>
   <li><a href=#tabular-data><span class=secno>4.9 </span>Tabular data</a>
    <ol>
     <li><a href=#the-table-element><span class=secno>4.9.1 </span>The <code>table</code> element</a>
      <ol>
       <li><a href=#table-descriptions-techniques><span class=secno>4.9.1.1 </span>Techniques for describing tables</a></li>
       <li><a href=#table-layout-techniques><span class=secno>4.9.1.2 </span>Techniques for table design</a></ol></li>
     <li><a href=#the-caption-element><span class=secno>4.9.2 </span>The <code>caption</code> element</a></li>
     <li><a href=#the-colgroup-element><span class=secno>4.9.3 </span>The <code>colgroup</code> element</a></li>
     <li><a href=#the-col-element><span class=secno>4.9.4 </span>The <code>col</code> element</a></li>
     <li><a href=#the-tbody-element><span class=secno>4.9.5 </span>The <code>tbody</code> element</a></li>
     <li><a href=#the-thead-element><span class=secno>4.9.6 </span>The <code>thead</code> element</a></li>
     <li><a href=#the-tfoot-element><span class=secno>4.9.7 </span>The <code>tfoot</code> element</a></li>
     <li><a href=#the-tr-element><span class=secno>4.9.8 </span>The <code>tr</code> element</a></li>
     <li><a href=#the-td-element><span class=secno>4.9.9 </span>The <code>td</code> element</a></li>
     <li><a href=#the-th-element><span class=secno>4.9.10 </span>The <code>th</code> element</a></li>
     <li><a href=#attributes-common-to-td-and-th-elements><span class=secno>4.9.11 </span>Attributes common to <code>td</code> and <code>th</code> elements</a></li>
     <li><a href=#processing-model-1><span class=secno>4.9.12 </span>Processing model</a>
      <ol>
       <li><a href=#forming-a-table><span class=secno>4.9.12.1 </span>Forming a table</a></li>
       <li><a href=#header-and-data-cell-semantics><span class=secno>4.9.12.2 </span>Forming relationships between data cells and header cells</a></ol></li>
     <li><a href=#table-sorting-model><span class=secno>4.9.13 </span>Table sorting model</a></li>
     <li><a href=#examples-0><span class=secno>4.9.14 </span>Examples</a></ol></li>
   <li><a href=#forms><span class=secno>4.10 </span>Forms</a>
    <ol>
     <li><a href=#introduction-1><span class=secno>4.10.1 </span>Introduction</a>
      <ol>
       <li><a href="#writing-a-form's-user-interface"><span class=secno>4.10.1.1 </span>Writing a form's user interface</a></li>
       <li><a href=#implementing-the-server-side-processing-for-a-form><span class=secno>4.10.1.2 </span>Implementing the server-side processing for a form</a></li>
       <li><a href=#configuring-a-form-to-communicate-with-a-server><span class=secno>4.10.1.3 </span>Configuring a form to communicate with a server</a></li>
       <li><a href=#client-side-form-validation><span class=secno>4.10.1.4 </span>Client-side form validation</a></li>
       <li><a href=#enabling-client-side-automatic-filling-of-form-controls><span class=secno>4.10.1.5 </span>Enabling client-side automatic filling of form controls</a></li>
       <li><a href=#improving-the-user-experience-on-mobile-devices><span class=secno>4.10.1.6 </span>Improving the user experience on mobile devices</a></li>
       <li><a href=#the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality><span class=secno>4.10.1.7 </span>The difference between the field type, the autofill field name, and the input modality</a></li>
       <li><a href=#input-author-notes><span class=secno>4.10.1.8 </span>Date, time, and number formats</a></ol></li>
     <li><a href=#categories><span class=secno>4.10.2 </span>Categories</a></li>
     <li><a href=#the-form-element><span class=secno>4.10.3 </span>The <code>form</code> element</a></li>
     <li><a href=#the-fieldset-element><span class=secno>4.10.4 </span>The <code>fieldset</code> element</a></li>
     <li><a href=#the-legend-element><span class=secno>4.10.5 </span>The <code>legend</code> element</a></li>
     <li><a href=#the-label-element><span class=secno>4.10.6 </span>The <code>label</code> element</a></li>
     <li><a href=#the-input-element><span class=secno>4.10.7 </span>The <code>input</code> element</a>
      <ol>
       <li><a href=#states-of-the-type-attribute><span class=secno>4.10.7.1 </span>States of the <code title=attr-input-type>type</code> attribute</a>
        <ol>
         <li><a href="#hidden-state-(type=hidden)"><span class=secno>4.10.7.1.1 </span>Hidden state (<code title="">type=hidden</code>)</a></li>
         <li><a href="#text-(type=text)-state-and-search-state-(type=search)"><span class=secno>4.10.7.1.2 </span>Text (<code title="">type=text</code>) state and Search state (<code title="">type=search</code>)</a></li>
         <li><a href="#telephone-state-(type=tel)"><span class=secno>4.10.7.1.3 </span>Telephone state (<code title="">type=tel</code>)</a></li>
         <li><a href="#url-state-(type=url)"><span class=secno>4.10.7.1.4 </span>URL state (<code title="">type=url</code>)</a></li>
         <li><a href="#e-mail-state-(type=email)"><span class=secno>4.10.7.1.5 </span>E-mail state (<code title="">type=email</code>)</a></li>
         <li><a href="#password-state-(type=password)"><span class=secno>4.10.7.1.6 </span>Password state (<code title="">type=password</code>)</a></li>
         <li><a href="#date-and-time-state-(type=datetime)"><span class=secno>4.10.7.1.7 </span>Date and Time state (<code title="">type=datetime</code>)</a></li>
         <li><a href="#date-state-(type=date)"><span class=secno>4.10.7.1.8 </span>Date state (<code title="">type=date</code>)</a></li>
         <li><a href="#month-state-(type=month)"><span class=secno>4.10.7.1.9 </span>Month state (<code title="">type=month</code>)</a></li>
         <li><a href="#week-state-(type=week)"><span class=secno>4.10.7.1.10 </span>Week state (<code title="">type=week</code>)</a></li>
         <li><a href="#time-state-(type=time)"><span class=secno>4.10.7.1.11 </span>Time state (<code title="">type=time</code>)</a></li>
         <li><a href="#local-date-and-time-state-(type=datetime-local)"><span class=secno>4.10.7.1.12 </span>Local Date and Time state (<code title="">type=datetime-local</code>)</a></li>
         <li><a href="#number-state-(type=number)"><span class=secno>4.10.7.1.13 </span>Number state (<code title="">type=number</code>)</a></li>
         <li><a href="#range-state-(type=range)"><span class=secno>4.10.7.1.14 </span>Range state (<code title="">type=range</code>)</a></li>
         <li><a href="#color-state-(type=color)"><span class=secno>4.10.7.1.15 </span>Color state (<code title="">type=color</code>)</a></li>
         <li><a href="#checkbox-state-(type=checkbox)"><span class=secno>4.10.7.1.16 </span>Checkbox state (<code title="">type=checkbox</code>)</a></li>
         <li><a href="#radio-button-state-(type=radio)"><span class=secno>4.10.7.1.17 </span>Radio Button state (<code title="">type=radio</code>)</a></li>
         <li><a href="#file-upload-state-(type=file)"><span class=secno>4.10.7.1.18 </span>File Upload state (<code title="">type=file</code>)</a></li>
         <li><a href="#submit-button-state-(type=submit)"><span class=secno>4.10.7.1.19 </span>Submit Button state (<code title="">type=submit</code>)</a></li>
         <li><a href="#image-button-state-(type=image)"><span class=secno>4.10.7.1.20 </span>Image Button state (<code title="">type=image</code>)</a></li>
         <li><a href="#reset-button-state-(type=reset)"><span class=secno>4.10.7.1.21 </span>Reset Button state (<code title="">type=reset</code>)</a></li>
         <li><a href="#button-state-(type=button)"><span class=secno>4.10.7.1.22 </span>Button state (<code title="">type=button</code>)</a></ol></li>
       <li><a href=#input-impl-notes><span class=secno>4.10.7.2 </span>Implemention notes regarding localization of form controls</a></li>
       <li><a href=#common-input-element-attributes><span class=secno>4.10.7.3 </span>Common <code>input</code> element attributes</a>
        <ol>
         <li><a href=#the-maxlength-attribute><span class=secno>4.10.7.3.1 </span>The <code title=attr-input-maxlength>maxlength</code> attribute</a></li>
         <li><a href=#the-size-attribute><span class=secno>4.10.7.3.2 </span>The <code title=attr-input-size>size</code> attribute</a></li>
         <li><a href=#the-readonly-attribute><span class=secno>4.10.7.3.3 </span>The <code title=attr-input-readonly>readonly</code> attribute</a></li>
         <li><a href=#the-required-attribute><span class=secno>4.10.7.3.4 </span>The <code title=attr-input-required>required</code> attribute</a></li>
         <li><a href=#the-multiple-attribute><span class=secno>4.10.7.3.5 </span>The <code title=attr-input-multiple>multiple</code> attribute</a></li>
         <li><a href=#the-pattern-attribute><span class=secno>4.10.7.3.6 </span>The <code title=attr-input-pattern>pattern</code> attribute</a></li>
         <li><a href=#the-min-and-max-attributes><span class=secno>4.10.7.3.7 </span>The <code title=attr-input-min>min</code> and <code title=attr-input-max>max</code> attributes</a></li>
         <li><a href=#the-step-attribute><span class=secno>4.10.7.3.8 </span>The <code title=attr-input-step>step</code> attribute</a></li>
         <li><a href=#the-list-attribute><span class=secno>4.10.7.3.9 </span>The <code title=attr-input-list>list</code> attribute</a></li>
         <li><a href=#the-placeholder-attribute><span class=secno>4.10.7.3.10 </span>The <code title=attr-input-placeholder>placeholder</code> attribute</a></ol></li>
       <li><a href=#common-input-element-apis><span class=secno>4.10.7.4 </span>Common <code>input</code> element APIs</a></li>
       <li><a href=#common-event-behaviors><span class=secno>4.10.7.5 </span>Common event behaviors</a></ol></li>
     <li><a href=#the-button-element><span class=secno>4.10.8 </span>The <code>button</code> element</a></li>
     <li><a href=#the-select-element><span class=secno>4.10.9 </span>The <code>select</code> element</a></li>
     <li><a href=#the-datalist-element><span class=secno>4.10.10 </span>The <code>datalist</code> element</a></li>
     <li><a href=#the-optgroup-element><span class=secno>4.10.11 </span>The <code>optgroup</code> element</a></li>
     <li><a href=#the-option-element><span class=secno>4.10.12 </span>The <code>option</code> element</a></li>
     <li><a href=#the-textarea-element><span class=secno>4.10.13 </span>The <code>textarea</code> element</a></li>
     <li><a href=#the-keygen-element><span class=secno>4.10.14 </span>The <code>keygen</code> element</a></li>
     <li><a href=#the-output-element><span class=secno>4.10.15 </span>The <code>output</code> element</a></li>
     <li><a href=#the-progress-element><span class=secno>4.10.16 </span>The <code>progress</code> element</a></li>
     <li><a href=#the-meter-element><span class=secno>4.10.17 </span>The <code>meter</code> element</a></li>
     <li><a href=#form-control-infrastructure><span class=secno>4.10.18 </span>Form control infrastructure</a>
      <ol>
       <li><a href="#a-form-control's-value"><span class=secno>4.10.18.1 </span>A form control's value</a></li>
       <li><a href=#mutability><span class=secno>4.10.18.2 </span>Mutability</a></li>
       <li><a href=#association-of-controls-and-forms><span class=secno>4.10.18.3 </span>Association of controls and forms</a></ol></li>
     <li><a href=#attributes-common-to-form-controls><span class=secno>4.10.19 </span>Attributes common to form controls</a>
      <ol>
       <li><a href=#naming-form-controls:-the-name-attribute><span class=secno>4.10.19.1 </span>Naming form controls: the <code title=attr-fe-name>name</code> attribute</a></li>
       <li><a href=#submitting-element-directionality:-the-dirname-attribute><span class=secno>4.10.19.2 </span>Submitting element directionality: the <code title=attr-fe-dirname>dirname</code> attribute</a></li>
       <li><a href=#limiting-user-input-length:-the-maxlength-attribute><span class=secno>4.10.19.3 </span>Limiting user input length: the <code title=attr-fe-maxlength>maxlength</code> attribute</a></li>
       <li><a href=#enabling-and-disabling-form-controls:-the-disabled-attribute><span class=secno>4.10.19.4 </span>Enabling and disabling form controls: the <code title=attr-fe-disabled>disabled</code> attribute</a></li>
       <li><a href=#form-submission-0><span class=secno>4.10.19.5 </span>Form submission</a></li>
       <li><a href=#autofocusing-a-form-control:-the-autofocus-attribute><span class=secno>4.10.19.6 </span>Autofocusing a form control: the <code title=attr-fe-autofocus>autofocus</code> attribute</a></li>
       <li><a href=#input-modalities:-the-inputmode-attribute><span class=secno>4.10.19.7 </span>Input modalities: the <code title=attr-fe-inputmode>inputmode</code> attribute</a></li>
       <li><a href=#autofilling-form-controls:-the-autocomplete-attribute><span class=secno>4.10.19.8 </span>Autofilling form controls: the <code title=attr-fe-autocomplete>autocomplete</code> attribute</a></ol></li>
     <li><a href=#textFieldSelection><span class=secno>4.10.20 </span>APIs for the text field selections</a></li>
     <li><a href=#constraints><span class=secno>4.10.21 </span>Constraints</a>
      <ol>
       <li><a href=#definitions><span class=secno>4.10.21.1 </span>Definitions</a></li>
       <li><a href=#constraint-validation><span class=secno>4.10.21.2 </span>Constraint validation</a></li>
       <li><a href=#the-constraint-validation-api><span class=secno>4.10.21.3 </span>The constraint validation API</a></li>
       <li><a href=#security-forms><span class=secno>4.10.21.4 </span>Security</a></ol></li>
     <li><a href=#form-submission><span class=secno>4.10.22 </span>Form submission</a>
      <ol>
       <li><a href=#introduction-2><span class=secno>4.10.22.1 </span>Introduction</a></li>
       <li><a href=#implicit-submission><span class=secno>4.10.22.2 </span>Implicit submission</a></li>
       <li><a href=#form-submission-algorithm><span class=secno>4.10.22.3 </span>Form submission algorithm</a></li>
       <li><a href=#constructing-form-data-set><span class=secno>4.10.22.4 </span>Constructing the form data set</a></li>
       <li><a href=#selecting-a-form-submission-encoding><span class=secno>4.10.22.5 </span>Selecting a form submission encoding</a></li>
       <li><a href=#url-encoded-form-data><span class=secno>4.10.22.6 </span>URL-encoded form data</a></li>
       <li><a href=#multipart-form-data><span class=secno>4.10.22.7 </span>Multipart form data</a></li>
       <li><a href=#plain-text-form-data><span class=secno>4.10.22.8 </span>Plain text form data</a></ol></li>
     <li><a href=#resetting-a-form><span class=secno>4.10.23 </span>Resetting a form</a></ol></li>
   <li><a href=#interactive-elements><span class=secno>4.11 </span>Interactive elements</a>
    <ol>
     <li><a href=#the-details-element><span class=secno>4.11.1 </span>The <code>details</code> element</a></li>
     <li><a href=#the-summary-element><span class=secno>4.11.2 </span>The <code>summary</code> element</a></li>
     <li><a href=#the-menu-element><span class=secno>4.11.3 </span>The <code>menu</code> element</a></li>
     <li><a href=#the-menuitem-element><span class=secno>4.11.4 </span>The <code>menuitem</code> element</a></li>
     <li><a href=#context-menus><span class=secno>4.11.5 </span>Context menus</a>
      <ol>
       <li><a href=#declaring-a-context-menu><span class=secno>4.11.5.1 </span>Declaring a context menu</a></li>
       <li><a href=#processing-model-2><span class=secno>4.11.5.2 </span>Processing model</a></li>
       <li><a href=#event-definitions-0><span class=secno>4.11.5.3 </span>Event definitions</a></ol></li>
     <li><a href=#commands><span class=secno>4.11.6 </span>Commands</a>
      <ol>
       <li><a href=#facets-0><span class=secno>4.11.6.1 </span>Facets</a></li>
       <li><a href=#using-the-a-element-to-define-a-command><span class=secno>4.11.6.2 </span>Using the <code>a</code> element to define a command</a></li>
       <li><a href=#using-the-button-element-to-define-a-command><span class=secno>4.11.6.3 </span>Using the <code>button</code> element to define a command</a></li>
       <li><a href=#using-the-input-element-to-define-a-command><span class=secno>4.11.6.4 </span>Using the <code>input</code> element to define a command</a></li>
       <li><a href=#using-the-option-element-to-define-a-command><span class=secno>4.11.6.5 </span>Using the <code>option</code> element to define a command</a></li>
       <li><a href=#using-the-menuitem-element-to-define-a-command><span class=secno>4.11.6.6 </span>Using the <code>menuitem</code> element to define a
  command</a></li>
       <li><a href=#using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly><span class=secno>4.11.6.7 </span>Using the <code title=attr-menuitem-command>command</code> attribute on <code>menuitem</code> elements to define
  a command indirectly</a></li>
       <li><a href=#using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.6.8 </span>Using the <code title=attr-accesskey>accesskey</code> attribute
  on a <code>label</code> element to define a command</a></li>
       <li><a href=#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.6.9 </span>Using the <code title=attr-accesskey>accesskey</code> attribute
  on a <code>legend</code> element to define a command</a></li>
       <li><a href=#using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.6.10 </span>Using the <code title=attr-accesskey>accesskey</code>
  attribute to define a command on other elements</a></ol></li>
     <li><a href=#the-dialog-element><span class=secno>4.11.7 </span>The <code>dialog</code> element</a>
      <ol>
       <li><a href=#anchor-points><span class=secno>4.11.7.1 </span>Anchor points</a></ol></ol></li>
   <li><a href=#links><span class=secno>4.12 </span>Links</a>
    <ol>
     <li><a href=#introduction-3><span class=secno>4.12.1 </span>Introduction</a></li>
     <li><a href=#links-created-by-a-and-area-elements><span class=secno>4.12.2 </span>Links created by <code>a</code> and <code>area</code> elements</a></li>
     <li><a href=#following-hyperlinks-0><span class=secno>4.12.3 </span>Following hyperlinks</a></li>
     <li><a href=#downloading-resources><span class=secno>4.12.4 </span>Downloading resources</a>
      <ol>
       <li><a href=#hyperlink-auditing><span class=secno>4.12.4.1 </span>Hyperlink auditing</a></ol></li>
     <li><a href=#linkTypes><span class=secno>4.12.5 </span>Link types</a>
      <ol>
       <li><a href=#rel-alternate><span class=secno>4.12.5.1 </span>Link type "<code>alternate</code>"</a></li>
       <li><a href=#link-type-author><span class=secno>4.12.5.2 </span>Link type "<code>author</code>"</a></li>
       <li><a href=#link-type-bookmark><span class=secno>4.12.5.3 </span>Link type "<code>bookmark</code>"</a></li>
       <li><a href=#link-type-help><span class=secno>4.12.5.4 </span>Link type "<code>help</code>"</a></li>
       <li><a href=#rel-icon><span class=secno>4.12.5.5 </span>Link type "<code>icon</code>"</a></li>
       <li><a href=#link-type-license><span class=secno>4.12.5.6 </span>Link type "<code>license</code>"</a></li>
       <li><a href=#link-type-nofollow><span class=secno>4.12.5.7 </span>Link type "<code>nofollow</code>"</a></li>
       <li><a href=#link-type-noreferrer><span class=secno>4.12.5.8 </span>Link type "<code>noreferrer</code>"</a></li>
       <li><a href=#link-type-prefetch><span class=secno>4.12.5.9 </span>Link type "<code>prefetch</code>"</a></li>
       <li><a href=#link-type-search><span class=secno>4.12.5.10 </span>Link type "<code>search</code>"</a></li>
       <li><a href=#link-type-sidebar><span class=secno>4.12.5.11 </span>Link type "<code>sidebar</code>"</a></li>
       <li><a href=#link-type-stylesheet><span class=secno>4.12.5.12 </span>Link type "<code>stylesheet</code>"</a></li>
       <li><a href=#link-type-tag><span class=secno>4.12.5.13 </span>Link type "<code>tag</code>"</a></li>
       <li><a href=#sequential-link-types><span class=secno>4.12.5.14 </span>Sequential link types</a>
        <ol>
         <li><a href=#link-type-next><span class=secno>4.12.5.14.1 </span>Link type "<code>next</code>"</a></li>
         <li><a href=#link-type-prev><span class=secno>4.12.5.14.2 </span>Link type "<code>prev</code>"</a></ol></li>
       <li><a href=#other-link-types><span class=secno>4.12.5.15 </span>Other link types</a></ol></ol></li>
   <li><a href=#common-idioms><span class=secno>4.13 </span>Common idioms without dedicated elements</a>
    <ol>
     <li><a href=#the-main-part-of-the-content><span class=secno>4.13.1 </span>The main part of the content</a></li>
     <li><a href=#rel-up><span class=secno>4.13.2 </span>Bread crumb navigation</a></li>
     <li><a href=#tag-clouds><span class=secno>4.13.3 </span>Tag clouds</a></li>
     <li><a href=#conversations><span class=secno>4.13.4 </span>Conversations</a></li>
     <li><a href=#footnotes><span class=secno>4.13.5 </span>Footnotes</a></ol></li>
   <li><a href=#disabled-elements><span class=secno>4.14 </span>Disabled elements</a></li>
   <li><a href=#selectors><span class=secno>4.15 </span>Matching HTML elements using selectors</a>
    <ol>
     <li><a href=#case-sensitivity><span class=secno>4.15.1 </span>Case-sensitivity</a></li>
     <li><a href=#pseudo-classes><span class=secno>4.15.2 </span>Pseudo-classes</a></ol></ol></li>
 <li><a href=#microdata><span class=secno>5 </span>Microdata</a>
  <ol>
   <li><a href=#introduction-4><span class=secno>5.1 </span>Introduction</a>
    <ol>
     <li><a href=#overview><span class=secno>5.1.1 </span>Overview</a></li>
     <li><a href=#the-basic-syntax><span class=secno>5.1.2 </span>The basic syntax</a></li>
     <li><a href=#typed-items><span class=secno>5.1.3 </span>Typed items</a></li>
     <li><a href=#global-identifiers-for-items><span class=secno>5.1.4 </span>Global identifiers for items</a></li>
     <li><a href=#selecting-names-when-defining-vocabularies><span class=secno>5.1.5 </span>Selecting names when defining vocabularies</a></li>
     <li><a href=#using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the microdata DOM API</a></ol></li>
   <li><a href=#encoding-microdata><span class=secno>5.2 </span>Encoding microdata</a>
    <ol>
     <li><a href=#the-microdata-model><span class=secno>5.2.1 </span>The microdata model</a></li>
     <li><a href=#items><span class=secno>5.2.2 </span>Items</a></li>
     <li><a href=#names:-the-itemprop-attribute><span class=secno>5.2.3 </span>Names: the <code>itemprop</code> attribute</a></li>
     <li><a href=#values><span class=secno>5.2.4 </span>Values</a></li>
     <li><a href=#associating-names-with-items><span class=secno>5.2.5 </span>Associating names with items</a></li>
     <li><a href=#microdata-and-other-namespaces><span class=secno>5.2.6 </span>Microdata and other namespaces</a></ol></li>
   <li><a href=#microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</a></li>
   <li><a href=#mdvocabs><span class=secno>5.4 </span>Sample microdata vocabularies</a>
    <ol>
     <li><a href=#vcard><span class=secno>5.4.1 </span>vCard</a>
      <ol>
       <li><a href=#conversion-to-vcard><span class=secno>5.4.1.1 </span>Conversion to vCard</a></li>
       <li><a href=#examples-1><span class=secno>5.4.1.2 </span>Examples</a></ol></li>
     <li><a href=#vevent><span class=secno>5.4.2 </span>vEvent</a>
      <ol>
       <li><a href=#conversion-to-icalendar><span class=secno>5.4.2.1 </span>Conversion to iCalendar</a></li>
       <li><a href=#examples-2><span class=secno>5.4.2.2 </span>Examples</a></ol></li>
     <li><a href=#licensing-works><span class=secno>5.4.3 </span>Licensing works</a>
      <ol>
       <li><a href=#examples-3><span class=secno>5.4.3.1 </span>Examples</a></ol></ol></li>
   <li><a href=#converting-html-to-other-formats><span class=secno>5.5 </span>Converting HTML to other formats</a>
    <ol>
     <li><a href=#json><span class=secno>5.5.1 </span>JSON</a></ol></ol></li>
 <li><a href=#browsers><span class=secno>6 </span>Loading Web pages</a>
  <ol>
   <li><a href=#windows><span class=secno>6.1 </span>Browsing contexts</a>
    <ol>
     <li><a href=#nested-browsing-contexts><span class=secno>6.1.1 </span>Nested browsing contexts</a>
      <ol>
       <li><a href=#navigating-nested-browsing-contexts-in-the-dom><span class=secno>6.1.1.1 </span>Navigating nested browsing contexts in the DOM</a></ol></li>
     <li><a href=#auxiliary-browsing-contexts><span class=secno>6.1.2 </span>Auxiliary browsing contexts</a>
      <ol>
       <li><a href=#navigating-auxiliary-browsing-contexts-in-the-dom><span class=secno>6.1.2.1 </span>Navigating auxiliary browsing contexts in the DOM</a></ol></li>
     <li><a href=#secondary-browsing-contexts><span class=secno>6.1.3 </span>Secondary browsing contexts</a></li>
     <li><a href=#security-nav><span class=secno>6.1.4 </span>Security</a></li>
     <li><a href=#groupings-of-browsing-contexts><span class=secno>6.1.5 </span>Groupings of browsing contexts</a></li>
     <li><a href=#browsing-context-names><span class=secno>6.1.6 </span>Browsing context names</a></ol></li>
   <li><a href=#the-window-object><span class=secno>6.2 </span>The <code>Window</code> object</a>
    <ol>
     <li><a href=#security-window><span class=secno>6.2.1 </span>Security</a></li>
     <li><a href=#apis-for-creating-and-navigating-browsing-contexts-by-name><span class=secno>6.2.2 </span>APIs for creating and navigating browsing contexts by name</a></li>
     <li><a href=#accessing-other-browsing-contexts><span class=secno>6.2.3 </span>Accessing other browsing contexts</a></li>
     <li><a href=#named-access-on-the-window-object><span class=secno>6.2.4 </span>Named access on the <code>Window</code> object</a></li>
     <li><a href=#garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>Garbage collection and browsing contexts</a></li>
     <li><a href=#closing-browsing-contexts><span class=secno>6.2.6 </span>Closing browsing contexts</a></li>
     <li><a href=#browser-interface-elements><span class=secno>6.2.7 </span>Browser interface elements</a></li>
     <li><a href=#the-windowproxy-object><span class=secno>6.2.8 </span>The <code>WindowProxy</code> object</a></ol></li>
   <li><a href=#origin-0><span class=secno>6.3 </span>Origin</a>
    <ol>
     <li><a href=#relaxing-the-same-origin-restriction><span class=secno>6.3.1 </span>Relaxing the same-origin restriction</a></ol></li>
   <li><a href=#sandboxing><span class=secno>6.4 </span>Sandboxing</a></li>
   <li><a href=#history><span class=secno>6.5 </span>Session history and navigation</a>
    <ol>
     <li><a href=#the-session-history-of-browsing-contexts><span class=secno>6.5.1 </span>The session history of browsing contexts</a></li>
     <li><a href=#the-history-interface><span class=secno>6.5.2 </span>The <code>History</code> interface</a></li>
     <li><a href=#the-location-interface><span class=secno>6.5.3 </span>The <code>Location</code> interface</a>
      <ol>
       <li><a href=#security-location><span class=secno>6.5.3.1 </span>Security</a></ol></li>
     <li><a href=#history-notes><span class=secno>6.5.4 </span>Implementation notes for session history</a></ol></li>
   <li><a href=#browsing-the-web><span class=secno>6.6 </span>Browsing the Web</a>
    <ol>
     <li><a href=#navigating-across-documents><span class=secno>6.6.1 </span>Navigating across documents</a></li>
     <li><a href=#read-html><span class=secno>6.6.2 </span>Page load processing model for HTML files</a></li>
     <li><a href=#read-xml><span class=secno>6.6.3 </span>Page load processing model for XML files</a></li>
     <li><a href=#read-text><span class=secno>6.6.4 </span>Page load processing model for text files</a></li>
     <li><a href=#read-multipart-x-mixed-replace><span class=secno>6.6.5 </span>Page load processing model for <code>multipart/x-mixed-replace</code> resources</a></li>
     <li><a href=#read-media><span class=secno>6.6.6 </span>Page load processing model for media</a></li>
     <li><a href=#read-plugin><span class=secno>6.6.7 </span>Page load processing model for content that uses plugins</a></li>
     <li><a href=#read-ua-inline><span class=secno>6.6.8 </span>Page load processing model for inline content that doesn't have a DOM</a></li>
     <li><a href=#scroll-to-fragid><span class=secno>6.6.9 </span>Navigating to a fragment identifier</a></li>
     <li><a href=#history-traversal><span class=secno>6.6.10 </span>History traversal</a>
      <ol>
       <li><a href=#event-definitions-1><span class=secno>6.6.10.1 </span>Event definitions</a></ol></li>
     <li><a href=#unloading-documents><span class=secno>6.6.11 </span>Unloading documents</a>
      <ol>
       <li><a href=#event-definition><span class=secno>6.6.11.1 </span>Event definition</a></ol></li>
     <li><a href=#aborting-a-document-load><span class=secno>6.6.12 </span>Aborting a document load</a></ol></li>
   <li><a href=#offline><span class=secno>6.7 </span>Offline Web applications</a>
    <ol>
     <li><a href=#introduction-5><span class=secno>6.7.1 </span>Introduction</a>
      <ol>
       <li><a href=#supporting-offline-caching-for-legacy-applications><span class=secno>6.7.1.1 </span>Supporting offline caching for legacy applications</a></li>
       <li><a href=#appcacheevents><span class=secno>6.7.1.2 </span>Event summary</a></ol></li>
     <li><a href=#appcache><span class=secno>6.7.2 </span>Application caches</a></li>
     <li><a href=#manifests><span class=secno>6.7.3 </span>The cache manifest syntax</a>
      <ol>
       <li><a href=#some-sample-manifests><span class=secno>6.7.3.1 </span>Some sample manifests</a></li>
       <li><a href=#writing-cache-manifests><span class=secno>6.7.3.2 </span>Writing cache manifests</a></li>
       <li><a href=#parsing-cache-manifests><span class=secno>6.7.3.3 </span>Parsing cache manifests</a></ol></li>
     <li><a href=#downloading-or-updating-an-application-cache><span class=secno>6.7.4 </span>Downloading or updating an application cache</a></li>
     <li><a href=#the-application-cache-selection-algorithm><span class=secno>6.7.5 </span>The application cache selection algorithm</a></li>
     <li><a href=#changesToNetworkingModel><span class=secno>6.7.6 </span>Changes to the networking model</a></li>
     <li><a href=#expiring-application-caches><span class=secno>6.7.7 </span>Expiring application caches</a></li>
     <li><a href=#disk-space><span class=secno>6.7.8 </span>Disk space</a></li>
     <li><a href=#application-cache-api><span class=secno>6.7.9 </span>Application cache API</a></li>
     <li><a href=#browser-state><span class=secno>6.7.10 </span>Browser state</a></ol></ol></li>
 <li><a href=#webappapis><span class=secno>7 </span>Web application APIs</a>
  <ol>
   <li><a href=#scripting><span class=secno>7.1 </span>Scripting</a>
    <ol>
     <li><a href=#introduction-6><span class=secno>7.1.1 </span>Introduction</a></li>
     <li><a href=#enabling-and-disabling-scripting><span class=secno>7.1.2 </span>Enabling and disabling scripting</a></li>
     <li><a href=#processing-model-3><span class=secno>7.1.3 </span>Processing model</a>
      <ol>
       <li><a href=#definitions-0><span class=secno>7.1.3.1 </span>Definitions</a></li>
       <li><a href=#calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</a></li>
       <li><a href=#creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</a></li>
       <li><a href=#killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</a></li>
       <li><a href=#runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script errors</a>
        <ol>
         <li><a href=#runtime-script-errors-in-documents><span class=secno>7.1.3.5.1 </span>Runtime script errors in documents</a></li>
         <li><a href=#the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code>ErrorEvent</code> interface</a></ol></ol></li>
     <li><a href=#event-loops><span class=secno>7.1.4 </span>Event loops</a>
      <ol>
       <li><a href=#definitions-1><span class=secno>7.1.4.1 </span>Definitions</a></li>
       <li><a href=#processing-model-4><span class=secno>7.1.4.2 </span>Processing model</a></li>
       <li><a href=#generic-task-sources><span class=secno>7.1.4.3 </span>Generic task sources</a></ol></li>
     <li><a href=#javascript-protocol><span class=secno>7.1.5 </span>The <code title="">javascript:</code> URL scheme</a></li>
     <li><a href=#events><span class=secno>7.1.6 </span>Events</a>
      <ol>
       <li><a href=#event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers</a></li>
       <li><a href=#event-handlers-on-elements,-document-objects,-and-window-objects><span class=secno>7.1.6.2 </span>Event handlers on elements, <code>Document</code> objects, and <code>Window</code> objects</a>
        <ol>
         <li><a href=#idl-definitions><span class=secno>7.1.6.2.1 </span>IDL definitions</a></ol></li>
       <li><a href=#event-firing><span class=secno>7.1.6.3 </span>Event firing</a></li>
       <li><a href=#events-and-the-window-object><span class=secno>7.1.6.4 </span>Events and the <code>Window</code> object</a></ol></ol></li>
   <li><a href=#atob><span class=secno>7.2 </span>Base64 utility methods</a></li>
   <li><a href=#timers><span class=secno>7.3 </span>Timers</a></li>
   <li><a href=#user-prompts><span class=secno>7.4 </span>User prompts</a>
    <ol>
     <li><a href=#simple-dialogs><span class=secno>7.4.1 </span>Simple dialogs</a></li>
     <li><a href=#printing><span class=secno>7.4.2 </span>Printing</a></li>
     <li><a href=#dialogs-implemented-using-separate-documents><span class=secno>7.4.3 </span>Dialogs implemented using separate documents</a></ol></li>
   <li><a href=#system-state-and-capabilities><span class=secno>7.5 </span>System state and capabilities</a>
    <ol>
     <li><a href=#the-navigator-object><span class=secno>7.5.1 </span>The <code>Navigator</code> object</a>
      <ol>
       <li><a href=#client-identification><span class=secno>7.5.1.1 </span>Client identification</a></li>
       <li><a href=#language-preferences><span class=secno>7.5.1.2 </span>Language preferences</a></li>
       <li><a href=#custom-handlers><span class=secno>7.5.1.3 </span>Custom scheme and content handlers</a>
        <ol>
         <li><a href=#security-and-privacy><span class=secno>7.5.1.3.1 </span>Security and privacy</a></li>
         <li><a href=#sample-handler-impl><span class=secno>7.5.1.3.2 </span>Sample user interface</a></ol></li>
       <li><a href=#manually-releasing-the-storage-mutex><span class=secno>7.5.1.4 </span>Manually releasing the storage mutex</a></li>
       <li><a href=#plugins-0><span class=secno>7.5.1.5 </span>Plugins</a></ol></li>
     <li><a href=#the-external-interface><span class=secno>7.5.2 </span>The <code>External</code> interface</a></ol></li>
   <li><a href=#images><span class=secno>7.6 </span>Images</a></ol></li>
 <li><a href=#editing><span class=secno>8 </span>User interaction</a>
  <ol>
   <li><a href=#the-hidden-attribute><span class=secno>8.1 </span>The <code>hidden</code> attribute</a></li>
   <li><a href=#inert-subtrees><span class=secno>8.2 </span>Inert subtrees</a>
    <ol>
     <li><a href=#the-inert-attribute><span class=secno>8.2.1 </span>The <code>inert</code> attribute</a></ol></li>
   <li><a href=#activation><span class=secno>8.3 </span>Activation</a></li>
   <li><a href=#focus><span class=secno>8.4 </span>Focus</a>
    <ol>
     <li><a href=#sequential-focus-navigation-and-the-tabindex-attribute><span class=secno>8.4.1 </span>Sequential focus navigation and the <code title=attr-tabindex>tabindex</code> attribute</a></li>
     <li><a href=#focus-management><span class=secno>8.4.2 </span>Focus management</a></li>
     <li><a href=#document-level-focus-apis><span class=secno>8.4.3 </span>Document-level focus APIs</a></li>
     <li><a href=#element-level-focus-apis><span class=secno>8.4.4 </span>Element-level focus APIs</a></ol></li>
   <li><a href=#assigning-keyboard-shortcuts><span class=secno>8.5 </span>Assigning keyboard shortcuts</a>
    <ol>
     <li><a href=#introduction-7><span class=secno>8.5.1 </span>Introduction</a></li>
     <li><a href=#the-accesskey-attribute><span class=secno>8.5.2 </span>The <code>accesskey</code> attribute</a></li>
     <li><a href=#processing-model-5><span class=secno>8.5.3 </span>Processing model</a></ol></li>
   <li><a href=#editing-0><span class=secno>8.6 </span>Editing</a>
    <ol>
     <li><a href=#contenteditable><span class=secno>8.6.1 </span>Making document regions editable: The <code title=attr-contenteditable>contenteditable</code> content attribute</a></li>
     <li><a href=#making-entire-documents-editable:-the-designmode-idl-attribute><span class=secno>8.6.2 </span>Making entire documents editable: The <code title=dom-document-designMode>designMode</code> IDL attribute</a></li>
     <li><a href=#best-practices-for-in-page-editors><span class=secno>8.6.3 </span>Best practices for in-page editors</a></li>
     <li><a href=#editing-apis><span class=secno>8.6.4 </span>Editing APIs</a></li>
     <li><a href=#spelling-and-grammar-checking><span class=secno>8.6.5 </span>Spelling and grammar checking</a></ol></li>
   <li><a href=#dnd><span class=secno>8.7 </span>Drag and drop</a>
    <ol>
     <li><a href=#introduction-8><span class=secno>8.7.1 </span>Introduction</a></li>
     <li><a href=#the-drag-data-store><span class=secno>8.7.2 </span>The drag data store</a></li>
     <li><a href=#the-datatransfer-interface><span class=secno>8.7.3 </span>The <code>DataTransfer</code> interface</a>
      <ol>
       <li><a href=#the-datatransferitemlist-interface><span class=secno>8.7.3.1 </span>The <code>DataTransferItemList</code> interface</a></li>
       <li><a href=#the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code>DataTransferItem</code> interface</a></ol></li>
     <li><a href=#the-dragevent-interface><span class=secno>8.7.4 </span>The <code>DragEvent</code> interface</a></li>
     <li><a href=#drag-and-drop-processing-model><span class=secno>8.7.5 </span>Drag-and-drop processing model</a></li>
     <li><a href=#dndevents><span class=secno>8.7.6 </span>Events summary</a></li>
     <li><a href=#the-draggable-attribute><span class=secno>8.7.7 </span>The <code>draggable</code> attribute</a></li>
     <li><a href=#the-dropzone-attribute><span class=secno>8.7.8 </span>The <code>dropzone</code> attribute</a></li>
     <li><a href=#security-risks-in-the-drag-and-drop-model><span class=secno>8.7.9 </span>Security risks in the drag-and-drop model</a></ol></ol></li>
 <li><a href=#workers><span class=secno>9 </span>Web workers</a>
  <ol>
   <li><a href=#introduction-9><span class=secno>9.1 </span>Introduction</a>
    <ol>
     <li><a href=#scope-0><span class=secno>9.1.1 </span>Scope</a></li>
     <li><a href=#examples-4><span class=secno>9.1.2 </span>Examples</a>
      <ol>
       <li><a href=#a-background-number-crunching-worker><span class=secno>9.1.2.1 </span>A background number-crunching worker</a></li>
       <li><a href=#worker-used-for-background-i/o><span class=secno>9.1.2.2 </span>Worker used for background I/O</a></li>
       <li><a href=#shared-workers-introduction><span class=secno>9.1.2.3 </span>Shared workers introduction</a></li>
       <li><a href=#shared-state-using-a-shared-worker><span class=secno>9.1.2.4 </span>Shared state using a shared worker</a></li>
       <li><a href=#delegation><span class=secno>9.1.2.5 </span>Delegation</a></ol></li>
     <li><a href=#tutorials><span class=secno>9.1.3 </span>Tutorials</a>
      <ol>
       <li><a href=#creating-a-dedicated-worker><span class=secno>9.1.3.1 </span>Creating a dedicated worker</a></li>
       <li><a href=#communicating-with-a-dedicated-worker><span class=secno>9.1.3.2 </span>Communicating with a dedicated worker</a></li>
       <li><a href=#shared-workers><span class=secno>9.1.3.3 </span>Shared workers</a></ol></ol></li>
   <li><a href=#infrastructure-0><span class=secno>9.2 </span>Infrastructure</a>
    <ol>
     <li><a href=#the-global-scope><span class=secno>9.2.1 </span>The global scope</a>
      <ol>
       <li><a href=#the-workerglobalscope-common-interface><span class=secno>9.2.1.1 </span>The <code>WorkerGlobalScope</code> common interface</a></li>
       <li><a href=#dedicated-workers-and-the-dedicatedworkerglobalscope-interface><span class=secno>9.2.1.2 </span>Dedicated workers and the <code>DedicatedWorkerGlobalScope</code> interface</a></li>
       <li><a href=#shared-workers-and-the-sharedworkerglobalscope-interface><span class=secno>9.2.1.3 </span>Shared workers and the <code>SharedWorkerGlobalScope</code> interface</a></ol></li>
     <li><a href=#the-event-loop><span class=secno>9.2.2 </span>The event loop</a></li>
     <li><a href="#the-worker's-lifetime"><span class=secno>9.2.3 </span>The worker's lifetime</a></li>
     <li><a href=#processing-model-6><span class=secno>9.2.4 </span>Processing model</a></li>
     <li><a href=#runtime-script-errors-0><span class=secno>9.2.5 </span>Runtime script errors</a></li>
     <li><a href=#creating-workers><span class=secno>9.2.6 </span>Creating workers</a>
      <ol>
       <li><a href=#the-abstractworker-abstract-interface><span class=secno>9.2.6.1 </span>The <code>AbstractWorker</code> abstract interface</a></li>
       <li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>9.2.6.2 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
       <li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>9.2.6.3 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
   <li><a href=#apis-available-to-workers><span class=secno>9.3 </span>APIs available to workers</a>
    <ol>
     <li><a href=#importing-scripts-and-libraries><span class=secno>9.3.1 </span>Importing scripts and libraries</a></li>
     <li><a href=#the-workernavigator-object><span class=secno>9.3.2 </span>The <code>WorkerNavigator</code> object</a></li>
     <li><a href=#interface-objects-and-constructors><span class=secno>9.3.3 </span>Interface objects and constructors</a></li>
     <li><a href=#worker-locations><span class=secno>9.3.4 </span>Worker locations</a></ol></ol></li>
 <li><a href=#comms><span class=secno>10 </span>Communication</a>
  <ol>
   <li><a href=#event-definitions-2><span class=secno>10.1 </span>Event definitions</a></li>
   <li><a href=#server-sent-events><span class=secno>10.2 </span>Server-sent events</a>
    <ol>
     <li><a href=#server-sent-events-intro><span class=secno>10.2.1 </span>Introduction</a></li>
     <li><a href=#the-eventsource-interface><span class=secno>10.2.2 </span>The <code>EventSource</code> interface</a></li>
     <li><a href=#processing-model-7><span class=secno>10.2.3 </span>Processing model</a></li>
     <li><a href=#parsing-an-event-stream><span class=secno>10.2.4 </span>Parsing an event stream</a></li>
     <li><a href=#event-stream-interpretation><span class=secno>10.2.5 </span>Interpreting an event stream</a></li>
     <li><a href=#authoring-notes><span class=secno>10.2.6 </span>Authoring notes</a></li>
     <li><a href=#eventsource-push><span class=secno>10.2.7 </span>Connectionless push and other features</a></li>
     <li><a href=#garbage-collection-0><span class=secno>10.2.8 </span>Garbage collection</a></li>
     <li><a href=#implementation-advice><span class=secno>10.2.9 </span>Implementation advice</a></li>
     <li><a href=#iana-considerations><span class=secno>10.2.10 </span>IANA considerations</a>
      <ol>
       <li><a href=#text/event-stream><span class=secno>10.2.10.1 </span><code>text/event-stream</code></a></li>
       <li><a href=#last-event-id><span class=secno>10.2.10.2 </span><code>Last-Event-ID</code></a></ol></ol></li>
   <li><a href=#network><span class=secno>10.3 </span>Web sockets</a>
    <ol>
     <li><a href=#network-intro><span class=secno>10.3.1 </span>Introduction</a></li>
     <li><a href=#the-websocket-interface><span class=secno>10.3.2 </span>The <code>WebSocket</code> interface</a></li>
     <li><a href=#feedback-from-the-protocol><span class=secno>10.3.3 </span>Feedback from the protocol</a></li>
     <li><a href=#ping-and-pong-frames><span class=secno>10.3.4 </span>Ping and Pong frames</a></li>
     <li><a href=#parsing-websocket-urls><span class=secno>10.3.5 </span>Parsing WebSocket URLs</a></li>
     <li><a href=#event-definitions-3><span class=secno>10.3.6 </span>Event definitions</a></li>
     <li><a href=#garbage-collection-1><span class=secno>10.3.7 </span>Garbage collection</a></ol></li>
   <li><a href=#web-messaging><span class=secno>10.4 </span>Cross-document messaging</a>
    <ol>
     <li><a href=#introduction-10><span class=secno>10.4.1 </span>Introduction</a></li>
     <li><a href=#security-postmsg><span class=secno>10.4.2 </span>Security</a>
      <ol>
       <li><a href=#authors><span class=secno>10.4.2.1 </span>Authors</a></li>
       <li><a href=#user-agents><span class=secno>10.4.2.2 </span>User agents</a></ol></li>
     <li><a href=#posting-messages><span class=secno>10.4.3 </span>Posting messages</a></ol></li>
   <li><a href=#channel-messaging><span class=secno>10.5 </span>Channel messaging</a>
    <ol>
     <li><a href=#introduction-11><span class=secno>10.5.1 </span>Introduction</a>
      <ol>
       <li><a href=#examples-5><span class=secno>10.5.1.1 </span>Examples</a></li>
       <li><a href=#ports-as-the-basis-of-an-object-capability-model-on-the-web><span class=secno>10.5.1.2 </span>Ports as the basis of an object-capability model on the Web</a></li>
       <li><a href=#ports-as-the-basis-of-abstracting-out-service-implementations><span class=secno>10.5.1.3 </span>Ports as the basis of abstracting out service implementations</a></ol></li>
     <li><a href=#message-channels><span class=secno>10.5.2 </span>Message channels</a></li>
     <li><a href=#message-ports><span class=secno>10.5.3 </span>Message ports</a></li>
     <li><a href=#broadcasting-to-many-ports><span class=secno>10.5.4 </span>Broadcasting to many ports</a></li>
     <li><a href=#ports-and-garbage-collection><span class=secno>10.5.5 </span>Ports and garbage collection</a></ol></ol></li>
 <li><a href=#webstorage><span class=secno>11 </span>Web storage</a>
  <ol>
   <li><a href=#introduction-12><span class=secno>11.1 </span>Introduction</a></li>
   <li><a href=#storage><span class=secno>11.2 </span>The API</a>
    <ol>
     <li><a href=#the-storage-interface><span class=secno>11.2.1 </span>The <code>Storage</code> interface</a></li>
     <li><a href=#the-sessionstorage-attribute><span class=secno>11.2.2 </span>The <code title=dom-sessionStorage>sessionStorage</code> attribute</a></li>
     <li><a href=#the-localstorage-attribute><span class=secno>11.2.3 </span>The <code title=dom-localStorage>localStorage</code> attribute</a></li>
     <li><a href=#the-storage-event><span class=secno>11.2.4 </span>The <code title=event-storage>storage</code> event</a>
      <ol>
       <li><a href=#event-definition-0><span class=secno>11.2.4.1 </span>Event definition</a></ol></li>
     <li><a href=#threads><span class=secno>11.2.5 </span>Threads</a></ol></li>
   <li><a href=#disk-space-0><span class=secno>11.3 </span>Disk space</a></li>
   <li><a href=#privacy><span class=secno>11.4 </span>Privacy</a>
    <ol>
     <li><a href=#user-tracking><span class=secno>11.4.1 </span>User tracking</a></li>
     <li><a href=#sensitivity-of-data><span class=secno>11.4.2 </span>Sensitivity of data</a></ol></li>
   <li><a href=#security-storage><span class=secno>11.5 </span>Security</a>
    <ol>
     <li><a href=#dns-spoofing-attacks><span class=secno>11.5.1 </span>DNS spoofing attacks</a></li>
     <li><a href=#cross-directory-attacks><span class=secno>11.5.2 </span>Cross-directory attacks</a></li>
     <li><a href=#implementation-risks><span class=secno>11.5.3 </span>Implementation risks</a></ol></ol></li>
 <li><a href=#syntax><span class=secno>12 </span>The HTML syntax</a>
  <ol>
   <li><a href=#writing><span class=secno>12.1 </span>Writing HTML documents</a>
    <ol>
     <li><a href=#the-doctype><span class=secno>12.1.1 </span>The DOCTYPE</a></li>
     <li><a href=#elements-0><span class=secno>12.1.2 </span>Elements</a>
      <ol>
       <li><a href=#start-tags><span class=secno>12.1.2.1 </span>Start tags</a></li>
       <li><a href=#end-tags><span class=secno>12.1.2.2 </span>End tags</a></li>
       <li><a href=#attributes-0><span class=secno>12.1.2.3 </span>Attributes</a></li>
       <li><a href=#optional-tags><span class=secno>12.1.2.4 </span>Optional tags</a></li>
       <li><a href=#element-restrictions><span class=secno>12.1.2.5 </span>Restrictions on content models</a></li>
       <li><a href=#cdata-rcdata-restrictions><span class=secno>12.1.2.6 </span>Restrictions on the contents of raw text and escapable raw text elements</a></ol></li>
     <li><a href=#text-0><span class=secno>12.1.3 </span>Text</a>
      <ol>
       <li><a href=#newlines><span class=secno>12.1.3.1 </span>Newlines</a></ol></li>
     <li><a href=#character-references><span class=secno>12.1.4 </span>Character references</a></li>
     <li><a href=#cdata-sections><span class=secno>12.1.5 </span>CDATA sections</a></li>
     <li><a href=#comments><span class=secno>12.1.6 </span>Comments</a></ol></li>
   <li><a href=#parsing><span class=secno>12.2 </span>Parsing HTML documents</a>
    <ol>
     <li><a href=#overview-of-the-parsing-model><span class=secno>12.2.1 </span>Overview of the parsing model</a></li>
     <li><a href=#the-input-byte-stream><span class=secno>12.2.2 </span>The input byte stream</a>
      <ol>
       <li><a href=#parsing-with-a-known-character-encoding><span class=secno>12.2.2.1 </span>Parsing with a known character encoding</a></li>
       <li><a href=#determining-the-character-encoding><span class=secno>12.2.2.2 </span>Determining the character encoding</a></li>
       <li><a href=#character-encodings><span class=secno>12.2.2.3 </span>Character encodings</a></li>
       <li><a href=#changing-the-encoding-while-parsing><span class=secno>12.2.2.4 </span>Changing the encoding while parsing</a></li>
       <li><a href=#preprocessing-the-input-stream><span class=secno>12.2.2.5 </span>Preprocessing the input stream</a></ol></li>
     <li><a href=#parse-state><span class=secno>12.2.3 </span>Parse state</a>
      <ol>
       <li><a href=#the-insertion-mode><span class=secno>12.2.3.1 </span>The insertion mode</a></li>
       <li><a href=#the-stack-of-open-elements><span class=secno>12.2.3.2 </span>The stack of open elements</a></li>
       <li><a href=#the-list-of-active-formatting-elements><span class=secno>12.2.3.3 </span>The list of active formatting elements</a></li>
       <li><a href=#the-element-pointers><span class=secno>12.2.3.4 </span>The element pointers</a></li>
       <li><a href=#other-parsing-state-flags><span class=secno>12.2.3.5 </span>Other parsing state flags</a></ol></li>
     <li><a href=#tokenization><span class=secno>12.2.4 </span>Tokenization</a>
      <ol>
       <li><a href=#data-state><span class=secno>12.2.4.1 </span>Data state</a></li>
       <li><a href=#character-reference-in-data-state><span class=secno>12.2.4.2 </span>Character reference in data state</a></li>
       <li><a href=#rcdata-state><span class=secno>12.2.4.3 </span>RCDATA state</a></li>
       <li><a href=#character-reference-in-rcdata-state><span class=secno>12.2.4.4 </span>Character reference in RCDATA state</a></li>
       <li><a href=#rawtext-state><span class=secno>12.2.4.5 </span>RAWTEXT state</a></li>
       <li><a href=#script-data-state><span class=secno>12.2.4.6 </span>Script data state</a></li>
       <li><a href=#plaintext-state><span class=secno>12.2.4.7 </span>PLAINTEXT state</a></li>
       <li><a href=#tag-open-state><span class=secno>12.2.4.8 </span>Tag open state</a></li>
       <li><a href=#end-tag-open-state><span class=secno>12.2.4.9 </span>End tag open state</a></li>
       <li><a href=#tag-name-state><span class=secno>12.2.4.10 </span>Tag name state</a></li>
       <li><a href=#rcdata-less-than-sign-state><span class=secno>12.2.4.11 </span>RCDATA less-than sign state</a></li>
       <li><a href=#rcdata-end-tag-open-state><span class=secno>12.2.4.12 </span>RCDATA end tag open state</a></li>
       <li><a href=#rcdata-end-tag-name-state><span class=secno>12.2.4.13 </span>RCDATA end tag name state</a></li>
       <li><a href=#rawtext-less-than-sign-state><span class=secno>12.2.4.14 </span>RAWTEXT less-than sign state</a></li>
       <li><a href=#rawtext-end-tag-open-state><span class=secno>12.2.4.15 </span>RAWTEXT end tag open state</a></li>
       <li><a href=#rawtext-end-tag-name-state><span class=secno>12.2.4.16 </span>RAWTEXT end tag name state</a></li>
       <li><a href=#script-data-less-than-sign-state><span class=secno>12.2.4.17 </span>Script data less-than sign state</a></li>
       <li><a href=#script-data-end-tag-open-state><span class=secno>12.2.4.18 </span>Script data end tag open state</a></li>
       <li><a href=#script-data-end-tag-name-state><span class=secno>12.2.4.19 </span>Script data end tag name state</a></li>
       <li><a href=#script-data-escape-start-state><span class=secno>12.2.4.20 </span>Script data escape start state</a></li>
       <li><a href=#script-data-escape-start-dash-state><span class=secno>12.2.4.21 </span>Script data escape start dash state</a></li>
       <li><a href=#script-data-escaped-state><span class=secno>12.2.4.22 </span>Script data escaped state</a></li>
       <li><a href=#script-data-escaped-dash-state><span class=secno>12.2.4.23 </span>Script data escaped dash state</a></li>
       <li><a href=#script-data-escaped-dash-dash-state><span class=secno>12.2.4.24 </span>Script data escaped dash dash state</a></li>
       <li><a href=#script-data-escaped-less-than-sign-state><span class=secno>12.2.4.25 </span>Script data escaped less-than sign state</a></li>
       <li><a href=#script-data-escaped-end-tag-open-state><span class=secno>12.2.4.26 </span>Script data escaped end tag open state</a></li>
       <li><a href=#script-data-escaped-end-tag-name-state><span class=secno>12.2.4.27 </span>Script data escaped end tag name state</a></li>
       <li><a href=#script-data-double-escape-start-state><span class=secno>12.2.4.28 </span>Script data double escape start state</a></li>
       <li><a href=#script-data-double-escaped-state><span class=secno>12.2.4.29 </span>Script data double escaped state</a></li>
       <li><a href=#script-data-double-escaped-dash-state><span class=secno>12.2.4.30 </span>Script data double escaped dash state</a></li>
       <li><a href=#script-data-double-escaped-dash-dash-state><span class=secno>12.2.4.31 </span>Script data double escaped dash dash state</a></li>
       <li><a href=#script-data-double-escaped-less-than-sign-state><span class=secno>12.2.4.32 </span>Script data double escaped less-than sign state</a></li>
       <li><a href=#script-data-double-escape-end-state><span class=secno>12.2.4.33 </span>Script data double escape end state</a></li>
       <li><a href=#before-attribute-name-state><span class=secno>12.2.4.34 </span>Before attribute name state</a></li>
       <li><a href=#attribute-name-state><span class=secno>12.2.4.35 </span>Attribute name state</a></li>
       <li><a href=#after-attribute-name-state><span class=secno>12.2.4.36 </span>After attribute name state</a></li>
       <li><a href=#before-attribute-value-state><span class=secno>12.2.4.37 </span>Before attribute value state</a></li>
       <li><a href=#attribute-value-(double-quoted)-state><span class=secno>12.2.4.38 </span>Attribute value (double-quoted) state</a></li>
       <li><a href=#attribute-value-(single-quoted)-state><span class=secno>12.2.4.39 </span>Attribute value (single-quoted) state</a></li>
       <li><a href=#attribute-value-(unquoted)-state><span class=secno>12.2.4.40 </span>Attribute value (unquoted) state</a></li>
       <li><a href=#character-reference-in-attribute-value-state><span class=secno>12.2.4.41 </span>Character reference in attribute value state</a></li>
       <li><a href=#after-attribute-value-(quoted)-state><span class=secno>12.2.4.42 </span>After attribute value (quoted) state</a></li>
       <li><a href=#self-closing-start-tag-state><span class=secno>12.2.4.43 </span>Self-closing start tag state</a></li>
       <li><a href=#bogus-comment-state><span class=secno>12.2.4.44 </span>Bogus comment state</a></li>
       <li><a href=#markup-declaration-open-state><span class=secno>12.2.4.45 </span>Markup declaration open state</a></li>
       <li><a href=#comment-start-state><span class=secno>12.2.4.46 </span>Comment start state</a></li>
       <li><a href=#comment-start-dash-state><span class=secno>12.2.4.47 </span>Comment start dash state</a></li>
       <li><a href=#comment-state><span class=secno>12.2.4.48 </span>Comment state</a></li>
       <li><a href=#comment-end-dash-state><span class=secno>12.2.4.49 </span>Comment end dash state</a></li>
       <li><a href=#comment-end-state><span class=secno>12.2.4.50 </span>Comment end state</a></li>
       <li><a href=#comment-end-bang-state><span class=secno>12.2.4.51 </span>Comment end bang state</a></li>
       <li><a href=#doctype-state><span class=secno>12.2.4.52 </span>DOCTYPE state</a></li>
       <li><a href=#before-doctype-name-state><span class=secno>12.2.4.53 </span>Before DOCTYPE name state</a></li>
       <li><a href=#doctype-name-state><span class=secno>12.2.4.54 </span>DOCTYPE name state</a></li>
       <li><a href=#after-doctype-name-state><span class=secno>12.2.4.55 </span>After DOCTYPE name state</a></li>
       <li><a href=#after-doctype-public-keyword-state><span class=secno>12.2.4.56 </span>After DOCTYPE public keyword state</a></li>
       <li><a href=#before-doctype-public-identifier-state><span class=secno>12.2.4.57 </span>Before DOCTYPE public identifier state</a></li>
       <li><a href=#doctype-public-identifier-(double-quoted)-state><span class=secno>12.2.4.58 </span>DOCTYPE public identifier (double-quoted) state</a></li>
       <li><a href=#doctype-public-identifier-(single-quoted)-state><span class=secno>12.2.4.59 </span>DOCTYPE public identifier (single-quoted) state</a></li>
       <li><a href=#after-doctype-public-identifier-state><span class=secno>12.2.4.60 </span>After DOCTYPE public identifier state</a></li>
       <li><a href=#between-doctype-public-and-system-identifiers-state><span class=secno>12.2.4.61 </span>Between DOCTYPE public and system identifiers state</a></li>
       <li><a href=#after-doctype-system-keyword-state><span class=secno>12.2.4.62 </span>After DOCTYPE system keyword state</a></li>
       <li><a href=#before-doctype-system-identifier-state><span class=secno>12.2.4.63 </span>Before DOCTYPE system identifier state</a></li>
       <li><a href=#doctype-system-identifier-(double-quoted)-state><span class=secno>12.2.4.64 </span>DOCTYPE system identifier (double-quoted) state</a></li>
       <li><a href=#doctype-system-identifier-(single-quoted)-state><span class=secno>12.2.4.65 </span>DOCTYPE system identifier (single-quoted) state</a></li>
       <li><a href=#after-doctype-system-identifier-state><span class=secno>12.2.4.66 </span>After DOCTYPE system identifier state</a></li>
       <li><a href=#bogus-doctype-state><span class=secno>12.2.4.67 </span>Bogus DOCTYPE state</a></li>
       <li><a href=#cdata-section-state><span class=secno>12.2.4.68 </span>CDATA section state</a></li>
       <li><a href=#tokenizing-character-references><span class=secno>12.2.4.69 </span>Tokenizing character references</a></ol></li>
     <li><a href=#tree-construction><span class=secno>12.2.5 </span>Tree construction</a>
      <ol>
       <li><a href=#creating-and-inserting-nodes><span class=secno>12.2.5.1 </span>Creating and inserting nodes</a></li>
       <li><a href=#parsing-elements-that-contain-only-text><span class=secno>12.2.5.2 </span>Parsing elements that contain only text</a></li>
       <li><a href=#closing-elements-that-have-implied-end-tags><span class=secno>12.2.5.3 </span>Closing elements that have implied end tags</a></li>
       <li><a href=#parsing-main-inhtml><span class=secno>12.2.5.4 </span>The rules for parsing tokens in HTML content</a>
        <ol>
         <li><a href=#the-initial-insertion-mode><span class=secno>12.2.5.4.1 </span>The "initial" insertion mode</a></li>
         <li><a href=#the-before-html-insertion-mode><span class=secno>12.2.5.4.2 </span>The "before html" insertion mode</a></li>
         <li><a href=#the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "before head" insertion mode</a></li>
         <li><a href=#parsing-main-inhead><span class=secno>12.2.5.4.4 </span>The "in head" insertion mode</a></li>
         <li><a href=#parsing-main-inheadnoscript><span class=secno>12.2.5.4.5 </span>The "in head noscript" insertion mode</a></li>
         <li><a href=#the-after-head-insertion-mode><span class=secno>12.2.5.4.6 </span>The "after head" insertion mode</a></li>
         <li><a href=#parsing-main-inbody><span class=secno>12.2.5.4.7 </span>The "in body" insertion mode</a></li>
         <li><a href=#parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "text" insertion mode</a></li>
         <li><a href=#parsing-main-intable><span class=secno>12.2.5.4.9 </span>The "in table" insertion mode</a></li>
         <li><a href=#parsing-main-intabletext><span class=secno>12.2.5.4.10 </span>The "in table text" insertion mode</a></li>
         <li><a href=#parsing-main-incaption><span class=secno>12.2.5.4.11 </span>The "in caption" insertion mode</a></li>
         <li><a href=#parsing-main-incolgroup><span class=secno>12.2.5.4.12 </span>The "in column group" insertion mode</a></li>
         <li><a href=#parsing-main-intbody><span class=secno>12.2.5.4.13 </span>The "in table body" insertion mode</a></li>
         <li><a href=#parsing-main-intr><span class=secno>12.2.5.4.14 </span>The "in row" insertion mode</a></li>
         <li><a href=#parsing-main-intd><span class=secno>12.2.5.4.15 </span>The "in cell" insertion mode</a></li>
         <li><a href=#parsing-main-inselect><span class=secno>12.2.5.4.16 </span>The "in select" insertion mode</a></li>
         <li><a href=#parsing-main-inselectintable><span class=secno>12.2.5.4.17 </span>The "in select in table" insertion mode</a></li>
         <li><a href=#parsing-main-intemplate><span class=secno>12.2.5.4.18 </span>The "in template" insertion mode</a></li>
         <li><a href=#parsing-main-afterbody><span class=secno>12.2.5.4.19 </span>The "after body" insertion mode</a></li>
         <li><a href=#parsing-main-inframeset><span class=secno>12.2.5.4.20 </span>The "in frameset" insertion mode</a></li>
         <li><a href=#parsing-main-afterframeset><span class=secno>12.2.5.4.21 </span>The "after frameset" insertion mode</a></li>
         <li><a href=#the-after-after-body-insertion-mode><span class=secno>12.2.5.4.22 </span>The "after after body" insertion mode</a></li>
         <li><a href=#the-after-after-frameset-insertion-mode><span class=secno>12.2.5.4.23 </span>The "after after frameset" insertion mode</a></ol></li>
       <li><a href=#parsing-main-inforeign><span class=secno>12.2.5.5 </span>The rules for parsing tokens in foreign content</a></ol></li>
     <li><a href=#the-end><span class=secno>12.2.6 </span>The end</a></li>
     <li><a href=#coercing-an-html-dom-into-an-infoset><span class=secno>12.2.7 </span>Coercing an HTML DOM into an infoset</a></li>
     <li><a href=#an-introduction-to-error-handling-and-strange-cases-in-the-parser><span class=secno>12.2.8 </span>An introduction to error handling and strange cases in the parser</a>
      <ol>
       <li><a href=#misnested-tags:-b-i-/b-/i><span class=secno>12.2.8.1 </span>Misnested tags: &lt;b&gt;&lt;i&gt;&lt;/b&gt;&lt;/i&gt;</a></li>
       <li><a href=#misnested-tags:-b-p-/b-/p><span class=secno>12.2.8.2 </span>Misnested tags: &lt;b&gt;&lt;p&gt;&lt;/b&gt;&lt;/p&gt;</a></li>
       <li><a href=#unexpected-markup-in-tables><span class=secno>12.2.8.3 </span>Unexpected markup in tables</a></li>
       <li><a href=#scripts-that-modify-the-page-as-it-is-being-parsed><span class=secno>12.2.8.4 </span>Scripts that modify the page as it is being parsed</a></li>
       <li><a href=#the-execution-of-scripts-that-are-moving-across-multiple-documents><span class=secno>12.2.8.5 </span>The execution of scripts that are moving across multiple documents</a></li>
       <li><a href=#unclosed-formatting-elements><span class=secno>12.2.8.6 </span>Unclosed formatting elements</a></ol></ol></li>
   <li><a href=#serializing-html-fragments><span class=secno>12.3 </span>Serializing HTML fragments</a></li>
   <li><a href=#parsing-html-fragments><span class=secno>12.4 </span>Parsing HTML fragments</a></li>
   <li><a href=#named-character-references><span class=secno>12.5 </span>Named character references</a></ol></li>
 <li><a href=#the-xhtml-syntax><span class=secno>13 </span>The XHTML syntax</a>
  <ol>
   <li><a href=#writing-xhtml-documents><span class=secno>13.1 </span>Writing XHTML documents</a></li>
   <li><a href=#parsing-xhtml-documents><span class=secno>13.2 </span>Parsing XHTML documents</a></li>
   <li><a href=#serializing-xhtml-fragments><span class=secno>13.3 </span>Serializing XHTML fragments</a></li>
   <li><a href=#parsing-xhtml-fragments><span class=secno>13.4 </span>Parsing XHTML fragments</a></ol></li>
 <li><a href=#rendering><span class=secno>14 </span>Rendering</a>
  <ol>
   <li><a href=#introduction-13><span class=secno>14.1 </span>Introduction</a></li>
   <li><a href=#the-css-user-agent-style-sheet-and-presentational-hints><span class=secno>14.2 </span>The CSS user agent style sheet and presentational hints</a></li>
   <li><a href=#non-replaced-elements><span class=secno>14.3 </span>Non-replaced elements</a>
    <ol>
     <li><a href=#hidden-elements><span class=secno>14.3.1 </span>Hidden elements</a></li>
     <li><a href=#the-page><span class=secno>14.3.2 </span>The page</a></li>
     <li><a href=#flow-content-1><span class=secno>14.3.3 </span>Flow content</a></li>
     <li><a href=#phrasing-content-1><span class=secno>14.3.4 </span>Phrasing content</a></li>
     <li><a href=#bidirectional-text><span class=secno>14.3.5 </span>Bidirectional text</a></li>
     <li><a href=#quotes><span class=secno>14.3.6 </span>Quotes</a></li>
     <li><a href=#sections-and-headings><span class=secno>14.3.7 </span>Sections and headings</a></li>
     <li><a href=#lists><span class=secno>14.3.8 </span>Lists</a></li>
     <li><a href=#tables><span class=secno>14.3.9 </span>Tables</a></li>
     <li><a href=#margin-collapsing-quirks><span class=secno>14.3.10 </span>Margin collapsing quirks</a></li>
     <li><a href=#form-controls><span class=secno>14.3.11 </span>Form controls</a></li>
     <li><a href=#the-hr-element-0><span class=secno>14.3.12 </span>The <code>hr</code> element</a></li>
     <li><a href=#the-fieldset-and-legend-elements><span class=secno>14.3.13 </span>The <code>fieldset</code> and <code>legend</code> elements</a></ol></li>
   <li><a href=#replaced-elements><span class=secno>14.4 </span>Replaced elements</a>
    <ol>
     <li><a href=#embedded-content-2><span class=secno>14.4.1 </span>Embedded content</a></li>
     <li><a href=#images-0><span class=secno>14.4.2 </span>Images</a></li>
     <li><a href=#attributes-for-embedded-content-and-images><span class=secno>14.4.3 </span>Attributes for embedded content and images</a></li>
     <li><a href=#image-maps-0><span class=secno>14.4.4 </span>Image maps</a></ol></li>
   <li><a href=#bindings><span class=secno>14.5 </span>Bindings</a>
    <ol>
     <li><a href=#introduction-14><span class=secno>14.5.1 </span>Introduction</a></li>
     <li><a href=#the-button-element-0><span class=secno>14.5.2 </span>The <code>button</code> element</a></li>
     <li><a href=#the-details-element-0><span class=secno>14.5.3 </span>The <code>details</code> element</a></li>
     <li><a href=#the-input-element-as-a-text-entry-widget><span class=secno>14.5.4 </span>The <code>input</code> element as a text entry widget</a></li>
     <li><a href=#the-input-element-as-domain-specific-widgets><span class=secno>14.5.5 </span>The <code>input</code> element as domain-specific widgets</a></li>
     <li><a href=#the-input-element-as-a-range-control><span class=secno>14.5.6 </span>The <code>input</code> element as a range control</a></li>
     <li><a href=#the-input-element-as-a-color-well><span class=secno>14.5.7 </span>The <code>input</code> element as a color well</a></li>
     <li><a href=#the-input-element-as-a-checkbox-and-radio-button-widgets><span class=secno>14.5.8 </span>The <code>input</code> element as a checkbox and radio button widgets</a></li>
     <li><a href=#the-input-element-as-a-file-upload-control><span class=secno>14.5.9 </span>The <code>input</code> element as a file upload control</a></li>
     <li><a href=#the-input-element-as-a-button><span class=secno>14.5.10 </span>The <code>input</code> element as a button</a></li>
     <li><a href=#the-marquee-element-0><span class=secno>14.5.11 </span>The <code>marquee</code> element</a></li>
     <li><a href=#the-meter-element-0><span class=secno>14.5.12 </span>The <code>meter</code> element</a></li>
     <li><a href=#the-progress-element-0><span class=secno>14.5.13 </span>The <code>progress</code> element</a></li>
     <li><a href=#the-select-element-0><span class=secno>14.5.14 </span>The <code>select</code> element</a></li>
     <li><a href=#the-textarea-element-0><span class=secno>14.5.15 </span>The <code>textarea</code> element</a></li>
     <li><a href=#the-keygen-element-0><span class=secno>14.5.16 </span>The <code>keygen</code> element</a></ol></li>
   <li><a href=#frames-and-framesets><span class=secno>14.6 </span>Frames and framesets</a></li>
   <li><a href=#interactive-media><span class=secno>14.7 </span>Interactive media</a>
    <ol>
     <li><a href=#links,-forms,-and-navigation><span class=secno>14.7.1 </span>Links, forms, and navigation</a></li>
     <li><a href=#the-title-attribute-0><span class=secno>14.7.2 </span>The <code title=attr-title>title</code> attribute</a></li>
     <li><a href=#editing-hosts><span class=secno>14.7.3 </span>Editing hosts</a></li>
     <li><a href=#text-rendered-in-native-user-interfaces><span class=secno>14.7.4 </span>Text rendered in native user interfaces</a></ol></li>
   <li><a href=#print-media><span class=secno>14.8 </span>Print media</a></li>
   <li><a href=#unstyled-xml-documents><span class=secno>14.9 </span>Unstyled XML documents</a></ol></li>
 <li><a href=#obsolete><span class=secno>15 </span>Obsolete features</a>
  <ol>
   <li><a href=#obsolete-but-conforming-features><span class=secno>15.1 </span>Obsolete but conforming features</a>
    <ol>
     <li><a href=#warnings-for-obsolete-but-conforming-features><span class=secno>15.1.1 </span>Warnings for obsolete but conforming features</a></ol></li>
   <li><a href=#non-conforming-features><span class=secno>15.2 </span>Non-conforming features</a></li>
   <li><a href=#requirements-for-implementations><span class=secno>15.3 </span>Requirements for implementations</a>
    <ol>
     <li><a href=#the-applet-element><span class=secno>15.3.1 </span>The <code>applet</code> element</a></li>
     <li><a href=#the-marquee-element><span class=secno>15.3.2 </span>The <code>marquee</code> element</a></li>
     <li><a href=#frames><span class=secno>15.3.3 </span>Frames</a></li>
     <li><a href=#other-elements,-attributes-and-apis><span class=secno>15.3.4 </span>Other elements, attributes and APIs</a></ol></ol></li>
 <li><a href=#iana><span class=secno>16 </span>IANA considerations</a>
  <ol>
   <li><a href=#text/html><span class=secno>16.1 </span><code>text/html</code></a></li>
   <li><a href=#multipart/x-mixed-replace><span class=secno>16.2 </span><code>multipart/x-mixed-replace</code></a></li>
   <li><a href=#application/xhtml+xml><span class=secno>16.3 </span><code>application/xhtml+xml</code></a></li>
   <li><a href=#application/x-www-form-urlencoded><span class=secno>16.4 </span><code>application/x-www-form-urlencoded</code></a></li>
   <li><a href=#text/cache-manifest><span class=secno>16.5 </span><code>text/cache-manifest</code></a></li>
   <li><a href=#text/ping><span class=secno>16.6 </span><code>text/ping</code></a></li>
   <li><a href=#application/microdata+json><span class=secno>16.7 </span><code>application/microdata+json</code></a></li>
   <li><a href=#ping-from><span class=secno>16.8 </span><code>Ping-From</code></a></li>
   <li><a href=#ping-to><span class=secno>16.9 </span><code>Ping-To</code></a></li>
   <li><a href=#web+-scheme-prefix><span class=secno>16.10 </span><code>web+</code> scheme prefix</a></ol></li>
 <li><a href=#index class=no-num>Index</a>
  <ol>
   <li><a href=#elements-1 class=no-num>Elements</a></li>
   <li><a href=#element-content-categories class=no-num>Element content categories</a></li>
   <li><a href=#attributes-1 class=no-num>Attributes</a></li>
   <li><a href=#element-interfaces class=no-num>Element Interfaces</a></li>
   <li><a href=#all-interfaces class=no-num>All Interfaces</a></ol></li>
 <li><a href=#references class=no-num>References</a></li>
 <li><a href=#acknowledgements class=no-num>Acknowledgements</a></ol>
<!--end-toc-->
  <hr><!-- An advisory for those reading this source. --><!-- In this specification, there are a number of comments (like
        this one) that have three consecutive Xs. These indicate known
        problems that are expected to be resolved in the future. --><!-- There are also comments with the string "v2", "v3", "v4", or
        higher numbers. These indicate ideas for future versions of
        the specification that have not yet been included, usually
        because it's too early (one has to move slowly lest the
        browser vendors get overwhelmed with changes). --><!-- Finally, there may also be some known issues in this
        specification marked with the following punctuation: --><!--!--><!-- These are issues that are known to the editor but cannot be
        currently fixed because they were introduced by W3C decisions.
        In theory we could fork the WHATWG copy of the spec, but doing
        so would introduce normative differences between the W3C and
        WHATWG specs and these issues are not worth the hassle that
        this would cause. We'll probably be able to fix them some day,
        but for now we are living with them. --><h2 id=introduction><span class=secno>1 </span>Introduction</h2>


  <h3 id=abstract><span class=secno>1.1 </span>Where does this specification fit?</h3>

  <p>This specification defines a big part of the Web platform, in
  lots of detail. Its place in the Web platform specification stack
  relative to other specifications can be best summed up as
  follows:</p>

  <p><img src=http://images.whatwg.org/abstract.png width=398 alt="It consists of everything else, above such core technologies as HTTP, URI/IRIs, DOM, XML, Unicode, and ECMAScript; below presentation-layer technologies like CSS, XBL, and the NPAPI; and to the side of technologies like Geolocation, SVG, MathML, and XHR." height=359></p>



  <h3 id=is-this-html5?><span class=secno>1.2 </span>Is this HTML5?</h3><!--VERSION-->

  <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, in some cases in conjunction with
  the W3C and IETF.</p>

  <p>The WHATWG work is all published in one specification

  (the one you are reading right now),
  parts of which are republished in an edition optimized for Web developers.

  </p>

  <p>The W3C also publishes parts of this specification as separate
  documents. One of these parts is called "HTML5"; it is a forked subset of

  this specification (the HTML Living Standard).
  There are numerous differences between 

  this specification (the HTML Living Standard)
  and the W3C version, some minor, some major. Unfortunately these are not currently accurately
  documented anywhere, so there is no way to know which are intentional and which are not.</p>



  <h3 id=background><span class=secno>1.3 </span>Background</h3>

  <p><i>This section is non-normative.</i></p>

  <p>The World Wide Web's markup language has always been HTML. HTML was primarily designed as a
  language for semantically describing scientific documents, although its general design and
  adaptations over the years have enabled it to be used to describe a number of other types of
  documents.</p>

  <p>The main area that has not been adequately addressed by HTML is a vague subject referred to as
  Web Applications. This specification attempts to rectify this, while at the same time updating the
  HTML specifications to address issues raised in the past few years.</p>


  <h3 id=audience><span class=secno>1.4 </span>Audience</h3>

  <p><i>This section is non-normative.</i></p>

  <p>This specification is intended for authors of documents and scripts that use the features
  defined in this specification<span class=impl>, 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</span>.</p>

  <p>This document is probably not suited to readers who do not already have at least a passing
  familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity
  for completeness. More approachable tutorials and authoring guides can provide a gentler
  introduction to the topic.</p>

  <p>In particular, familiarity with the basics of DOM is necessary for a complete understanding of
  some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML,
  Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not
  essential.</p>


  <h3 id=scope><span class=secno>1.5 </span>Scope</h3>

  <p><i>This section is non-normative.</i></p>

  <p>This specification is limited to providing a semantic-level markup language and associated
  semantic-level scripting APIs for authoring accessible pages on the Web ranging from static
  documents to dynamic applications.</p>

  <p>The scope of this specification does not include providing mechanisms for media-specific
  customization of presentation (although default rendering rules for Web browsers are included at
  the end of this specification, and several mechanisms for hooking into CSS are provided as part of
  the language).</p>

  <p>The scope of this specification is not to describe an entire operating system. In particular,
  hardware configuration software, image manipulation tools, and applications that users would be
  expected to use with high-end workstations on a daily basis are out of scope. In terms of
  applications, this specification is targeted specifically at applications that would be expected
  to be used by users on an occasional basis, or regularly but from disparate locations, with low
  CPU requirements. Examples of such applications include online purchasing systems, searching
  systems, games (especially multiplayer online games), public telephone books or address books,
  communications software (e-mail clients, instant messaging clients, discussion software), document
  editing software, etc.</p>


  <h3 id=history-1><span class=secno>1.6 </span>History</h3>

  <p><i>This section is non-normative.</i></p>

  <p>For its first five years (1990-1995), HTML went through a number of revisions and experienced a
  number of extensions, primarily hosted first at CERN, and then at the IETF.</p>

  <p>With the creation of the W3C, HTML's development changed venue again. A first abortive attempt
  at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as
  HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year.</p>

  <p>The following year, the W3C membership decided to stop evolving HTML and instead begin work on
  an XML-based equivalent, called XHTML. <!-- http://www.w3.org/MarkUp/future/#summary --> 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 W3C's
  focus turned to making it easier for other working groups to extend XHTML, under the banner of
  XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not
  compatible with the earlier HTML and XHTML languages, calling it XHTML2.</p>

  <p>Around the time that HTML's evolution was stopped in 1998, parts of the API for HTML developed
  by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level
  2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered
  out, with some DOM Level 3 specifications published in 2004 but the working group being closed
  before all the Level 3 drafts were completed.</p>

  <p>In 2003, the publication of XForms, a technology which was positioned as the next generation of
  Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements
  for it. This interest was borne from the realization that XML's deployment as a Web technology was
  limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for
  existing deployed technologies (like HTML).</p>

  <p>A proof of concept to show that it was possible to extend HTML4's forms to provide many of the
  features that XForms 1.0 introduced, without requiring browsers to implement rendering engines
  that were incompatible with existing HTML Web pages, was the first result of this renewed
  interest. At this early stage, while the draft was already publicly available, and input was
  already being solicited from all sources, the specification was only under Opera Software's
  copyright.</p>

  <p>The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004, where
  some of the principles that underlie the HTML5 work (described below), as well as the
  aforementioned early draft proposal covering just forms-related features, were presented to the
  W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal
  conflicted with the previously chosen direction for the Web's evolution; the W3C staff and
  membership voted to continue developing XML-based replacements instead.</p>

  <p>Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue
  working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list
  was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to
  be jointly owned by all three vendors, and to allow reuse of the specification.</p>

  <p>The WHATWG was based on several core principles, in particular that technologies need to be
  backwards compatible, that specifications and implementations need to match even if this means
  changing the specification rather than the implementations, and that specifications need to be
  detailed enough that implementations can achieve complete interoperability without
  reverse-engineering each other.</p>

  <p>The latter requirement in particular required that the scope of the HTML5 specification include
  what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It
  also meant including significantly more detail than had previously been considered the norm.</p>

  <p>In 2006, the W3C indicated an interest to participate in the development of HTML5 after all,
  and in 2007 formed a working group chartered to work with the WHATWG on the development of the
  HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under
  the W3C copyright, while keeping a version with the less restrictive license on the WHATWG
  site.</p>

  <p>For a number of years, both groups then worked together. In 2011, however, the groups came to
  the conclusion that they had different goals: the W3C wanted to publish a "finished" version of
  "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously
  maintaining the specification rather than freezing it in a state with known problems, and adding
  new features as needed to evolve the platform.</p>

  <p>Since then, the WHATWG has been working on this specification (amongst others), and the W3C has
  been copying fixes made by the WHATWG into their fork of the document, as well as making other
  changes, many of which are described <a href=#is-this-html5?>above</a>.</p>




  <h3 id=design-notes><span class=secno>1.7 </span>Design notes</h3>

  <p><i>This section is non-normative.</i></p>

  <p>It must be admitted that many aspects of HTML appear at first glance to be nonsensical and
  inconsistent.</p>

  <p>HTML, its supporting DOM APIs, as well as many of its supporting technologies, have been
  developed over a period of several decades by a wide array of people with different priorities
  who, in many cases, did not know of each other's existence.</p>

  <p>Features have thus arisen from many sources, and have not always been designed in especially
  consistent ways. Furthermore, because of the unique characteristics of the Web, implementation
  bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally
  written in ways that rely on them before they can be fixed.</p>

  <p>Despite all this, efforts have been made to adhere to certain design goals. These are described
  in the next few subsections.</p>


  <h4 id=serializability-of-script-execution><span class=secno>1.7.1 </span>Serializability of script execution</h4>

  <p><i>This section is non-normative.</i></p>

  <p>To avoid exposing Web authors to the complexities of multithreading, the HTML and DOM APIs are
  designed such that no script can ever detect the simultaneous execution of other scripts. Even
  with <a href=#worker title=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 title="browsing
  context">browsing contexts</a>.</p>

  <p class=note>The <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method, in
  this model, is equivalent to allowing other scripts to run while the calling script is
  blocked.</p>


  <h4 id=compliance-with-other-specifications><span class=secno>1.7.2 </span>Compliance with other specifications</h4>

  <p><i>This section is non-normative.</i></p>

  <p>This specification interacts with and relies on a wide variety of other specifications. In
  certain circumstances, unfortunately, conflicting needs have led to this specification violating
  the requirements of these other specifications. Whenever this has occurred, the transgressions
  have each been noted as a "<dfn id=willful-violation>willful violation</dfn>", and the reason for the violation has
  been noted.</p>




  <h3 id=html-vs-xhtml><span class=secno>1.8 </span>HTML vs XHTML</h3>

  <p><i>This section is non-normative.</i></p>

  <p>This specification defines an abstract language for describing documents and applications, and
  some APIs for interacting with in-memory representations of resources that use this language.</p>

  <p>The in-memory representation is known as "DOM HTML", or "the DOM" for short.</p>

  <p>There are various concrete syntaxes that can be used to transmit resources that use this
  abstract language, two of which are defined in this specification.</p>

  <p>The first such concrete syntax is the HTML syntax. This is the format suggested for most
  authors. It is compatible with most legacy Web browsers. If a document is transmitted with the
  <code><a href=#text/html>text/html</a></code> <a href=#mime-type>MIME type</a>, then it will be processed as an HTML document by
  Web browsers. This specification defines the latest HTML syntax, known simply as "HTML".</p>

  <p>The second concrete syntax is the XHTML syntax, which is an application of XML. When a document
  is transmitted with an <a href=#xml-mime-type>XML MIME type</a>, such as <code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>,
  then it is treated as an XML document by Web browsers, to be parsed by an XML processor. Authors
  are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors
  will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in
  the HTML syntax. This specification defines the latest XHTML syntax, known simply as "XHTML".</p>

  <p>The DOM, the HTML syntax, and the XHTML syntax cannot all represent the same content. For
  example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM
  and in the XHTML syntax. Similarly, documents that use the <code><a href=#the-noscript-element>noscript</a></code> feature can be
  represented using the HTML syntax, but cannot be represented with the DOM or in the XHTML syntax.
  Comments that contain the string "<code title="">--&gt;</code>" can only be represented in the
  DOM, not in the HTML and XHTML syntaxes.</p>


  <h3 id=structure-of-this-specification><span class=secno>1.9 </span>Structure of this specification</h3>

  <p><i>This section is non-normative.</i></p>

  <p>This specification is divided into the following major sections:</p>

  <dl><dt><a href=#introduction>Introduction</a></dt>

   <dd>Non-normative materials providing a context for the HTML standard.</dd>


   <dt><a href=#infrastructure>Common infrastructure</a></dt>

   <dd>The conformance classes, algorithms, definitions, and the common underpinnings of the rest of
   the specification.</dd>


   <dt><a href=#dom>Semantics, structure, and APIs of HTML documents</a></dt>

   <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.</dd>


   <dt><a href=#semantics>The elements of HTML</a></dt>

   <dd>Each element has a predefined meaning, which is explained in this section. Rules for authors
   on how to use the element<span class=impl>, along with user agent requirements for how to
   handle each element,</span> 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.</dd>


   <dt><a href=#microdata>Microdata</a></dt>

   <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<span class=impl> and some algorithms that can be used to convert HTML
   documents into other formats</span>. This section also defines some sample Microdata vocabularies
   for contact information, calendar events, and licensing works.</dd>


   <dt><a href=#browsers>Loading Web pages</a></dt>

   <dd>HTML documents do not exist in a vacuum &mdash; 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.</dd>


   <dt><a href=#webappapis>Web application APIs</a></dt>

   <dd>This section introduces basic features for scripting of applications in HTML.</dd>


   <dt><a href=#editing>User interaction</a></dt>

   <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.</dd>



   <dt><a href=#workers>Web workers</a></dt>

   <dd>This section defines an API for background threads in JavaScript.</dd>



   <dt><a href=#comms>The communication APIs</a></dt>

   <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><a href=#eventsource>EventSource</a></code>, and a two-way full-duplex socket protocol for scripts known as Web
   Sockets.


   </dd>



   <dt><a href=#webstorage>Web storage</a></dt>

   <dd>This section defines a client-side storage mechanism based on name-value pairs.</dd>



   <dt><a href=#syntax>The HTML syntax</a></dt>
   <dt><a href=#xhtml>The XHTML syntax</a></dt>

   <dd>All of these features would be for naught if they couldn't be represented in a serialized
   form and sent to other people, and so these sections define the syntaxes of HTML and XHTML<span class=impl>, along with rules for how to parse content using those syntaxes</span>.</dd>


   <dt><a href=#rendering>Rendering</a></dt>

   <dd>This section defines the default rendering rules for Web browsers.</dd>


  </dl><p>There are also some appendices, listing <a href=#obsolete>obsolete features</a> and <a href=#iana>IANA considerations</a>, and several indices.</p>



  <h4 id=how-to-read-this-specification><span class=secno>1.9.1 </span>How to read this specification</h4>

  <p>This specification should be read like all other specifications. First, it should be read
  cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be
  read by picking random sections from the contents list and following all the cross-references.</p>

  <p>As described in the conformance requirements section below, this specification describes
  conformance criteria for a variety of conformance classes. In particular, there are conformance
  requirements that apply to <em>producers</em>, for example authors and the documents they create,
  and there are conformance requirements that apply to <em>consumers</em>, for example Web browsers.
  They can be distinguished by what they are requiring: a requirement on a producer states what is
  allowed, while a requirement on a consumer states how software is to act.</p>

  <div class=example>

   <p>For example, "the <code title="">foo</code> attribute's value must be a <a href=#valid-integer>valid
   integer</a>" is a requirement on producers, as it lays out the allowed values; in contrast,
   the requirement "the <code title="">foo</code> attribute's value must be parsed using the
   <a href=#rules-for-parsing-integers>rules for parsing integers</a>" is a requirement on consumers, as it describes how to
   process the content.</p>

  </div>

  <p><strong>Requirements on producers have no bearing whatsoever on consumers.</strong></p>

  <div class=example>

   <p>Continuing the above example, a requirement stating that a particular attribute's value is
   constrained to being a <a href=#valid-integer>valid integer</a> emphatically does <em>not</em> imply anything
   about the requirements on consumers. It might be that the consumers are in fact required to treat
   the attribute as an opaque string, completely unaffected by whether the value conforms to the
   requirements or not. It might be (as in the previous example) that the consumers are required to
   parse the value using specific rules that define how invalid (non-numeric in this case) values
   are to be processed.</p>

  </div>



  <h4 id=typographic-conventions><span class=secno>1.9.2 </span>Typographic conventions</h4>

  <p>This is a definition, requirement, or explanation.</p>

  <p class=note>This is a note.</p>

  <p class=example>This is an example.</p>

  <p class=XXX>This is an open issue.</p>

  <p class=warning>This is a warning.</p>

  <pre class="idl extract">interface <dfn title="">Example</dfn> {
  // this is an IDL definition
};</pre>

  <dl class=domintro><dt><var title="">variable</var> = <var title="">object</var> . <code title="">method</code>( [ <var title="">optionalArgument</var> ] )</dt>

   <dd>

    <p>This is a note to authors describing the usage of an interface.</p>

   </dd>

  </dl><pre class=css>/* this is a CSS fragment */</pre>

  <p>The defining instance of a term is marked up like <dfn id=x-this title=x-this>this</dfn>. Uses of that
  term are marked up like <a href=#x-this title=x-this>this</a> or like <i title=x-this><a href=#x-this>this</a></i>.</p>

  <p>The defining instance of an element, attribute, or API is marked up like <dfn id=x-that title=x-that><code>this</code></dfn>. References to that element, attribute, or API are marked
  up like <code title=x-that><a href=#x-that>this</a></code>.</p>

  <p>Other code fragments are marked up <code title="">like this</code>.</p>

  <p>Variables are marked up like <var title="">this</var>.</p>

  <p class=impl>This is an implementation requirement.</p>

  <p>In an algorithm, steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are
  marked with &#x231b;.</p>


  <h3 id=fingerprint><span class=secno>1.10 </span>Privacy concerns</h3>

  <p><i>This section is non-normative.</i></p>

  <p>Some features of HTML trade user convenience for a measure of user privacy.</p>

  <p>In general, due to the Internet's architecture, a user can be distinguished from another by the
  user's IP address. IP addresses do not perfectly match to a user; as a user moves from device to
  device, or from network to network, their IP address will change; similarly, NAT routing, proxy
  servers, and shared computers enable packets that appear to all come from a single IP address to
  actually map to multiple users. Technologies such as onion routing can be used to further
  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 user's requests is not the only mechanism by which a user's
  requests could be related to each other. Cookies, for example, are designed specifically to enable
  this, and are the basis of most of the Web's session features that enable you to log into a site
  with which you have an account.</p>

  <p>There are other mechanisms that are more subtle. Certain characteristics of a user's system can
  be used to distinguish groups of users from each other; by collecting enough such information, an
  individual user's browser's "digital fingerprint" can be computed, which can be as good, if not
  better, as an IP address in ascertaining which requests are from the same user.</p>

  <p>Grouping requests in this manner, especially across multiple sites, can be used for both benign
  (and even arguably positive) purposes, as well as for malevolent purposes. An example of a
  reasonably benign purpose would be determining whether a particular person seems to prefer sites
  with dog illustrations as opposed to sites with cat illustrations (based on how often they visit
  the sites in question) and then automatically using the preferred illustrations on subsequent
  visits to participating sites. Malevolent purposes, however, could include governments combining
  information such as the person's home address (determined from the addresses they use when getting
  driving directions on one site) with their apparent political affiliations (determined by
  examining the forum sites that they participate in) to determine whether the person should be
  prevented from voting in an election.</p>

  <p>Since the malevolent purposes can be remarkably evil, user agent implementors are encouraged to
  consider how to provide their users with tools to 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 it's not as easy as simply blocking all possible leaks. For instance, the ability to
  log into a site to post under a specific identity requires that the user's requests be
  identifiable as all being from the same user, more or less by definition. More subtly, though,
  information such as how wide text is, which is necessary for many effects that involve drawing
  text onto a canvas (e.g. any effect that involves drawing a border around the text) also leaks
  information that can be used to group a user's requests. (In this case, by potentially exposing,
  via a brute force search, which fonts a user has installed, information which can vary
  considerably from user to user.)</p>

  <p>Features in this specification which can be <dfn id=fingerprinting-vector title="fingerprinting vector">used to
  fingerprint the user</dfn> are marked as this paragraph is.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>Other features in the platform can be used for the same purpose, though, including, though not
  limited to:</p>

  <ul><li>The exact list of which features a user agents supports.</li>

   <li>The maximum allowed stack depth for recursion in script.</li>

   <li>Features that describe the user's environment, like Media Queries and the <code><a href=#screen>Screen</a></code>
   object. <a href=#refsMQ>[MQ]</a> <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

   <li>The user's time zone.</li>

  </ul><h3 id=a-quick-introduction-to-html><span class=secno>1.11 </span>A quick introduction to HTML</h3>

  <p><i>This section is non-normative.</i></p>

  <p>A basic HTML document looks like this:</p>

  <pre id=intro-early-example>&lt;!DOCTYPE html&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Sample page&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;Sample page&lt;/h1&gt;
  &lt;p&gt;This is a &lt;a href="demo.html"&gt;simple&lt;/a&gt; sample.&lt;/p&gt;
  &lt;!-- this is a comment --&gt;
 &lt;/body&gt;
&lt;/html&gt;</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 title=syntax-start-tag>start tag</a>, such as "<code title="">&lt;body&gt;</code>", and
  an <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>, such as "<code title="">&lt;/body&gt;</code>".
  (Certain start tags and end tags can in certain cases be <a href=#syntax-tag-omission title=syntax-tag-omission>omitted</a> and are implied by other tags.)</p>

  <p>Tags have to be nested such that elements are all completely within each other, without
  overlapping:</p>

  <pre class=bad>&lt;p&gt;This is &lt;em&gt;very &lt;strong&gt;wrong&lt;/em&gt;!&lt;/strong&gt;&lt;/p&gt;</pre>
  <pre>&lt;p&gt;This &lt;em&gt;is &lt;strong&gt;correct&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;</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>hyperlink</a>, formed using the <code><a href=#the-a-element>a</a></code> element and its <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute:</p>

  <pre>&lt;a href="demo.html"&gt;simple&lt;/a&gt;</pre>

  <p><a href=#syntax-attributes title=syntax-attributes>Attributes</a> are placed inside the start tag, and consist
  of a <a href=#syntax-attribute-name title=syntax-attribute-name>name</a> and a <a href=#syntax-attribute-value title=syntax-attribute-value>value</a>, separated by an "<code title="">=</code>" character.
  The attribute value can remain <a href=#unquoted>unquoted</a> if it doesn't contain <a href=#space-character title="space character">space characters</a> or any of <code title="">"</code> <code title="">'</code> <code title="">`</code> <code title="">=</code> <code title="">&lt;</code> or
  <code title="">&gt;</code>. Otherwise, it has to be quoted using either single or double quotes.
  The value, along with the "<code title="">=</code>" character, can be omitted altogether if the
  value is the empty string.</p>

  <pre>&lt;!-- empty attributes --&gt;
&lt;input name=address disabled&gt;
&lt;input name=address disabled=""&gt;

&lt;!-- attributes with a value --&gt;
&lt;input name=address maxlength=200&gt;
&lt;input name=address maxlength='200'&gt;
&lt;input name=address maxlength="200"&gt;</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><a href=#documenttype>DocumentType</a></code> node,
  <code><a href=#element>Element</a></code> nodes, <code><a href=#text>Text</a></code> nodes, <code><a href=#comment-0>Comment</a></code> nodes, and in some cases
  <code><a href=#processinginstruction>ProcessingInstruction</a></code> nodes.</p>

  <p>The <a href=#intro-early-example>markup snippet at the top of this section</a> would be
  turned into the following DOM tree:</p>

  <ul class=domTree><li class=t10>DOCTYPE: <code title="">html</code><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><ul><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;&blank;</span><li class=t1><code><a href=#the-title-element>title</a></code><ul><li class=t3><code>#text</code>: <span title="">Sample page</span></ul><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;</span></ul><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;</span><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;&blank;</span><li class=t1><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code><ul><li class=t3><code>#text</code>: <span title="">Sample page</span></ul><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;&blank;</span><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">This is a <!--grammar-check-override--></span><li class=t1><code><a href=#the-a-element>a</a></code> <span class=t2 title=""><code class="attribute name">href</code>="<code class="attribute value">demo.html</code>"</span><ul><li class=t3><code>#text</code>: <span title="">simple</span></ul><li class=t3><code>#text</code>: <span title=""> sample.</span></ul><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;&blank;</span><li class=t8><code>#comment</code>: <span title=""> this is a comment </span><li class=t3><code>#text</code>: <span title="">&#x23ce;&blank;&#x23ce;</span></ul></ul></ul><p>The <a href=#root-element>root element</a> of this tree is the <code><a href=#the-html-element>html</a></code> element, which is the
  element always found at the root of HTML documents. It contains two elements, <code><a href=#the-head-element>head</a></code>
  and <code><a href=#the-body-element>body</a></code>, as well as a <code><a href=#text>Text</a></code> node between them.</p>

  <p>There are many more <code><a href=#text>Text</a></code> nodes in the DOM tree than one would initially expect,
  because the source contains a number of spaces (represented here by "&blank;") and line breaks
  ("&#x23ce;") that all end up as <code><a href=#text>Text</a></code> nodes in the DOM. However, for historical
  reasons not all of the spaces and line breaks in the original markup appear in the DOM. In
  particular, all the whitespace before <code><a href=#the-head-element>head</a></code> start tag ends up being dropped silently,
  and all the whitespace after the <code><a href=#the-body-element>body</a></code> end tag ends up placed at the end of the
  <code><a href=#the-body-element>body</a></code>.</p>

  <p>The <code><a href=#the-head-element>head</a></code> element contains a <code><a href=#the-title-element>title</a></code> element, which itself contains a
  <code><a href=#text>Text</a></code> node with the text "Sample page". Similarly, the <code><a href=#the-body-element>body</a></code> element
  contains an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element, a <code><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><a href=#the-script-element>script</a></code> element or using <a href=#event-handler-content-attributes>event
  handler content attributes</a>. For example, here is a form with a script that sets the value
  of the form's <code><a href=#the-output-element>output</a></code> element to say "Hello World":</p>

  <pre>&lt;<a href=#the-form-element>form</a> <a href=#attr-form-name title=attr-form-name>name</a>="main"&gt;
 Result: &lt;<a href=#the-output-element>output</a> <a href=#attr-fe-name title=attr-fe-name>name</a>="result"&gt;&lt;/output&gt;
 &lt;<a href=#the-script-element>script</a>&gt;
  <a href=#document title=Document>document</a>.<a href=#dom-document-forms title=dom-document-forms>forms</a>.main.<a href=#dom-form-elements title=dom-form-elements>elements</a>.result.<a href=#dom-output-value title=dom-output-value>value</a> = 'Hello World';
 &lt;/script&gt;
&lt;/form&gt;</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><a href=#the-a-element>a</a></code> element in the tree above)
  can have its "<code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>" attribute changed in several
  ways:</p>

  <pre>var a = <a href=#document title=Document>document</a>.<a href=#dom-document-links title=dom-document-links>links</a>[0]; // obtain the first link in the document
a.<a href=#dom-url-href title=dom-url-href>href</a> = 'sample.html'; // change the destination URL of the link
a.<a href=#dom-url-protocol title=dom-url-protocol>protocol</a> = 'https'; // change just the scheme part of the URL
a.setAttribute('href', 'http://example.com/'); // change the content attribute directly</pre>

  <p>Since DOM trees are used as the way to represent HTML documents when they are processed and
  presented by implementations (especially interactive implementations like Web browsers), this
  specification is mostly phrased in terms of DOM trees, instead of the markup described above.</p>

  <hr><p>HTML documents represent a media-independent description of interactive content. HTML documents
  might be rendered to a screen, or through a speech 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>&lt;!DOCTYPE html&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Sample styled page&lt;/title&gt;
  &lt;style&gt;
   body { background: navy; color: yellow; }
  &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;Sample styled page&lt;/h1&gt;
  &lt;p&gt;This page is just a demo.&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</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>

<!--ADD-TOPIC:Security-->
  <h4 id=writing-secure-applications-with-html><span class=secno>1.11.1 </span>Writing secure applications with HTML</h4>

  <p><i>This section is non-normative.</i></p>

  <p>When HTML is used to create interactive sites, care needs to be taken to avoid introducing
  vulnerabilities through which attackers can compromise the integrity of the site itself or of the
  site's users.</p>

  <p>A comprehensive study of this matter is beyond the scope of this document, and authors are
  strongly encouraged to study the matter in more detail. However, this section attempts to provide
  a quick introduction to some common pitfalls in HTML application development.</p>

  <p>The security model of the Web is based on the concept of "origins", and correspondingly many of
  the potential attacks on the Web involve cross-origin actions. <a href=#refsORIGIN>[ORIGIN]</a></p>

  <dl><dt>Not validating user input</dt>
   <dt>Cross-site scripting (XSS)</dt>
   <dt>SQL injection</dt>

   <dd>

    <p>When accepting untrusted input, e.g. user-generated content such as text comments, values in
    URL parameters, messages from third-party sites, etc, it is imperative that the data be
    validated before use, and properly escaped when displayed. Failing to do this can allow a
    hostile user to perform a variety of attacks, ranging from the potentially benign, such as
    providing bogus user information like a negative age, to the serious, such as running scripts
    every time a user looks at a page that includes the information, potentially propagating the
    attack in the process, to the catastrophic, such as deleting all data in the server.</p>

    <p>When writing filters to validate user input, it is imperative that filters always be
    whitelist-based, allowing known-safe constructs and disallowing all other input. Blacklist-based
    filters that disallow known-bad inputs and allow everything else are not secure, as not
    everything that is bad is yet known (for example, because it might be invented in the
    future).</p>

    <div class=example>

     <p>For example, suppose a page looked at its URL's query string to determine what to display,
     and the site then redirected the user to that page to display a message, as in:</p>

     <pre>&lt;ul&gt;
 &lt;li&gt;&lt;a href="message.cgi?say=Hello"&gt;Say Hello&lt;/a&gt;
 &lt;li&gt;&lt;a href="message.cgi?say=Welcome"&gt;Say Welcome&lt;/a&gt;
 &lt;li&gt;&lt;a href="message.cgi?say=Kittens"&gt;Say Kittens&lt;/a&gt;
&lt;/ul&gt;</pre>

     <p>If the message was just displayed to the user without escaping, a hostile attacker could
     then craft a URL that contained a script element:</p>

     <pre>http://example.com/message.cgi?say=%3Cscript%3Ealert%28%27Oh%20no%21%27%29%3C/script%3E</pre>

     <p>If the attacker then convinced a victim user to visit this page, a script of the attacker's
     choosing would run on the page. Such a script could do any number of hostile actions, limited
     only by what the site offers: if the site is an e-commerce shop, for instance, such a script
     could cause the user to unknowingly make arbitrarily many unwanted purchases.</p>

     <p>This is called a cross-site scripting attack.</p>

    </div>

    <p>There are many constructs that can be used to try to trick a site into executing code. Here
    are some that authors are encouraged to consider when writing whitelist filters:</p>

    <ul><li>When allowing harmless-seeming elements like <code><a href=#the-img-element>img</a></code>, it is important to whitelist
     any provided attributes as well. If one allowed all attributes then an attacker could, for
     instance, use the <code title=handler-onload><a href=#handler-onload>onload</a></code> attribute to run arbitrary
     script.</li>

     <li>When allowing URLs to be provided (e.g. for links), the scheme of each URL also needs to be
     explicitly whitelisted, as there are many schemes that can be abused. The most prominent
     example is "<code title=javascript-protocol>javascript:</code>", but user agents can
     implement (and indeed, have historically implemented) others.</li> <!-- IE had vbscript:,
     Netscape had livescript:, etc. -->

     <li>Allowing a <code><a href=#the-base-element>base</a></code> element to be inserted means any <code><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.</li>

    </ul></dd>


   <dt>Cross-site request forgery (CSRF)</dt>

   <dd>

    <p>If a site allows a user to make form submissions with user-specific side-effects, for example
    posting messages on a forum under the user's name, making purchases, or applying for a passport,
    it is important to verify that the request was made by the user intentionally, rather than by
    another site tricking the user into making the request unknowingly.</p>

    <p>This problem exists because HTML forms can be submitted to other origins.</p>

    <p>Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by
    checking <code title=http-origin>Origin</code> headers on all requests.</p>

   </dd>



   <dt>Clickjacking</dt>

   <dd>

    <p>A page that provides users with an interface to perform actions that the user might not wish
    to perform needs to be designed so as to avoid the possibility that users can be tricked into
    activating the interface.</p>

    <p>One way that a user could be so tricked is if a hostile site places the victim site in a
    small <code><a href=#the-iframe-element>iframe</a></code> and then convinces the user to click, for instance by having the user
    play a reaction game. Once the user is playing the game, the hostile site can quickly position
    the iframe under the mouse cursor just as the user is about to click, thus tricking the user
    into clicking the victim site's interface.</p>

    <p>To avoid this, sites that do not expect to be used in frames are encouraged to only enable
    their interface if they detect that they are not in a frame (e.g. by comparing the <code title=dom-window><a href=#dom-window>window</a></code> object to the value of the <code title=dom-top><a href=#dom-top>top</a></code>
    attribute).</p>

   </dd>

  </dl><!--REMOVE-TOPIC:Security--><h4 id=common-pitfalls-to-avoid-when-using-the-scripting-apis><span class=secno>1.11.2 </span>Common pitfalls to avoid when using the scripting APIs</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Scripts in HTML have "run-to-completion" semantics, meaning that the browser will generally run
  the script uninterrupted before doing anything else, such as firing further events or continuing
  to parse the document.</p>

  <p>On the other hand, parsing of HTML files happens asynchronously and incrementally, meaning that
  the parser can pause at any point to let scripts run. This is generally a good thing, but it does
  mean that authors need to be careful to avoid hooking event handlers after the events could have
  possibly fired.</p>

  <p>There are two techniques for doing this reliably: use <a href=#event-handler-content-attributes>event handler content
  attributes</a>, or create the element and add the event handlers in the same script. The latter
  is safe because, as mentioned earlier, scripts are run to completion before further events can
  fire.</p>

  <div class=example>

   <p>One way this could manifest itself is with <code><a href=#the-img-element>img</a></code> elements and the <code title=event-load>load</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 title=handler-onload><a href=#handler-onload>onload</a></code> handler on an
   <code><a href=#the-img-element>img</a></code> element to catch the <code title=event-load>load</code> event:</p>

   <pre>&lt;img src="games.png" alt="Games" onload="gamesLogoHasLoaded(event)"&gt;</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>&lt;script&gt;
 var img = new Image();
 img.src = 'games.png';
 img.alt = 'Games';
 img.onload = gamesLogoHasLoaded;
 // img.addEventListener('load', gamesLogoHasLoaded, false); // would work also
&lt;/script&gt;</pre>

   <p>However, if the author first created the <code><a href=#the-img-element>img</a></code> element and then in a separate
   script added the event listeners, there's a chance that the <code title=event-load>load</code>
   event would be fired in between, leading it to be missed:</p>

   <pre class=bad>&lt;!-- Do not use this style, it has a race condition! --&gt;
 &lt;img id="games" src="games.png" alt="Games"&gt;
 &lt;!-- the 'load' event might fire here while the parser is taking a
      break, in which case you will not see it! --&gt;
 &lt;script&gt;
  var img = document.getElementById('games');
  img.onload = gamesLogoHasLoaded; // might never fire!
 &lt;/script&gt;</pre>

  </div>



  <h3 id=conformance-requirements-for-authors><span class=secno>1.12 </span>Conformance requirements for authors</h3>

  <p><i>This section is non-normative.</i></p>

  <p>Unlike previous versions of the HTML specification, this specification defines in some detail
  the required processing for invalid documents as well as valid documents.</p> <!-- This has led to
  some questioning the purpose of conformance criteria: if there is no ambiguity in how something
  will be processed, why disallow it? -->

  <p>However, even though the processing of invalid content is in most cases well-defined,
  conformance requirements for documents are still important: in practice, interoperability (the
  situation in which all implementations process particular content in a reliable and identical or
  equivalent way) is not the only goal of document conformance requirements. This section details
  some of the more common reasons for still distinguishing between a conforming document and one
  with errors.</p>


  <h4 id=presentational-markup><span class=secno>1.12.1 </span>Presentational markup</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The majority of presentational features from previous versions of HTML are no longer allowed.
  Presentational markup in general has been found to have a number of problems:</p>

  <dl><dt>The use of presentational elements leads to poorer accessibility</dt>

   <dd>

    <p>While it is possible to use presentational markup in a way that provides users of assistive
    technologies (ATs) with an acceptable experience (e.g. using ARIA), doing so is significantly
    more difficult than doing so when using semantically-appropriate markup. Furthermore, even using
    such techniques doesn't help make pages accessible for non-AT non-graphical users, such as users
    of text-mode browsers.</p>

    <p>Using media-independent markup, on the other hand, provides an easy way for documents to be
    authored in such a way that they work for more users (e.g. text browsers).</p>

   </dd>


   <dt>Higher cost of maintenance</dt>

   <dd>

    <p>It is significantly easier to maintain a site written in such a way that the markup is
    style-independent. For example, changing the color of a site that uses
    <code>&lt;font&nbsp;color=""&gt;</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>

   </dd>


   <dt>Larger document sizes</dt>

   <dd>

    <p>Presentational markup tends to be much more redundant, and thus results in larger document
    sizes.</p>

   </dd>

  </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 title=attr-style><a href=#the-style-attribute>style</a></code> attribute and the <code><a href=#the-style-element>style</a></code> element. Use of the <code title=attr-style><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><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><a href=#the-b-element>b</a></code>, <code><a href=#the-i-element>i</a></code>,
  <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-s-element>s</a></code>, <code><a href=#the-small-element>small</a></code>, and <code><a href=#the-u-element>u</a></code>.</p>


  <h4 id=syntax-errors><span class=secno>1.12.2 </span>Syntax errors</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The syntax of HTML is constrained to avoid a wide variety of problems.</p>

  <dl><dt>Unintuitive error-handling behavior</dt>

   <dd>

    <p>Certain invalid syntax constructs, when parsed, result in DOM trees that are highly
    unintuitive.</p>

    <div class=example>

     <p>For example, the following markup fragment results in a DOM with an <code><a href=#the-hr-element>hr</a></code> element
     that is an <em>earlier</em> sibling of the corresponding <code><a href=#the-table-element>table</a></code> element:</p>

     <pre class=bad>&lt;table&gt;&lt;hr&gt;...</pre>

    </div>

   </dd>


   <dt>Errors with optional error recovery</dt>

   <dd>

    <p>To allow user agents to be used in controlled environments without having to implement the
    more bizarre and convoluted error handling rules, user agents are permitted to fail whenever
    encountering a <a href=#parse-error>parse error</a>.</p>

   </dd>


   <dt>Errors where the error-handling behavior is not compatible with streaming user agents</dt>

   <dd>

    <p>Some error-handling behavior, such as the behavior for the <code title="">&lt;table&gt;&lt;hr&gt;...</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>

   </dd>


   <dt>Errors that can result in infoset coercion</dt>

   <dd>

    <p>When a user agent based on XML is connected to an HTML parser, it is possible that certain
    invariants that XML enforces, such as comments never containing two consecutive hyphens, will be
    violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an
    XML-compatible infoset. Most syntax constructs that require such handling are considered
    invalid.</p>

   </dd>


   <dt>Errors that result in disproportionally poor performance</dt>

   <dd>

    <p>Certain syntax constructs can result in disproportionally poor performance. To discourage the
    use of such constructs, they are typically made non-conforming.</p>

    <div class=example>

     <p>For example, the following markup results in poor performance, since all the unclosed
     <code><a href=#the-i-element>i</a></code> elements have to be reconstructed in each paragraph, resulting in progressively
     more elements in each paragraph:</p>

     <pre class=bad>&lt;p&gt;&lt;i&gt;He dreamt.
&lt;p&gt;&lt;i&gt;He dreamt that he ate breakfast.
&lt;p&gt;&lt;i&gt;Then lunch.
&lt;p&gt;&lt;i&gt;And finally dinner.</pre>

     <p>The resulting DOM for this fragment would be:</p>

     <ul class=domTree><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">He dreamt.</span></ul></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">He dreamt that he ate breakfast.</span></ul></ul></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">Then lunch.</span></ul></ul></ul></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">And finally dinner.</span></ul></ul></ul></ul></ul></ul></div>

   </dd>


   <dt>Errors involving fragile syntax constructs</dt>

   <dd>

    <p>There are syntax constructs that, for historical reasons, are relatively fragile. To help
    reduce the number of users who accidentally run into such problems, they are made
    non-conforming.</p>

    <div class=example>

     <p>For example, the parsing of certain named character references in attributes happens even
     with the closing semicolon being omitted. It is safe to include an ampersand followed by
     letters that do not form a named character reference, but if the letters are changed to a
     string that <em>does</em> form a named character reference, they will be interpreted as that
     character instead.</p>

     <p>In this fragment, the attribute's value is "<code title="">?bill&amp;ted</code>":</p>

     <pre class=bad>&lt;a href="?bill&amp;ted"&gt;Bill and Ted&lt;/a&gt;</pre>

     <p>In the following fragment, however, the attribute's value is actually "<code title="">?art&copy;</code>", <em>not</em> the intended "<code title="">?art&amp;copy</code>",
     because even without the final semicolon, "<code title="">&amp;copy</code>" is handled the same
     as "<code title="">&amp;copy;</code>" and thus gets interpreted as "<code title="">&copy;</code>":</p>

     <pre class=bad>&lt;a href="?art&amp;copy"&gt;Art and Copy&lt;/a&gt;</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>&lt;a href="?bill&amp;ted"&gt;Bill and Ted&lt;/a&gt; &lt;!-- &amp;ted is ok, since it's not a named character reference --&gt;</pre>
     <pre>&lt;a href="?art&amp;amp;copy"&gt;Art and Copy&lt;/a&gt; &lt;!-- the &amp; has to be escaped, since &amp;copy <em>is</em> a named character reference --&gt;</pre>

    </div>

   </dd>


   <dt>Errors involving known interoperability problems in legacy user agents</dt>

   <dd>

    <p>Certain syntax constructs are known to cause especially subtle or serious problems in legacy
    user agents, and are therefore marked as non-conforming to help authors avoid them.</p>

    <div class=example>

     <p>For example, this is why the U+0060 GRAVE ACCENT character (`) is not allowed in unquoted
     attributes. In certain legacy user agents, <!-- namely IE --> it is sometimes treated as a
     quote character.</p>

    </div>

    <div class=example>

     <p>Another example of this is the DOCTYPE, which is required to trigger <a href=#no-quirks-mode>no-quirks
     mode</a>, because the behavior of legacy user agents in <a href=#quirks-mode>quirks mode</a> is often
     largely undocumented.</p>

    </div>

   </dd>


<!--ADD-TOPIC:Security-->
   <dt>Errors that risk exposing authors to security attacks</dt>

   <dd>

    <p>Certain restrictions exist purely to avoid known security problems.</p>

    <div class=example>

     <p>For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a
     known cross-site-scripting attack using UTF-7. <a href=#refsUTF7>[UTF7]</a></p>

    </div>

   </dd>
<!--REMOVE-TOPIC:Security-->


   <dt>Cases where the author's intent is unclear</dt>

   <dd>

    <p>Markup where the author's intent is very unclear is often made non-conforming. Correcting
    these errors early makes later maintenance easier.</p>

    <div class=example>

     <p>For example, it is unclear whether the author intended the following to be an
     <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> heading or an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> heading:</p>

     <pre class=bad>&lt;h1&gt;Contact details&lt;/h2&gt;</pre>

    </div>

   </dd>


   <dt>Cases that are likely to be typos</dt>

   <dd>

    <p>When a user makes a simple typo, it is helpful if the error can be caught early, as this can
    save the author a lot of debugging time. This specification therefore usually considers it an
    error to use element names, attribute names, and so forth, that do not match the names defined
    in this specification.</p>

    <div class=example>

     <p>For example, if the author typed <code>&lt;capton&gt;</code> instead of
     <code>&lt;caption&gt;</code>, this would be flagged as an error and the author could correct the
     typo immediately.</p>

    </div>

   </dd>


   <dt>Errors that could interfere with new syntax in the future</dt>

   <dd>

    <p>In order to allow the language syntax to be extended in the future, certain otherwise
    harmless features are disallowed.</p>

    <div class=example>

     <p>For example, "attributes" in end tags are ignored currently, but they are invalid, in case a
     future change to the language makes use of that syntax feature without conflicting with
     already-deployed (and valid!) content.</p>

    </div>

   </dd>


  </dl><p>Some authors find it helpful to be in the practice of always quoting all attributes and always
  including all optional tags, preferring the consistency derived from such custom over the minor
  benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such
  authors, conformance checkers can provide modes of operation wherein such conventions are
  enforced.</p>



  <h4 id=restrictions-on-content-models-and-on-attribute-values><span class=secno>1.12.3 </span>Restrictions on content models and on attribute values</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Beyond the syntax of the language, this specification also places restrictions on how elements
  and attributes can be specified. These restrictions are present for similar reasons:</p>

  <dl><dt>Errors involving content with dubious semantics</dt>

   <dd>

    <p>To avoid misuse of elements with defined meanings, content models are defined that restrict
    how elements can be nested when such nestings would be of dubious value.</p>

    <p class=example>For example, this specification disallows nesting a <code><a href=#the-section-element>section</a></code>
    element inside a <code><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>

   </dd>


   <dt>Errors that involve a conflict in expressed semantics</dt>

   <dd>

    <p>Similarly, to draw the author's attention to mistakes in the use of elements, clear
    contradictions in the semantics expressed are also considered conformance errors.</p>

    <div class=example>

     <p>In the fragments below, for example, the semantics are nonsensical: a separator cannot
     simultaneously be a cell, nor can a radio button be a progress bar.</p>

     <pre class=bad>&lt;hr role="cell"&gt;</pre>
     <pre class=bad>&lt;input type=radio role=progressbar&gt;</pre>

    </div>

    <p class=example>Another example is the restrictions on the content models of the
    <code><a href=#the-ul-element>ul</a></code> element, which only allows <code><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><a href=#the-ul-element>ul</a></code> element contains something
    other than an <code><a href=#the-li-element>li</a></code> element, it's not clear what was meant.</p>

   </dd>


   <dt>Cases where the default styles are likely to lead to confusion</dt>

   <dd>

    <p>Certain elements have default styles or behaviors that make certain combinations likely to
    lead to confusion. Where these have equivalent alternatives without this problem, the confusing
    combinations are disallowed.</p>

    <p class=example>For example, <code><a href=#the-div-element>div</a></code> elements are rendered as block boxes, and
    <code><a href=#the-span-element>span</a></code> elements as inline boxes. Putting a block box in an inline box is
    unnecessarily confusing; since either nesting just <code><a href=#the-div-element>div</a></code> elements, or nesting just
    <code><a href=#the-span-element>span</a></code> elements, or nesting <code><a href=#the-span-element>span</a></code> elements inside <code><a href=#the-div-element>div</a></code>
    elements all serve the same purpose as nesting a <code><a href=#the-div-element>div</a></code> element in a <code><a href=#the-span-element>span</a></code>
    element, but only the latter involves a block box in an inline box, the latter combination is
    disallowed.</p>

    <p class=example>Another example would be the way <a href=#interactive-content>interactive content</a> cannot be
    nested. For example, a <code><a href=#the-button-element>button</a></code> element cannot contain a <code><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>

   </dd>


   <dt>Errors that indicate a likely misunderstanding of the specification</dt>

   <dd>

    <p>Sometimes, something is disallowed because allowing it would likely cause author
    confusion.</p>

    <p class=example>For example, setting the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>
    attribute to the value "<code title="">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>

   </dd>


   <dt>Errors involving limits that have been imposed merely to simplify the language</dt>

   <dd>

    <p>Some conformance errors simplify the language that authors need to learn.</p>

    <p class=example>For example, the <code><a href=#the-area-element>area</a></code> element's <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute, despite accepting both <code title=attr-area-shape-keyword-circ><a href=#attr-area-shape-keyword-circ>circ</a></code> and <code title=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 title=attr-area-shape-keyword-circ><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>

   </dd>


   <dt>Errors that involve peculiarities of the parser</dt>

   <dd>

    <p>Certain elements are parsed in somewhat eccentric ways (typically for historical reasons),
    and their content model restrictions are intended to avoid exposing the author to these
    issues.</p>

    <div class=example>

     <p>For example, a <code><a href=#the-form-element>form</a></code> element isn't allowed inside <a href=#phrasing-content>phrasing content</a>,
     because when parsed as HTML, a <code><a href=#the-form-element>form</a></code> element's start tag will imply a
     <code><a href=#the-p-element>p</a></code> element's end tag. Thus, the following markup results in two <a href=#paragraph title=paragraph>paragraphs</a>, not one:</p>

     <pre>&lt;p&gt;Welcome. &lt;form&gt;&lt;label&gt;Name:&lt;/label&gt; &lt;input&gt;&lt;/form&gt;</pre>

     <p>It is parsed exactly like the following:</p>

     <pre>&lt;p&gt;Welcome. &lt;/p&gt;&lt;form&gt;&lt;label&gt;Name:&lt;/label&gt; &lt;input&gt;&lt;/form&gt;</pre>

    </div>

   </dd>


   <dt>Errors that would likely result in scripts failing in hard-to-debug ways</dt>

   <dd>

    <p>Some errors are intended to help prevent script problems that would be hard to debug.</p>

    <p class=example>This is why, for instance, it is non-conforming to have two <code title=attr-id><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>

   </dd>


   <dt>Errors that waste authoring time</dt>

   <dd>

    <p>Some constructs are disallowed because historically they have been the cause of a lot of
    wasted authoring time, and by encouraging authors to avoid making them, authors can save time in
    future efforts.</p>

    <p class=example>For example, a <code><a href=#the-script-element>script</a></code> element's <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute causes the element's contents to be ignored.
    However, this isn't obvious, especially if the element's contents appear to be executable script
    &mdash; 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><a href=#the-script-element>script</a></code> element when the <code title=attr-script-src><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>

   </dd>


   <dt>Errors that involve areas that affect authors migrating to and from XHTML</dt>

   <dd>

    <p>Some authors like to write files that can be interpreted as both XML and HTML with similar
    results. Though this practice is discouraged in general due to the myriad of subtle
    complications involved (especially when involving scripting, styling, or any kind of automated
    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 HTML and XHTML.</p>

    <p class=example>For example, there are somewhat complicated rules surrounding the <code title=attr-lang><a href=#attr-lang>lang</a></code> and <code title=attr-xml-lang><a href=#attr-xml-lang>xml:lang</a></code> attributes
    intended to keep the two synchronized.</p>

    <p class=example>Another example would be the restrictions on the values of <code title="">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>

   </dd>


   <dt>Errors that involve areas reserved for future expansion</dt>

   <dd>

    <p>As with the restrictions on the syntax intended to allow for new syntax in future revisions
    of the language, some restrictions on the content models of elements and values of attributes
    are intended to allow for future expansion of the HTML vocabulary.</p>

    <p class=example>For example, limiting the values of the <code title=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>

   </dd>


   <dt>Errors that indicate a mis-use of other specifications</dt>

   <dd>

    <p>Certain restrictions are intended to support the restrictions made by other
    specifications.</p>

    <p class=example>For example, requiring that attributes that take media queries use only
    <em>valid</em> media queries reinforces the importance of following the conformance rules of
    that specification.</p>

   </dd>

  </dl><h3 id=suggested-reading><span class=secno>1.13 </span>Suggested reading</h3>

  <p><i>This section is non-normative.</i></p>

  <p>The following documents might be of interest to readers of this specification.</p>

  <dl><dt><cite>Character Model for the World Wide Web 1.0: Fundamentals</cite> <a href=#refsCHARMOD>[CHARMOD]</a></dt>

   <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></dd>

   <dt><cite>Unicode Security Considerations</cite> <a href=#refsUTR36>[UTR36]</a></dt>

   <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></dd>

   <dt><cite>Web Content Accessibility Guidelines (WCAG) 2.0</cite> <a href=#refsWCAG>[WCAG]</a></dt>

   <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></dd>

   <dt class=impl><cite>Authoring Tool Accessibility Guidelines (ATAG) 2.0</cite> <a href=#refsATAG>[ATAG]</a></dt>

   <dd class=impl><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></dd>

   <dt class=impl><cite>User Agent Accessibility Guidelines (UAAG) 2.0</cite> <a href=#refsUAAG>[UAAG]</a></dt>

   <dd class=impl><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></dd>

  </dl><h2 id=infrastructure><span class=secno>2 </span>Common infrastructure</h2>

  <h3 id=terminology><span class=secno>2.1 </span>Terminology</h3>

  <p>This specification refers to both HTML and XML attributes and IDL attributes, often in the same
  context. When it is not clear which is being referred to, they are referred to as <dfn title="">content attributes</dfn> for HTML and XML attributes, and <dfn title="">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 title="">object properties</dfn> and <dfn title="">CSS properties</dfn> respectively.</p>

  <p>Generally, when the specification states that a feature applies to <a href=#syntax>the HTML syntax</a>
  or <a href=#the-xhtml-syntax>the XHTML syntax</a>, it also includes the other. When a feature specifically only
  applies to one of the two languages, it is called out by explicitly stating that it does not apply
  to the other format, as in "for HTML, ... (this does not apply to XHTML)".</p>

  <p>This specification uses the term <dfn title="">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><a href=#document>Document</a></code>
  objects and their descendant DOM trees, and to serialized byte streams using the <a href=#syntax title="the
  HTML syntax">HTML syntax</a> or <a href=#the-xhtml-syntax title="the XHTML syntax">XHTML syntax</a>, depending
  on context.</p>

  <p>In the context of the DOM structures, the terms <a href=#html-documents title="HTML documents">HTML
  document</a> and <a href=#xml-documents title="XML documents">XML document</a> are used as defined in the DOM
  specification, and refer specifically to two different modes that <code><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><a href=#text/html>text/html</a></code>, and the term XML document refers to resources labeled with an <a href=#xml-mime-type>XML
  MIME type</a>.</p>

  <p>The term <dfn id=xhtml-document>XHTML document</dfn> is used to refer to both <code><a href=#document>Document</a></code>s in the <a href=#xml-documents title="XML documents">XML document</a> mode that contains element nodes in the <a href=#html-namespace-0>HTML
  namespace</a>, and byte streams labeled with an <a href=#xml-mime-type>XML MIME type</a> that contain
  elements from the <a href=#html-namespace-0>HTML namespace</a>, depending on context.</p>

  <hr><p>For simplicity, terms such as <dfn title="">shown</dfn>, <dfn title="">displayed</dfn>, and
  <dfn title="">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>

  <div class=impl>

  <p>When an algorithm B says to return to another algorithm A, it implies that A called B. Upon
  returning to A, the implementation must continue from where it left off in calling B.</p>

  </div>

  <!-- should find somewhere more appropriate to put this -->
  <p>The term "transparent black" refers to the color with red, green, blue, and alpha channels all
  set to zero.</p>


  <h4 id=resources><span class=secno>2.1.1 </span>Resources</h4>

  <p>The specification uses the term <dfn title="">supported</dfn> when referring to whether a user
  agent has an implementation capable of decoding the semantics of an external resource. A format or
  type is said to be <i>supported</i> if the implementation can process an external resource of that
  format or type without critical aspects of the resource being ignored. Whether a specific resource
  is <i>supported</i> can depend on what features of the resource's format are in use.</p>

  <p class=example>For example, a PNG image would be considered to be in a supported format if its
  pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image
  also contained animation data.</p>

  <p class=example>An MPEG-4 video file would not be considered to be in a supported format if the
  compression format used was not supported, even if the implementation could determine the
  dimensions of the movie from the file's metadata.</p>

  <p>What some specifications, in particular the HTTP specification, refer to as a
  <i>representation</i> is referred to in this specification as a <dfn title="">resource</dfn>. <a href=#refsHTTP>[HTTP]</a></p>

  <p>The term <dfn id=mime-type>MIME type</dfn> is used to refer to what is sometimes called an <i>Internet media
  type</i> in protocol literature. The term <i>media type</i> in this specification is used to refer
  to the type of media intended for presentation, as used by the CSS specifications. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsMQ>[MQ]</a></p>

  <p>A string is a <dfn id=valid-mime-type>valid MIME type</dfn> if it matches the <code title="">media-type</code>
  rule defined in section 3.7 "Media Types" of RFC 2616. In particular, a <a href=#valid-mime-type>valid MIME
  type</a> may include MIME type parameters. <a href=#refsHTTP>[HTTP]</a></p>

  <p>A string is a <dfn id=valid-mime-type-with-no-parameters>valid MIME type with no parameters</dfn> if it matches the <code title="">media-type</code> rule defined in section 3.7 "Media Types" of RFC 2616, but does not
  contain any U+003B SEMICOLON characters (;). In other words, if it consists only of a type and
  subtype, with no MIME Type parameters. <a href=#refsHTTP>[HTTP]</a></p>

  <p>The term <dfn id=html-mime-type>HTML MIME type</dfn> is used to refer to the <a href=#mime-type>MIME type</a>
  <code><a href=#text/html>text/html</a></code>.</p>

  <p>A resource's <dfn id=critical-subresources>critical subresources</dfn> are those that the resource needs to have
  available to be correctly processed. Which resources are considered critical or not is defined by
  the specification that defines the resource's format.</p>

  <p>The term <dfn id=data-protocol title="data protocol"><code title="">data:</code> URL</dfn> refers to <a href=#url title=URL>URLs</a> that use the <code title="">data:</code> scheme. <a href=#refsRFC2397>[RFC2397]</a></p>


  <h4 id=xml><span class=secno>2.1.2 </span>XML</h4>

  <p id=html-namespace>To ease migration from HTML to XHTML, UAs conforming to this specification
  will place elements in HTML in the <code>http://www.w3.org/1999/xhtml</code> namespace, at least
  for the purposes of the DOM and CSS. The term "<dfn id=html-elements>HTML elements</dfn>", when used in this
  specification, refers to any element in that namespace, and thus refers to both HTML and XHTML
  elements.</p>

  <p>Except where otherwise stated, all elements defined or mentioned in this specification are in
  the <a href=#html-namespace-0>HTML namespace</a> ("<code>http://www.w3.org/1999/xhtml</code>"), and all attributes
  defined or mentioned in this specification have no namespace.</p>

  <p>The term <dfn id=element-type>element type</dfn> is used to refer to the set of elements that have a given
  local name and namespace. For example, <code><a href=#the-button-element>button</a></code> elements are elements with the element
  type <code><a href=#the-button-element>button</a></code>, meaning they have the local name "<code title="">button</code>" and
  (implicitly as defined above) the <a href=#html-namespace-0>HTML namespace</a>.</p>

  <p>Attribute names are said to be <dfn id=xml-compatible>XML-compatible</dfn> if they match the <a href=http://www.w3.org/TR/xml/#NT-Name><code title="">Name</code></a> production defined in
  XML, they contain no U+003A COLON characters (:), and their first three characters are not an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">xml</code>". <a href=#refsXML>[XML]</a></p>

  <p>The term <dfn id=xml-mime-type>XML MIME type</dfn> is used to refer to the <a href=#mime-type title="MIME type">MIME
  types</a> <code title="">text/xml</code>, <code title="">application/xml</code>, and any
  <a href=#mime-type>MIME type</a> whose subtype ends with the four characters "<code title="">+xml</code>".
  <a href=#refsRFC3023>[RFC3023]</a></p>


  <h4 id=dom-trees><span class=secno>2.1.3 </span>DOM trees</h4>

  <p>The <dfn id=root-element-of-a-document-object>root element of a <code>Document</code> object</dfn> is that <code><a href=#document>Document</a></code>'s
  first element child, if any. If it does not have one then the <code><a href=#document>Document</a></code> has no root
  element.</p>

  <p>The term <dfn id=root-element>root element</dfn>, when not referring to a <code><a href=#document>Document</a></code> object's root
  element, means the furthest ancestor element node of whatever node is being discussed, or the node
  itself if it has no ancestors. When the node is a part of the document, then the node's <a href=#root-element>root
  element</a> is indeed the document's root element; however, if the node is not currently part
  of the document tree, the root element will be an orphaned node.</p>

  <p>When an element's <a href=#root-element>root element</a> is the <a href=#root-element-of-a-document-object>root element of a
  <code>Document</code> object</a>, it is said to be <dfn id=in-a-document>in a <code>Document</code></dfn>. An
  element is said to have been <dfn id=insert-an-element-into-a-document title="insert an element into a document">inserted into a
  document</dfn> when its <a href=#root-element>root element</a> changes and is now the document's <a href=#root-element>root
  element</a>. Analogously, an element is said to have been <dfn id=remove-an-element-from-a-document title="remove an element from a
  document">removed from a document</dfn> when its <a href=#root-element>root element</a> changes from being the
  document's <a href=#root-element>root element</a> to being another element.</p>

  <p>A node's <dfn id=home-subtree>home subtree</dfn> is the subtree rooted at that node's <a href=#root-element>root
  element</a>. When a node is <a href=#in-a-document>in a <code>Document</code></a>, its <a href=#home-subtree>home
  subtree</a> is that <code><a href=#document>Document</a></code>'s tree.</p>

  <p>The <code><a href=#document>Document</a></code> of a <code><a href=#node>Node</a></code> (such as an element) is the
  <code><a href=#document>Document</a></code> that the <code><a href=#node>Node</a></code>'s <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> IDL attribute returns. When a
  <code><a href=#node>Node</a></code> is <a href=#in-a-document>in a <code>Document</code></a> then that <code><a href=#document>Document</a></code> is
  always the <code><a href=#node>Node</a></code>'s <code><a href=#document>Document</a></code>, and the <code><a href=#node>Node</a></code>'s <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> IDL attribute thus always returns that
  <code><a href=#document>Document</a></code>.</p>

  <p>The <code><a href=#document>Document</a></code> of a content attribute is the <code><a href=#document>Document</a></code> of the
  attribute's element.</p>

  <p>The term <dfn id=tree-order>tree order</dfn> means a pre-order, depth-first traversal of DOM nodes involved
  (through the <code title=dom-Node-parentNode><a href=#dom-node-parentnode>parentNode</a></code>/<code title=dom-Node-childNodes><a href=#dom-node-childnodes>childNodes</a></code> relationship).</p>

  <p>When it is stated that some element or attribute is <dfn id=ignore title=ignore>ignored</dfn>, or
  treated as some other value, or handled as if it was something else, this refers only to the
  processing of the node after it is in the DOM. <span class=impl>A user agent must not mutate the
  DOM in such situations.</span></p>

  <p>A content attribute is said to <dfn title="">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 title="">empty</dfn>, when used of an attribute value, <code><a href=#text>Text</a></code> node, or
  string, means that the length of the text is zero (i.e. not even containing spaces or control
  characters).</p>


  <h4 id=scripting-0><span class=secno>2.1.4 </span>Scripting</h4>

  <p>The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface,
  is sometimes used instead of the more accurate "an object implementing the interface
  <code>Foo</code>".</p>

  <p>An IDL attribute is said to be <dfn title="">getting</dfn> when its value is being retrieved
  (e.g. by author script), and is said to be <dfn title="">setting</dfn> when a new value is
  assigned to it.</p>

  <p>If a DOM object is said to be <dfn id=live>live</dfn>, then the attributes and methods on that object
  <span class=impl>must</span> operate on the actual underlying data, not a snapshot of the
  data.</p>

  <p>In the contexts of events, the terms <i>fire</i> and <i>dispatch</i> are used as defined in the
  DOM specification: <dfn id=concept-event-fire title=concept-event-fire>firing</dfn> an event means to create and <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> it, and <dfn id=concept-event-dispatch title=concept-event-dispatch>dispatching</dfn> an event means to follow the steps that propagate
  the event through the tree. The term <dfn id=concept-events-trusted title=concept-events-trusted>trusted event</dfn> is
  used to refer to events whose <code title=dom-event-isTrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute is
  initialized to true. <a href=#refsDOM>[DOM]</a></p>


  <h4 id=plugins><span class=secno>2.1.5 </span>Plugins</h4>

  <p>The term <dfn id=plugin>plugin</dfn> refers to a user-agent defined set of content handlers used by the
  user agent that can take part in the user agent's rendering of a <code><a href=#document>Document</a></code> object, but
  that neither act as <a href=#child-browsing-context title="child browsing context">child browsing contexts</a> of the
  <code><a href=#document>Document</a></code> nor introduce any <code><a href=#node>Node</a></code> objects to the <code><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>

  <div class=impl>

  <p>A user agent must not consider the types <code>text/plain</code> and
  <code>application/octet-stream</code> as having a registered <a href=#plugin>plugin</a>.</p> <!-- because
  of the way <object> handles those types, if nothing else (it also doesn't make any sense to have a
  plugin registered for those types, of course) -->

  </div>

  <p class=example>One example of a plugin would be a PDF viewer that is instantiated in a
  <a href=#browsing-context>browsing context</a> when the user navigates to a PDF file. This would count as a plugin
  regardless of whether the party that implemented the PDF viewer component was the same as that
  which implemented the user agent itself. However, a PDF viewer application that launches separate
  from the user agent (as opposed to using the same interface) is not a plugin by this
  definition.</p>

  <p class=note>This specification does not define a mechanism for interacting with plugins, as it
  is expected to be user-agent- and platform-specific. Some UAs might opt to support a plugin
  mechanism such as the Netscape Plugin API; others might use remote content converters or have
  built-in support for certain types. Indeed, this specification doesn't require user agents to
  support plugins at all. <a href=#refsNPAPI>[NPAPI]</a></p>

  <p>A plugin can be <dfn id=concept-plugin-secure title=concept-plugin-secure>secured</dfn> if it honors the semantics of
  the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>

  <p class=example>For example, a secured plugin would prevent its contents from creating pop-up
  windows when the plugin is instantiated inside a sandboxed <code><a href=#the-iframe-element>iframe</a></code>.</p>

  <div class=impl>

  <p class=warning>Browsers should take extreme care when interacting with external content
  intended for <a href=#plugin title=plugin>plugins</a>. When third-party software is run with the same
  privileges as the user agent itself, vulnerabilities in the third-party software become as
  dangerous as those in the user agent.</p>

  <p>Since different users having differents sets of <a href=#plugin title=plugin>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 title=plugin>plugins</a> for each
  user.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  </div>



  <h4 id=encoding-terminology><span class=secno>2.1.6 </span>Character encodings</h4>

  <p>A <dfn id=encoding title=encoding>character encoding</dfn>, or just <i><a href=#encoding>encoding</a></i> where that is not
  ambiguous, is a defined way to convert between byte streams and Unicode strings, as defined in the
  WHATWG Encoding standard. An <a href=#encoding>encoding</a> has an <dfn id=encoding-name>encoding name</dfn> and one or more
  <dfn id=encoding-label title="encoding label">encoding labels</dfn>, referred to as the encoding's <i>name</i> and
  <i>labels</i> in the Encoding specification. <a href=#refsENCODING>[ENCODING]</a></p>

  <p>An <dfn id=ascii-compatible-character-encoding>ASCII-compatible character encoding</dfn> is a single-byte or variable-length
  <a href=#encoding>encoding</a> in which the bytes 0x09, 0x0A, 0x0C, 0x0D, 0x20 - 0x22, 0x26, 0x27, 0x2C -
  0x3F, 0x41 - 0x5A, and 0x61 - 0x7A<!-- is that list ok? do any character sets we want to support
  do things outside that range? -->, ignoring bytes that are the second and later bytes of multibyte
  sequences, all correspond to single-byte sequences that map to the same Unicode characters as
  those bytes in Windows-1252<!--ANSI_X3.4-1968 (US-ASCII)-->. <a href=#refsENCODING>[ENCODING]</a></p>

  <p class=note>This includes such encodings as Shift_JIS, HZ-GB-2312, and variants of ISO-2022,
  even though it is possible in these encodings for bytes like 0x70 to be part of longer sequences
  that are unrelated to their interpretation as ASCII. It excludes UTF-16 variants, as well as
  obsolete legacy encodings such as UTF-7, GSM03.38, and EBCDIC variants.</p>

  <!--
   We'll have to change that if anyone comes up with a way to have a document that is valid as two
   different encodings at once, with different <meta charset> elements applying in each case.
  -->

  <p>The term <dfn id=a-utf-16-encoding>a UTF-16 encoding</dfn> refers to any variant of UTF-16: UTF-16LE or UTF-16BE,
  regardless of the presence or absence of a BOM. <a href=#refsENCODING>[ENCODING]</a></p>

  <p>The term <dfn id=code-unit>code unit</dfn> is used as defined in the Web IDL specification: a 16 bit
  unsigned integer, the smallest atomic component of a <code>DOMString</code>. (This is a narrower
  definition than the one used in Unicode, and is not the same as a <i>code point</i>.) <a href=#refsWEBIDL>[WEBIDL]</a></p>

  <p>The term <dfn id=unicode-code-point>Unicode code point</dfn> means a <i title="">Unicode scalar value</i> where
  possible, and an isolated surrogate code point when not. When a conformance requirement is defined
  in terms of characters or Unicode code points, a pair of <a href=#code-unit title="code unit">code units</a>
  consisting of a high surrogate followed by a low surrogate must be treated as the single code
  point represented by the surrogate pair, but isolated surrogates must each be treated as the
  single code point with the value of the surrogate. <a href=#refsUNICODE>[UNICODE]</a></p>

  <p>In this specification, the term <dfn id=character>character</dfn>, when not qualified as <em>Unicode</em>
  character, is synonymous with the term <a href=#unicode-code-point>Unicode code point</a>.</p>

  <p>The term <dfn id=unicode-character>Unicode character</dfn> is used to mean a <i title="">Unicode scalar value</i>
  (i.e. any Unicode code point that is not a surrogate code point). <a href=#refsUNICODE>[UNICODE]</a></p>

  <p>The <dfn id=code-unit-length>code-unit length</dfn> of a string is the number of <a href=#code-unit title="code unit">code
  units</a> in that string.</p>

  <p class=note>This complexity results from the historical decision to define the DOM API in
  terms of 16 bit (UTF-16) <a href=#code-unit title="code unit">code units</a>, rather than in terms of <a href=#unicode-character title="Unicode character">Unicode characters</a>.</p>





  <h3 id=conformance-requirements><span class=secno>2.2 </span>Conformance requirements</h3>

  <p>All diagrams, examples, and notes in this specification are non-normative, as are all sections
  explicitly marked non-normative. Everything else in this specification is normative.</p>

  <p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL NOT",--> "SHOULD", "SHOULD
  NOT", <!--"RECOMMENDED", "NOT RECOMMENDED",--> "MAY", and "OPTIONAL" in the normative parts of
  this document are to be interpreted as described in RFC2119. The key word "OPTIONALLY" in the
  normative parts of this document is to be interpreted with the same normative meaning as "MAY" and
  "OPTIONAL". For readability, these words do not appear in all uppercase letters in this
  specification. <a href=#refsRFC2119>[RFC2119]</a></p>

  <div class=impl>

  <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space
  characters" or "return false and abort these steps") are to be interpreted with the meaning of the
  key word ("must", "should", "may", etc) used in introducing the algorithm.</p>

  <div class=example>

   <p>For example, were the spec to say:</p>

   <pre>To eat an orange, the user must:
1. Peel the orange.
2. Separate each slice of the orange.
3. Eat the orange slices.</pre>

   <p>...it would be equivalent to the following:</p>

   <pre>To eat an orange:
1. The user must peel the orange.
2. The user must separate each slice of the orange.
3. The user must eat the orange slices.</pre>

   <p>Here the key word is "must".</p>

   <p>The former (imperative) style is generally preferred in this specification for stylistic
   reasons.</p>

  </div>

  <p>Conformance requirements phrased as algorithms or specific steps may be implemented in any
  manner, so long as the end result is equivalent. (In particular, the algorithms defined in this
  specification are intended to be easy to follow, and not intended to be performant.)</p>

  </div>



  <div class=impl>

  <h4 id=conformance-classes><span class=secno>2.2.1 </span>Conformance classes</h4>

  <p>This specification describes the conformance criteria for <span class=impl>user agents
  (relevant to implementors) and</span> documents<span class=impl> (relevant to authors and
  authoring tool implementors)</span>.</p>

  <p><dfn id=conforming-documents>Conforming documents</dfn> are those that comply with all the conformance criteria for
  documents. For readability, some of these conformance requirements are phrased as conformance
  requirements on authors; such requirements are implicitly requirements on documents: by
  definition, all documents are assumed to have had an author. (In some cases, that author may
  itself be a user agent &mdash; such user agents are subject to additional rules, as explained
  below.)</p>

  <p class=example>For example, if a requirement states that "authors must not use the <code title="">foobar</code> element", it would imply that documents are not allowed to contain elements
  named <code title="">foobar</code>.</p>

  <p class="note impl">There is no implied relationship between document conformance requirements
  and implementation conformance requirements. User agents are not free to handle non-conformant
  documents as they please; the processing model described in this specification applies to
  implementations regardless of the conformity of the input documents.</p>

  <p>User agents fall into several (overlapping) categories with different conformance
  requirements.</p>

  <dl><dt id=interactive>Web browsers and other interactive user agents</dt>

   <dd>

    <p>Web browsers that support <a href=#the-xhtml-syntax>the XHTML syntax</a> must process elements and attributes
    from the <a href=#html-namespace-0>HTML namespace</a> found in XML documents as described in this specification,
    so that users can interact with them, unless the semantics of those elements have been
    overridden by other specifications.</p>

    <p class=example>A conforming XHTML processor would, upon finding an XHTML <code><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><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>the HTML syntax</a> must process documents labeled with an
    <a href=#html-mime-type>HTML MIME type</a> as described in this specification, so that users can interact with
    them.</p>

    <p>User agents that support scripting must also be conforming implementations of the IDL
    fragments in this specification, as described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>

    <p class=note>Unless explicitly stated, specifications that override the semantics of HTML
    elements do not override the requirements on DOM objects representing those elements. For
    example, the <code><a href=#the-script-element>script</a></code> element in the example above would still implement the
    <code><a href=#htmlscriptelement>HTMLScriptElement</a></code> interface.</p>

   </dd>

   <dt id=non-interactive>Non-interactive presentation user agents</dt>

   <dd>

    <p>User agents that process HTML and XHTML documents purely to render non-interactive versions
    of them must comply to the same conformance criteria as Web browsers, except that they are
    exempt from requirements regarding user interaction.</p>

    <p class=note>Typical examples of non-interactive presentation user agents are printers
    (static UAs) and overhead displays (dynamic UAs). It is expected that most static
    non-interactive presentation user agents will also opt to <a href=#non-scripted>lack scripting
    support</a>.</p>

    <p class=example>A non-interactive but dynamic presentation UA would still execute scripts,
    allowing forms to be dynamically submitted, and so forth. However, since the concept of "focus"
    is irrelevant when the user cannot interact with the document, the UA would not need to support
    any of the focus-related DOM APIs.</p>

   </dd>

   <dt id=renderingUA>Visual user agents that support the suggested default rendering</dt>

   <dd>

    <p>User agents, whether interactive or not, may be designated (possibly as a user option) as
    supporting the suggested default rendering defined by this specification.</p>

    <p>This is not required. In particular, even user agents that do implement the suggested default
    rendering are encouraged to offer settings that override this default to improve the experience
    for the user, e.g. changing the 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 in <a href=#rendering>the rendering section</a> that that
    section defines as the behavior that user agents are <em>expected</em> to implement.</p>

   </dd>

   <dt id=non-scripted>User agents with no scripting support</dt>

   <dd>

    <p>Implementations that do not support scripting (or which have their scripting features
    disabled entirely) are exempt from supporting the events and DOM interfaces mentioned in this
    specification. For the parts of this specification that are defined in terms of an events model
    or in terms of the DOM, such user agents must still act as if events and the DOM were
    supported.</p>

    <p class=note>Scripting can form an integral part of an application. Web browsers that do not
    support scripting, or that have scripting disabled, might be unable to fully convey the author's
    intent.</p>

   </dd>


   <dt>Conformance checkers</dt>

   <dd id=conformance-checkers>

    <p>Conformance checkers must verify that a document conforms to the applicable conformance
    criteria described in this specification. Automated conformance checkers are exempt from
    detecting errors that require interpretation of the author's intent (for example, while a
    document is non-conforming if the content of a <code><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><a href=#the-blockquote-element>blockquote</a></code> elements only contain quoted material).</p>

    <p>Conformance checkers must check that the input document conforms when parsed without a
    <a href=#browsing-context>browsing context</a> (meaning that no scripts are run, and that the parser's
    <a href=#scripting-flag>scripting flag</a> is disabled), and should also check that the input document conforms
    when parsed with a <a href=#browsing-context>browsing context</a> in which scripts execute, and that the scripts
    never cause non-conforming states to occur other than transiently during script execution
    itself. (This is only a "SHOULD" and not a "MUST" requirement because it has been proven to be
    impossible. <a href=#refsCOMPUTABLE>[COMPUTABLE]</a>)</p>

    <p>The term "HTML validator" can be used to refer to a conformance checker that itself conforms
    to the applicable requirements of this specification.</p>

    <div class=note>

     <p>XML DTDs cannot express all the conformance requirements of this specification. Therefore, a
     validating XML processor and a DTD cannot constitute a conformance checker. Also, since neither
     of the two authoring formats defined in this specification are applications of SGML, a
     validating SGML system cannot constitute a conformance checker either.</p>

     <p>To put it another way, there are three types of conformance criteria:</p>

     <ol><li>Criteria that can be expressed in a DTD.</li>

      <li>Criteria that cannot be expressed by a DTD, but can still be checked by a machine.</li>

      <li>Criteria that can only be checked by a human.</li>

     </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>
   </dd>


   <dt>Data mining tools</dt>

   <dd id=data-mining>

    <p>Applications and tools that process HTML and XHTML documents for reasons other than to either
    render the documents or check them for conformance should act in accordance with the semantics
    of the documents that they process.</p>

    <p class=example>A tool that generates <a href=#outline title=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>

   </dd>


   <dt id=editors>Authoring tools and markup generators</dt>

   <dd>

    <p>Authoring tools and markup generators must generate <a href=#conforming-documents>conforming documents</a>.
    Conformance criteria that apply to authors also apply to authoring tools, where appropriate.</p>

    <p>Authoring tools are exempt from the strict requirements of using elements only for their
    specified purpose, but only to the extent that authoring tools are not yet able to determine
    author intent. However, authoring tools must not automatically misuse elements or encourage
    their users to do so.</p>

    <p class=example>For example, it is not conforming to use an <code><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><a href=#the-address-element>address</a></code> elements for any block of italics text
    (for instance); it just means that the authoring tool doesn't have to verify that when the user
    uses a tool for inserting contact information for a section, that the user really is doing that
    and not inserting something else instead.</p>

    <p class=note>In terms of conformance checking, an editor has to output documents that conform
    to the same extent that a conformance checker will verify.</p>

    <p>When an authoring tool is used to edit a non-conforming document, it may preserve the
    conformance errors in sections of the document that were not edited during the editing session
    (i.e. an editing tool is allowed to round-trip erroneous content). However, an authoring tool
    must not claim that the output is conformant if errors have been so preserved.</p>

    <p>Authoring tools are expected to come in two broad varieties: tools that work from structure
    or semantic data, and tools that work on a What-You-See-Is-What-You-Get media-specific editing
    basis (WYSIWYG).</p>

    <p>The former is the preferred mechanism for tools that author HTML, since the structure in the
    source information can be used to make informed choices regarding which HTML elements and
    attributes are most appropriate.</p>

    <p>However, WYSIWYG tools are legitimate. WYSIWYG tools should use elements they know are
    appropriate, and should not use elements that they do not know to be appropriate. This might in
    certain extreme cases mean limiting the use of flow elements to just a few elements, like
    <code><a href=#the-div-element>div</a></code>, <code><a href=#the-b-element>b</a></code>, <code><a href=#the-i-element>i</a></code>, and <code><a href=#the-span-element>span</a></code> and making liberal use
    of the <code title=attr-style><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>

   </dd>

  </dl><p id=hardwareLimitations>User agents may impose implementation-specific limits on otherwise
  unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of
  memory, or to work around platform-specific limitations.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>For compatibility with existing content and prior specifications, this specification describes
  two authoring formats: one based on XML (referred to as <a href=#the-xhtml-syntax>the XHTML syntax</a>), and one
  using a <a href=#writing>custom format</a> inspired by SGML (referred to as <a href=#syntax>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>

  </div>


  <div class=impl>

  <h4 id=dependencies><span class=secno>2.2.2 </span>Dependencies</h4>

  <p>This specification relies on several other underlying specifications.</p>

  <dl><dt>Unicode and Encoding</dt>

   <dd>

    <p>The Unicode character set is used to represent textual data, and the WHATWG Encoding standard
    defines requirements around <a href=#encoding title=encoding>character encodings</a>. <a href=#refsUNICODE>[UNICODE]</a></p>

    <p class=note>This specification <a href=#encoding-terminology>introduces terminology</a>
    based on the terms defined in those specifications, as described earlier.</p>

    <p>The following terms are used as defined in the Encoding specification: <a href=#refsENCODING>[ENCODING]</a></p>

    <ul class=brief><li><dfn id=getting-an-encoding>Getting an encoding</dfn>

     <li>The <dfn id=encoder>encoder</dfn> and <dfn id=decoder>decoder</dfn> algorithms for various encodings, including
     the <dfn id=utf-8-encoder>UTF-8 encoder</dfn> and <dfn id=utf-8-decoder>UTF-8 decoder</dfn>

     <li>The generic <dfn id=decode>decode</dfn> algorithm which takes a byte stream and an encoding and
     returns a character stream

     <li>The <dfn id=utf-8-decode>UTF-8 decode</dfn> algorithm which takes a byte stream and returns a character
     stream, additionally stripping one leading UTF-8 Byte Order Mark (BOM), if any

    </ul><p class=note>The <a href=#utf-8-decoder>UTF-8 decoder</a> is distinct from the <i>UTF-8 decode
    algorithm</i>. The latter first strips a Byte Order Mark (BOM), if any, and then invokes the
    former.</p>

    <p>For readability, character encodings are sometimes referenced in this specification with a
    case that differs from the canonical case given in the encoding standard. (For example,
    "UTF-16LE" instead of "utf-16le".)</p>

   </dd>


   <dt>XML</dt>

   <dd>

    <p>Implementations that support <a href=#the-xhtml-syntax>the XHTML syntax</a> must support some version of XML,
    as well as its corresponding namespaces specification, because that syntax uses an XML
    serialization with namespaces. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>

   </dd>


   <dt>URLs</dt>

   <dd>

    <p>The following terms are defined in the URL standard: <a href=#refsURL>[URL]</a></p>

    <ul class=brief><li><dfn id=url>URL</dfn>
     <li><dfn id=absolute-url>Absolute URL</dfn>
     <li><dfn id=relative-url>Relative URL</dfn>
     <li><dfn id=concept-url-scheme-relative title=concept-url-scheme-relative>Relative schemes</dfn>
     <li>The <dfn id=url-parser>URL parser</dfn>
     <li><dfn id=parsed-url>Parsed URL</dfn>
     <li>The <dfn id=concept-url-scheme title=concept-url-scheme>scheme</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-scheme-data title="concept-url-scheme data">scheme data</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-username title=concept-url-username>username</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-password title=concept-url-password>password</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-host title=concept-url-host>host</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-port title=concept-url-port>port</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-path title=concept-url-path>path</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-query title=concept-url-query>query</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li>The <dfn id=concept-url-fragment title=concept-url-fragment>fragment</dfn> component of a <a href=#parsed-url>parsed URL</a>
     <li><dfn id=concept-url-parse-error title=concept-url-parse-error>Parse errors</dfn> from the <a href=#url-parser>URL parser</a>
     <li>The <dfn id=concept-url-serializer title=concept-url-serializer>URL serializer</dfn>
     <li><dfn id=default-encode-set>Default encode set</dfn>
     <li><dfn id=percent-encode>Percent encode</dfn>
     <li><dfn id=utf-8-percent-encode>UTF-8 percent encode</dfn>
     <li><dfn id=percent-decode>Percent decode</dfn>
     <li><dfn id=decoder-error>Decoder error</dfn>
     <li><dfn id=urlutils><code>URLUtils</code></dfn> interface
     <li><dfn id=urlutilsreadonly><code>URLUtilsReadOnly</code></dfn> interface
     <li><dfn id=dom-url-href title=dom-url-href><code>href</code> attribute</dfn>
     <li><dfn id=dom-url-protocol title=dom-url-protocol><code>protocol</code> attribute</dfn>
     <li>The <dfn id=concept-uu-get-the-base title=concept-uu-get-the-base>get the base</dfn> hook for <code><a href=#urlutils>URLUtils</a></code>
     <li>The <dfn id=concept-uu-update title=concept-uu-update>update steps</dfn> hook for <code><a href=#urlutils>URLUtils</a></code>
     <li>The <dfn id=concept-uu-set-the-input title=concept-uu-set-the-input>set the input</dfn> algorithm for <code><a href=#urlutils>URLUtils</a></code>
     <li>The <dfn id=concept-uu-query-encoding title=concept-uu-query-encoding>query encoding</dfn> of an <code><a href=#urlutils>URLUtils</a></code> object
     <li>The <dfn id=concept-uu-input title=concept-uu-input>input</dfn> of an <code><a href=#urlutils>URLUtils</a></code> object
     <li>The <dfn id=concept-uu-url title=concept-uu-url>url</dfn> of an <code><a href=#urlutils>URLUtils</a></code> object
    </ul></dd>


   <dt>Cookies</dt>

   <dd>

    <p>The following terms are defined in the Cookie specification: <a href=#refsCOOKIES>[COOKIES]</a></p>

    <ul class=brief><li><dfn id=cookie-string>cookie-string</dfn>
     <li><dfn id=receives-a-set-cookie-string>receives a set-cookie-string</dfn>
    </ul></dd>


   <dt>CORS</dt>

   <dd>

    <p>The following terms are defined in the CORS specification: <a href=#refsCORS>[CORS]</a></p>

    <ul class=brief><li><dfn id=cross-origin-request>cross-origin request</dfn>
     <li><dfn id=cross-origin-request-status>cross-origin request status</dfn>
     <li><dfn id=custom-request-headers>custom request headers</dfn>
     <li><dfn id=simple-cross-origin-request>simple cross-origin request</dfn>
     <li><dfn id=redirect-steps>redirect steps</dfn>
     <li><dfn id=omit-credentials-flag>omit credentials flag</dfn>
     <li><dfn id=resource-sharing-check>resource sharing check</dfn>
    </ul></dd>


<!--TOPIC:DOM APIs-->

   <dt>Web IDL</dt>

   <dd>

    <p>The IDL fragments in this specification must be interpreted as required for conforming IDL
    fragments, as described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>

    <p>The terms <dfn id=supported-property-indices>supported property indices</dfn>, <dfn id=determine-the-value-of-an-indexed-property>determine the value
    of an indexed property</dfn>, <dfn id=support-named-properties>support named properties</dfn>, <dfn id=supported-property-names>supported property
    names</dfn>, <dfn id=determine-the-value-of-a-named-property>determine the value of a named property</dfn>, <dfn id=platform-array-objects>platform array
    objects</dfn>, and <dfn id=dfn-read-only-array title=dfn-read-only-array>read only</dfn> (when applied to arrays) are
    used as defined in the Web IDL specification. The algorithm to <dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>convert a DOMString to a
    sequence of Unicode characters</dfn> is similarly that defined in the Web IDL specification.</p>

    <p>Where this specification says an interface or exception is <dfn id=exposed-to-javascript>exposed to JavaScript</dfn>,
    it refers to the manner, described in the Web IDL specification, in which an ECMAScript global
    environment <i title=dfn-expose>exposes</i> interfaces and exceptions.</p>

    <p>When this specification requires a user agent to <dfn id=create-a-date-object>create a <code>Date</code> object</dfn>
    representing a particular time (which could be the special value Not-a-Number), the milliseconds
    component of that time, if any, must be truncated to an integer and the time value of the newly
    created <code>Date</code> object must represent the time after that truncation.</p>

    <p class=example>For instance, given the time 23045 millionths of a second after 01:00 UTC on
    January 1st 2000, i.e. the time 2000-01-01T00:00:00.023045Z, then the <code>Date</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>Date</code> object that represents a time value NaN (indicating that the object does
    not represent a specific instant of time).</p>

   </dd>


   <dt>JavaScript</dt>

   <dd>

    <p>Some parts of the language described by this specification only support JavaScript as the
    underlying scripting language. <a href=#refsECMA262>[ECMA262]</a></p>

    <p class=note>The term "JavaScript" is used to refer to ECMA262, rather than the official term
    ECMAScript, since the term JavaScript is more widely known. Similarly, the <a href=#mime-type>MIME
    type</a> used to refer to JavaScript in this specification is <code title="">text/javascript</code>, since that is the most commonly used type, <a href=#willful-violation title="willful
    violation">despite it being an officially obsoleted type</a> according to RFC 4329. <a href=#refsRFC4329>[RFC4329]</a></p>

    <p>The term <dfn id=javascript-global-environment>JavaScript global environment</dfn> refers to the <i title="">global
    environment</i> concept defined in the ECMAScript specification.</p>

    <p>The ECMAScript <dfn id=js-syntaxerror title=js-SyntaxError><code>SyntaxError</code></dfn> exception is also
    defined in the ECMAScript specification. <a href=#refsECMA262>[ECMA262]</a></p>

   </dd>


   <dt>DOM</dt>

   <dd>

    <p>The Document Object Model (DOM) is a representation &mdash; a model &mdash; of a document and
    its content. The DOM is not just an API; the conformance criteria of HTML implementations are
    defined, in this specification, in terms of operations on the DOM. <a href=#refsDOM>[DOM]</a></p>

    <p>Implementations must support DOM and the events defined in DOM Events, because this
    specification is defined in terms of the DOM, and some of the features are defined as extensions
    to the DOM interfaces. <a href=#refsDOM>[DOM]</a> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>

    <p>In particular, the following features are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p> <!-- aka DOM Core or DOMCORE -->

    <ul class=brief><li><dfn id=attr><code>Attr</code></dfn> interface</li>
     <li><dfn id=comment-0><code>Comment</code></dfn> interface</li>
     <li><dfn id=domimplementation><code>DOMImplementation</code></dfn> interface</li>
     <li><dfn id=dom-document title="DOM Document"><code>Document</code></dfn> interface</li>
     <li><dfn id=documentfragment><code>DocumentFragment</code></dfn> interface</li>
     <li><dfn id=documenttype><code>DocumentType</code></dfn> interface</li>
     <li><dfn id=domexception><code>DOMException</code></dfn> interface</li>
     <li><dfn id=element><code>Element</code></dfn> interface</li>
     <li><dfn id=node><code>Node</code></dfn> interface</li>
     <li><dfn id=nodelist><code>NodeList</code></dfn> interface</li>
     <li><dfn id=processinginstruction><code>ProcessingInstruction</code></dfn> interface</li>
     <li><dfn id=text><code>Text</code></dfn> interface</li>

     <li><dfn id=htmlcollection><code>HTMLCollection</code></dfn> interface</li>
     <li><dfn id=dom-htmlcollection-item title=dom-HTMLCollection-item><code>item()</code> method</dfn>
     <li>The terms <dfn id=collections>collections</dfn> and <dfn id=represented-by-the-collection>represented by the collection</dfn></li>

     <li><dfn id=domtokenlist><code>DOMTokenList</code></dfn> interface</li>
     <li><dfn id=domsettabletokenlist><code>DOMSettableTokenList</code></dfn> interface</li>

     <li><dfn id=dom-domimplementation-createdocument title=dom-DOMImplementation-createDocument><code>createDocument()</code></dfn> method</li>
     <li><dfn id=dom-domimplementation-createhtmldocument title=dom-DOMImplementation-createHTMLDocument><code>createHTMLDocument()</code></dfn> method</li>
     <li><dfn id=dom-document-createelement title=dom-Document-createElement><code>createElement()</code></dfn> method</li>
     <li><dfn id=dom-document-createelementns title=dom-Document-createElementNS><code>createElementNS()</code></dfn> method</li>
     <li><dfn id=dom-document-getelementbyid title=dom-Document-getElementById><code>getElementById()</code></dfn> method</li>
     <li><dfn id=dom-node-insertbefore title=dom-Node-insertBefore><code>insertBefore()</code></dfn> method</li>

     <li><dfn id=dom-node-ownerdocument title=dom-Node-ownerDocument><code>ownerDocument</code></dfn> attribute</li>
     <li><dfn id=dom-node-childnodes title=dom-Node-childNodes><code>childNodes</code></dfn> attribute</li>
     <li><dfn id=dom-node-localname title=dom-Node-localName><code>localName</code></dfn> attribute</li>
     <li><dfn id=dom-node-parentnode title=dom-Node-parentNode><code>parentNode</code></dfn> attribute</li>
     <li><dfn id=dom-node-namespaceuri title=dom-Node-namespaceURI><code>namespaceURI</code></dfn> attribute</li>
     <li><dfn id=dom-element-tagname title=dom-Element-tagName><code>tagName</code></dfn> attribute</li>
     <li><dfn id=dom-element-id title=dom-Element-id><code>id</code></dfn> attribute</li>
     <li><dfn id=textcontent><code>textContent</code></dfn> attribute</li>

     <li>The <dfn id=concept-node-insert title=concept-node-insert>insert</dfn>, <dfn id=concept-node-append title=concept-node-append>append</dfn>, <dfn id=concept-node-remove title=concept-node-remove>remove</dfn>, and <dfn id=concept-node-replace title=concept-node-replace>replace</dfn> algorithms for nodes</li>
     <li>The <dfn id=nodes-are-inserted>nodes are inserted</dfn> and <dfn id=nodes-are-removed>nodes are removed</dfn> concepts</li>
     <li>The <dfn id=attribute-list>attribute list</dfn> concept.</li>
     <li>The <dfn id=concept-cd-data title=concept-cd-data>data</dfn> of a text node.</li>

     <li><dfn id=event><code>Event</code></dfn> interface</li>
     <li><dfn id=eventtarget><code>EventTarget</code></dfn> interface</li>
     <li><dfn id=eventinit><code>EventInit</code></dfn> dictionary type</li>
     <li><dfn id=dom-event-target title=dom-Event-target><code>target</code></dfn> attribute</li>
     <li><dfn id=dom-event-istrusted title=dom-Event-isTrusted><code>isTrusted</code></dfn> attribute</li>
     <li>The <dfn id=concept-event-type title=concept-event-type>type</dfn> of an event</li>
     <li>The concept of an <dfn id=concept-event-listener title=concept-event-listener>event listener</dfn> and the <a href=#concept-event-listener title=concept-event-listener>event listeners</a> associated with an <code><a href=#eventtarget>EventTarget</a></code></li>
     <li>The concept of a regular <dfn id=event-parent>event parent</dfn> and a <dfn id=cross-boundary-event-parent>cross-boundary event parent</dfn></li> <!-- see bug 18780 -->

     <li>The <dfn id="document's-character-encoding" title="document's character encoding">encoding</dfn> (herein the <i>character encoding</i>) and <dfn id=concept-document-content-type title=concept-document-content-type>content type</dfn> of a <code><a href=#document>Document</a></code></li>
     <li>The distinction between <dfn id=xml-documents>XML documents</dfn> and <dfn id=html-documents>HTML documents</dfn></li>
     <li>The terms <dfn id=quirks-mode>quirks mode</dfn>, <dfn id=limited-quirks-mode>limited-quirks mode</dfn>, and <dfn id=no-quirks-mode>no-quirks mode</dfn></li>
     <li>The algorithm to <dfn id=concept-node-clone title=concept-node-clone>clone</dfn> a <code><a href=#node>Node</a></code>, and the concept of <dfn id=concept-node-clone-ext title=concept-node-clone-ext>cloning steps</dfn> used by that algorithm</li>
     <li>The concept of <dfn id=base-url-change-steps>base URL change steps</dfn> and the definition of what happens when an element is <dfn id=affected-by-a-base-url-change>affected by a base URL change</dfn></li>
     <li>The concept of an element's <dfn id=concept-id title=concept-id>unique identifier (ID)</dfn></li>

     <li>The concept of a DOM <dfn id=concept-range title=concept-range>range</dfn>, and the terms <dfn id=concept-range-start title=concept-range-start>start</dfn>, <dfn id=concept-range-end title=concept-range-end>end</dfn>, and <dfn id=concept-range-bp title=concept-range-bp>boundary point</dfn> as applied to ranges.</li>

     <li><dfn id=mutationobserver><code>MutationObserver</code></dfn> interface</li>
     <li>The <dfn id=mutationobserver-scripting-environment><code>MutationObserver</code> <var title="">scripting environment</var></dfn> concept</li>
     <li>The <dfn id=concept-mo-invoke title=concept-mo-invoke>invoke <code>MutationObserver</code> objects</dfn> algorithm</li>

     <li><dfn id=promise>Promise</dfn> interface</li>
     <li>The <dfn id=concept-resolver title=concept-resolver>resolver</dfn> concept</li>
     <li>The <dfn id=concept-resolver-fulfill title=concept-resolver-fulfill>fulfill</dfn> and <dfn id=concept-resolver-reject title=concept-resolver-reject>reject</dfn> algorithms</li>

    </ul><p>The term <dfn id=throw>throw</dfn> in this specification is used as defined in the DOM specification.
    The following <code><a href=#domexception>DOMException</a></code> types are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p>

    <ol class=brief><li value=1><dfn id=indexsizeerror><code>IndexSizeError</code></dfn></li>
     <li value=3><dfn id=hierarchyrequesterror><code>HierarchyRequestError</code></dfn></li>
     <li value=4><dfn id=wrongdocumenterror><code>WrongDocumentError</code></dfn></li>
     <li value=5><dfn id=invalidcharactererror><code>InvalidCharacterError</code></dfn></li>
     <li value=7><dfn id=nomodificationallowederror><code>NoModificationAllowedError</code></dfn></li>
     <li value=8><dfn id=notfounderror><code>NotFoundError</code></dfn></li>
     <li value=9><dfn id=notsupportederror><code>NotSupportedError</code></dfn></li>
     <li value=11><dfn id=invalidstateerror><code>InvalidStateError</code></dfn></li>
     <li value=12><dfn id=syntaxerror><code>SyntaxError</code></dfn></li>
     <li value=13><dfn id=invalidmodificationerror><code>InvalidModificationError</code></dfn></li>
     <li value=14><dfn id=namespaceerror><code>NamespaceError</code></dfn></li>
     <li value=15><dfn id=invalidaccesserror><code>InvalidAccessError</code></dfn></li>
     <li value=18><dfn id=securityerror><code>SecurityError</code></dfn></li>
     <li value=19><dfn id=networkerror><code>NetworkError</code></dfn></li>
     <li value=20><dfn id=aborterror><code>AbortError</code></dfn></li>
     <li value=21><dfn id=urlmismatcherror><code>URLMismatchError</code></dfn></li>
     <li value=22><dfn id=quotaexceedederror><code>QuotaExceededError</code></dfn></li>
     <li value=23><dfn id=timeouterror><code>TimeoutError</code></dfn></li>
     <li value=24><dfn id=invalidnodetypeerror><code>InvalidNodeTypeError</code></dfn></li>
     <li value=25><dfn id=datacloneerror><code>DataCloneError</code></dfn></li>
    </ol><p class=example>For example, to <i>throw a <code><a href=#timeouterror>TimeoutError</a></code> exception</i>, a user
    agent would construct a <code><a href=#domexception>DOMException</a></code> object whose type was the string "<code title="">TimeoutError</code>" (and whose code was the number 23, for legacy reasons) and
    actually throw that object as an exception.</p>

    <p>The <span title=concept-document-URL>URL</span> associated with a <code><a href=#document>Document</a></code>, as
    defined in the DOM specification, is referred to in this specification as <a href="#the-document's-address">the document's
    address</a>.</p>

    <p>The following features are defined in the DOM Events specification: <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>

    <ul class=brief><li><dfn id=mouseevent><code>MouseEvent</code></dfn> interface</li>
     <li><dfn id=mouseeventinit><code>MouseEventInit</code></dfn> dictionary type</li>

     <li>The <dfn id=uievent><code>UIEvent</code></dfn> interface's <dfn id=dom-uievent-detail title=dom-UIEvent-detail><code>detail</code></dfn> attribute</li>

     <li><dfn id=event-click title=event-click><code>click</code></dfn> event</li>

    </ul><p>This specification sometimes uses the term <dfn title="">name</dfn> to refer to the event's <code title=dom-event-type>type</code>; as in, "an event named <code title="">click</code>" or "if the event name is <code title="">keypress</code>". The terms "name" and "type" for events
    are synonymous.</p>

    <p>The following features are defined in the DOM Parsing and
    Serialization specification: <a href=#refsDOMPARSING>[DOMPARSING]</a></p>

    <ul class=brief><li><dfn id=dom-innerhtml title=dom-innerHTML><code>innerHTML</code></dfn></li>
     <li><dfn id=dom-outerhtml title=dom-outerHTML><code>outerHTML</code></dfn></li>
    </ul><p class=note>User agents are also encouraged to implement the
    features described in the <cite>HTML Editing APIs</cite> and
    <cite><code>UndoManager</code> and DOM Transaction</cite>
    specifications.
    <a href=#refsEDITING>[EDITING]</a>
    <a href=#refsUNDO>[UNDO]</a>
    </p>

    <p>The following parts of the Fullscreen specification are referenced from this specification,
    in part to define the rendering of <code><a href=#the-dialog-element>dialog</a></code> elements, and also to define how the
    Fullscreen API interacts with the sandboxing features in HTML: <a href=#refsFULLSCREEN>[FULLSCREEN]</a></p>

    <ul class=brief><li>The <dfn id=top-layer>top layer</dfn> concept</li>
     <li><dfn id=dom-element-requestfullscreen title=dom-element-requestFullscreen><code>requestFullscreen()</code></dfn>
     <li>The <dfn id=fullscreen-enabled-flag>fullscreen enabled flag</dfn></li>
     <li>The <dfn id=fully-exit-fullscreen>fully exit fullscreen</dfn> algorithm</li>
    </ul></dd>


   <dt>Typed Arrays</dt>

   <dd>

    <p>The <dfn id=arraybuffer>ArrayBuffer</dfn> and <dfn id=arraybufferview>ArrayBufferView</dfn> interfaces and underlying concepts
    from the Typed Array Specification are used for several features in this specification. The
    <dfn id=uint8clampedarray>Uint8ClampedArray</dfn> interface type is specifically used in the definition of the
    <code><a href=#the-canvas-element>canvas</a></code> element's 2D API. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

   </dd>


   <dt>File API</dt>

   <dd>

    <p>This specification uses the following features defined in the File API specification: <a href=#refsFILEAPI>[FILEAPI]</a></p>

    <ul class=brief><li><dfn id=blob><code>Blob</code></dfn></li>
     <li><dfn id=file><code>File</code></dfn></li>
     <li><dfn id=filelist><code>FileList</code></dfn></li>
     <li><dfn id=blob.close()><code title=dom-Blob-close>Blob.close()</code></dfn></li>
     <li><dfn id=blob.type><code title=dom-Blob-type>Blob.type</code></dfn></li>
     <li>The concept of <dfn id=file-error-read title=file-error-read>read errors</dfn></li>
    </ul></dd>


   <dt>XMLHttpRequest</dt>

   <dd>

    <p>This specification references the XMLHttpRequest specification to define how the two
    specifications interact and to use its <code><a href=#progressevent>ProgressEvent</a></code> features. The following
    features and terms are defined in the XMLHttpRequest specification: <a href=#refsXHR>[XHR]</a></p>

    <ul class=brief><li><dfn id=document-response-entity-body>Document response entity body</dfn>
     <li><dfn id=xmlhttprequest-base-url><code>XMLHttpRequest</code> base URL</dfn>
     <li><dfn id=xmlhttprequest-origin><code>XMLHttpRequest</code> origin</dfn>
     <li><dfn id=xmlhttprequest-referrer-source><code>XMLHttpRequest</code> referrer source</dfn>

     <li><dfn id=progressevent><code>ProgressEvent</code></dfn>
     <li><dfn id=fire-a-progress-event title="fire a progress event">Fire a progress event named <var title="">e</var></dfn>

    </ul></dd>


<!--TOPIC:HTML-->

   <dt>Media Queries</dt>

   <dd>

    <p>Implementations must support the Media Queries language. <a href=#refsMQ>[MQ]</a></p>

   </dd>


   <dt>CSS modules</dt>

   <dd>

    <p>While support for CSS as a whole is not required of implementations of this specification
    (though it is encouraged, at least for Web browsers), some features are defined in terms of
    specific CSS requirements.</p>

    <p>In particular, some features require that a string be <dfn id=parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt;
    value</dfn>. When parsing a CSS value, user agents are required by the CSS specifications to
    apply some error handling rules. These apply to this specification also. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> <a href=#refsCSS>[CSS]</a></p>

    <p class=example>For example, user agents are required to close all open constructs upon
    finding the end of a style sheet unexpectedly. Thus, when parsing the string "<code title="">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 title="">rgb(0,0,</code>" (with both a missing parenthesis
    and a missing "blue" value) cannot be parsed, as closing the open construct does not result in a
    viable value.</p>

    <p>The term <dfn id=css-element-reference-identifier>CSS element reference identifier</dfn> is used as defined in the <cite>CSS
    Image Values and Replaced Content</cite> specification to define the API that declares
    identifiers for use with the CSS 'element()' function. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

    <p>Similarly, the term <dfn id=provides-a-paint-source>provides a paint source</dfn> is used as defined in the <cite>CSS
    Image Values and Replaced Content</cite> specification to define the interaction of certain HTML
    elements with the CSS 'element()' function. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

    <p>The term <dfn id=default-object-size>default object size</dfn> is also defined in the <cite>CSS Image Values and
    Replaced Content</cite> specification. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

    <p>Support for the CSS Object Model is required for implementations that support scripting. The
    following features and terms are defined in the CSSOM specifications: <a href=#refsCSSOM>[CSSOM]</a> <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a>

    <ul class=brief><li><dfn id=screen><code>Screen</code></dfn></li>
     <li><dfn id=linkstyle><code>LinkStyle</code></dfn></li>
     <li><dfn id=cssstyledeclaration><code>CSSStyleDeclaration</code></dfn></li>
     <li><dfn id=dom-cssstyledeclaration-csstext title=dom-CSSStyleDeclaration-cssText><code>cssText</code></dfn> attribute of <code><a href=#cssstyledeclaration>CSSStyleDeclaration</a></code></li>
     <li><dfn id=stylesheet><code>StyleSheet</code></dfn></li>
     <li><dfn id=dom-linkstyle-sheet title=dom-linkstyle-sheet><code>sheet</code></dfn></li>
     <li><dfn id=dom-stylesheet-disabled title=dom-stylesheet-disabled><code>disabled</code></dfn></li>
     <li><dfn id=alternative-style-sheet-sets>Alternative style sheet sets</dfn> and the <dfn id=preferred-style-sheet-set>preferred style sheet set</dfn></li>
     <li><dfn id=serializing-a-css-value>Serializing a CSS value</dfn></li>
     <li><dfn id=scroll-an-element-into-view>Scroll an element into view</dfn></li>
     <li><dfn id=scroll-to-the-beginning-of-the-document>Scroll to the beginning of the document</dfn></li>
    </ul><p>The term <dfn id=css-styling-attribute>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
    specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>

    <p>The <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's use of fonts depends on the features
    described in the CSS <cite>Fonts</cite> and <cite>Font Load Events</cite> specifications, including in particular
    <dfn id=fontloader><code>FontLoader</code></dfn>. <a href=#refsCSSFONTS>[CSSFONTS]</a> <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>

   </dd>


<!--TOPIC:Canvas-->

   <dt>SVG</dt>

   <dd>

    <p>The following interface is defined in the SVG specification: <a href=#refsSVG>[SVG]</a></p>

    <ul class=brief><li><dfn id=svgmatrix><code>SVGMatrix</code></dfn>
    </ul><!-- mention that the parser supports it? --></dd>


   <dt>WebGL</dt>

   <dd>

    <p>The following interface is defined in the WebGL specification: <a href=#refsWEBGL>[WEBGL]</a></p>

    <ul class=brief><li><dfn id=webglrenderingcontext><code>WebGLRenderingContext</code></dfn>
    </ul></dd>


<!--TOPIC:HTML-->

   <!-- mention that the parser supports mathml? -->


<!--TOPIC:Video Text Tracks-->

   <dt>WebVTT</dt>

   <dd>

    <p>Implementations may support <dfn id=webvtt>WebVTT</dfn> as a text track format for subtitles, captions,
    chapter titles, metadata, etc, for media resources. <a href=#refsWEBVTT>[WEBVTT]</a></p>

    <p>The following terms, used in this specification, are defined in the WebVTT specification:</p>

    <ul class=brief><li><dfn id=webvtt-file>WebVTT file</dfn>
     <li><dfn id=webvtt-file-using-cue-text>WebVTT file using cue text</dfn>
     <li><dfn id=webvtt-file-using-chapter-title-text>WebVTT file using chapter title text</dfn>
     <li><dfn id=webvtt-file-using-only-nested-cues>WebVTT file using only nested cues</dfn>
     <li><dfn id=webvtt-parser>WebVTT parser</dfn>
     <li>The <dfn id=rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</dfn>
     <li>The <dfn id=rules-for-interpreting-webvtt-cue-text>rules for interpreting WebVTT cue text</dfn>
     <li>The WebVTT <dfn id=text-track-cue-writing-direction>text track cue writing direction</dfn>
    </ul></dd>


<!--TOPIC:WebSocket API-->

   <dt>The WebSocket protocol</dt>

   <dd>

    <p>The following terms are defined in the WebSocket protocol specification: <a href=#refsWSP>[WSP]</a></p>

    <ul class=brief><li><dfn id=establish-a-websocket-connection>establish a WebSocket connection</dfn>
     <li><dfn id=the-websocket-connection-is-established>the WebSocket connection is established</dfn>
     <li><dfn id="validate-the-server's-response">validate the server's response</dfn>
     <li><dfn id=extensions-in-use>extensions in use</dfn>
     <li><dfn id=subprotocol-in-use>subprotocol in use</dfn>
     <li><dfn id=headers-to-send-appropriate-cookies>headers to send appropriate cookies</dfn>
     <li><dfn id="cookies-set-during-the-server's-opening-handshake">cookies set during the server's opening handshake</dfn>
     <li><dfn id=a-websocket-message-has-been-received>a WebSocket message has been received</dfn>
     <li><dfn id=fail-the-websocket-connection>fail the WebSocket connection</dfn>
     <li><dfn id=close-the-websocket-connection>close the WebSocket connection</dfn>
     <li><dfn id=start-the-websocket-closing-handshake>start the WebSocket closing handshake</dfn>
     <li><dfn id=the-websocket-closing-handshake-is-started>the WebSocket closing handshake is started</dfn>
     <li><dfn id=the-websocket-connection-is-closed>the WebSocket connection is closed</dfn> (possibly <i title="">cleanly</i>)
     <li><dfn id=the-websocket-connection-close-code>the WebSocket connection close code</dfn>
     <li><dfn id=the-websocket-connection-close-reason>the WebSocket connection close reason</dfn>

    </ul></dd>


<!--TOPIC:HTML-->

   <dt>ARIA</dt>

   <dd>

    <p>The terms <dfn id=strong-native-semantics>strong native semantics</dfn> is used as defined in the ARIA specification.
    The term <dfn id=default-implicit-aria-semantics>default implicit ARIA semantics</dfn> has the same meaning as the term <i>implicit
    WAI-ARIA semantics</i> as used in the ARIA specification. <a href=#refsARIA>[ARIA]</a></p>

    <p>The <dfn id=attr-aria-role title=attr-aria-role><code>role</code></dfn> and <code title="">aria-*</code>
    attributes are defined in the ARIA specification. <a href=#refsARIA>[ARIA]</a></p>


   </dd>


  </dl><p>This specification does not <em>require</em> support of any particular network protocol, style
  sheet language, scripting language, or any of the DOM specifications beyond those required in the
  list above. However, the language described by this specification is biased towards CSS as the
  styling language, JavaScript as the scripting language, and HTTP as the network protocol, and
  several features assume that those languages and protocols are in use.</p>

  <p>A user agent that implements the HTTP protocol must implement the Web Origin Concept
  specification and the HTTP State Management Mechanism specification (Cookies) as well. <a href=#refsHTTP>[HTTP]</a> <a href=#refsORIGIN>[ORIGIN]</a> <a href=#refsCOOKIES>[COOKIES]</a></p>

  <p class=note>This specification might have certain additional requirements on character
  encodings, image formats, audio formats, and video formats in the respective sections.</p>

  </div>



  <h4 id=extensibility><span class=secno>2.2.3 </span>Extensibility</h4>

  <p>HTML has a wide number of extensibility mechanisms that can be used for adding semantics in a
  safe manner:</p>

  <ul><li>Authors can use the <code title=attr-class><a href=#classes>class</a></code> attribute to extend elements,
   effectively creating their own elements, while using the most applicable existing "real" HTML
   element, so that browsers and other tools that don't know of the extension can still support it
   somewhat well. This is the tack used by microformats, for example.</li>

   <li>Authors can include data for inline client-side scripts or server-side site-wide scripts to
   process using the <code title=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>

   <li>Authors can use the <code title=meta><a href=#the-meta-element>&lt;meta name="" content=""&gt;</a></code> mechanism to
   include page-wide metadata by registering <a href=#concept-meta-extensions title=concept-meta-extensions>extensions to the
   predefined set of metadata names</a>.</li>

   <li>Authors can use the <code title=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 title=concept-rel-extensions>extensions to
   the predefined set of link types</a>. This is also used by microformats.</li>

   <li>Authors can embed raw data using the <code title=script><a href=#the-script-element>&lt;script type=""&gt;</a></code>
   mechanism with a custom type, for further handling by inline or server-side scripts.</li>

   <li>Authors can create <a href=#plugin title=plugin>plugins</a> and invoke them using the
   <code><a href=#the-embed-element>embed</a></code> element. This is how Flash works.</li>

   <li>Authors can extend APIs using the JavaScript prototyping mechanism. This is widely used by
   script libraries, for instance.</li>

   <li>Authors can use the microdata feature (the <code title=attr-itemscope><a href=#attr-itemscope>itemscope=""</a></code>
   and <code title=attr-itemprop><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.</li>

  </ul><hr><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>

  <div class=impl>

  <p>If such extensions are nonetheless needed, e.g. for experimental purposes, then vendors are
  strongly urged to use one of the following extension mechanisms:</p>

  <p>For markup-level features that can be limited to the XML serialization and need not be
  supported in the HTML serialization, vendors should use the namespace mechanism to define custom
  namespaces in which the non-standard elements and attributes are supported.</p>

  <p>For markup-level features that are intended for use with <a href=#syntax>the HTML syntax</a>,
  extensions should be limited to new attributes of the form "<code title="">x-<var title="">vendor</var>-<var title="">feature</var></code>", where <var title="">vendor</var> is a
  short string that identifies the vendor responsible for the extension, and <var title="">feature</var> is the name of the feature. New element names should not be created. Using
  attributes for such extensions exclusively allows extensions from multiple vendors to co-exist on
  the same element, which would not be possible with elements. Using the "<code title="">x-<var title="">vendor</var>-<var title="">feature</var></code>" form allows extensions to be made
  without risk of conflicting with future additions to the specification.</p>

  <div class=example>

   <p>For instance, a browser named "FerretBrowser" could use "ferret" as a vendor prefix, while a
   browser named "Mellblom Browser" could use "mb". If both of these browsers invented extensions
   that turned elements into scratch-and-sniff areas, an author experimenting with these features
   could write:</p>

   <pre>&lt;p&gt;This smells of lemons!
&lt;span x-ferret-smellovision x-ferret-smellcode="LEM01"
      x-mb-outputsmell x-mb-smell="lemon juice"&gt;&lt;/span&gt;&lt;/p&gt;</pre>

  </div>

  <p>Attribute names beginning with the two characters "<code title="">x-</code>" are reserved for
  user agent use and are guaranteed to never be formally added to the HTML language. For
  flexibility, attributes names containing underscores (the U+005F LOW LINE character) are also
  reserved for experimental purposes and are guaranteed to never be formally added to the HTML
  language.</p>

  <p class=note>Pages that use such attributes are by definition non-conforming.</p>

  <p>For DOM extensions, e.g. new methods and IDL attributes, the new members should be prefixed by
  vendor-specific strings to prevent clashes with future versions of this specification.</p>

  <p>For events, experimental event types should be prefixed with vendor-specific strings.</p>

  <div class=example>

   <p>For example, if a user agent called "Pleas<!--e h-->old" were to add an event to indicate when
   the user is going up in an elevator, it could use the prefix "<code title="">pleasold</code>" and
   thus name the event "<code title="">pleasoldgoingup</code>", possibly with an event handler
   attribute named "<code title="">onpleasoldgoingup</code>".</p>

  </div>

  <p>All extensions must be defined so that the use of extensions neither contradicts nor causes the
  non-conformance of functionality defined in the specification.</p> <!-- thanks to QA Framework -->

  <div class=example>

   <p>For example, while strongly discouraged from doing so, an implementation "Foo Browser" could
   add a new IDL attribute "<code title="">fooTypeTime</code>" to a control's DOM interface that
   returned the time it took the user to select the current value of a control (say). On the other
   hand, defining a new control that appears in a form's <code title=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 title=dom-form-elements><a href=#dom-form-elements>elements</a></code> given in
   this specification.</p>

  </div>

  <p>When adding new <a href=#reflect title=reflect>reflecting</a> IDL attributes corresponding to content
  attributes of the form "<code title="">x-<var title="">vendor</var>-<var title="">feature</var></code>", the IDL attribute should be named "<code title=""><var title="">vendor</var><var title="">Feature</var></code>" (i.e. the "<code title="">x</code>" is
  dropped from the IDL attribute's name).</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 id=other-applicable-specifications title="other applicable specifications">applicable specification</dfn> for the purposes of
  conformance requirements in this specification.</p>

  <p class=note>Someone could write a specification that defines any arbitrary byte stream as
  conforming, and then claim that their random junk is conforming. However, that does not mean that
  their random junk actually is conforming for everyone's purposes: if someone else decides that
  that specification does not apply to their work, then they can quite legitimately say that the
  aforementioned random junk is just that, junk, and not conforming at all. As far as conformance
  goes, what matters in a particular community is what that community <em>agrees</em> is
  applicable.</p>

  <div class=impl>

  <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>

<!--ADD-TOPIC:Security-->
  <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
  &mdash; leaving the attribute on the object but making it return null or throw an exception is
  insufficient.</p>
<!--REMOVE-TOPIC:Security-->

  </div>



  <h3 id=case-sensitivity-and-string-comparison><span class=secno>2.3 </span>Case-sensitivity and string comparison</h3>

  <p>Comparing two strings in a <dfn id=case-sensitive>case-sensitive</dfn> manner means comparing them exactly, code
  point for code point.</p>

  <p>Comparing two strings in an <dfn id=ascii-case-insensitive>ASCII case-insensitive</dfn> manner means comparing them
  exactly, code point for code point, except that the characters in the range U+0041 to U+005A (i.e.
  LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and the corresponding characters in the range
  U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z) are considered to also
  match.</p>

  <p>Comparing two strings in a <dfn id=compatibility-caseless>compatibility caseless</dfn> manner means using the Unicode
  <i>compatibility caseless match</i> operation to compare the two strings, with no language-specific tailoirings. <a href=#refsUNICODE>[UNICODE]</a></p>

  <p>Except where otherwise stated, string comparisons must be performed in a
  <a href=#case-sensitive>case-sensitive</a> manner.</p>


  <div class=impl>

  <p><dfn id=converted-to-ascii-uppercase title="converted to ASCII uppercase">Converting a string to ASCII uppercase</dfn> means
  replacing all characters in the range U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL
  LETTER Z) with the corresponding characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL
  LETTER A to LATIN CAPITAL LETTER Z).</p>

  <p><dfn id=converted-to-ascii-lowercase title="converted to ASCII lowercase">Converting a string to ASCII lowercase</dfn> means
  replacing all characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN
  CAPITAL LETTER Z) with the corresponding characters in the range U+0061 to U+007A (i.e. LATIN
  SMALL LETTER A to LATIN SMALL LETTER Z).</p>

  </div>


  <p>A string <var title="">pattern</var> is a <dfn id=prefix-match>prefix match</dfn> for a string <var title="">s</var> when <var title="">pattern</var> is not longer than <var title="">s</var> and
  truncating <var title="">s</var> to <var title="">pattern</var>'s length leaves the two strings as
  matches of each other.</p>



  <h3 id=common-microsyntaxes><span class=secno>2.4 </span>Common microsyntaxes</h3>

  <p>There are various places in HTML that accept particular data types, such as dates or numbers.
  This section describes what the conformance criteria for content in those formats is, and how to
  parse them.</p>

  <div class=impl>

  <p class=note>Implementors are strongly urged to carefully examine any third-party libraries
  they might consider using to implement the parsing of syntaxes described below. For example, date
  libraries are likely to implement error handling behavior that differs from what is required in
  this specification, since error-handling behavior is often not defined in specifications that
  describe date syntaxes similar to those used in this specification, and thus implementations tend
  to vary greatly in how they handle errors.</p>

  </div>


  <div class=impl>

  <h4 id=common-parser-idioms><span class=secno>2.4.1 </span>Common parser idioms</h4>

  </div>

  <p>The <dfn id=space-character title="space character">space characters</dfn>, for the purposes of this
  specification, are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C
  FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).</p>

  <p>The <dfn id=white_space title=White_Space>White_Space characters</dfn> are those that have the Unicode
  property "White_Space" in the Unicode <code title="">PropList.txt</code> data file. <a href=#refsUNICODE>[UNICODE]</a></p>

  <p class=note>This should not be confused with the "White_Space" value (abbreviated "WS") of the
  "Bidi_Class" property in the <code title="">Unicode.txt</code> data file.</p>

  <p>The <dfn id=uppercase-ascii-letters>uppercase ASCII letters</dfn> are the characters in the range U+0041 LATIN CAPITAL
  LETTER A to U+005A LATIN CAPITAL LETTER Z.</p>

  <p>The <dfn id=lowercase-ascii-letters>lowercase ASCII letters</dfn> are the characters in the range U+0061 LATIN SMALL
  LETTER A to U+007A LATIN SMALL LETTER Z.</p>

  <p>The <dfn id=ascii-digits>ASCII digits</dfn> are the characters in the range U+0030 DIGIT ZERO (0) to U+0039
  DIGIT NINE (9).</p>

  <p>The <dfn id=alphanumeric-ascii-characters>alphanumeric ASCII characters</dfn> are those that are either <a href=#uppercase-ascii-letters>uppercase ASCII
  letters</a>, <a href=#lowercase-ascii-letters>lowercase ASCII letters</a>, or <a href=#ascii-digits>ASCII digits</a>.</p>

  <p>The <dfn id=ascii-hex-digits>ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
  U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and U+0061
  LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F.</p>

  <p>The <dfn id=uppercase-ascii-hex-digits>uppercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
  U+0039 DIGIT NINE (9) and U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F only.</p>

  <p>The <dfn id=lowercase-ascii-hex-digits>lowercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO
  (0) to U+0039 DIGIT NINE (9) and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F
  only.</p>

  <div class=impl>

  <p>Some of the micro-parsers described below follow the pattern of having an <var title="">input</var> variable that holds the string being parsed, and having a <var title="">position</var> variable pointing at the next character to parse in <var title="">input</var>.</p>

  <p>For parsers based on this pattern, a step that requires the user agent to <dfn id=collect-a-sequence-of-characters>collect a
  sequence of characters</dfn> means that the following algorithm must be run, with <var title="">characters</var> being the set of characters that can be collected:</p>

  <ol><li><p>Let <var title="">input</var> and <var title="">position</var> be the same variables as
   those of the same name in the algorithm that invoked these steps.</li>

   <li><p>Let <var title="">result</var> be the empty string.</li>

   <li><p>While <var title="">position</var> doesn't point past the end of <var title="">input</var>
   and the character at <var title="">position</var> is one of the <var title="">characters</var>,
   append that character to the end of <var title="">result</var> and advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

   <li><p>Return <var title="">result</var>.</li>

  </ol><p>The step <dfn id=skip-whitespace>skip whitespace</dfn> means that the user agent must <a href=#collect-a-sequence-of-characters>collect a sequence of
  characters</a> that are <a href=#space-character title="space character">space characters</a>. The step
  <dfn id=skip-white_space-characters>skip White_Space characters</dfn> means that the user agent must <a href=#collect-a-sequence-of-characters>collect a sequence of
  characters</a> that are <a href=#white_space>White_Space</a> characters. In both cases, the collected
  characters are not used. <a href=#refsUNICODE>[UNICODE]</a></p>

  <p>When a user agent is to <dfn id=strip-line-breaks>strip line breaks</dfn> from a string, the user agent must remove
  any U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters from that string.</p>

  <p>When a user agent is to <dfn id=strip-leading-and-trailing-whitespace>strip leading and trailing whitespace</dfn> from a string, the
  user agent must remove all <a href=#space-character title="space character">space characters</a> that are at the
  start or end of the string.</p>

  <p>When a user agent is to <dfn id=strip-and-collapse-whitespace>strip and collapse whitespace</dfn> in a string, it must replace
  any sequence of one or more consecutive <a href=#space-character title="space character">space characters</a> in
  that string with a single U+0020 SPACE character, and then <a href=#strip-leading-and-trailing-whitespace>strip leading and trailing
  whitespace</a> from that string.</p>

  <p>When a user agent has to <dfn id=strictly-split-a-string>strictly split a string</dfn> on a particular delimiter character
  <var title="">delimiter</var>, it must use the following algorithm:</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">tokens</var> be an ordered list of tokens, initially empty.</li>

   <li><p>While <var title="">position</var> is not past the end of <var title="">input</var>:</p>

    <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not the <var title="">delimiter</var> character.</li>

     <li><p>Append the string collected in the previous step to <var title="">tokens</var>.</li>

     <li><p>Advance <var title="">position</var> to the next character in <var title="">input</var>.</li> <!-- skips past the delimiter -->

    </ol></li>

   <li><p>Return <var title="">tokens</var>.</li>

  </ol><p class=note>For the special cases of splitting a string <a href=#split-a-string-on-spaces title="split a string on
  spaces">on spaces</a> and <a href=#split-a-string-on-commas title="split a string on commas">on commas</a>, this
  algorithm does not apply (those algorithms also perform <a href=#strip-leading-and-trailing-whitespace title="strip leading and trailing
  whitespace">whitespace trimming</a>).</p>

  </div>



  <h4 id=boolean-attributes><span class=secno>2.4.2 </span>Boolean attributes</h4>

  <p>A number of attributes are <dfn id=boolean-attribute title="boolean attribute">boolean attributes</dfn>. The
  presence of a boolean attribute on an element represents the true value, and the absence of the
  attribute represents the false value.</p>

  <p>If the attribute is present, its value must either be the empty string or a value that is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the attribute's canonical name, with no leading or
  trailing whitespace.</p>

  <p class=note>The values "true" and "false" are not allowed on boolean attributes. To represent
  a false value, the attribute has to be omitted altogether.</p>

  <div class=example>

   <p>Here is an example of a checkbox that is checked and disabled. The <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> and <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>
   attributes are the boolean attributes.</p>

   <pre>&lt;label&gt;&lt;input type=checkbox checked name=cheese disabled&gt; Cheese&lt;/label&gt;</pre>

   <p>This could be equivalently written as this:

   <pre>&lt;label&gt;&lt;input type=checkbox checked=checked name=cheese disabled=disabled&gt; Cheese&lt;/label&gt;</pre>

   <p>You can also mix styles; the following is still equivalent:</p>

   <pre>&lt;label&gt;&lt;input type='checkbox' checked name=cheese disabled=""&gt; Cheese&lt;/label&gt;</pre>

  </div>



  <h4 id=keywords-and-enumerated-attributes><span class=secno>2.4.3 </span>Keywords and enumerated attributes</h4>

  <p>Some attributes are defined as taking one of a finite set of keywords. Such attributes are
  called <dfn id=enumerated-attribute title="enumerated attribute">enumerated attributes</dfn>. The keywords are each
  defined to map to a particular <em>state</em> (several keywords might map to the same state, in
  which case some of the keywords are synonyms of each other; additionally, some of the keywords can
  be said to be non-conforming, and are only in the specification for historical reasons). In
  addition, two default states can be given. The first is the <i>invalid value default</i>, the
  second is the <i>missing value default</i>.</p>

  <p>If an enumerated attribute is specified, the attribute's value must be an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> match for one of the given keywords that are not said to be
  non-conforming, with no leading or trailing whitespace.</p>

  <p>When the attribute is specified, if its value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match
  for one of the given keywords then that keyword's state is the state that the attribute
  represents. If the attribute value matches none of the given keywords, but the attribute has an
  <i>invalid value default</i>, then the attribute represents that state. Otherwise, if the
  attribute value matches none of the keywords but there is a <i>missing value default</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>missing value default</i> state
  defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of
  the attribute means that there is no state represented.</p>

  <p class=note>The empty string can be a valid keyword.</p>


  <h4 id=numbers><span class=secno>2.4.4 </span>Numbers</h4>

  <h5 id=signed-integers><span class=secno>2.4.4.1 </span>Signed integers</h5>

  <p>A string is a <dfn id=valid-integer>valid integer</dfn> if it consists of one or more <a href=#ascii-digits>ASCII digits</a>,
  optionally prefixed with a U+002D HYPHEN-MINUS character (-).</p>

  <p>A <a href=#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>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>

  <div class=impl>

  <p>The <dfn id=rules-for-parsing-integers>rules for parsing integers</dfn> are as given in the following algorithm. When
  invoked, the steps must be followed in the order given, aborting at the first step that returns a
  value. This algorithm will return either an integer or an error.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">sign</var> have the value "positive".</li>

   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an
    error.</li>

   <li>

    <p>If the character indicated by <var title="">position</var> (the first character) is a U+002D
    HYPHEN-MINUS character (-):</p>

    <ol><li>Let <var title="">sign</var> be "negative".</li>

     <li>Advance <var title="">position</var> to the next character.</li>

     <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an
     error.</li>

    </ol><p>Otherwise, if the character indicated by <var title="">position</var> (the first character)
    is a U+002B PLUS SIGN character (+):</p>

    <ol><li>Advance <var title="">position</var> to the next character. (The "<code title="">+</code>"
     is ignored, but it is not conforming.)</li>

     <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an
     error.</li>

    </ol></li>

   <li><p>If the character indicated by <var title="">position</var> is not an <a href=#ascii-digits title="ASCII
   digits">ASCII digit</a>, then return an error.</li>

   <!-- Ok. At this point we know we have a number. It might have
   trailing garbage which we'll ignore, but it's a number, and we
   won't return an error. -->

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>, and
   interpret the resulting sequence as a base-ten integer. Let <var title="">value</var> be that
   integer.</li>

   <li><p>If <var title="">sign</var> is "positive", return <var title="">value</var>, otherwise return the result of subtracting
   <var title="">value</var> from zero.</li>

  </ol></div>


  <h5 id=non-negative-integers><span class=secno>2.4.4.2 </span>Non-negative integers</h5>

  <p>A string is a <dfn id=valid-non-negative-integer>valid non-negative integer</dfn> if it consists of one or more <a href=#ascii-digits>ASCII
  digits</a>.</p>

  <p>A <a href=#valid-non-negative-integer>valid non-negative integer</a> represents the number that is represented in base ten
  by that string of digits.</p>

  <div class=impl>

  <p>The <dfn id=rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</dfn> are as given in the following algorithm.
  When invoked, the steps must be followed in the order given, aborting at the first step that
  returns a value. This algorithm will return either zero, a positive integer, or an error.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">value</var> be the result of parsing <var title="">input</var> using the
   <a href=#rules-for-parsing-integers>rules for parsing integers</a>.</li>

   <li><p>If <var title="">value</var> is an error, return an error.</li>

   <li><p>If <var title="">value</var> is less than zero, return an error.</li>

   <li><p>Return <var title="">value</var>.</li>

  </ol><!-- Implications: A leading + is ignored. A leading - is ignored if the value is zero. --></div>


  <h5 id=floating-point-numbers><span class=secno>2.4.4.3 </span>Floating-point numbers</h5>

  <p>A string is a <dfn id=valid-floating-point-number>valid floating-point number</dfn> if it consists of:</p>

  <ol class=brief><li>Optionally, a U+002D HYPHEN-MINUS character (-).</li>

   <li>One or both of the following, in the given order:

    <ol><li>A series of one or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>

      <ol><li>A single U+002E FULL STOP character (.).</li>

       <li>A series of one or more <a href=#ascii-digits>ASCII digits</a>.</li>

      </ol></li>

    </ol></li>

   <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>

     <li>Optionally, a U+002D HYPHEN-MINUS character (-) or U+002B PLUS SIGN character (+).</li>

     <li>A series of one or more <a href=#ascii-digits>ASCII digits</a>.</li>

    </ol></li>

  </ol><p>A <a href=#valid-floating-point-number>valid floating-point number</a> represents the number obtained by multiplying the
  significand by ten raised to the power of the exponent, where the significand is the first number,
  interpreted as base ten (including the decimal point and the number after the decimal point, if
  any, and interpreting the significand as a negative number if the whole string starts with a
  U+002D HYPHEN-MINUS character (-) and the number is not zero), and where the exponent is the
  number after the E, if any (interpreted as a negative number if there is a U+002D HYPHEN-MINUS
  character (-) between the E and the number and the number is not zero, or else ignoring a U+002B
  PLUS SIGN character (+) between the E and the number if there is one). If there is no E, then the
  exponent is treated as zero.</p>

  <p class=note>The Infinity and Not-a-Number (NaN) values are not <a href=#valid-floating-point-number title="valid
  floating-point number">valid floating-point numbers</a>.</p>

  <div class=impl>

  <p>The <dfn id=best-representation-of-the-number-as-a-floating-point-number title="best representation of the number as a floating-point number">best
  representation of the number <var title="">n</var> as a floating-point number</dfn> is the string
  obtained from applying the JavaScript operator ToString to <var title="">n</var>. The JavaScript
  operator ToString is not uniquely determined. When there are multiple possible strings that could
  be obtained from the JavaScript operator ToString for a particular value, the user agent must
  always return the same string for that value (though it may differ from the value used by other
  user agents).</p>

  <p>The <dfn id=rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</dfn> are as given in the following
  algorithm. This algorithm must be aborted at the first step that returns something. This algorithm
  will return either a number or an error.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">value</var> have the value 1.</li>

   <li><p>Let <var title="">divisor</var> have the value 1.</li>

   <li><p>Let <var title="">exponent</var> have the value 1.</li>

   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an
   error.</li>

   <li>

    <p>If the character indicated by <var title="">position</var> is a U+002D HYPHEN-MINUS character
    (-):</p>

    <ol><li>Change <var title="">value</var> and <var title="">divisor</var> to &minus;1.</li>

     <li>Advance <var title="">position</var> to the next character.</li>

     <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an
     error.</li>

    </ol><p>Otherwise, if the character indicated by <var title="">position</var> (the first character)
    is a U+002B PLUS SIGN character (+):</p>

    <ol><li>Advance <var title="">position</var> to the next character. (The "<code title="">+</code>"
     is ignored, but it is not conforming.)</li>

     <li>If <var title="">position</var> is past the end of <var title="">input</var>, return an
     error.</li>

    </ol></li>

   <li><p>If the character indicated by <var title="">position</var> is a U+002E FULL STOP (.), and
   that is not the last character in <var title="">input</var>, and the character after the
   character indicated by <var title="">position</var> is an <a href=#ascii-digits title="ASCII digits">ASCII
   digit</a>, then set <var title="">value</var> to zero and jump to the step labeled
   <i>fraction</i>.</p> <!-- we have to check there's a number so that ".e1" fails to parse but ".0"
   does not -->

   <li><p>If the character indicated by <var title="">position</var> is not an <a href=#ascii-digits title="ASCII
   digits">ASCII digit</a>, then return an error.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>, and
   interpret the resulting sequence as a base-ten integer. Multiply <var title="">value</var> by
   that integer.</li>

   <li>If <var title="">position</var> is past the end of <var title="">input</var>, jump to the
   step labeled <i>conversion</i>.</li>

   <li><p><i>Fraction</i>: If the character indicated by <var title="">position</var> is a U+002E
   FULL STOP (.), run these substeps:</p>

    <ol><li><p>Advance <var title="">position</var> to the next character.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, or if the
     character indicated by <var title="">position</var> is not an <a href=#ascii-digits title="ASCII 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>

     <li><p>If the character indicated by <var title="">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 title="">divisor</var> by ten.</li>

     <li>Add the value of the character indicated by <var title="">position</var>, interpreted as a
     base-ten digit (0..9) and divided by <var title="">divisor</var>, to <var title="">value</var>.</li>

     <li><p>Advance <var title="">position</var> to the next character.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump
     to the step labeled <i>conversion</i>.</li>

     <li><p>If the character indicated by <var title="">position</var> is an <a href=#ascii-digits title="ASCII
     digits">ASCII digit</a>, jump back to the step labeled <i>fraction loop</i> in these
     substeps.</li>

    </ol></li>

   <li><p>If the character indicated by <var title="">position</var> is a U+0065 LATIN SMALL LETTER
   E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), run these substeps:</p>

    <ol><li><p>Advance <var title="">position</var> to the next character.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump
     to the step labeled <i>conversion</i>.</li>

     <li>

      <p>If the character indicated by <var title="">position</var> is a U+002D HYPHEN-MINUS
      character (-):</p>

      <ol><li>Change <var title="">exponent</var> to &minus;1.</li>

       <li>Advance <var title="">position</var> to the next character.</li>

       <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then
       jump to the step labeled <i>conversion</i>.</li>

      </ol><p>Otherwise, if the character indicated by <var title="">position</var> is a U+002B PLUS SIGN
      character (+):</p>

      <ol><li>Advance <var title="">position</var> to the next character.</li>

       <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then
       jump to the step labeled <i>conversion</i>.</li>

      </ol></li>

     <li><p>If the character indicated by <var title="">position</var> is not an <a href=#ascii-digits title="ASCII
     digits">ASCII digit</a>, then jump to the step labeled <i>conversion</i>.</li>

     <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>, and
     interpret the resulting sequence as a base-ten integer. Multiply <var title="">exponent</var>
     by that integer.</li>

     <li><p>Multiply <var title="">value</var> by ten raised to the <var title="">exponent</var>th
     power.</li>

    </ol></li>

   <li><p><i>Conversion</i>: Let <var title="">S</var> be the set of finite IEEE 754
   double-precision floating-point values except &minus;0, but with two special values added: 2<sup title="">1024</sup> and &minus;2<sup title="">1024</sup>.</li>

   <li><p>Let <var title="">rounded-value</var> be the number in <var title="">S</var> that is
   closest to <var title="">value</var>, selecting the number with an even significand if there are
   two equally close values. (The two special values 2<sup title="">1024</sup> and &minus;2<sup title="">1024</sup> are considered to have even significands for this purpose.)</li>

   <li><p>If <var title="">rounded-value</var> is 2<sup title="">1024</sup> or &minus;2<sup title="">1024</sup>, return an error.</li>

   <li><p>Return <var title="">rounded-value</var>.</li>

  </ol></div>


<div class=impl>
  <h5 id=percentages-and-dimensions><span class=secno>2.4.4.4 </span>Percentages and lengths</h5>

<!--(percentages are not used in valid html anymore - what would they be percentages of?)
  <p>A string is a <dfn>valid dimension value</dfn> if it consists of a character in the range
  U+0031 DIGIT ONE (1) to U+0039 DIGIT NINE (9), optionally followed by zero of more <span>ASCII
  digits</span>, optionally followed by a U+002E FULL STOP character (.) and one or more <span>ASCII
  digits</span>, and optionally suffixed by a U+0025 PERCENT SIGN character (%).</p>

  <p>A <span>valid dimension value</span> represents the number that is represented in base ten by
  that string of digits, optionally with a fractional component. If the U+0025 PERCENT SIGN is
  present, then the dimension is a percentage; otherwise, it is a length.</p>

  <p class="note">For historical reasons, percentanges and lengths less than 1.0 cannot be
  represented as <span title="valid dimension value">valid dimension values</span>.</p>
-->

  <p>The <dfn id=rules-for-parsing-dimension-values>rules for parsing dimension values</dfn> are as given in the following algorithm. When
  invoked, the steps must be followed in the order given, aborting at the first step that returns a
  value. This algorithm will return either a number greater than or equal to 1.0, or an error; if a
  number is returned, then it is further categorized as either a percentage or a length.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an
   error.</li>

   <li><p>If the character indicated by <var title="">position</var> is a U+002B PLUS SIGN character
   (+), advance <var title="">position</var> to the next character.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are U+0030 DIGIT ZERO (0) characters,
   and discard them.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an
   error.</li>

   <li><p>If the character indicated by <var title="">position</var> is not one of U+0031 DIGIT ONE
   (1) to U+0039 DIGIT NINE (9), then return an error.</li>

   <!-- Ok. At this point we know we have a number. It might have trailing garbage which we'll
   ignore, but it's a number, and we won't return an error. -->

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>, and
   interpret the resulting sequence as a base-ten integer. Let <var title="">value</var> be that
   number.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return <var title="">value</var> as a length.</li>

   <li>

    <p>If the character indicated by <var title="">position</var> is a U+002E FULL STOP character
    (.):</p>

    <ol><li><p>Advance <var title="">position</var> to the next character.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, or if the
     character indicated by <var title="">position</var> is not an <a href=#ascii-digits title="ASCII digits">ASCII
     digit</a>, then return <var title="">value</var> as a length.</li>

     <li><p>Let <var title="">divisor</var> have the value 1.</li>

     <li><p><i>Fraction loop</i>: Multiply <var title="">divisor</var> by ten.</li>

     <li>Add the value of the character indicated by <var title="">position</var>, interpreted as a
     base-ten digit (0..9) and divided by <var title="">divisor</var>, to <var title="">value</var>.</li>

     <li><p>Advance <var title="">position</var> to the next character.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then
     return <var title="">value</var> as a length.</li>

     <li><p>If the character indicated by <var title="">position</var> is an <a href=#ascii-digits title="ASCII
     digits">ASCII digit</a>, return to the step labeled <i>fraction loop</i> in these
     substeps.</li>

    </ol></li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return <var title="">value</var> as a length.</li>

   <li><p>If the character indicated by <var title="">position</var> is a U+0025 PERCENT SIGN
   character (%), return <var title="">value</var> as a percentage.</li>

   <li><p>Return <var title="">value</var> as a length.</li>

  </ol></div>


  <h5 id=lists-of-integers><span class=secno>2.4.4.5 </span>Lists of integers</h5>

  <p>A <dfn id=valid-list-of-integers>valid list of integers</dfn> is a number of <a href=#valid-integer title="valid integer">valid
  integers</a> separated by U+002C COMMA characters, with no other characters (e.g. no <a href=#space-character title="space character">space characters</a>). In addition, there might be restrictions on the
  number of integers that can be given, or on the range of values allowed.</p>

  <div class=impl>

  <p>The <dfn id=rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</dfn> are as follows:</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">numbers</var> be an initially empty list of integers. This list will be
   the result of this algorithm.</li>

   <li><p>If there is a character in the string <var title="">input</var> at position <var title="">position</var>, and it is either a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON
   character, then advance <var title="">position</var> to the next character in <var title="">input</var>, or to beyond the end of the string if there are no more
   characters.</li>

   <li><p>If <var title="">position</var> points to beyond the end of <var title="">input</var>,
   return <var title="">numbers</var> and abort.</li>

   <li><p>If the character in the string <var title="">input</var> at position <var title="">position</var> is a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then
   return to step 4.</li>

   <li><p>Let <var title="">negated</var> be false.</li> <li><p>Let <var title="">value</var> be
   0.</li>

   <li><p>Let <var title="">started</var> be false. This variable is set to true when the parser
   sees a number or a U+002D HYPHEN-MINUS character (-).</li>

   <li><p>Let <var title="">got number</var> be false. This variable is set to true when the parser
   sees a number.</li>

   <li><p>Let <var title="">finished</var> be false. This variable is set to true to switch parser
   into a mode where it ignores characters until the next separator.</li>

   <li><p>Let <var title="">bogus</var> be false.</li>

   <li><p><i>Parser</i>: If the character in the string <var title="">input</var> at position <var title="">position</var> is:</p>

    <dl class=switch><dt>A U+002D HYPHEN-MINUS character</dt>

     <dd>

      <p>Follow these substeps:</p>

      <ol><li>If <var title="">got number</var> is true, let <var title="">finished</var> be true.</li>

       <li>If <var title="">finished</var> is true, skip to the next step in the overall set of
       steps.</li>

       <li>If <var title="">started</var> is true, let <var title="">negated</var> be false.</li>

       <li>Otherwise, if <var title="">started</var> is false and if <var title="">bogus</var> is
       false, let <var title="">negated</var> be true.</li>

       <li>Let <var title="">started</var> be true.</li>

      </ol></dd>

     <dt>An <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>

     <dd>

      <p>Follow these substeps:</p>

      <ol><li>If <var title="">finished</var> is true, skip to the next step in the overall set of
       steps.</li>

       <li>Multiply <var title="">value</var> by ten.</li>

       <li>Add the value of the digit, interpreted in base ten, to <var title="">value</var>.</li>

       <li>Let <var title="">started</var> be true.</li>

       <li>Let <var title="">got number</var> be true.</li>

      </ol></dd>


     <dt>A U+0020 SPACE character</dt>
     <dt>A U+002C COMMA character</dt>
     <dt>A U+003B SEMICOLON character</dt>

     <dd>

      <p>Follow these substeps:</p>

      <ol><li>If <var title="">got number</var> is false, return the <var title="">numbers</var> list
       and abort. This happens if an entry in the list has no digits, as in "<code title="">1,2,x,4</code>".</li>

       <li>If <var title="">negated</var> is true, then negate <var title="">value</var>.</li>

       <li>Append <var title="">value</var> to the <var title="">numbers</var> list.</li>

       <li>Jump to step 4 in the overall set of steps.</li>

      </ol></dd>


     <!-- <dt>A U+002E FULL STOP character</dt> -->
     <dt>A character in the range U+0001 to U+001F, <!-- space --> U+0021 to U+002B, <!-- comma --> U+002D to U+002F, <!-- digits --> U+003A, <!-- semicolon --> U+003C to U+0040, <!-- a-z --> U+005B to U+0060, <!-- A-Z --> U+007b to U+007F
        (i.e. any other non-alphabetic ASCII character)</dt>

 <!--
 Test: http://www.hixie.ch/tests/adhoc/html/flow/image-maps/004-demo.html
 IE6 on Wine treats the following characters like this also: U+1-U+1f, U+21-U+2b, U+2d-U+2f, U+3a,
 U+3c-U+40, U+5b-U+60, U+7b-U+82, U+84-U+89, U+8b, U+8d, U+8f-U+99, U+9b, U+9d, U+a0-U+bf, U+d7,
 U+f7, U+1f6-U+1f9, U+218-U+24f, U+2a9-U+385, U+387, U+38b, U+38d, U+3a2, U+3cf, U+3d7-U+3d9, U+3db,
 U+3dd, U+3df, U+3e1, U+3f4-U+400, U+40d, U+450, U+45d, U+482-U+48f, U+4c5-U+4c6, U+4c9-U+4ca,
 U+4cd-U+4cf, U+4ec-U+4ed, U+4f6-U+4f7, U+4fa-U+530, U+557-U+560, U+588-U+5cf, U+5eb-U+5ef,
 U+5f3-U+620, U+63b-U+640, U+64b-U+670, U+6b8-U+6b9, U+6bf, U+6cf, U+6d4, U+6d6-U+904, U+93a-U+957,
 U+962-U+984, U+98d-U+98e, U+991-U+992, U+9a9, U+9b1, U+9b3-U+9b5, U+9ba-U+9db, U+9de, U+9e2-U+9ef,
 U+9f2-U+a04, U+a0b-U+a0e, U+a11-U+a12, U+a29, U+a31, U+a34, U+a37, U+a3a-U+a58, U+a5d, U+a5f-U+a84,
 U+a8c, U+a8e, U+a92, U+aa9, U+ab1, U+ab4, U+aba-U+adf, U+ae1-U+b04, U+b0d-U+b0e, U+b11-U+b12,
 U+b29, U+b31, U+b34-U+b35, U+b3a-U+b5b, U+b5e, U+b62-U+b84, U+b8b-U+b8d, U+b91, U+b96-U+b98, U+b9b,
 U+b9d, U+ba0-U+ba2, U+ba5-U+ba7, U+bab-U+bad, U+bb6, U+bba-U+c04, U+c0d, U+c11, U+c29, U+c34,
 U+c3a-U+c5f, U+c62-U+c84, U+c8d, U+c91, U+ca9, U+cb4, U+cba-U+cdd, U+cdf, U+ce2-U+d04, U+d0d,
 U+d11, U+d29, U+d3a-U+d5f, U+d62-U+e00, U+e2f, U+e31, U+e34-U+e3f, U+e46-U+e80, U+e83, U+e85-U+e86,
 U+e89, U+e8b-U+e8c, U+e8e-U+e93, U+e98, U+ea0, U+ea4, U+ea6, U+ea8-U+ea9, U+eac, U+eaf-U+edb,
 U+ede-U+109f, U+10c6-U+10cf, U+10f7-U+10ff, U+115a-U+115e, U+11a3-U+11a7, U+11fa-U+1dff,
 U+1e9b-U+1e9f, U+1efa-U+1eff, U+1f16-U+1f17, U+1f1e-U+1f1f, U+1f46-U+1f47, U+1f4e-U+1f4f, U+1f58,
 U+1f5a, U+1f5c, U+1f5e, U+1f7e-U+1f7f, U+1fb5, U+1fbd-U+1fc1, U+1fc5, U+1fcd-U+1fcf, U+1fd4-U+1fd5,
 U+1fdc-U+1fdf, U+1fed-U+1ff1, U+1ff5, U+1ffd-U+249b, U+24ea-U+3004, U+3006-U+3040, U+3095-U+309a,
 U+309f-U+30a0, U+30fb, U+30ff-U+3104, U+312d-U+3130, U+318f-U+4dff, U+9fa6-U+abff, U+d7a4-U+d7ff,
 U+e000-U+f8ff, U+fa2e-U+faff, U+fb07-U+fb12, U+fb18-U+fb1e, U+fb37, U+fb3d, U+fb3f, U+fb42, U+fb45,
 U+fbb2-U+fbd2, U+fbe9, U+fce1, U+fd3e-U+fd4f, U+fd90-U+fd91, U+fdc8-U+fdef, U+fdfc-U+fe7f,
 U+fefd-U+ff20, U+ff3b-U+ff40, U+ff5b-U+ff65, U+ffa0, U+ffbf-U+ffc1, U+ffc8-U+ffc9, U+ffd0-U+ffd1,
 U+ffd8-U+ffd9, U+ffdd-U+ffff
 IE7 on Win2003 treats the following characters like this also instead: U+1-U+1f, U+21-U+2b,
 U+2d-U+2f, U+3a, U+3c-U+40, U+5b-U+60, U+7b-U+82, U+84-U+89, U+8b, U+8d, U+8f-U+99, U+9b, U+9d,
 U+a0-U+a9, U+ab-U+b4, U+b6-U+b9, U+bb-U+bf, U+d7, U+f7, U+220-U+221, U+234-U+24f, U+2ae-U+2af,
 U+2b9-U+2ba, U+2c2-U+2df, U+2e5-U+2ed, U+2ef-U+344, U+346-U+379, U+37b-U+385, U+387, U+38b, U+38d,
 U+3a2, U+3cf, U+3d8-U+3d9, U+3f4-U+3ff, U+482-U+48b, U+4c5-U+4c6, U+4c9-U+4ca, U+4cd-U+4cf,
 U+4f6-U+4f7, U+4fa-U+530, U+557-U+558, U+55a-U+560, U+588-U+5cf, U+5eb-U+5ef, U+5f3-U+620,
 U+63b-U+640, U+656-U+66f, U+6d4, U+6dd-U+6e0, U+6e9-U+6ec, U+6ee-U+6f9, U+6fd-U+70f, U+72d-U+72f,
 U+740-U+77f, U+7b1-U+900, U+904, U+93a-U+93c, U+94d - U+94f, U+951-U+957, U+964-U+980, U+984,
 U+98d-U+98e, U+991-U+992, U+9a9, U+9b1, U+9b3-U+9b5, U+9ba-U+9bd, U+9c5-U+9c6, U+9c9-U+9ca,
 U+9cd-U+9d6, U+9d8-U+9db, U+9de, U+9e4-U+9ef, U+9f2-U+a01, U+a03-U+a04, U+a0b-U+a0e, U+a11-U+a12,
 U+a29, U+a31, U+a34, U+a37, U+a3a-U+a3d, U+a43-U+a46, U+a49-U+a4a, U+a4d-U+a58, U+a5d, U+a5f-U+a6f,
 U+a75-U+a80, U+a84, U+a8c, U+a8e, U+a92, U+aa9, U+ab1, U+ab4, U+aba-U+abc, U+ac6, U+aca,
 U+acd-U+acf, U+ad1-U+adf, U+ae1-U+b00, U+b04, U+b0d-U+b0e, U+b11-U+b12, U+b29, U+b31, U+b34-U+b35,
 U+b3a-U+b3c, U+b44-U+b46, U+b49 - U+b4a, U+b4d-U+b55, U+b58-U+b5b, U+b5e, U+b62-U+b81, U+b84,
 U+b8b-U+b8d, U+b91, U+b96-U+b98, U+b9b, U+b9d, U+ba0 - U+ba2, U+ba5-U+ba7, U+bab-U+bad, U+bb6,
 U+bba-U+bbd, U+bc3-U+bc5, U+bc9, U+bcd-U+bd6, U+bd8-U+c00, U+c04, U+c0d, U+c11, U+c29, U+c34,
 U+c3a-U+c3d, U+c45, U+c49, U+c4d-U+c54, U+c57-U+c5f, U+c62-U+c81, U+c84, U+c8d, U+c91, U+ca9,
 U+cb4, U+cba-U+cbd, U+cc5, U+cc9, U+ccd-U+cd4, U+cd7-U+cdd, U+cdf, U+ce2-U+d01, U+d04, U+d0d,
 U+d11, U+d29, U+d3a-U+d3d, U+d44-U+d45, U+d49, U+d4d-U+d56, U+d58-U+d5f, U+d62-U+d81, U+d84,
 U+d97-U+d99, U+db2, U+dbc, U+dbe - U+dbf, U+dc7-U+dce, U+dd5, U+dd7, U+de0-U+df1, U+df4-U+e00,
 U+e3b-U+e3f, U+e4f-U+e80, U+e83, U+e85-U+e86, U+e89, U+e8b-U+e8c, U+e8e-U+e93, U+e98, U+ea0, U+ea4,
 U+ea6, U+ea8-U+ea9, U+eac, U+eba, U+ebe-U+ebf, U+ec5-U+ecc, U+ece-U+edb, U+ede-U+eff, U+f01-U+f3f,
 U+f48, U+f6b-U+f70, U+f82-U+f87, U+f8c-U+f8f, U+f98, U+fbd-U+fff, U+1022, U+1028, U+102b,
 U+1033-U+1035, U+1037, U+1039-U+104f, U+105a-U+109f, U+10c6-U+10cf, U+10f7-U+10ff, U+115a - U+115e,
 U+11a3-U+11a7, U+11fa-U+11ff, U+1207, U+1247, U+1249, U+124e-U+124f, U+1257, U+1259, U+125e-U+125f,
 U+1287, U+1289, U+128e-U+128f, U+12af, U+12b1, U+12b6-U+12b7, U+12bf, U+12c1, U+12c6-U+12c7,
 U+12cf, U+12d7, U+12ef, U+130f, U+1311, U+1316-U+1317, U+131f, U+1347, U+135b-U+139f,
 U+13f5-U+1400, U+166d-U+166e, U+1677-U+1680, U+169b - U+169f, U+16eb-U+177f, U+17c9-U+181f, U+1843,
 U+1878-U+187f, U+18aa-U+1dff, U+1e9c-U+1e9f, U+1efa-U+1eff, U+1f16-U+1f17, U+1f1e-U+1f1f,
 U+1f46-U+1f47, U+1f4e-U+1f4f, U+1f58, U+1f5a, U+1f5c, U+1f5e, U+1f7e-U+1f7f, U+1fb5, U+1fbd,
 U+1fbf-U+1fc1, U+1fc5, U+1fcd-U+1fcf, U+1fd4-U+1fd5, U+1fdc-U+1fdf, U+1fed-U+1ff1, U+1ff5,
 U+1ffd-U+207e, U+2080-U+2101, U+2103-U+2106, U+2108-U+2109, U+2114, U+2116-U+2118, U+211e-U+2123,
 U+2125, U+2127, U+2129, U+212e, U+2132, U+213a-U+215f, U+2184-U+3005, U+3008-U+3020, U+302a-U+3037,
 U+303b-U+3104, U+312d-U+3130, U+318f - U+319f, U+31b8-U+33ff, U+4db6-U+4dff, U+9fa6-U+9fff,
 U+a48d-U+abff, U+d7a4-U+d7ff, U+e000-U+f8ff, U+fa2e-U+faff, U+fb07-U+fb12, U+fb18-U+fb1c, U+fb1e,
 U+fb29, U+fb37, U+fb3d, U+fb3f, U+fb42, U+fb45, U+fbb2-U+fbd2, U+fd3e-U+fd4f, U+fd90-U+fd91,
 U+fdc8-U+fdef, U+fdfc-U+fe6f, U+fe73, U+fe75, U+fefd-U+ff20, U+ff3b-U+ff40, U+ff5b-U+ff9f,
 U+ffbf-U+ffc1, U+ffc8-U+ffc9, U+ffd0-U+ffd1, U+ffd8-U+ffd9, U+ffdd-U+ffff
-->

     <dd>

      <p>Follow these substeps:</p>

      <ol><li>If <var title="">got number</var> is true, let <var title="">finished</var> be true.</li>

       <li>If <var title="">finished</var> is true, skip to the next step in the overall set of
       steps.</li>

       <li>Let <var title="">negated</var> be false.</li>

      </ol></dd>


     <dt>Any other character</dt>
     <!-- alphabetic a-z A-Z, and non-ASCII -->

     <dd>

      <p>Follow these substeps:</p>

      <ol><li>If <var title="">finished</var> is true, skip to the next step in the overall set of
       steps.</li>

       <li>Let <var title="">negated</var> be false.</li>

       <li>Let <var title="">bogus</var> be true.</li>

       <li>If <var title="">started</var> is true, then return the <var title="">numbers</var> list,
       and abort. (The value in <var title="">value</var> is not appended to the list first; it is
       dropped.)</li>

      </ol></dd>

    </dl></li>

   <li><p>Advance <var title="">position</var> to the next character in <var title="">input</var>,
   or to beyond the end of the string if there are no more characters.</li>

   <li><p>If <var title="">position</var> points to a character (and not to beyond the end of <var title="">input</var>), jump to the big <i>Parser</i> step above.</li>

   <li><p>If <var title="">negated</var> is true, then negate <var title="">value</var>.</li>

   <li><p>If <var title="">got number</var> is true, then append <var title="">value</var> to the
   <var title="">numbers</var> list.</li>

   <li><p>Return the <var title="">numbers</var> list and abort.</li>

  </ol></div>


  <div class=impl>

  <h5 id=lists-of-dimensions><span class=secno>2.4.4.6 </span>Lists of dimensions</h5>

  <!-- no definition of a type since no conforming feature uses this
  syntax (it's only used in cols="" and rows="" on <frameset> -->

  <p>The <dfn id=rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions</dfn> are as
  follows. These rules return a list of zero or more pairs consisting
  of a number and a unit, the unit being one of <i>percentage</i>,
  <i>relative</i>, and <i>absolute</i>.</p>

  <ol><li><p>Let <var title="">raw input</var> be the string being
   parsed.</li>

   <li><p>If the last character in <var title="">raw input</var> is a
   U+002C COMMA character (,), then remove that character from <var title="">raw input</var>.</li>

   <li><p><a href=#split-a-string-on-commas title="split a string on commas">Split the string <var title="">raw input</var> on commas</a>. Let <var title="">raw
   tokens</var> be the resulting list of tokens.</li>

   <li><p>Let <var title="">result</var> be an empty list of
   number/unit pairs.</li>

   <li>

    <p>For each token in <var title="">raw tokens</var>, run the
    following substeps:</p>

    <ol><li><p>Let <var title="">input</var> be the token.</li>

     <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
     string.</li>

     <li><p>Let <var title="">value</var> be the number 0.</li>

     <li><p>Let <var title="">unit</var> be <i>absolute</i>.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, set <var title="">unit</var> to
     <i>relative</i> and jump to the last substep.</li>

     <li><p>If the character at <var title="">position</var> is an <a href=#ascii-digits title="ASCII digits">ASCII
     digit</a>, <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>,
     interpret the resulting sequence as an integer in base ten, and increment <var title="">value</var> by that integer.</li>

     <li>

      <p>If the character at <var title="">position</var> is a U+002E
      FULL STOP character (.), run these substeps:</p>

      <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> consisting of <a href=#space-character title="space
       character">space characters</a> and <a href=#ascii-digits>ASCII digits</a>. Let <var title="">s</var>
       be the resulting sequence.</li>

       <li><p>Remove all <a href=#space-character title="space character">space
       characters</a> in <var title="">s</var>.</li>

       <li>

        <p>If <var title="">s</var> is not the empty string, run these
        subsubsteps:</p>

        <ol><li><p>Let <var title="">length</var> be the number of
         characters in <var title="">s</var> (after the spaces were
         removed).</li>

         <li><p>Let <var title="">fraction</var> be the result of
         interpreting <var title="">s</var> as a base-ten integer, and
         then dividing that number by <span title="">10<sup title=""><var title="">length</var></sup></span>.</li>

         <li><p>Increment <var title="">value</var> by <var title="">fraction</var>.</li>

        </ol></li>

      </ol></li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li>

      <p>If the character at <var title="">position</var> is a U+0025
      PERCENT SIGN character (%), then set <var title="">unit</var> to
      <i>percentage</i>.</p>

      <p>Otherwise, if the character at <var title="">position</var>
      is a U+002A ASTERISK character (*), then set <var title="">unit</var> to <i>relative</i>.</p>

     </li>

     <!-- the remaining characters in /input/ are ignored -->

     <li><p>Add an entry to <var title="">result</var> consisting of
     the number given by <var title="">value</var> and the unit given
     by <var title="">unit</var>.</li>

    </ol></li>

   <li><p>Return the list <var title="">result</var>.</li>

  </ol></div>


  <h4 id=dates-and-times><span class=secno>2.4.5 </span>Dates and times</h4>

  <p>In the algorithms below, the <dfn id=number-of-days-in-month-month-of-year-year>number of days in month <var title="">month</var> of year
  <var title="">year</var></dfn> is: <em>31</em> if <var title="">month</var> is 1, 3, 5, 7, 8, 10,
  or 12; <em>30</em> if <var title="">month</var> is 4, 6, 9, or 11; <em>29</em> if <var title="">month</var> is 2 and <var title="">year</var> is a number divisible by 400, or if <var title="">year</var> is a number divisible by 4 but not by 100; and <em>28</em> otherwise. This
  takes into account leap years in the Gregorian calendar. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>When <a href=#ascii-digits>ASCII digits</a> are used in the date and time syntaxes defined in this section,
  they express numbers in base ten.</p>

  <div class=impl>

  <p class=note>While the formats described here are intended to be subsets of the corresponding
  ISO8601 formats, this specification defines parsing rules in much more detail than ISO8601.
  Implementors are therefore encouraged to carefully examine any date parsing libraries before using
  them to implement the parsing rules described below; ISO8601 libraries might not parse dates and
  times in exactly the same manner. <a href=#refsISO8601>[ISO8601]</a></p>

  </div>

  <p>Where this specification refers to the <dfn id=proleptic-gregorian-calendar>proleptic Gregorian calendar</dfn>, it means the
  modern Gregorian calendar, extrapolated backwards to year 1. A date in the <a href=#proleptic-gregorian-calendar>proleptic
  Gregorian calendar</a>, sometimes explicitly referred to as a <dfn id=proleptic-gregorian-date>proleptic-Gregorian
  date</dfn>, is one that is described using that calendar even if that calendar was not in use at
  the time (or place) in question. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p class=note>The use of the Gregorian calendar as the wire format in this specification is an
  arbitrary choice resulting from the cultural biases of those involved in the decision. See also
  the section discussing <a href=#input-author-notes>date, time, and number formats</a> in forms
  <span class=impl>(for authors), <a href=#input-impl-notes>implemention notes regarding
  localization of form controls</a>,</span> and the <code><a href=#the-time-element>time</a></code> element.</p>


  <h5 id=months><span class=secno>2.4.5.1 </span>Months</h5>

  <p>A <dfn id=concept-month title=concept-month>month</dfn> consists of a specific <a href=#proleptic-gregorian-date>proleptic-Gregorian
  date</a> with no time-zone information and no date information beyond a year and a month. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>A string is a <dfn id=valid-month-string>valid month string</dfn> representing a year <var title="">year</var> and
  month <var title="">month</var> if it consists of the following components in the given order:</p>

  <ol><li>Four or more <a href=#ascii-digits>ASCII digits</a>, representing <var title="">year</var>, where <var title="">year</var>&nbsp;&gt;&nbsp;0</li>

   <li>A U+002D HYPHEN-MINUS character (-)</li>

   <li>Two <a href=#ascii-digits>ASCII digits</a>, representing the month <var title="">month</var>, in the range
   1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12</li>

  </ol><div class=impl>

  <p>The rules to <dfn id=parse-a-month-string>parse a month string</dfn> are as follows. This will return either a year and
  month, or nothing. If at any point the algorithm says that it "fails", this means that it is
  aborted at that point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-month-component>Parse a month component</a> to obtain <var title="">year</var> and <var title="">month</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the
   end of <var title="">input</var>, then fail.</li>

   <li><p>Return <var title="">year</var> and <var title="">month</var>.</li>

  </ol><p>The rules to <dfn id=parse-a-month-component>parse a month component</dfn>, given an <var title="">input</var> string and
  a <var title="">position</var>, are as follows. This will return either a year and a month, or
  nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
  point and returns nothing.</p>

  <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not at least four characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">year</var>.</li>

   <li><p>If <var title="">year</var> is not a number greater than zero, then fail.</li>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
   Otherwise, move <var title="">position</var> forwards one character.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">month</var>.</li>

   <li><p>If <var title="">month</var> is not a number in the range 1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12, then fail.</li>

   <li><p>Return <var title="">year</var> and <var title="">month</var>.</li>

  </ol></div>


  <h5 id=dates><span class=secno>2.4.5.2 </span>Dates</h5>

  <p>A <dfn id=concept-date title=concept-date>date</dfn> consists of a specific <a href=#proleptic-gregorian-date>proleptic-Gregorian
  date</a> with no time-zone information, consisting of a year, a month, and a day. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>A string is a <dfn id=valid-date-string>valid date string</dfn> representing a year <var title="">year</var>, month
  <var title="">month</var>, and day <var title="">day</var> if it consists of the following
  components in the given order:</p>

  <ol><li>A <a href=#valid-month-string>valid month string</a>, representing <var title="">year</var> and <var title="">month</var></li>

   <li>A U+002D HYPHEN-MINUS character (-)</li>

   <li>Two <a href=#ascii-digits>ASCII digits</a>, representing <var title="">day</var>, in the range
   1&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<var title="">maxday</var> where <var title="">maxday</var> is the <a href=#number-of-days-in-month-month-of-year-year title="number of days in month month of year year">number of
   days in the month <var title="">month</var> and year <var title="">year</var></a></li>

  </ol><div class=impl>

  <p>The rules to <dfn id=parse-a-date-string>parse a date string</dfn> are as follows. This will return either a date, or
  nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
  point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Let <var title="">date</var> be the date with year <var title="">year</var>, month <var title="">month</var>, and day <var title="">day</var>.</li>

   <li><p>Return <var title="">date</var>.</li>

  </ol><p>The rules to <dfn id=parse-a-date-component>parse a date component</dfn>, given an <var title="">input</var> string and a
  <var title="">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>Parse a month component</a> to obtain <var title="">year</var> and <var title="">month</var>. If this returns nothing, then fail.</li>

   <li><p>Let <var title="">maxday</var> be the <a href=#number-of-days-in-month-month-of-year-year>number of days in month <var title="">month</var> of year <var title="">year</var></a>.</li>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
   Otherwise, move <var title="">position</var> forwards one character.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">day</var>.</li>

   <li><p>If <var title="">day</var> is not a number in the range 1&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<var title="">maxday</var>, then fail.</li>

   <li><p>Return <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>.</li>

  </ol></div>


  <h5 id=yearless-dates><span class=secno>2.4.5.3 </span>Yearless dates</h5>

  <p>A <dfn id=concept-yearless-date title=concept-yearless-date>yearless date</dfn> consists of a Gregorian month and a
  day within that month, but with no associated year. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>A string is a <dfn id=valid-yearless-date-string>valid yearless date string</dfn> representing a month <var title="">month</var> and a day <var title="">day</var> if it consists of the following components
  in the given order:</p>

  <ol><li>Optionally, two U+002D HYPHEN-MINUS characters (-)</li>

   <li>Two <a href=#ascii-digits>ASCII digits</a>, representing the month <var title="">month</var>, in the range
   1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12</li>

   <li>A U+002D HYPHEN-MINUS character (-)</li>

   <li>Two <a href=#ascii-digits>ASCII digits</a>, representing <var title="">day</var>, in the range
   1&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<var title="">maxday</var> where <var title="">maxday</var> is the <a href=#number-of-days-in-month-month-of-year-year title="number of days in month month of year year">number of
   days</a> in the month <var title="">month</var> and any arbitrary leap year (e.g. 4 or
   2000)</li>

  </ol><p class=note>In other words, if the <var title="">month</var> is "<code title="">02</code>",
  meaning February, then the day can be 29, as if the year was a leap year.</p>

  <div class=impl>

  <p>The rules to <dfn id=parse-a-yearless-date-string>parse a yearless date string</dfn> are as follows. This will return either a
  month and a day, or nothing. If at any point the algorithm says that it "fails", this means that
  it is aborted at that point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-yearless-date-component>Parse a yearless date component</a> to obtain <var title="">month</var> and <var title="">day</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Return <var title="">month</var> and <var title="">day</var>.</li>

  </ol><p>The rules to <dfn id=parse-a-yearless-date-component>parse a yearless date component</dfn>, given an <var title="">input</var>
  string and a <var title="">position</var>, are as follows. This will return either a month and a
  day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted
  at that point and returns nothing.</p>

  <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are U+002D HYPHEN-MINUS characters (-).
   If the collected sequence is not exactly zero or two characters long, then fail.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">month</var>.</li>

   <li><p>If <var title="">month</var> is not a number in the range 1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12, then fail.</li>

   <li><p>Let <var title="">maxday</var> be the <a href=#number-of-days-in-month-month-of-year-year title="number of days in month month of year
   year">number of days</a> in month <var title="">month</var> of any arbitrary leap year (e.g. 4
   or 2000).</li>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
   Otherwise, move <var title="">position</var> forwards one character.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">day</var>.</li>

   <li><p>If <var title="">day</var> is not a number in the range 1&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<var title="">maxday</var>, then fail.</li>

   <li><p>Return <var title="">month</var> and <var title="">day</var>.</li>

  </ol></div>


  <h5 id=times><span class=secno>2.4.5.4 </span>Times</h5>

  <p>A <dfn id=concept-time title=concept-time>time</dfn> consists of a specific time with no time-zone
  information, consisting of an hour, a minute, a second, and a fraction of a second.</p>

  <p>A string is a <dfn id=valid-time-string>valid time string</dfn> representing an hour <var title="">hour</var>, a
  minute <var title="">minute</var>, and a second <var title="">second</var> if it consists of the
  following components in the given order:</p>

  <ol><li>Two <a href=#ascii-digits>ASCII digits</a>, representing <var title="">hour</var>, in the range
   0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23</li>

   <li>A U+003A COLON character (:)</li>

   <li>Two <a href=#ascii-digits>ASCII digits</a>, representing <var title="">minute</var>, in the range
   0&nbsp;&le;&nbsp;<var title="">minute</var>&nbsp;&le;&nbsp;59</li>

   <li>Optionally (required if <var title="">second</var> is
   non-zero):

    <ol><li>A U+003A COLON character (:)</li>

     <li>Two <a href=#ascii-digits>ASCII digits</a>, representing the integer part of <var title="">second</var>,
     in the range 0&nbsp;&le;&nbsp;<var title="">s</var>&nbsp;&le;&nbsp;59</li>

     <li>Optionally (required if <var title="">second</var> is not an
     integer):

      <ol><li>A 002E FULL STOP character (.)</li>

       <li>One, two, or three <a href=#ascii-digits>ASCII digits</a>, representing the fractional part of <var title="">second</var></li>

      </ol></li>

    </ol></li>

  </ol><p class=note>The <var title="">second</var> component cannot be 60 or 61; leap seconds cannot
  be represented.</p>

  <div class=impl>

  <p>The rules to <dfn id=parse-a-time-string>parse a time string</dfn> are as follows. This will return either a time, or
  nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
  point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-time-component>Parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Let <var title="">time</var> be the time with hour <var title="">hour</var>, minute <var title="">minute</var>, and second <var title="">second</var>.</li>

   <li><p>Return <var title="">time</var>.</li>

  </ol><p>The rules to <dfn id=parse-a-time-component>parse a time component</dfn>, given an <var title="">input</var> string and a
  <var title="">position</var>, are as follows. This will return either an hour, a minute, and a
  second, or nothing. If at any point the algorithm says that it "fails", this means that it is
  aborted at that point and returns nothing.</p>

  <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">hour</var>.</li>

   <li>If <var title="">hour</var> is not a number in the range 0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23, then fail.</li>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is not a U+003A COLON character, then fail. Otherwise,
   move <var title="">position</var> forwards one character.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">minute</var>.</li>

   <li>If <var title="">minute</var> is not a number in the range 0&nbsp;&le;&nbsp;<var title="">minute</var>&nbsp;&le;&nbsp;59, then fail.</li>

   <li><p>Let <var title="">second</var> be a string with the value "0".</li>

   <li>

    <p>If <var title="">position</var> is not beyond the end of <var title="">input</var> and the
    character at <var title="">position</var> is a U+003A COLON, then run these substeps:</p>

    <ol><li><p>Advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

     <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var>, or at
     the last character in <var title="">input</var>, or if the next <em>two</em> characters in <var title="">input</var> starting at <var title="">position</var> are not both <a href=#ascii-digits>ASCII
     digits</a>, then fail.</li>

     <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are either <a href=#ascii-digits>ASCII digits</a>
     or U+002E FULL STOP characters. If the collected sequence is three characters long, or if it is
     longer than three characters long and the third character is not a U+002E FULL STOP character,
     or if it has more than one U+002E FULL STOP character, then fail. Otherwise, let the collected
     string be <var title="">second</var> instead of its previous value.</li>

    </ol></li>

   <li><p>Interpret <var title="">second</var> as a base-ten number (possibly with a fractional
   part). Let <var title="">second</var> be that number instead of the string version.</li>

   <li><p>If <var title="">second</var> is not a number in the range 0&nbsp;&le;&nbsp;<var title="">second</var>&nbsp;&lt;&nbsp;60, then fail.</li>

   <li><p>Return <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>.</li>

  </ol></div>


  <h5 id=local-dates-and-times><span class=secno>2.4.5.5 </span>Local dates and times</h5>

  <p>A <dfn id=concept-datetime-local title=concept-datetime-local>local date and time</dfn> consists of a specific
  <a href=#proleptic-gregorian-date>proleptic-Gregorian date</a>, consisting of a year, a month, and a day, and a time,
  consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a
  time zone. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>A string is a <dfn id=valid-local-date-and-time-string>valid local date and time string</dfn> representing a date and time if it
  consists of the following components in the given order:</p>

  <ol><li>A <a href=#valid-date-string>valid date string</a> representing the date</li>

   <li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character</li>

   <li>A <a href=#valid-time-string>valid time string</a> representing the time</li>

  </ol><p>A string is a <dfn id=valid-normalized-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>valid date string</a> representing the date</li>

   <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>

   <li>A <a href=#valid-time-string>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)</li>

  </ol><div class=impl>

  <p>The rules to <dfn id=parse-a-local-date-and-time-string>parse a local date and time string</dfn> are as follows. This will return
  either a date and time, or nothing. If at any point the algorithm says that it "fails", this means
  that it is aborted at that point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is neither a U+0054 LATIN CAPITAL LETTER T character
   (T) nor a U+0020 SPACE character, then fail. Otherwise, move <var title="">position</var>
   forwards one character.</li>

   <li><p><a href=#parse-a-time-component>Parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Let <var title="">date</var> be the date with year <var title="">year</var>, month <var title="">month</var>, and day <var title="">day</var>.</li>

   <li><p>Let <var title="">time</var> be the time with hour <var title="">hour</var>, minute <var title="">minute</var>, and second <var title="">second</var>.</li>

   <li><p>Return <var title="">date</var> and <var title="">time</var>.</li>

  </ol></div>


  <h5 id=time-zones><span class=secno>2.4.5.6 </span>Time zones</h5>

  <p>A <dfn id=concept-timezone title=concept-timezone>time-zone offset</dfn> consists of a signed number of hours and
  minutes.</p>

  <p>A string is a <dfn id=valid-time-zone-offset-string>valid time-zone offset string</dfn> representing a time-zone offset if it
  consists of either:</p>


  <ul><li><p>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only if the time zone is
   UTC</li>

   <li>

    <p>Or, the following components, in the given order:</p>

    <ol><li>Either a U+002B PLUS SIGN character (+) or, if the time-zone offset is not zero, a U+002D
     HYPHEN-MINUS character (-), representing the sign of the time-zone offset</li>
     <!-- the -00:00 offset is disallowed because RFC3339 gives it a special semantic -->

     <li>Two <a href=#ascii-digits>ASCII digits</a>, representing the hours component <var title="">hour</var> of
     the time-zone offset, in the range 0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23</li>

     <li>Optionally, a U+003A COLON character (:)</li>

     <li>Two <a href=#ascii-digits>ASCII digits</a>, representing the minutes component <var title="">minute</var> of the time-zone offset, in the range 0&nbsp;&le;&nbsp;<var title="">minute</var>&nbsp;&le;&nbsp;59</li>

    </ol></li>

  </ul><p class=note>This format allows for time-zone offsets from -23:59 to +23:59. In practice,
  however, right now 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; time zones are used as political footballs and are thus
  subject to very whimsical policy decisions.</p>

  <p class=note>See also the usage notes and examples in the <a href=#concept-datetime title=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>

  <div class=impl>

  <p>The rules to <dfn id=parse-a-time-zone-offset-string>parse a time-zone offset string</dfn> are as follows. This will return either
  a time-zone offset, or nothing. If at any point the algorithm says that it "fails", this means
  that it is aborted at that point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-time-zone-offset-component>Parse a time-zone offset component</a> to obtain <var title="">timezone<sub title="">hours</sub></var> and <var title="">timezone<sub title="">minutes</sub></var>. If this
   returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Return the time-zone offset that is <var title="">timezone<sub title="">hours</sub></var>
   hours and <var title="">timezone<sub title="">minutes</sub></var> minutes from UTC.</li>

  </ol><p>The rules to <dfn id=parse-a-time-zone-offset-component>parse a time-zone offset component</dfn>, given an <var title="">input</var>
  string and a <var title="">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 title="">position</var> is a U+005A LATIN CAPITAL LETTER Z character
    (Z), then:</p>

    <ol><li><p>Let <var title="">timezone<sub title="">hours</sub></var> be 0.</li>

     <li><p>Let <var title="">timezone<sub title="">minutes</sub></var> be 0.</li>

     <li><p>Advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

    </ol><p>Otherwise, if the character at <var title="">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 title="">position</var> is a U+002B PLUS SIGN (+), let <var title="">sign</var> be "positive". Otherwise, it's a U+002D HYPHEN-MINUS (-); let <var title="">sign</var> be "negative".</li>

     <li><p>Advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

     <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. Let
     <var title="">s</var> be the collected sequence.</li>

     <li>

      <p>If <var title="">s</var> is exactly two characters long, then run these substeps:</p>

      <ol><li><p>Interpret <var title="">s</var> as a base-ten integer. Let that number be the <var title="">timezone<sub title="">hours</sub></var>.</li>

       <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if
       the character at <var title="">position</var> is not a U+003A COLON character, then fail.
       Otherwise, move <var title="">position</var> forwards one character.</li>

       <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If
       the collected sequence is not exactly two characters long, then fail. Otherwise, interpret
       the resulting sequence as a base-ten integer. Let that number be the <var title="">timezone<sub title="">minutes</sub></var>.</li>

      </ol><p>If <var title="">s</var> is exactly four characters long, then run these substeps:</p>

      <ol><li><p>Interpret the first two characters of <var title="">s</var> as a base-ten integer. Let
       that number be the <var title="">timezone<sub title="">hours</sub></var>.</li>

       <li><p>Interpret the last two characters of <var title="">s</var> as a base-ten integer. Let
       that number be the <var title="">timezone<sub title="">minutes</sub></var>.</li>

      </ol><p>Otherwise, fail.</p>

     </li>

     <li>If <var title="">timezone<sub title="">hours</sub></var> is not a number in the range
     0&nbsp;&le;&nbsp;<var title="">timezone<sub title="">hours</sub></var>&nbsp;&le;&nbsp;23, then
     fail.</li>

     <li>If <var title="">sign</var> is "negative", then negate <var title="">timezone<sub title="">hours</sub></var>.</li>

     <li>If <var title="">timezone<sub title="">minutes</sub></var> is not a number in the range
     0&nbsp;&le;&nbsp;<var title="">timezone<sub title="">minutes</sub></var>&nbsp;&le;&nbsp;59,
     then fail.</li>

     <li>If <var title="">sign</var> is "negative", then negate <var title="">timezone<sub title="">minutes</sub></var>.</li>

    </ol><p>Otherwise, fail.</p>

   </li>

   <li><p>Return <var title="">timezone<sub title="">hours</sub></var> and <var title="">timezone<sub title="">minutes</sub></var>.</li>

  </ol></div>


  <h5 id=global-dates-and-times><span class=secno>2.4.5.7 </span>Global dates and times</h5>

  <p>A <dfn id=concept-datetime title=concept-datetime>global date and time</dfn> consists of a specific
  <a href=#proleptic-gregorian-date>proleptic-Gregorian date</a>, consisting of a year, a month, and a day, and a time,
  consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone
  offset, consisting of a signed number of hours and minutes. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>A string is a <dfn id=valid-global-date-and-time-string>valid global date and time string</dfn> representing a date, time, and a
  time-zone offset if it consists of the following components in the given order:</p>

  <ol><li>A <a href=#valid-date-string>valid date string</a> representing the date</li>

   <li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character</li>

   <li>A <a href=#valid-time-string>valid time string</a> representing the time</li>

   <li>A <a href=#valid-time-zone-offset-string>valid time-zone offset string</a> representing the time-zone offset</li>

  </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&deg; longitude), not UTC (the
  approximation of UT1 that ticks in SI seconds). Time before the formation of time zones must be
  expressed and interpeted as UT1 times with explicit time zones that approximate the contemporary
  difference between the appropriate local time and the time observed at the location of Greenwich,
  London.</p>

  <div class=example>

   <p>The following are some examples of dates written as <a href=#valid-global-date-and-time-string title="valid global date and time
   string">valid global date and time strings</a>.</p>

   <dl><dt>"<code>0037-12-13 00:00Z</code>"</dt>

    <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.</dd>

    <dt>"<code>1979-10-14T12:00:00.001-04:00</code>"</dt>

    <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.</dd>

    <dt>"<code>8592-01-01T02:09+02:09</code>"</dt>

    <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.</dd>

   </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>

    <li>If the "<code title="">T</code>" is replaced by a space, it must be a single space
    character. The string "<code title="">2001-12-21&nbsp;&nbsp;12:00Z</code>" (with two spaces
    between the components) would not be parsed successfully.</li>

    <li>To unambiguously identify a moment in time prior to the introduction of the Gregorian
    calendar (insofar as moments in time before the formation of UTC can be unambiguously
    identified), the date has to be first converted to the Gregorian calendar from the calendar in
    use at the time (e.g. from the Julian calendar). The date of Nero's birth is the 15th of
    December 37, in the Julian Calendar, which is the 13th of December 37 in the <a href=#proleptic-gregorian-calendar>proleptic
    Gregorian calendar</a>.</li> <!-- This might not be true. I can't find a reference that gives
    his birthday with an explicit statement about the calendar being used. However, it seems
    unlikely that it would be given in the Gregorian calendar, so I assume sites use the Julian one.
    -->

    <li>The time and time-zone offset components are not optional.</li>

    <li>Dates before the year one can't be represented as a datetime in this version of HTML.</li>

    <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>

    <li>Time-zone offsets differ based on daylight savings time.</li>

   </ul></div>

  <p>A string is a <dfn id=valid-normalized-forced-utc-global-date-and-time-string>valid normalized forced-UTC global date and time string</dfn> representing a
  date, time, and a time-zone offset if it consists of the following components in the given
  order:</p>

  <ol><li>A <a href=#valid-date-string>valid date string</a> representing the date converted to the UTC time zone</li>

   <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>

   <li>A <a href=#valid-time-string>valid time string</a> representing the time converted to the UTC time zone and
   expressed as the shortest possible string for the given time (e.g. omitting the seconds component
   entirely if the given time is zero seconds past the minute)</li>

   <li>A U+005A LATIN CAPITAL LETTER Z character (Z)</li>

  </ol><div class=impl>

  <p>The rules to <dfn id=parse-a-global-date-and-time-string>parse a global date and time string</dfn> are as follows. This will return
  either a time in UTC, with associated time-zone offset information for round-tripping or display
  purposes, or nothing. If at any point the algorithm says that it "fails", this means that it is
  aborted at that point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is neither a U+0054 LATIN CAPITAL LETTER T character
   (T) nor a U+0020 SPACE character, then fail. Otherwise, move <var title="">position</var>
   forwards one character.</li>

   <li><p><a href=#parse-a-time-component>Parse a time component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var>, then
   fail.</li>

   <li><p><a href=#parse-a-time-zone-offset-component>Parse a time-zone offset component</a> to obtain <var title="">timezone<sub title="">hours</sub></var> and <var title="">timezone<sub title="">minutes</sub></var>. If this
   returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Let <var title="">time</var> be the moment in time at year <var title="">year</var>, month
   <var title="">month</var>, day <var title="">day</var>, hours <var title="">hour</var>, minute
   <var title="">minute</var>, second <var title="">second</var>, subtracting <var title="">timezone<sub title="">hours</sub></var> hours and <var title="">timezone<sub title="">minutes</sub></var> minutes. That moment in time is a moment in the UTC time
   zone.</li>

   <li><p>Let <var title="">timezone</var> be <var title="">timezone<sub title="">hours</sub></var>
   hours and <var title="">timezone<sub title="">minutes</sub></var> minutes from UTC.</li>

   <li><p>Return <var title="">time</var> and <var title="">timezone</var>.</li>

  </ol></div>


  <h5 id=weeks><span class=secno>2.4.5.8 </span>Weeks</h5>

  <p>A <dfn id=concept-week title=concept-week>week</dfn> consists of a week-year number and a week number
  representing a seven-day period starting on a Monday. Each week-year in this calendaring system
  has either 52 or 53 such seven-day periods, as defined below. The seven-day period starting on the
  Gregorian date Monday December 29th 1969 (1969-12-29) is defined as week number 1 in week-year
  1970. Consecutive weeks are numbered sequentially. The week before the number 1 week in a
  week-year is the last week in the previous week-year, and vice versa. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

  <p>A week-year with a number <var title="">year</var> has 53 weeks if it corresponds to either a
  year <var title="">year</var> in the <a href=#proleptic-gregorian-calendar>proleptic Gregorian calendar</a> that has a Thursday
  as its first day (January 1st), or a year <var title="">year</var> in the <a href=#proleptic-gregorian-calendar>proleptic
  Gregorian calendar</a> that has a Wednesday as its first day (January 1st) and where <var title="">year</var> is a number divisible by 400, or a number divisible by 4 but not by 100. All
  other week-years have 52 weeks.</p>

  <p>The <dfn id=week-number-of-the-last-day>week number of the last day</dfn> of a week-year with 53 weeks is 53; the week number
  of the last day of a week-year with 52 weeks is 52.</p>

  <p class=note>The week-year number of a particular day can be different than the number of the
  year that contains that day in the <a href=#proleptic-gregorian-calendar>proleptic Gregorian calendar</a>. The first week in a
  week-year <var title="">y</var> is the week that contains the first Thursday of the Gregorian year
  <var title="">y</var>.</p>

  <p class=note>For modern purposes, a <a href=#concept-week title=concept-week>week</a> as defined here is
  equivalent to ISO weeks as defined in ISO 8601. <a href=#refsISO8601>[ISO8601]</a></p>

  <p>A string is a <dfn id=valid-week-string>valid week string</dfn> representing a week-year <var title="">year</var>
  and week <var title="">week</var> if it consists of the following components in the given
  order:</p>

  <ol><li>Four or more <a href=#ascii-digits>ASCII digits</a>, representing <var title="">year</var>, where <var title="">year</var>&nbsp;&gt;&nbsp;0</li>

   <li>A U+002D HYPHEN-MINUS character (-)</li>

   <li>A U+0057 LATIN CAPITAL LETTER W character (W)</li>

   <li>Two <a href=#ascii-digits>ASCII digits</a>, representing the week <var title="">week</var>, in the range
   1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var title="">maxweek</var>, where <var title="">maxweek</var> is the <a href=#week-number-of-the-last-day>week number of the last day</a> of week-year <var title="">year</var></li>

  </ol><div class=impl>

  <p>The rules to <dfn id=parse-a-week-string>parse a week string</dfn> are as follows. This will return either a week-year
  number and week number, or nothing. If at any point the algorithm says that it "fails", this means
  that it is aborted at that point and returns nothing.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not at least four characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">year</var>.</li>

   <li><p>If <var title="">year</var> is not a number greater than zero, then fail.</li>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
   Otherwise, move <var title="">position</var> forwards one character.</li>

   <li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the
   character at <var title="">position</var> is not a U+0057 LATIN CAPITAL LETTER W character (W),
   then fail. Otherwise, move <var title="">position</var> forwards one character.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. If the
   collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
   resulting sequence as a base-ten integer. Let that number be the <var title="">week</var>.</li>

   <li><p>Let <var title="">maxweek</var> be the <a href=#week-number-of-the-last-day>week number of the last day</a> of year
   <var title="">year</var>.</li>

   <li><p>If <var title="">week</var> is not a number in the range 1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var title="">maxweek</var>, then fail.</li>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li><p>Return the week-year number <var title="">year</var> and the week number <var title="">week</var>.</li>

  </ol></div>


  <h5 id=durations><span class=secno>2.4.5.9 </span>Durations</h5>

  <!-- if you add support for year and month durations, then search for MONTHS throughout the spec
  (not just this section) for things that have to change -->

  <p>A <dfn id=concept-duration title=concept-duration>duration</dfn> consists of <!--MONTHS: either a number of
  months or--> a number of seconds.</p>

  <p class=note>Since months and seconds are not comparable (a month is not a precise number of
  seconds, but is instead a period whose exact length depends on the precise day from which it is
  measured) a <a href=#concept-duration title=concept-duration>duration</a> as defined in this specification cannot
  <!--MONTHS: consist of a mixture of both--> include months (or years, which are equivalent to
  twelve months). Only durations that describe a specific number of seconds can be described.</p>

  <p>A string is a <dfn id=valid-duration-string>valid duration string</dfn> representing a <a href=#concept-duration title=concept-duration>duration</a> <var title="">t</var> if it consists of either of the
  following:</p>

  <ul><li>

    <!-- The ISO format -->

    <!-- NOTE: ISO durations also have a number of formats we do not
         consider conforming:

         - a "week" format (e.g. P4W). This one is actually supported
           by the parser.

         - P<date>T<time>, with or without hyphens

         - All these formats, with commas instead of periods for the
           seconds decimal

    -->

    <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 years, if any, multiplied by twelve,
    plus the number of months, if any, equals the number of months in <var title="">t</var>, if the
    duration is in months; or, if it is in seconds, -->the number of days, hours, minutes, and
    seconds corresponds to the same number of seconds as in <var title="">t</var>:</p>

    <ol><!--MONTHS:
     <li><p>One or more <span>ASCII digits</span> followed by a U+0059 LATIN CAPITAL LETTER Y
     character, representing a number of years.</p></li>

     <li><p>One or more <span>ASCII digits</span> followed by a U+004D LATIN CAPITAL LETTER M
     character, representing a number of months.</p></li>
--><li><p>One or more <a href=#ascii-digits>ASCII digits</a> followed by a U+0044 LATIN CAPITAL LETTER D
     character, representing a number of days.</li>

     <li>

      <p>A U+0054 LATIN CAPITAL LETTER T character followed by one or more of the following
      subcomponents, in the order given:</p>

      <ol><li><p>One or more <a href=#ascii-digits>ASCII digits</a> followed by a U+0048 LATIN CAPITAL LETTER H
       character, representing a number of hours.</li>

       <li><p>One or more <a href=#ascii-digits>ASCII digits</a> followed by a U+004D LATIN CAPITAL LETTER M
       character, representing a number of minutes.</li>

       <li>

        <p>The following components:</p>

        <ol><li><p>One or more <a href=#ascii-digits>ASCII digits</a>, representing a number of seconds.</li>

         <li><p>Optionally, a U+002E FULL STOP character (.) followed by one, two, or three
         <a href=#ascii-digits>ASCII digits</a>, representing a fraction of a second.</li>

         <li><p>A U+0053 LATIN CAPITAL LETTER S character.</li>

        </ol></li>

      </ol></li>

    </ol><p class=note>This, as with a number of other date- and time-related microsyntaxes defined in
    this specification, is based on one of the formats defined in ISO 8601. <a href=#refsISO8601>[ISO8601]</a></p>

   </li>

   <li>

    <p>One or more <a href=#duration-time-component title="duration time component">duration time components</a>, each with
    a different <a href=#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 title="">t</var>.</p>

    <p>A <dfn id=duration-time-component>duration time component</dfn> is a string consisting of the following components:</p>

    <ol><li><p>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

     <li><p>One or more <a href=#ascii-digits>ASCII digits</a>, representing a number of time units, scaled by
     the <a href=#duration-time-component-scale>duration time component scale</a> specified (see below) to represent a number of
     seconds.</li>

     <li><p>If the <a href=#duration-time-component-scale>duration time component scale</a> specified is 1 (i.e. the units are
     seconds), then, optionally, a U+002E FULL STOP character (.) followed by one, two, or three
     <a href=#ascii-digits>ASCII digits</a>, representing a fraction of a second.</li>

     <li><p>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

     <li>

      <p>One of the following characters, representing the <dfn id=duration-time-component-scale>duration time component scale</dfn>
      of the time unit used in the numeric part of the <a href=#duration-time-component>duration time component</a>:</p>

      <dl><dt>U+0057 LATIN CAPITAL LETTER W character</dt>
       <dt>U+0077 LATIN SMALL LETTER W character</dt>

       <dd>Weeks. The scale is 604800.</dd>

       <dt>U+0044 LATIN CAPITAL LETTER D character</dt>
       <dt>U+0064 LATIN SMALL LETTER D character</dt>

       <dd>Days. The scale is 86400.</dd>

       <dt>U+0048 LATIN CAPITAL LETTER H character</dt>
       <dt>U+0068 LATIN SMALL LETTER H character</dt>

       <dd>Hours. The scale is 3600.</dd>

       <dt>U+004D LATIN CAPITAL LETTER M character</dt>
       <dt>U+006D LATIN SMALL LETTER M character</dt>

       <dd>Minutes. The scale is 60.</dd>

       <dt>U+0053 LATIN CAPITAL LETTER S character</dt>
       <dt>U+0073 LATIN SMALL LETTER S character</dt>

       <dd>Seconds. The scale is 1.</dd>

      </dl></li>

     <li><p>Zero or more <a href=#space-character title="space character">space
     characters</a>.</li>

    </ol><p class=note>This is not based on any of the formats in ISO 8601. It is intended to be a more
    human-readable alternative to the ISO 8601 duration format.</p>

   </li>    

  </ul><div class=impl>

  <p>The rules to <dfn id=parse-a-duration-string>parse a duration string</dfn> are as follows. This will return either a <a href=#concept-duration title=concept-duration>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><!--MONTHS: this algorithm actually already parses months adequately, though it would need
   tweaking if we introduced a "mo" unit for the non-ISO variant. See other "MONTHS" annotations
   below. --><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">months</var>, <var title="">seconds</var>, and <var title="">component
   count</var> all be zero.</li>

   <li>

    <p>Let <var title="">M-disambiguator</var> be <i>minutes</i>.</p>

    <!--MONTHS: this note would change-->
    <p class=note>This flag's other value is <i>months</i>. It is used to disambiguate the "M"
    unit in ISO8601 durations, which use the same unit for months and minutes. Months are not
    allowed, but are parsed for future compatibility and to avoid misinterpreting ISO8601 durations
    that would be valid in other contexts.</p>

   </li>

   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then
   fail.</li>

   <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
   is a U+0050 LATIN CAPITAL LETTER P character, then advance <var title="">position</var> to the
   next character, set <var title="">M-disambiguator</var> to <i>months</i>, and <a href=#skip-whitespace>skip
   whitespace</a>.</li>

   <li>

    <p>Run the following substeps in a loop, until a step requiring the loop to be broken or the
    entire algorithm to fail is reached:</p>

    <ol><li><p>Let <var title="">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>

     <li><p>Let <var title="">next character</var> be undefined. It is used to process characters
     from the <var title="">input</var>.</li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then break
     the loop.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is a U+0054 LATIN CAPITAL LETTER T character, then advance <var title="">position</var> to the
     next character, set <var title="">M-disambiguator</var> to <i>minutes</i>, <a href=#skip-whitespace>skip
     whitespace</a>, and return to the top of the loop.</li>

     <li><p>Set <var title="">next character</var> to the character in <var title="">input</var>
     pointed to by <var title="">position</var>.</li>

     <li>

      <p>If <var title="">next character</var> is a U+002E FULL STOP character (.), then let <var title="">N</var> equal zero. (Do not advance <var title="">position</var>. That is taken care
      of below.)</p>

      <p>Otherwise, if <var title="">next character</var> is an <a href=#ascii-digits title="ASCII digits">ASCII
      digit</a>, then <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII
      digits</a>, interpret the resulting sequence as a base-ten integer, and let <var title="">N</var> be that number.</p>

      <p>Otherwise <var title="">next character</var> is not part of a number; fail.</p>

     </li>

     <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then
     fail.</li>

     <li><p>Set <var title="">next character</var> to the character in <var title="">input</var>
     pointed to by <var title="">position</var>, and this time advance <var title="">position</var>
     to the next character. (If <var title="">next character</var> was a U+002E FULL STOP character
     (.) before, it will still be that character this time.)</li>

     <li>

      <p>If <var title="">next character</var> is a U+002E FULL STOP character (.), then run these
      substeps:</p>

      <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>. Let
       <var title="">s</var> be the resulting sequence.</li>

       <li><p>If <var title="">s</var> is the empty string, then fail.</li>

       <li><p>Let <var title="">length</var> be the number of characters in <var title="">s</var>.</li>

       <li><p>Let <var title="">fraction</var> be the result of interpreting <var title="">s</var>
       as a base-ten integer, and then dividing that number by <span title="">10<sup title=""><var title="">length</var></sup></span>.</li>

       <li><p>Increment <var title="">N</var> by <var title="">fraction</var>.</li>

       <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

       <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then
       fail.</li>

       <li><p>Set <var title="">next character</var> to the character in <var title="">input</var>
       pointed to by <var title="">position</var>, and advance <var title="">position</var> to the
       next character.</li>

       <li><p>If <var title="">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>

       <li><p>Set <var title="">units</var> to <i>seconds</i>.</li>

      </ol><p>Otherwise, run these substeps:</p>

      <ol><li><p>If <var title="">next character</var> is a <a href=#space-character>space character</a>, then
       <a href=#skip-whitespace>skip whitespace</a>, set <var title="">next character</var> to the character in <var title="">input</var> pointed to by <var title="">position</var>, and advance <var title="">position</var> to the next character.</li>

       <li>

        <!--MONTHS: this would probably be where we would add more
        logic to support a new unit like 'mo' -->

        <p>If <var title="">next character</var> is a U+0059 LATIN CAPITAL LETTER Y character, or a
        U+0079 LATIN SMALL LETTER Y character, set <var title="">units</var> to <i>years</i> and set
        <var title="">M-disambiguator</var> to <i>months</i>.</p>

        <p>If <var title="">next character</var> is a U+004D LATIN CAPITAL LETTER M character or a
        U+006D LATIN SMALL LETTER M character, and <var title="">M-disambiguator</var> is
        <i>months</i>, then set <var title="">units</var> to <i>months</i>.</p>

        <p>If <var title="">next character</var> is a U+0057 LATIN CAPITAL LETTER W character or a
        U+0077 LATIN SMALL LETTER W character, set <var title="">units</var> to <i>weeks</i> and set
        <var title="">M-disambiguator</var> to <i>minutes</i>.</p>

        <p>If <var title="">next character</var> is a U+0044 LATIN CAPITAL LETTER D character or a
        U+0064 LATIN SMALL LETTER D character, set <var title="">units</var> to <i>days</i> and set
        <var title="">M-disambiguator</var> to <i>minutes</i>.</p>

        <p>If <var title="">next character</var> is a U+0048 LATIN CAPITAL LETTER H character or a
        U+0068 LATIN SMALL LETTER H character, set <var title="">units</var> to <i>hours</i> and set
        <var title="">M-disambiguator</var> to <i>minutes</i>.</p>

        <p>If <var title="">next character</var> is a U+004D LATIN CAPITAL LETTER M character or a
        U+006D LATIN SMALL LETTER M character, and <var title="">M-disambiguator</var> is
        <i>minutes</i>, then set <var title="">units</var> to <i>minutes</i>.</p>

        <p>If <var title="">next character</var> is a U+0053 LATIN CAPITAL LETTER S character or a
        U+0073 LATIN SMALL LETTER S character, set <var title="">units</var> to <i>seconds</i> and
        set <var title="">M-disambiguator</var> to <i>minutes</i>.</p>

        <p>Otherwise if <var title="">next character</var> is none of the above characters, then
        fail.</p>

       </li>

      </ol></li>

     <li><p>Increment <var title="">component count</var>.</li>

     <li><p>Let <var title="">multiplier</var> be 1.</li>

     <li><p>If <var title="">units</var> is <i>years</i>, multiply <var title="">multiplier</var> by
     12 and set <var title="">units</var> to <i>months</i>.</li>

     <li>

      <p>If <var title="">units</var> is <i>months</i>, add the product of <var title="">N</var> and
      <var title="">multiplier</var> to <var title="">months</var>.</p>

      <p>Otherwise, run these substeps:</p>

      <ol><li><p>If <var title="">units</var> is <i>weeks</i>, multiply <var title="">multiplier</var>
       by 7 and set <var title="">units</var> to <i>days</i>.</li>

       <li><p>If <var title="">units</var> is <i>days</i>, multiply <var title="">multiplier</var>
       by 24 and set <var title="">units</var> to <i>hours</i>.</li>

       <li><p>If <var title="">units</var> is <i>hours</i>, multiply <var title="">multiplier</var>
       by 60 and set <var title="">units</var> to <i>minutes</i>.</li>

       <li><p>If <var title="">units</var> is <i>minutes</i>, multiply <var title="">multiplier</var> by 60 and set <var title="">units</var> to <i>seconds</i>.</li>

       <li><p>Forcibly, <var title="">units</var> is now <i>seconds</i>. Add the product of <var title="">N</var> and <var title="">multiplier</var> to <var title="">seconds</var>.</li>

      </ol></li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

    </ol></li>

   <li><p>If <var title="">component count</var> is zero,
   fail.</li>

   <!--MONTHS: if we add month support this is where you'd return them-->
   <li><p>If <var title="">months</var> is not zero, fail.</li>

   <li><p>Return the <a href=#concept-duration title=concept-duration>duration</a> consisting of <var title="">seconds</var> seconds.</li>

  </ol></div>


  <h5 id=vaguer-moments-in-time><span class=secno>2.4.5.10 </span>Vaguer moments in time</h5>

  <p>A string is a <dfn id=valid-date-string-with-optional-time>valid date string with optional time</dfn> if
  it is also one of the following:</p>

  <ul><li>A <a href=#valid-date-string>valid date string</a></li>

   <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a></li>

  </ul><div class=impl>

  <hr><p>The rules to <dfn id=parse-a-date-or-time-string>parse a date or time string</dfn> are as follows. The algorithm will return
  either a <a href=#concept-date title=concept-date>date</a>, a <a href=#concept-time title=concept-time>time</a>, a <a href=#concept-datetime title=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 title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Set <var title="">start position</var> to the same position as <var title="">position</var>.</li>

   <li><p>Set the <var title="">date present</var> and <var title="">time present</var> flags to
   true.</li>

   <li><p><a href=#parse-a-date-component>Parse a date component</a> to obtain <var title="">year</var>, <var title="">month</var>, and <var title="">day</var>. If this fails, then set the <var title="">date
   present</var> flag to false.</p>

   <li>

    <p>If <var title="">date present</var> is true, and <var title="">position</var> is not beyond
    the end of <var title="">input</var>, and the character at <var title="">position</var> is
    either a U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character, then advance
    <var title="">position</var> to the next character in <var title="">input</var>.</p>

    <p>Otherwise, if <var title="">date present</var> is true, and either <var title="">position</var> is beyond the end of <var title="">input</var> or the character at <var title="">position</var> is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020
    SPACE character, then set <var title="">time present</var> to false.</p>

    <p>Otherwise, if <var title="">date present</var> is false, set <var title="">position</var>
    back to the same position as <var title="">start position</var>.</p>

   </li>

   <li><p>If the <var title="">time present</var> flag is true, then <a href=#parse-a-time-component>parse a time
   component</a> to obtain <var title="">hour</var>, <var title="">minute</var>, and <var title="">second</var>. If this returns nothing, then fail.</li>

   <li><p>If the <var title="">date present</var> and <var title="">time present</var> flags are
   both true, but <var title="">position</var> is beyond the end of <var title="">input</var>, then
   fail.</li>

   <li><p>If the <var title="">date present</var> and <var title="">time present</var> flags are
   both true, <a href=#parse-a-time-zone-offset-component>parse a time-zone offset component</a> to obtain <var title="">timezone<sub title="">hours</sub></var> and <var title="">timezone<sub title="">minutes</sub></var>. If this
   returns nothing, then fail.</p>

   <li><p>If <var title="">position</var> is <em>not</em> beyond the end of <var title="">input</var>, then fail.</li>

   <li>

    <p>If the <var title="">date present</var> flag is true and the <var title="">time present</var>
    flag is false, then let <var title="">date</var> be the date with year <var title="">year</var>,
    month <var title="">month</var>, and day <var title="">day</var>, and return <var title="">date</var>.</p>

    <p>Otherwise, if the <var title="">time present</var> flag is true and the <var title="">date
    present</var> flag is false, then let <var title="">time</var> be the time with hour <var title="">hour</var>, minute <var title="">minute</var>, and second <var title="">second</var>,
    and return <var title="">time</var>.</p>

    <p>Otherwise, let <var title="">time</var> be the moment in time at year <var title="">year</var>, month <var title="">month</var>, day <var title="">day</var>, hours <var title="">hour</var>, minute <var title="">minute</var>, second <var title="">second</var>,
    subtracting <var title="">timezone<sub title="">hours</sub></var> hours and <var title="">timezone<sub title="">minutes</sub></var> minutes, that moment in time being a moment
    in the UTC time zone; let <var title="">timezone</var> be <var title="">timezone<sub title="">hours</sub></var> hours and <var title="">timezone<sub title="">minutes</sub></var>
    minutes from UTC; and return <var title="">time</var> and <var title="">timezone</var>.</p>

   </li>

  </ol></div>


  <h4 id=colors><span class=secno>2.4.6 </span>Colors</h4>

  <p>A <dfn id=simple-color>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 id=valid-simple-color>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 href=#ascii-hex-digits>ASCII hex digits</a>, with the first two digits representing the red component, the
  middle two digits representing the green component, and the last two digits representing the blue
  component, in hexadecimal.</p>

  <p>A string is a <dfn id=valid-lowercase-simple-color>valid lowercase simple color</dfn> if it is a <a href=#valid-simple-color>valid simple
  color</a> and doesn't use any characters in the range U+0041 LATIN CAPITAL LETTER A to U+0046
  LATIN CAPITAL LETTER F.</p>

  <div class=impl>

  <p>The <dfn id=rules-for-parsing-simple-color-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-color>simple color</a> or an error.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>If <var title="">input</var> is not exactly seven characters long, then return an
   error.</li>

   <li><p>If the first character in <var title="">input</var> is not a U+0023 NUMBER SIGN character
   (#), then return an error.</li>

   <li><p>If the last six characters of <var title="">input</var> are not all <a href=#ascii-hex-digits>ASCII hex
   digits</a>, then return an error.</li>

   <li><p>Let <var title="">result</var> be a <a href=#simple-color>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 title="">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 title="">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 title="">result</var>.</p>

   <li><p>Return <var title="">result</var>.</p>

  </ol><p>The <dfn id=rules-for-serializing-simple-color-values>rules for serializing simple color values</dfn> given a <a href=#simple-color>simple color</a> are
  as given in the following algorithm:</p>

  <ol><li><p>Let <var title="">result</var> be a string consisting of a single U+0023 NUMBER SIGN
   character (#).</li>

   <li><p>Convert the red, green, and blue components in turn to two-digit hexadecimal numbers using
   <a href=#lowercase-ascii-hex-digits>lowercase ASCII hex digits</a>, zero-padding if necessary, and append these numbers to
   <var title="">result</var>, in the order red, green, blue.</p>

   <li><p>Return <var title="">result</var>, which will be a <a href=#valid-lowercase-simple-color>valid lowercase simple
   color</a>.</li>

  </ol><hr><p>Some obsolete legacy attributes parse colors in a more complicated manner, using the <dfn id=rules-for-parsing-a-legacy-color-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-color>simple color</a> or an error.</p>

  <ol><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>If <var title="">input</var> is the empty string, then return an error.</li>

   <li><p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var title="">input</var>.</li>

   <li><p>If <var title="">input</var> is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
   string "<code title="">transparent</code>", then return an error.</li>

   <li>

    <p>If <var title="">input</var> is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the
    keywords listed in the <a href=http://www.w3.org/TR/css3-color/#svg-color>SVG color
    keywords</a> <!-- or <a href="http://www.w3.org/TR/css3-color/#css2-system">CSS2 System
    Colors</a> --> section<!--s--> of the CSS3 Color specification, then return the <a href=#simple-color>simple
    color</a> corresponding to that keyword. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>

    <p class=note><a href=http://www.w3.org/TR/css3-color/#css2-system>CSS2 System
    Colors</a> are not recognised.</p>

   </li>

   <li>

    <p>If <var title="">input</var> is four characters long, and the first character in <var title="">input</var> is a U+0023 NUMBER SIGN character (#), and the last three characters of
    <var title="">input</var> are all <a href=#ascii-hex-digits>ASCII hex digits</a>, then run these substeps:</p>

    <ol><li><p>Let <var title="">result</var> be a <a href=#simple-color>simple color</a>.</p>

     <li><p>Interpret the second character of <var title="">input</var> as a hexadecimal digit; let
     the red component of <var title="">result</var> be the resulting number multiplied by 17.</p>

     <li><p>Interpret the third character of <var title="">input</var> as a hexadecimal digit; let
     the green component of <var title="">result</var> be the resulting number multiplied by 17.</p>

     <li><p>Interpret the fourth character of <var title="">input</var> as a hexadecimal digit; let
     the blue component of <var title="">result</var> be the resulting number multiplied by 17.</p>

     <li><p>Return <var title="">result</var>.</p>

    </ol></li>

   <li><p>Replace any characters in <var title="">input</var> that have a Unicode code point greater
   than U+FFFF (i.e. any characters that are not in the basic multilingual plane) with the
   two-character string "<code title="">00</code>".</li>

   <li><p>If <var title="">input</var> is longer than 128 characters, truncate <var title="">input</var>, leaving only the first 128 characters.</li>

   <li><p>If the first character in <var title="">input</var> is a U+0023 NUMBER SIGN character (#),
   remove it.</li>

   <li><p>Replace any character in <var title="">input</var> that is not an <a href=#ascii-hex-digits title="ASCII hex
   digits">ASCII hex digit</a> with the character U+0030 DIGIT ZERO (0).</li>

   <li><p>While <var title="">input</var>'s length is zero or not a multiple of three, append a
   U+0030 DIGIT ZERO (0) character to <var title="">input</var>.</li>

   <li><p>Split <var title="">input</var> into three strings of equal length, to obtain three
   components. Let <var title="">length</var> be the length of those components (one third the
   length of <var title="">input</var>).</li>

   <li><p>If <var title="">length</var> is greater than 8, then remove the leading <span title=""><var title="">length</var>-8</span> characters in each component, and let <var title="">length</var> be 8.</li>

   <li><p>While <var title="">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 title="">length</var> by one.</li>

   <li><p>If <var title="">length</var> is <em>still</em> greater than two, truncate each component,
   leaving only the first two characters in each.</li>

   <li><p>Let <var title="">result</var> be a <a href=#simple-color>simple color</a>.</p>

   <li><p>Interpret the first component as a hexadecimal number; let the red component of <var title="">result</var> be the resulting number.</li>

   <li><p>Interpret the second component as a hexadecimal number; let the green component of <var title="">result</var> be the resulting number.</li>

   <li><p>Interpret the third component as a hexadecimal number; let the blue component of <var title="">result</var> be the resulting number.</li>

   <li><p>Return <var title="">result</var>.</p>

  </ol></div>

  <hr><p class=note>The <a href=#canvas-context-2d title=canvas-context-2d>2D graphics context</a> has a separate
  color syntax that also handles opacity.</p>



  <h4 id=space-separated-tokens><span class=secno>2.4.7 </span>Space-separated tokens</h4>

  <p>A <dfn id=set-of-space-separated-tokens>set of space-separated tokens</dfn> is a string containing
  zero or more words (known as tokens) separated by one or more <a href=#space-character title="space character">space characters</a>, where words consist
  of any string of one or more characters, none of which are <a href=#space-character title="space character">space characters</a>.</p>

  <p>A string containing a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>
  may have leading or trailing <a href=#space-character title="space character">space
  characters</a>.</p>

  <p>An <dfn id=unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</dfn> is a
  <a href=#set-of-space-separated-tokens>set of space-separated tokens</a> where none of the tokens
  are duplicated.</p>

  <p>An <dfn id=ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</dfn> is a
  <a href=#set-of-space-separated-tokens>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 title="set of space-separated tokens">Sets of
  space-separated tokens</a> sometimes have a defined set of
  allowed values. When a set of allowed values is defined, the tokens
  must all be from that list of allowed values; other values are
  non-conforming. If no such set of allowed values is provided, then
  all values are conforming.</p>

  <p class=note>How tokens in a <a href=#set-of-space-separated-tokens>set of space-separated
  tokens</a> are to be compared (e.g. case-sensitively or not) is
  defined on a per-set basis.</p>

  <div class=impl>

  <p>When a user agent has to <dfn id=split-a-string-on-spaces>split a string on spaces</dfn>, it
  must use the following algorithm:</p>

  <ol><li><p>Let <var title="">input</var> be the string being
   parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
   string.</li>

   <li><p>Let <var title="">tokens</var> be an ordered list of tokens, initially empty.</li>

   <li><p><a href=#skip-whitespace>Skip whitespace</a></li>

   <li><p>While <var title="">position</var> is not past the end of
   <var title="">input</var>:</p>

    <ol><li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not
     <a href=#space-character title="space character">space characters</a>.</li>

     <li><p>Append the string collected in the previous step to <var title="">tokens</var>.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a></li>

    </ol></li>

   <li><p>Return <var title="">tokens</var>.</li>

  </ol></div>


  <h4 id=comma-separated-tokens><span class=secno>2.4.8 </span>Comma-separated tokens</h4>

  <p>A <dfn id=set-of-comma-separated-tokens>set of comma-separated tokens</dfn> is a string containing
  zero or more tokens each separated from the next by a single U+002C
  COMMA character (,), where tokens consist of any string of zero or
  more characters, neither beginning nor ending with <a href=#space-character title="space character">space characters</a>, nor containing any
  U+002C COMMA characters (,), and optionally surrounded by <a href=#space-character title="space character">space characters</a>.</p>

  <p class=example>For instance, the string "<code title="">&nbsp;a&nbsp;,b,,d&nbsp;d&nbsp;</code>" consists of four
  tokens: "a", "b", the empty string, and "d&nbsp;d". Leading and
  trailing whitespace around each token doesn't count as part of the
  token, and the empty string can be a token.</p>

  <p><a href=#set-of-comma-separated-tokens title="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>

  <div class=impl>

  <p>When a user agent has to <dfn id=split-a-string-on-commas>split a string on commas</dfn>, it
  must use the following algorithm:</p>

  <ol><li><p>Let <var title="">input</var> be the string being
   parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
   string.</li>

   <li><p>Let <var title="">tokens</var> be an ordered list of tokens, initially empty.</li>

   <li><p><i>Token</i>: If <var title="">position</var> is past the
   end of <var title="">input</var>, jump to the last step.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not
   U+002C COMMA characters (,). Let <var title="">s</var> be the resulting sequence (which might be the
   empty string).</li>

   <li><p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var title="">s</var>.</li>

   <li><p>Append <var title="">s</var> to <var title="">tokens</var>.</li>

   <li><p>If <var title="">position</var> is not past the end of <var title="">input</var>, then the character at <var title="">position</var> is a U+002C COMMA character (,); advance
   <var title="">position</var> past that character.</li>

   <li><p>Jump back to the step labeled <i>token</i>.</li>

   <li><p>Return <var title="">tokens</var>.</li>

  </ol></div>




  <h4 id=syntax-references><span class=secno>2.4.9 </span>References</h4>

  <p>A <dfn id=valid-hash-name-reference>valid hash-name reference</dfn> to an element of type <var title="">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 title="">name</code> attribute of an element with type
  <var title="">type</var> in the document.</p>

  <div class=impl>

  <p>The <dfn id=rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference</dfn> to an
  element of type <var title="">type</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>

   <li><p>Let <var title="">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>

   <li><p>Return the first element of type <var title="">type</var>
   that has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute whose value
   is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">s</var> or
   a <code title="">name</code> attribute whose value is a
   <a href=#compatibility-caseless>compatibility caseless</a> match for <var title="">s</var>.</li>

   <!--
   IE is also doing case-insensitive id="" matching.
   Tests:
   http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cmap%20name%3D%22T%26eacute%3B%26%23x01F1%3B%26%23x2075%3B%22%3E%3Carea%20href%3D%22%2F%22%20shape%3Drect%20coords%3D0%2C0%2C200%2C200%3E%3C%2Fmap%3E%0A%3Cimg%20usemap%3D%22%23t%26Eacute%3BDZ5%22%20src%3Dimage%3E
   ...except that doesn't explain why this fails:
   http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cmap%20name%3D%22T%26eacute%3B%26%23x01F1%3B%26%23x2075%3B%26%23xFB01%3B%22%3E%3Carea%20href%3D%22%2F%22%20shape%3Drect%20coords%3D0%2C0%2C200%2C200%3E%3C%2Fmap%3E%0A%3Cimg%20usemap%3D%22%23t%26Eacute%3BDZ5F%26%23x0131%3B%26%23x0307%3B%22%20src%3Dimage%3E
   maybe they just don't know about combining dot above?
   -->

  </ol></div>


  <h4 id=mq><span class=secno>2.4.10 </span>Media queries</h4>

  <p>A string is a <dfn id=valid-media-query>valid media query</dfn> if it matches the
  <code title="">media_query_list</code> production of the Media
  Queries specification. <a href=#refsMQ>[MQ]</a></p>

  <p>A string <dfn id=matches-the-environment>matches the environment</dfn> of the user if it is
  the empty string, a string consisting of only <a href=#space-character title="space
  character">space characters</a>, or is a media query that matches
  the user's environment according to the definitions given in the
  Media Queries specification. <a href=#refsMQ>[MQ]</a></p>




  <h3 id=urls><span class=secno>2.5 </span>URLs</h3>

  <h4 id=terminology-0><span class=secno>2.5.1 </span>Terminology</h4>

  <p>A <a href=#url>URL</a> is a <dfn id=valid-url>valid URL</dfn> if it conforms to the authoring conformance
  requirements in the URL standard. <a href=#refsURL>[URL]</a></p>

  <p>A string is a <dfn id=valid-non-empty-url>valid non-empty URL</dfn> if it is a <a href=#valid-url>valid URL</a> but it is not
  the empty string.</p>

  <p>A string is a <dfn id=valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</dfn> if, after <a href=#strip-leading-and-trailing-whitespace title="strip leading and trailing whitespace">stripping leading and trailing whitespace</a>
  from it, it is a <a href=#valid-url>valid URL</a>.</p>

  <p>A string is a <dfn id=valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</dfn> if, after <a href=#strip-leading-and-trailing-whitespace title="strip leading and trailing whitespace">stripping leading and trailing whitespace</a>
  from it, it is a <a href=#valid-non-empty-url>valid non-empty URL</a>.</p>

  <p>This specification defines the URL <dfn id=about:legacy-compat><code>about:legacy-compat</code></dfn> as a reserved,
  though unresolvable, <code title="">about:</code> URL, for use in <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>s in <a href=#html-documents>HTML documents</a> when needed for
  compatibility with XML tools. <a href=#refsABOUT>[ABOUT]</a></p>

  <p>This specification defines the URL <dfn id=about:srcdoc><code>about:srcdoc</code></dfn> as a reserved, though
  unresolvable, <code title="">about:</code> URL, that is used as <a href="#the-document's-address">the document's
  address</a> of <a href=#an-iframe-srcdoc-document title="an iframe srcdoc document"><code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> documents</a>. <a href=#refsABOUT>[ABOUT]</a></p>

  <p>The <dfn id=fallback-base-url>fallback base URL</dfn> of a <code><a href=#document>Document</a></code> object is the <a href=#absolute-url>absolute
  URL</a> obtained by running these substeps:</p>

  <ol><li><p>If the <code><a href=#document>Document</a></code> is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, then return the <a href=#document-base-url>document base
   URL</a> of the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-container>browsing context
   container</a>'s <code><a href=#document>Document</a></code> and abort these steps.</li>

   <li>

    <!-- http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/ -->

    <!-- this should be tested in the case of a browsing context that was navigated to about:blank
    after having been elsewhere, as opposed to the about:blank used at the time of the browsing
    context's creation. -->

    <p>If <a href="#the-document's-address">the document's address</a> is <code><a href=#about:blank>about:blank</a></code>, and the
    <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> has a <a href=#creator-browsing-context>creator browsing
    context</a>, then return the <a href=#document-base-url>document base URL</a> of the <a href=#creator-document>creator
    <code>Document</code></a>, and abort these steps.</p>

   </li>

   <!-- http://www.hixie.ch/tests/adhoc/dom/level0/history/pushState/001/ -->

   <li><p>Return <a href="#the-document's-address">the document's address</a>.</li>

  </ol><p>The <dfn id=document-base-url>document base URL</dfn> of a <code><a href=#document>Document</a></code> object is the <a href=#absolute-url>absolute
  URL</a> obtained by running these substeps:</p>

  <ol><li><p>If there is no <code><a href=#the-base-element>base</a></code> element that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute in the <code><a href=#document>Document</a></code>, then the
   <a href=#document-base-url>document base URL</a> is the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback base URL</a>;
   abort these steps.</li>

   <li><p>Otherwise, the <a href=#document-base-url>document base URL</a> is the <a href=#frozen-base-url>frozen base URL</a> of the
   first <code><a href=#the-base-element>base</a></code> element in the <code><a href=#document>Document</a></code> that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, in <a href=#tree-order>tree order</a>.</li>

  </ol><div class=impl>

  <h4 id=resolving-urls><span class=secno>2.5.2 </span>Resolving URLs</h4>

  <p>Resolving a URL is the process of taking a <a href=#relative-url>relative URL</a> and obtaining the
  <a href=#absolute-url>absolute URL</a> that it implies.</p>

  <p>To <dfn id=resolve-a-url>resolve a URL</dfn> to an <a href=#absolute-url>absolute URL</a> relative to either another
  <a href=#absolute-url>absolute URL</a> or an element, the user agent must use the following steps. Resolving a
  URL can result in an error, in which case the URL is not resolvable.</p>

  <ol><li><p>Let <var title="">url</var> be the <a href=#url>URL</a> being resolved.</li>

   <li>

    <p>Let <var title="">encoding</var> be determined as follows:</p>

    <dl class=switch><dt>If the URL had a character encoding defined when the URL was created or defined</dt>

     <dd>The URL character encoding is as defined.</dd>

     <dt>If the URL came from a script (e.g. as an argument to a method)</dt>

     <dd>The URL character encoding is the <a href="#script's-url-character-encoding">script's URL character encoding</a>.</dd>

     <dt>If the URL came from a DOM node (e.g. from an element)</dt>

     <dd>The node has a <code><a href=#document>Document</a></code>, and the URL character encoding is the
     <a href="#document's-character-encoding">document's character encoding</a>.</dd>

    </dl></li>

   <li><p>If <var title="">encoding</var> is <a href=#a-utf-16-encoding>a UTF-16 encoding</a>, then change the value
   of <var title="">encoding</var> to UTF-8.</li>

   <li>

    <p>If the algorithm was invoked with an <a href=#absolute-url>absolute URL</a> to use as the base URL, let
    <var title="">base</var> be that <a href=#absolute-url>absolute URL</a>.</p>

    <p>Otherwise, let <var title="">base</var> be <a href="#the-element's-base-url">the element's base URL</a>.</p>

   </li>

   <li><p>Apply the <a href=#url-parser>URL parser</a> to <var title="">url</var>, with <var title="">base</var> as the base URL, with <var title="">encoding</var> as the encoding.</li>

   <li><p>If this results in a <a href=#concept-url-parse-error title=concept-url-parse-error>parse error</a>, then abort
   these steps with an error.</li>

   <li><p>Let <var title="">parsed URL</var> be the result of the <a href=#url-parser>URL parser</a>.</li>

   <li><p>Let <var title="">serialized URL</var> be the result of apply the <a href=#concept-url-serializer title=concept-url-serializer>URL
   serializer</a> to <var title="">parsed URL</var>.</li>

   <li><p>Return <var title="">serialized URL</var> as the <dfn id=resulting-absolute-url>resulting absolute URL</dfn> and
   <var title="">parsed URL</var> as the <dfn id=resulting-parsed-url>resulting parsed URL</dfn>.</li>

  </ol><p>Given an element, <dfn id="the-element's-base-url">the element's base URL</dfn> is the <i>base URI of the element</i>, as
  defined by the XML Base specification, with <i>the base URI of the document entity</i> being
  defined as the <a href=#document-base-url>document base URL</a> of the <code><a href=#document>Document</a></code> that owns the element.
  <a href=#refsXMLBASE>[XMLBASE]</a></p>

  <p>For the purposes of the XML Base specification, user agents must act as if all
  <code><a href=#document>Document</a></code> objects represented XML documents.</p>

  <p class=note>It is possible for <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes to be
  present even in HTML fragments, as such attributes can be added dynamically using script. (Such
  scripts would not be conforming, however, as <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code>
  attributes are not allowed in <a href=#html-documents>HTML documents</a>.)</p>

  </div>



  <div class=impl>

  <h4 id=dynamic-changes-to-base-urls><span class=secno>2.5.3 </span>Dynamic changes to base URLs</h4>

  <p>When an <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute is set, changed, or removed, the
  attribute's element, and all descendant elements, are <a href=#affected-by-a-base-url-change>affected by a base URL
  change</a>.</p>

  <p>When a document's <a href=#document-base-url>document base URL</a> changes, all elements in that document are
  <a href=#affected-by-a-base-url-change>affected by a base URL change</a>.</p>

  <p>The following are <a href=#base-url-change-steps>base URL change steps</a>, which run when an element is
  <a href=#affected-by-a-base-url-change>affected by a base URL change</a> (as defined by the DOM specification):</p>

  <dl class=switch><dt>If the element creates a <a href=#hyperlink>hyperlink</a></dt>

   <dd>

    <p>If the <a href=#absolute-url>absolute URL</a> identified by the hyperlink is being shown to the user, or
    if any data derived from that URL is affecting the display, then the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute should be <a href=#resolve-a-url title="resolve a
    url">re-resolved</a> relative to the element and the UI updated appropriately.</p>

    <p class=example>For example, the CSS <code title=selector-link><a href=#selector-link>:link</a></code>/<code title=selector-visited><a href=#selector-visited>:visited</a></code> pseudo-classes might have been affected.</p>

    <p>If the hyperlink has a <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute and its <a href=#absolute-url title="absolute URL">absolute URL(s)</a> are being shown to the user, then the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute's tokens should be <a href=#resolve-a-url title="resolve a
    url">re-resolved</a> relative to the element and the UI updated appropriately.</p>

   </dd>

   <dt>If the element is a <code><a href=#the-q-element>q</a></code>, <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#the-ins-element>ins</a></code>, or
   <code><a href=#the-del-element>del</a></code> element with a <code title="">cite</code> attribute</dt>

   <dd>

    <p>If the <a href=#absolute-url>absolute URL</a> identified by the <code title="">cite</code> attribute is
    being shown to the user, or if any data derived from that URL is affecting the display, then the
    <a href=#url>URL</a> should be <a href=#resolve-a-url title="resolve a url">re-resolved</a> relative to the
    element and the UI updated appropriately.</p>

   </dd>

   <dt>Otherwise</dt>

   <dd>

    <p>The element is not directly affected.</p>

    <p class=example>For instance, changing the base URL doesn't affect the image displayed by
    <code><a href=#the-img-element>img</a></code> elements, although subsequent accesses of the <code title=dom-img-src><a href=#dom-img-src>src</a></code> IDL attribute from script will return a new <a href=#absolute-url>absolute
    URL</a> that might no longer correspond to the image being shown.</p>

   </dd>

  </dl></div>


  <div class=impl>

  <h3 id=fetching-resources><span class=secno>2.6 </span>Fetching resources</h3>

  <h4 id=terminology-1><span class=secno>2.6.1 </span>Terminology</h4>

  <p id=concept-http-equivalent>User agents can implement a variety of transfer protocols, but
  this specification mostly defines behavior in terms of HTTP. <a href=#refsHTTP>[HTTP]</a></p>

  <p>The <dfn id=concept-http-equivalent-get title=concept-http-equivalent-get>HTTP GET method</dfn> is equivalent to the default
  retrieval action of the protocol. For example, RETR in FTP. Such actions are idempotent and safe,
  in HTTP terms.</p>

  <p>The <dfn id=concept-http-equivalent-codes title=concept-http-equivalent-codes>HTTP response codes</dfn> are equivalent to
  statuses in other protocols that have the same basic meanings. For example, a "file not found"
  error is equivalent to a 404 code, a server error is equivalent to a 5xx code, and so on.</p>

  <p>The <dfn id=concept-http-equivalent-headers title=concept-http-equivalent-headers>HTTP headers</dfn> are equivalent to fields in
  other protocols that have the same basic meaning. For example, the HTTP authentication headers are
  equivalent to the authentication aspects of the FTP protocol.</p>

  <p>A <dfn id=referrer-source>referrer source</dfn> is either a <code><a href=#document>Document</a></code> or a <a href=#url>URL</a>.</p>


  <h4 id=processing-model><span class=secno>2.6.2 </span>Processing model</h4>

  <p>When a user agent is to <dfn id=fetch>fetch</dfn><!--FETCH--> a resource or <a href=#url>URL</a>, optionally
  <strong>from</strong> an origin <i title="">origin</i>, optionally <strong>using</strong> a
  specific <a href=#referrer-source>referrer source</a> as an <i>override referrer source</i>, and optionally with
  any of a <i>synchronous flag</i>, a <i>manual redirect flag</i>, a <i>force same-origin flag</i>,
  and a <i>block cookies flag</i>, the following steps must be run. (When a <em><a href=#url>URL</a></em> is to be
  fetched, the URL identifies a resource to be obtained.)</p>

  <!-- if invoked with the synchronous flag, make sure to release the storage mutex first -->

  <!-- synchronous flag is only to be used in algorithms that are themselves asynchronous! Only
  sync-XHR is allowed to make the mistake of screwing that up. :-P -->

  <!-- the force same-origin flag is for use in places where we'll be moving to CORS one day; when
  used, the algorithm must be invoked with a URL (not something else, like a POST request) whose
  origin is the same as the /origin/, which must also be present, and the algorithm must not be
  invoked with the manual redirect flag. -->

  <!-- "block cookies" is currently only used by XHR -->

  <ol><li><p>If there is a specific <i>override referrer source</i>, and it is a <a href=#url>URL</a>, then
   let <var title="">referrer</var> be the <i>override referrer source</i>, and jump to the step
   labeled <i>clean referrer</i>.</li>

   <li>

    <p>Let <var title="">document</var> be the appropriate <code><a href=#document>Document</a></code> as given by the
    following list:</p>

    <dl class=switch><dt>If there is a specific <i>override referrer source</i></dt>

     <dd>The <i>override referrer source</i>.</dd>


     <dt>When <a href=#navigate title=navigate>navigating</a></dt>

     <dd>The <a href=#active-document>active document</a> of the <a href=#source-browsing-context>source browsing context</a>.</dd>


     <dt>When fetching resources for an element</dt>

     <dd>The element's <code><a href=#document>Document</a></code>.</dd>


    </dl></li>

   <li>

    <p>While <var title="">document</var> is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, let <var title="">document</var> be
    <var title="">document</var>'s <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-container>browsing context
    container</a>'s <code><a href=#document>Document</a></code> instead.</p>

   </li>

   <li>

    <p>If the <a href=#origin>origin</a> of <var title="">Document</var> is not a scheme/host/port tuple,
    then set <var title="">referrer</var> to the empty string and jump to the step labeled <i>clean
    referrer</i>.</p>

   </li>

   <li>

    <p>Let <var title="">referrer</var> be <a href="#the-document's-address">the document's address</a> of <var title="">document</var>.</p>

   </li>

   <li>

    <p><i>Clean referrer</i>: Apply the <a href=#url-parser>URL parser</a> to <var title="">referrer</var> and let <var title="">parsed referrer</var> be the <a href=#resulting-parsed-url>resulting parsed URL</a>.</p>

   </li>

   <li>

    <p>Let <var title="">referrer</var> be the result of applying the
    <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a> to <var title="">parsed referrer</var>, with the <i>exclude fragment
    flag</i> set.</p> <!-- RFC2616 says "The URI MUST NOT include a fragment." (section 14.36) -->

   </li>

   <li>

    <p>If <var title="">referrer</var> is not the empty string, is not a <a href=#data-protocol title="data
    protocol"><code title="">data:</code> URL</a>, is not a <a href=#javascript-protocol title="javascript
    protocol"><code title="">javascript:</code> URL</a>, and is not the <a href=#url>URL</a>
    "<code><a href=#about:blank>about:blank</a></code>", then generate the <i>address of the resource from which Request-URIs
    are obtained</i> as required by HTTP for the <code title=http-referer>Referer</code> (sic)
    header from <var title="">referrer</var>. <a href=#refsHTTP>[HTTP]</a></p>

    <p>Otherwise, the <code title=http-referer>Referer</code> (sic) header must be omitted,
    regardless of its value.</p>

   </li>

   <li><p>If the algorithm was not invoked with the <i>synchronous flag</i>, perform the remaining
   steps asynchronously.</li>

   <li><p>If the <code><a href=#document>Document</a></code> with which any <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> by this algorithm would be associated doesn't have an
   associated <a href=#browsing-context>browsing context</a>, then abort these steps.</li>

<!--(redundant with 'at a time convenient...' below)
   <li><p>Optionally, wait until the <code>Document</code> with which any <span
   title="concept-task">tasks</span> <span title="queue a task">queued</span> by this algorithm
   would be associated is <span title="active document">active</span>.</p></li>
-->

   <li>

    <p>This is the <i>main step</i>.</p>

    <p>If the resource is to be obtained from an <a href=#application-cache>application cache</a>, then use the data
    from that <a href=#application-cache>application cache</a>, as if it had been obtained in the manner appropriate
    given its <a href=#url>URL</a>.</p>

    <p>If the resource is identified by an <a href=#absolute-url>absolute URL</a>, and the resource is to be
    obtained using an idempotent action (such as an HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>), and it is already being downloaded
    for other reasons (e.g. another invocation of this algorithm), and this request would be
    identical to the previous one (e.g. same <code title=http-accept>Accept</code> and <code title=http-origin>Origin</code> headers), and the user agent is configured such that it is to
    reuse the data from the existing download instead of initiating a new one, then use the results
    of the existing download instead of starting a new one.</p>

    <p>Otherwise, if the resource is identified by an <a href=#absolute-url>absolute URL</a> with a scheme that
    does not define a mechanism to obtain the resource (e.g. it is a <code title="">mailto:</code>
    URL) or that the user agent does not support, then act as if the resource was an HTTP 204 No
    Content response with no other metadata.</p>

    <p>Otherwise, if the resource is identified by the <a href=#url>URL</a>
    <dfn id=about:blank><code>about:blank</code></dfn>, then the resource is immediately available and consists of
    the empty string, with no metadata.</p>

    <p>Otherwise, at a time convenient to the user and the user agent, download (or otherwise
    obtain) the resource, applying the semantics of the relevant specifications (e.g. performing an
    HTTP GET or POST operation, or reading the file from disk, <a href=#concept-js-deref title=concept-js-deref>dereferencing <span title="javascript protocol"><code title="">javascript:</code> URLs</span></a>, etc).</p>

    <p>For the purposes of the <code title=http-referer>Referer</code> (sic) header, use the
    <i>address of the resource from which Request-URIs are obtained</i> generated in the earlier
    step.</p>

    <p>For the purposes of the <code title=http-origin>Origin</code> header, if the <a href=#fetch title=fetch>fetching algorithm</a> was explicitly initiated from an <i title="">origin</i>,
    then <i title="">the origin that initiated the HTTP request</i> is <i title="">origin</i>.
    Otherwise, this is <i title="">a request from a "privacy-sensitive" context</i>. <a href=#refsORIGIN>[ORIGIN]</a></p>

   </li>

   <li>

    <p>If the algorithm was not invoked with the <i>block cookies flag</i>, and there are cookies to
    be set, then the user agent must run the following substeps:</p>

    <ol><li><p>Wait until ownership of the <a href=#storage-mutex>storage mutex</a> can be taken by this instance of
     the <a href=#fetch title=fetch>fetching</a> algorithm.</li>

     <li><p>Take ownership of the <a href=#storage-mutex>storage mutex</a>.</li>

     <li><p>Update the cookies. <a href=#refsCOOKIES>[COOKIES]</a>
     <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
     </li>

     <li><p>Release the <a href=#storage-mutex>storage mutex</a> so that it is once again free.</li>

    </ol></li>

   <li>

    <p>If the fetched resource is an HTTP redirect <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
    equivalent</a>, then:</p>

    <dl class=switch><dt>If the <i>force same-origin flag</i> is set and the <a href=#url>URL</a> of the target of the
     redirect does not have the <a href=#same-origin>same origin</a> as the <a href=#url>URL</a> for which the
     <a href=#fetch>fetch</a> algorithm was invoked</dt>

     <dd>

      <p>Abort these steps and return failure from this algorithm, as if the remote host could not
      be contacted.</p>

     </dd>

     <dt>If the <i>manual redirect flag</i> is set</dt>

     <dd>

      <p>Continue, using the fetched resource (the redirect) as the result of the algorithm. If the
      calling algorithm subsequently requires the user agent to <dfn id=transparently-follow-the-redirect>transparently follow the
      redirect</dfn>, then the user agent must resume this algorithm from the <i>main step</i>, but
      using the target of the redirect as the resource to fetch, rather than the original
      resource.</p>

     </dd>

     <dt>Otherwise</dt>

     <dd>

      <p>First, apply any relevant requirements for redirects (such as showing any appropriate
      prompts). Then, redo <i>main step</i>, but using the target of the redirect as the resource to
      fetch, rather than the original resource. For HTTP requests, the new request must include the
      same headers as the original request, except for headers for which other requirements are
      specified (such as the <code title=http-host>Host</code> header). <a href=#refsHTTP>[HTTP]</a></p>

      <p class=note>The HTTP specification requires that 301, 302, and 307 redirects, when applied
      to methods other than the safe methods, not be followed without user confirmation. That would
      be an appropriate prompt for the purposes of the requirement in the paragraph above. <a href=#refsHTTP>[HTTP]</a></p>

     </dd>

    </dl></li>

   <li>

    <p>If the algorithm was not invoked with the <i>synchronous flag</i>: When the resource is
    available, or if there is an error of some description, <a href=#queue-a-task>queue a task</a> that uses the
    resource as appropriate. If the resource can be processed incrementally, as, for instance, with
    a progressively interlaced JPEG or an HTML file, additional tasks may be queued to process the
    data as it is downloaded. The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task source</a>.</p>

    <p>Otherwise, return the resource or error information to the calling algorithm.</p>

   </li>

  </ol><p>If the user agent can determine the actual length of the resource being <a href=#fetch title=fetch>fetched</a> for an instance of this algorithm, and if that length is finite, then
  that length is the file's <dfn id=concept-fetch-total title=concept-fetch-total>size</dfn>. Otherwise, the subject of
  the algorithm (that is, the resource being fetched) has no known <a href=#concept-fetch-total title=concept-fetch-total>size</a>. (For example, the HTTP <code title=http-content-length>Content-Length</code> header might provide this information.)</p>

  <p>The user agent must also keep track of the <dfn id=concept-fetch-loaded title=concept-fetch-loaded>number of bytes
  downloaded</dfn> for each instance of this algorithm. This number must exclude any out-of-band
  metadata, such as HTTP headers.</p>

  <p class=note>The <a href=#application-cache>application cache</a> processing model introduces some <a href=#changesToNetworkingModel>changes to the networking model</a> to handle the returning of
  cached resources.</p>

  <p class=note>The <a href=#navigate title=navigate>navigation</a> processing model handles redirects
  itself, overriding the redirection handling that would be done by the fetching algorithm.</p>

  <p class=note>Whether the <a href=#content-type-sniffing>type sniffing rules</a> apply to the
  fetched resource depends on the algorithm that invokes the rules &mdash; they are not always
  applicable.</p>


<!--ADD-TOPIC:Security-->
  <h4 id=encrypted-http-and-related-security-concerns><span class=secno>2.6.3 </span>Encrypted HTTP and related security concerns</h4>

  <p>Anything in this specification that refers to HTTP also applies to HTTP-over-TLS, as
  represented by <a href=#url title=url>URLs</a> representing the <code title="">https</code> scheme.
  <a href=#refsHTTPS>[HTTPS]</a></p>

  <p class=warning>User agents should report certificate errors to the user and must either refuse
  to download resources sent with erroneous certificates or must act as if such resources were in
  fact served with no encryption.</p>

  <p>User agents should warn the user that there is a potential problem whenever the user visits a
  page that the user has previously visited, if the page uses less secure encryption on the second
  visit.</p>

  <p>Not doing so can result in users not noticing man-in-the-middle attacks.</p>

  <div class=example>

   <p>If a user connects to a server with a self-signed certificate, the user agent could allow the
   connection but just act as if there had been no encryption. If the user agent instead allowed the
   user to override the problem and then displayed the page as if it was fully and safely encrypted,
   the user could be easily tricked into accepting man-in-the-middle connections.</p>

   <p>If a user connects to a server with full encryption, but the page then refers to an external
   resource that has an expired certificate, then the user agent will act as if the resource was
   unavailable, possibly also reporting the problem to the user. If the user agent instead allowed
   the resource to be used, then an attacker could just look for "secure" sites that used resources
   from a different host and only apply man-in-the-middle attacks to that host, for example taking
   over scripts in the page.</p>

   <p>If a user bookmarks a site that uses a CA-signed certificate, and then later revisits that
   site directly but the site has started using a self-signed certificate, the user agent could warn
   the user that a man-in-the-middle attack is likely underway, instead of simply acting as if the
   page was not encrypted.</p>

  </div>
<!--REMOVE-TOPIC:Security-->


  <h4 id=content-type-sniffing><span class=secno>2.6.4 </span>Determining the type of a resource</h4>

  <p>The <dfn id=content-type title=Content-Type>Content-Type metadata</dfn> of a resource must be obtained and
  interpreted in a manner consistent with the requirements of the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>

  <p>The <dfn id=content-type-sniffing-0 title="Content-Type sniffing">sniffed type of a resource</dfn> must be found in a
  manner consistent with the requirements given in the MIME Sniffing specification for finding the
  <i>sniffed media type</i> of the relevant sequence of octets. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>

  <p>The <dfn id=content-type-sniffing:-image title="Content-Type sniffing: image">rules for sniffing images specifically</dfn> and
  the <dfn id=content-type-sniffing:-text-or-binary title="Content-Type sniffing: text or binary">rules for distinguishing if a resource is
  text or binary</dfn> are also defined in the MIME Sniffing specification. Both sets of rules
  return a <a href=#mime-type>MIME type</a> as their result. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>

  <p class=warning>It is imperative that the rules in the MIME Sniffing specification be followed
  exactly. When a user agent uses different heuristics for content type detection than the server
  expects, security problems can occur. For more details, see the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>


  <h4 id=extracting-character-encodings-from-meta-elements><span class=secno>2.6.5 </span>Extracting character encodings from <code><a href=#the-meta-element>meta</a></code> elements</h4>

  <p>The <dfn id=algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a <code>meta</code> element</dfn>,
  given a string <var title="">s</var>, is as follows. It either returns a character encoding or
  nothing.</p>

  <ol><!-- http://www.hixie.ch/tests/adhoc/html/parsing/encoding/all.html --><li><p>Let <var title="">position</var> be a pointer into <var title="">s</var>, initially
   pointing at the start of the string.</li>

   <li><p><i>Loop</i>: Find the first seven characters in <var title="">s</var> after <var title="">position</var> that are an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the word "<code title="">charset</code>". If no such match is found, return nothing and abort these
   steps.</li>

   <li><p>Skip any <a href=#space-character title="space character">space characters</a> that immediately follow the
   word "<code title="">charset</code>" (there might not be any).</li>

   <li><p>If the next character is not a U+003D EQUALS SIGN (=), then move <var title="">position</var> to point just before that next character, and jump back to the step
   labeled <i>loop</i>.</li>

   <li><p>Skip any <a href=#space-character title="space character">space characters</a> that immediately follow the
   equals sign (there might not be any).</li>

   <li>

    <p>Process the next character as follows:</p>

    <dl class=switch><dt>If it is a U+0022 QUOTATION MARK character (") and there is a later U+0022 QUOTATION MARK character (") in <var title="">s</var></dt>
     <dt>If it is a U+0027 APOSTROPHE character (') and there is a later U+0027 APOSTROPHE character (') in <var title="">s</var></dt>
     <dd>Return the result of <a href=#getting-an-encoding>getting an encoding</a> from the substring that is between
     this character and the next earliest occurrence of this character.</dd>

     <dt>If it is an unmatched U+0022 QUOTATION MARK character (")</dt>
     <dt>If it is an unmatched U+0027 APOSTROPHE character (')</dt>
     <dt>If there is no next character</dt>
     <dd>Return nothing.</dd>

     <dt>Otherwise</dt>
     <dd>Return the result of <a href=#getting-an-encoding>getting an encoding</a> from the substring that consists of
     this character up to but not including the first <a href=#space-character>space character</a> or U+003B
     SEMICOLON character (;), or the end of <var title="">s</var>, whichever comes first.</dd>

    </dl></li>

  </ol><p class=note>This algorithm is distinct from those in the HTTP specification (for example, HTTP
  doesn't allow the use of single quotes and requires supporting a backslash-escape mechanism that
  is not supported by this algorithm<!-- not to mention not having any rules for error-handling,
  which is of course why we're having to define it ourselves -->). 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>

  </div>


  <h4 id=cors-settings-attributes><span class=secno>2.6.6 </span>CORS settings attributes</h4>

  <p>A <dfn id=cors-settings-attribute>CORS settings attribute</dfn> is an <a href=#enumerated-attribute>enumerated
  attribute</a>. The following table lists the keywords and states
  for the attribute &mdash; the keywords in the left column map to the
  states in the cell in the second column on the same row as the
  keyword.</p>

  <table><thead><tr><th> Keyword
     <th> State
     <th> Brief description
   <tbody><tr><td><dfn id=attr-crossorigin-anonymous-keyword title=attr-crossorigin-anonymous-keyword><code>anonymous</code></dfn>
     <td><dfn id=attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</dfn>
     <td>Cross-origin CORS requests for the element will have the <i><a href=#omit-credentials-flag>omit credentials flag</a></i> set.
    <tr><td><dfn id=attr-crossorigin-use-credentials-keyword title=attr-crossorigin-use-credentials-keyword><code>use-credentials</code></dfn>
     <td><dfn id=attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use Credentials</dfn>
     <td>Cross-origin CORS requests for the element will not have the <i><a href=#omit-credentials-flag>omit credentials flag</a></i> set.
  </table><p>The empty string is also a valid keyword, and maps to the <a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a> state. The
  attribute's <i>invalid value default</i> is the <a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a> state. For the purposes of <a href=#reflect title=reflect>reflection</a>, the canonical case for the <a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a> state is the <code title=attr-crossorigin-anonymous-keyword><a href=#attr-crossorigin-anonymous-keyword>anonymous</a></code> keyword. The
  <i>missing value default</i>, used when the attribute is omitted, is
  the <dfn id=attr-crossorigin-none title=attr-crossorigin-none>No CORS</dfn> state.</p>


  <div class=impl>
  <h4 id=cors-enabled-fetch><span class=secno>2.6.7 </span>CORS-enabled fetch</h4>

  <p>When the user agent is required to perform a <dfn id=potentially-cors-enabled-fetch>potentially
  CORS-enabled fetch</dfn> of an <a href=#absolute-url>absolute URL</a> <var title="">URL</var> with a mode <var title="">mode</var> that is
  either "<a href=#attr-crossorigin-none title=attr-crossorigin-none>No CORS</a>", "<a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a>", or "<a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use Credentials</a>",
  optionally using a <a href=#referrer-source>referrer source</a> <var title="">referrer source</var>, with an <a href=#origin>origin</a> <var title="">origin</var>, and with a default origin behaviour <var title="">default</var> which is either "<i>taint</i>" or
  "<i>fail</i>", it must run the first applicable set of steps from
  the following list. The default origin behaviour is only used if
  <var title="">mode</var> is "<a href=#attr-crossorigin-none title=attr-crossorigin-none>No
  CORS</a>". This algorithm wraps the <a href=#fetch>fetch</a> algorithm
  above, and labels the obtained resource as either
  <dfn id=cors-same-origin>CORS-same-origin</dfn> or <dfn id=cors-cross-origin>CORS-cross-origin</dfn>, or
  blocks the resource entirely.</p>

  <dl class=switch><dt>If the <var title="">URL</var> has the <a href=#same-origin>same origin</a> as <var title="">origin</var></dt>
   <dt>If the <var title="">URL</var> is a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a></dt>
   <dt>If the <var title="">URL</var> is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a></dt>
   <dt>If the <var title="">URL</var> is <code><a href=#about:blank>about:blank</a></code></dt>

   <dd>

    <p>Run these substeps:</p>

    <ol><li><p><a href=#fetch>Fetch</a><!--FETCH--> <var title="">URL</var>,
     using <var title="">referrer source</var> if one was specified,
     with the <i>manual redirect flag</i> set.</li> <!-- http-origin
     privacy sensitive -->

     <li><p><i>Loop</i>: Wait for the <a href=#fetch>fetch</a> algorithm
     to know if the result is a redirect or not.</li>

     <li>

      <p>Follow the first appropriate steps from the following list:</p>

      <dl class=switch><dt>If the result of the <a href=#fetch>fetch</a> is a redirect, and
       the <a href=#origin>origin</a> of the target URL of the redirect is
       not the <a href=#same-origin>same origin</a> as <var title="">origin</var></dt>

       <dd>

        <p>Set <var title="">URL</var> to the target URL of the
        redirect and return to the top of the <a href=#potentially-cors-enabled-fetch>potentially
        CORS-enabled fetch</a> algorithm (this time, one of the
        other branches below might be taken, based on the value of
        <var title="">mode</var><!-- but if it's a data: or
        javascript: URL, we'll stay here -->).</p>

       </dd>

       <dt>If the result of the <a href=#fetch>fetch</a> is a redirect</dt>

       <dd>

        <p class=note>The <a href=#origin>origin</a> of the target URL of
        the redirect is the <a href=#same-origin>same origin</a> as <var title="">origin</var>.</p>

        <p><a href=#transparently-follow-the-redirect>Transparently follow the redirect</a> and jump to
        the step labeled <i>loop</i> above.</p>

       </dd>

       <dt>Otherwise</dt>

       <dd>

        <p class=note>The resource is available, it is not a
        redirect, and its <a href=#origin>origin</a> is the <a href=#same-origin>same
        origin</a> as <var title="">origin</var>.</p>

        <p>The <a href=#concept-task title=concept-task>tasks</a> from the
        <a href=#fetch>fetch</a> algorithm are <a href=#queue-a-task title="queue a
        task">queued</a> normally, and for the purposes of the
        calling algorithm, the obtained resource is
        <a href=#cors-same-origin>CORS-same-origin</a>.</p>

       </dd>

      </dl></li>

    </ol></dd>


   <dt>If <var title="">mode</var> is "<a href=#attr-crossorigin-none title=attr-crossorigin-none>No CORS</a>" and <var title="">default</var> is <i>taint</i></dt>

   <dd>

    <p class=note>The <var title="">URL</var> does not have the
    <a href=#same-origin>same origin</a> as <var title="">origin</var>.</p>

    <p><a href=#fetch>Fetch</a><!--FETCH--> <var title="">URL</var>, using
    <var title="">referrer source</var> if one was specified.</p> <!--
    http-origin privacy sensitive -->

    <p>The <a href=#concept-task title=concept-task>tasks</a> from the
    <a href=#fetch>fetch</a> algorithm are <a href=#queue-a-task title="queue a
    task">queued</a> normally, but for the purposes of the calling
    algorithm, the obtained resource is
    <a href=#cors-cross-origin>CORS-cross-origin</a>. The user agent may report a
    cross-origin resource access failure to the user (e.g. in a
    debugging console).</p>

   </dd>


   <dt>If <var title="">mode</var> is "<a href=#attr-crossorigin-none title=attr-crossorigin-none>No CORS</a>"</dt>

   <dd>

    <p class=note>The <var title="">URL</var> does not have the
    <a href=#same-origin>same origin</a> as <var title="">origin</var>, and <var title="">default</var> is <i>fail</i>.</p>
 
    <p>Discard any data fetched as part of this algorithm, and prevent
    any <a href=#concept-task title=concept-task>tasks</a> from such invocations
    of the <a href=#fetch>fetch</a> algorithm from being <a href=#queue-a-task title="queue
    a task">queued</a>.

    For the purposes of the calling algorithm, the user agent must act
    as if there was a fatal network error and no resource was
    obtained. The user agent may report a cross-origin resource access
    failure to the user (e.g. in a debugging console).</p>

   </dd>


   <dt>If <var title="">mode</var> is "<a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a>" or "<a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use
   Credentials</a>"</dt>

   <dd>

    <p class=note>The <var title="">URL</var> does not have the
    <a href=#same-origin>same origin</a> as <var title="">origin</var>.</p>

    <p>Run these steps:</p>

    <ol><li><p>Perform a <a href=#cross-origin-request>cross-origin request</a><!--FETCH-->
     with the <i>request URL</i> set to <var title="">URL</var>, with
     the CORS <i title="">referrer source</i> set to <var title="">referrer source</var> if one was specified, the
     <i>source origin</i> set to <var title="">origin</var>, and with
     the <i><a href=#omit-credentials-flag>omit credentials flag</a></i> set if <var title="">mode</var>
     is "<a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a>"
     and not set otherwise. <a href=#refsCORS>[CORS]</a></li>

     <li><p>Wait for the CORS <a href=#cross-origin-request-status>cross-origin request status</a>
     to have a value.</li>

     <li>

      <p>Jump to the appropriate step from the following list:</p>

      <dl class=switch><dt>If the CORS <a href=#cross-origin-request-status>cross-origin request status</a> is not <i>success</i></dt>

       <dd>

        <p>Discard all fetched data and prevent any <a href=#concept-task title=concept-task>tasks</a> from the <a href=#fetch>fetch</a>
        algorithm from being <a href=#queue-a-task title="queue a task">queued</a>.
        For the purposes of the calling algorithm, the user agent must
        act as if there was a fatal network error and no resource was
        obtained. If a CORS <a href=#resource-sharing-check>resource sharing check</a>
        failed, the user agent may report a cross-origin resource
        access failure to the user (e.g. in a debugging console).</p>

       </dd>

       <dt>If the CORS <a href=#cross-origin-request-status>cross-origin request status</a> is <i>success</i></dt>

       <dd>

        <p>The <a href=#concept-task title=concept-task>tasks</a> from the
        <a href=#fetch>fetch</a> algorithm are <a href=#queue-a-task title="queue a
        task">queued</a> normally, and for the purposes of the
        calling algorithm, the obtained resource is
        <a href=#cors-same-origin>CORS-same-origin</a>.</p>

       </dd>

      </dl></li>

    </ol></dd>

  </dl></div>



  <h3 id=common-dom-interfaces><span class=secno>2.7 </span>Common DOM interfaces</h3>

  <h4 id=reflecting-content-attributes-in-idl-attributes><span class=secno>2.7.1 </span>Reflecting content attributes in IDL attributes</h4>

  <p>Some IDL attributes are defined to <dfn id=reflect>reflect</dfn> a particular content attribute. This
  means that on getting, the IDL attribute returns the current value of the content attribute, and
  on setting, the IDL attribute changes the value of the content attribute to the given value.</p>

<!-- v2 for completeness: (also search for REFLECTIDL)
  <p class="note">A list of <span>reflecting IDL attributes</span> and
  their corresponding content attributes is given in the index.</p>
-->

  <div class=impl>

  <p>In general, on getting, if the content attribute is not present, the IDL attribute must act as
  if the content attribute's value is the empty string; and on setting, if the content attribute is
  not present, it must first be added.</p>

  <p>If a reflecting IDL attribute is a <code>DOMString</code> attribute whose content attribute is
  defined to contain a <a href=#url>URL</a>, then on getting, the IDL attribute must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of the content attribute relative to the element
  and return the resulting <a href=#absolute-url>absolute URL</a> if that was successful, or the empty string
  otherwise; and on setting, must set the content attribute to the specified literal value. If the
  content attribute is absent, the IDL attribute must return the default value, if the content
  attribute has one, or else the empty string.</p>

  <p>If a reflecting IDL attribute is a <code>DOMString</code> attribute whose content attribute is
  defined to contain one or more <a href=#url title=URL>URLs</a>, then on getting, the IDL attribute
  must <a href=#split-a-string-on-spaces title="split a string on spaces">split the content attribute on spaces</a> and
  return the concatenation of <a href=#resolve-a-url title="resolve a URL">resolving</a> each token URL to an
  <a href=#absolute-url>absolute URL</a> relative to the element, with a single U+0020 SPACE character between
  each URL, ignoring any tokens that did not resolve successfully. If the content attribute is
  absent, the IDL attribute must return the default value, if the content attribute has one, or else
  the empty string. On setting, the IDL attribute must set the content attribute to the specified
  literal value.</p>

  <p>If a reflecting IDL attribute is a <code>DOMString</code> attribute whose content attribute is
  an <a href=#enumerated-attribute>enumerated attribute</a>, and the IDL attribute is <dfn id=limited-to-only-known-values>limited to only known
  values</dfn>, then, on getting, the IDL attribute must return the conforming value associated with
  the state the attribute is in (in its canonical case), if any, or the empty string if the
  attribute is in a state that has no associated keyword value or if the attribute is not in a defined state
  (e.g. the attribute is missing and there is no <i>missing value default</i>); and on setting, the
  content attribute must be set to the specified new value.</p>

  <p>If a reflecting IDL attribute is a <code>DOMString</code> attribute but doesn't fall into any
  of the above categories, then the getting and setting must be done in a transparent,
  case-preserving manner.</p>

  <p>If a reflecting IDL attribute is a <code title="">boolean</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 title="boolean attribute">boolean content attributes</a>.)</p>

  <p>If a reflecting IDL attribute has a signed integer type (<code>long</code>) then, on getting,
  the content attribute must be parsed according to the <a href=#rules-for-parsing-integers title="rules for parsing
  integers">rules for parsing signed integers</a>, and if that is successful, and the value is in
  the range of the IDL attribute's type, the resulting value must be returned. If, on the other
  hand, it fails or returns an out of range value, or if the attribute is absent, then the default
  value must be returned instead, or 0 if there is no default value. On setting, the given value
  must be converted to the shortest possible string representing the number as a <a href=#valid-integer>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>long</code>) that is
  <dfn id=limited-to-only-non-negative-numbers>limited to only non-negative numbers</dfn> then, on getting, the content attribute must be
  parsed according to the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>, and if that is
  successful, and the value is in the range of the IDL attribute's type, the resulting value must be
  returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is
  absent, the default value must be returned instead, or &minus;1 if there is no default value. On
  setting, if the value is negative, the user agent must throw an <code><a href=#indexsizeerror>IndexSizeError</a></code>
  exception. Otherwise, the given value must be converted to the shortest possible string
  representing the number as a <a href=#valid-non-negative-integer>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>unsigned
  long</code>) then, on getting, the content attribute must be parsed according to the <a href=#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
  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 title="">n</var> be the new value, otherwise let <var title="">n</var> be the default value, or 0 if there is no default value; then, <var title="">n</var> must be converted to the shortest possible string representing the number as a
  <a href=#valid-non-negative-integer>valid non-negative integer</a> and that string must be used as the new content attribute
  value.</p>
  <!-- see http://www.w3.org/Bugs/Public/show_bug.cgi?id=10352
  https://bugzilla.mozilla.org/show_bug.cgi?id=586118 and
  https://www.w3.org/Bugs/Public/show_bug.cgi?id=17705 for why the
  range is clamped to 2147483647 rather the normal unsigned long
  maximum value of 4294967295 -->

  <p>If a reflecting IDL attribute has an unsigned integer type (<code>unsigned long</code>) that is
  <dfn id=limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative numbers greater than zero</dfn>, then the behavior is similar to
  the previous case, but zero is not allowed. On getting, the content attribute must first be parsed
  according to the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>, and if that is successful,
  and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If,
  on the other hand, it fails or returns an out of range value, or if the attribute is absent, the
  default value must be returned instead, or 1 if there is no default value. On setting, if the
  value is zero, the user agent must throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception. Otherwise,
  first, if the new value is in the range 1 to 2147483647, then let <var title="">n</var> be the new
  value, otherwise let <var title="">n</var> be the default value, or 1 if there is no default
  value; then, <var title="">n</var> must be converted to the shortest possible string representing
  the number as a <a href=#valid-non-negative-integer>valid non-negative integer</a> and that string must be used as the new
  content attribute value.</p>
  <!-- see previous paragraph for note about the weird range -->
 
  <p>If a reflecting IDL attribute has a floating-point number type (<code>double</code> or
  <code>unrestricted double</code>), then, on getting, the content attribute must be parsed
  according to the <a href=#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>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>double</code> or
  <code>unrestricted double</code>) that is <dfn id=limited-to-numbers-greater-than-zero>limited to numbers greater than zero</dfn>, then
  the behavior is similar to the previous case, but zero and negative values are not allowed. On
  getting, the content attribute must be parsed according to the <a href=#rules-for-parsing-floating-point-number-values>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>best representation of the
  number as a floating-point number</a> and then that string must be used as the new content
  attribute value.</p>

  <p class=note>The values Infinity and Not-a-Number (NaN) values throw an exception on setting,
  as defined in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>

  <p>If a reflecting IDL attribute has the type <code><a href=#domtokenlist>DOMTokenList</a></code> or
  <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code>, then on getting it must return a <code><a href=#domtokenlist>DOMTokenList</a></code> or
  <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> object (as appropriate) whose associated element is the element
  in question and whose associated attribute's local name is the name of the attribute in question.
  The same <code><a href=#domtokenlist>DOMTokenList</a></code> or <code><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> object must be returned
  every time for each attribute.</p>

  <p>If a reflecting IDL attribute has the type <code><a href=#htmlelement>HTMLElement</a></code>, or an interface that
  descends from <code><a href=#htmlelement>HTMLElement</a></code>, then, on getting, it must run the following algorithm
  (stopping at the first point where a value is returned):</p>

  <ol><li>If the corresponding content attribute is absent, then the IDL attribute must return
   null.</li>

   <li>Let <var title="">candidate</var> be the element that the <code title=dom-Document-getElementById><a href=#dom-document-getelementbyid>document.getElementById()</a></code> method would find when
   called on the content attribute's document if it were passed as its argument the current value of
   the corresponding content attribute.</li>

   <li>If <var title="">candidate</var> is null, or if it is not type-compatible with the IDL
   attribute, then the IDL attribute must return null.</li>

   <li>Otherwise, it must return <var title="">candidate</var>.</li>

  </ol><p>On setting, if the given element has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute, and has the
  same <a href=#home-subtree>home subtree</a> as the element of the attribute being set, and the given element is
  the first element in that <a href=#home-subtree>home subtree</a> whose <a href=#concept-id title=concept-ID>ID</a> is
  the value of that <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute, then the content attribute must be
  set to the value of that <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute. Otherwise, the content
  attribute must be set to the empty string.</p>

  </div>


<!--TOPIC:DOM APIs-->
  <h4 id=collections-0><span class=secno>2.7.2 </span>Collections</h4>

  <p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code>, <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code>,
  <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code>, and <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> interfaces are
  <a href=#collections>collections</a> derived from the <code><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>


  <h5 id=htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</h5>

  <p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface is used for generic <a href=#collections>collections</a> of
  elements just like <code><a href=#htmlcollection>HTMLCollection</a></code>, with the exception that its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method returns an
  <code><a href=#htmlcollection>HTMLCollection</a></code> object when there are multiple matching elements, and that its <code title=dom-HTMLAllCollection-item>item()</code> method can be used as a synonym for its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method. It is intended only for the
  legacy <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> attribute.</p>

  <pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
  // inherits <span title=dom-HTMLCollection-length>length</span> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>(unsigned long index)
  (<a href=#htmlcollection>HTMLCollection</a> or <a href=#element>Element</a>)? <a href=#dom-htmlallcollection-item-string title=dom-HTMLAllCollection-item-string>item</a>(DOMString name);
  legacycaller getter (<a href=#htmlcollection>HTMLCollection</a> or <a href=#element>Element</a>)? <a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>(DOMString name); // shadows inherited namedItem()
  <a href=#htmlallcollection>HTMLAllCollection</a> <a href=#dom-htmlallcollection-tags title=dom-HTMLAllCollection-tags>tags</a>(DOMString tagName);
};</pre>

  <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length>length</code></dt>
   <dd>
    <p>Returns the number of elements in the collection.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">collection</var>[<var title="">index</var>]</dt>
   <dt><var title="">collection</var>(<var title="">index</var>)</dt>
   <dd>
    <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-item-string><a href=#dom-htmlallcollection-item-string>item</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-item-string><a href=#dom-htmlallcollection-item-string>item</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">collection</var>[<var title="">name</var>]</dt>
   <dt><var title="">collection</var>(<var title="">name</var>)</dt>
   <dd>
    <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or name <var title="">name</var> from the collection.</p>
    <p>If there are multiple matching items, then an <code><a href=#htmlcollection>HTMLCollection</a></code> object containing all those elements is returned.</p>
    <p>Only <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>,
    <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
    <code><a href=#the-img-element>img</a></code>, and <code><a href=#the-object-element>object</a></code> elements can have a name for the purpose of this
    method; their name is given by the value of their <code title="">name</code> attribute.</p>
   </dd>

   <dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-tags><a href=#dom-htmlallcollection-tags>tags</a></code>(<var title="">tagName</var>)</dt>
   <dd>
    <p>Returns a collection that is a filtered view of the current collection, containing only elements with the given tag name.</p>
   </dd>

  </dl><div class=impl>

  <p>The object's <a href=#supported-property-indices>supported property indices</a> are as defined for
  <code><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>

  <p>The <a href=#supported-property-names>supported property names</a> consist of the non-empty values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> attributes of all the elements <a href=#represented-by-the-collection>represented by the
  collection</a>, and the non-empty values of all the <code title="">name</code> attributes of all the
  <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>,
  <code><a href=#frame>frame</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
  <code><a href=#the-object-element>object</a></code> elements <a href=#represented-by-the-collection>represented by the collection</a>, in <a href=#tree-order>tree
  order</a>, ignoring later duplicates, with the <code title=attr-id><a href=#the-id-attribute>id</a></code> of an element
  preceding its <code title="">name</code> if it contributes both, they differ from each other, and neither
  is the duplicate of an earlier entry.</p>

  <p>The <dfn id=dom-htmlallcollection-item-string title=dom-HTMLAllCollection-item-string><code>item(<var title="">name</var>)</code></dfn> and <dfn id=dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn>
  methods must act according to the following algorithm:</p>

  <ol><li>If <var title="">name</var> is the empty string, return null and stop the algorithm.</li>

   <li>

    <p>Let <var title="">collection</var> be an <code><a href=#htmlcollection>HTMLCollection</a></code> object rooted at the
    same node as the <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object on which the method was invoked, whose
    filter matches only elements that already match the filter of the <code><a href=#htmlallcollection>HTMLAllCollection</a></code>
    object on which the method was invoked and that are either:</p>

    <ul><li><code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>,
     <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
     <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> elements with a <code title="">name</code> attribute
     equal to <var title="">name</var>, or,</li>

     <li>elements with an <a href=#concept-id title=concept-id>ID</a> equal to <var title="">name</var>.</li>

    </ul></li>

   <li>If, at the time the method is called, there is exactly one node in <var title="">collection</var>, then return that node and stop the algorithm.</li>

   <li>Otherwise, if, at the time the method is called, <var title="">collection</var> is empty,
   return null and stop the algorithm.</li>

   <li>Otherwise, return <var title="">collection</var>.</li>

  </ol><p>The <dfn id=dom-htmlallcollection-tags title=dom-HTMLAllCollection-tags><code>tags(<var title="">tagName</var>)</code></dfn> method must return an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> rooted
  at the same node as the <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object on which the method was invoked,
  whose filter matches only <a href=#html-elements>HTML elements</a> whose local name is the <var title="">tagName</var> argument and that already match the filter of the
  <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object on which the method was invoked. In <a href=#html-documents>HTML
  documents</a>, the argument must first be <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</p>
<!--if legacycaller is removed:
  <p>In addition to the above, <code>HTMLAllCollection</code> objects, in JavaScript, must be
  callable. Calling such an object must implicitly invoke the index getter with the same
  arguments.</p>
-->

  </div>


  <h5 id=htmlformcontrolscollection-0><span class=secno>2.7.2.2 </span>HTMLFormControlsCollection</h5>

  <p>The <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> interface is used for <a href=#collections>collections</a> of
  <a href=#category-listed title=category-listed>listed elements</a> in <code><a href=#the-form-element>form</a></code> and
  <code><a href=#the-fieldset-element>fieldset</a></code> elements.</p>

  <pre class=idl>interface <dfn id=htmlformcontrolscollection>HTMLFormControlsCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
  // inherits <span title=dom-HTMLCollection-length>length</span> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
  legacycaller getter (<a href=#radionodelist>RadioNodeList</a> or <a href=#element>Element</a>)? <a href=#dom-htmlformcontrolscollection-nameditem title=dom-HTMLFormControlsCollection-namedItem>namedItem</a>(DOMString name); // shadows inherited namedItem()
};

interface <dfn id=radionodelist>RadioNodeList</dfn> : <a href=#nodelist>NodeList</a> {
          attribute DOMString <a href=#dom-radionodelist-value title=dom-RadioNodeList-value>value</a>;
};</pre>

  <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length>length</code></dt>
   <dd>
    <p>Returns the number of elements in the collection.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">collection</var>[<var title="">index</var>]</dt>
   <dt><var title="">collection</var>(<var title="">index</var>)</dt>
   <dd>
    <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">radioNodeList</var> = <var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">collection</var>[<var title="">name</var>]</dt>
   <dt><var title="">collection</var>(<var title="">name</var>)</dt>
   <dd>
    <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> <var title="">name</var> from the collection.</p>
    <p>If there are multiple matching items, then a <code><a href=#radionodelist>RadioNodeList</a></code> object containing all those elements is returned.</p>
   </dd>

   <dt><var title="">radioNodeList</var> . <var title="">value</var> [ = <var title="">value</var> ]</dt>
   <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>
   </dd>

  </dl><div class=impl>

  <p>The object's <a href=#supported-property-indices>supported property indices</a> are as defined for
  <code><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>

  <p>The <a href=#supported-property-names>supported property names</a> consist of the non-empty values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> and <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attributes of all the
  elements <a href=#represented-by-the-collection>represented by the collection</a>, in <a href=#tree-order>tree order</a>, ignoring later
  duplicates, with the <code title=attr-id><a href=#the-id-attribute>id</a></code> of an element preceding its <code title=attr-fe-name><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 id=dom-htmlformcontrolscollection-nameditem title=dom-HTMLFormControlsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must act according to the following algorithm:</p>

  <ol><li>If <var title="">name</var> is the empty string, return null and stop the algorithm.</li>

   <li>If, at the time the method is called, there is exactly one node in the collection that has
   either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
   attribute equal to <var title="">name</var>, then return that node and stop the algorithm.</li>

   <li>Otherwise, if there are no nodes in the collection that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal
   to <var title="">name</var>, then return null and stop the algorithm.</li>

   <li>Otherwise, create a new <code><a href=#radionodelist>RadioNodeList</a></code> object representing a <a href=#live>live</a>
   view of the <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> object, further filtered so that the only
   nodes in the <code><a href=#radionodelist>RadioNodeList</a></code> object are those that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal
   to <var title="">name</var>. The nodes in the <code><a href=#radionodelist>RadioNodeList</a></code> object must be sorted in
   <a href=#tree-order>tree order</a>.</li>

   <li>Return that <code><a href=#radionodelist>RadioNodeList</a></code> object.</li>

  </ol><hr><p>Members of the <code><a href=#radionodelist>RadioNodeList</a></code> interface inherited from the <code><a href=#nodelist>NodeList</a></code>
  interface must behave as they would on a <code><a href=#nodelist>NodeList</a></code> object.</p>

  <p>The <dfn id=dom-radionodelist-value title=dom-RadioNodeList-value><code>value</code></dfn> IDL attribute on the
  <code><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 title="">element</var> be the first element in <a href=#tree-order>tree order</a>
   represented by the <code><a href=#radionodelist>RadioNodeList</a></code> object that is an <code><a href=#the-input-element>input</a></code> element whose
   <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state and whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is true. Otherwise, let it be null.</li>

   <li><p>If <var title="">element</var> is null, or if it is an element with no <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, return the empty string.</li>

   <li><p>Otherwise, return the value of <var title="">element</var>'s <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute.</li>

  </ol><p>On setting, the <code title=dom-RadioNodeList-value><a href=#dom-radionodelist-value>value</a></code> IDL attribute must run the
  following steps:</p>

  <ol><li><p>Let <var title="">element</var> be the first element in <a href=#tree-order>tree order</a>
   represented by the <code><a href=#radionodelist>RadioNodeList</a></code> object that is an <code><a href=#the-input-element>input</a></code> element whose
   <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state and whose <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute is present and equal to the new value, if
   any. Otherwise, let it be null.</li>

   <li><p>If <var title="">element</var> is not null, then set its <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to true.</p>

  </ol><!--
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
--></div>


  <h5 id=htmloptionscollection-0><span class=secno>2.7.2.3 </span>HTMLOptionsCollection</h5>

  <p>The <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> interface is used for <a href=#collections>collections</a> of
  <code><a href=#the-option-element>option</a></code> elements. It is always rooted on a <code><a href=#the-select-element>select</a></code> element and has
  attributes and methods that manipulate that element's descendants.</p>

  <pre class=idl>interface <dfn id=htmloptionscollection>HTMLOptionsCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
  // inherits <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
           attribute unsigned long <a href=#dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length>length</a>; // shadows inherited length
  legacycaller getter <a href=#htmloptionelement>HTMLOptionElement</a>? <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(DOMString name); // shadows inherited namedItem()
  <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement>HTMLOptionElement</a>? option);
  void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>((<a href=#htmloptionelement>HTMLOptionElement</a> or <a href=#htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement>HTMLElement</a> or long)? before = null);
  void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>(long index);
           attribute long <a href=#dom-htmloptionscollection-selectedindex title=dom-HTMLOptionsCollection-selectedIndex>selectedIndex</a>;
};</pre>

  <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-length><a href=#dom-htmloptionscollection-length>length</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the number of elements in the collection.</p>
    <p>When set to a smaller number, truncates the number of <code><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><a href=#the-option-element>option</a></code> elements to that container.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">collection</var>[<var title="">index</var>]</dt>
   <dt><var title="">collection</var>(<var title="">index</var>)</dt>
   <dd>
    <p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLOptionsCollection-namedItem><a href=#dom-htmloptionscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">nodeList</var> = <var title="">collection</var> . <code title=dom-HTMLOptionsCollection-namedItem><a href=#dom-htmloptionscollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">collection</var>[<var title="">name</var>]</dt>
   <dt><var title="">collection</var>(<var title="">name</var>)</dt>
   <dd>
    <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-option-name><a href=#attr-option-name>name</a></code> <var title="">name</var> from the collection.</p>
    <p>If there are multiple matching items, then the first is returned.</p>
   </dd>

   <dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-add><a href=#dom-htmloptionscollection-add>add</a></code>(<var title="">element</var> [, <var title="">before</var> ] )</dt>
   <dd>
    <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
    <p>The <var title="">before</var> argument can be a number, in which case <var title="">element</var> is inserted before the item with that number, or an element from the
    collection, in which case <var title="">element</var> is inserted before that element.</p>
    <p>If <var title="">before</var> is omitted, null, or a number out of range, then <var title="">element</var> will be added at the end of the list.</p>
    <p>This method will throw a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception if <var title="">element</var> is an ancestor of the element into which it is to be inserted.</p>
   </dd>

   <dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-selectedIndex><a href=#dom-htmloptionscollection-selectedindex>selectedIndex</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the index of the first selected item, if any, or &minus;1 if there is no selected
    item.</p>

    <p>Can be set, to change the selection.</p>

   </dd>

  </dl><div class=impl>

  <p>The object's <a href=#supported-property-indices>supported property indices</a> are as defined for
  <code><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>

  <p>On getting, the <dfn id=dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length><code>length</code></dfn>
  attribute must return the number of nodes <a href=#represented-by-the-collection>represented by the collection</a>.</p>

  <p>On setting, the behavior depends on whether the new value is equal to, greater than, or less
  than the number of nodes <a href=#represented-by-the-collection>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 title="">n</var> new <code><a href=#the-option-element>option</a></code> elements with no attributes and no child nodes must be
  appended to the <code><a href=#the-select-element>select</a></code> element on which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is
  rooted, where <var title="">n</var> is the difference between the two numbers (new value minus old
  value). Mutation events must be fired as if a <code><a href=#documentfragment>DocumentFragment</a></code> containing the new
  <code><a href=#the-option-element>option</a></code> elements had been inserted. If the new value is lower, then the last <var title="">n</var> nodes in the collection must be removed from their parent nodes, where <var title="">n</var> is the difference between the two numbers (old value minus new value).</p>

  <p class=note>Setting <code title=dom-HTMLOptionsCollection-length><a href=#dom-htmloptionscollection-length>length</a></code> never removes
  or adds any <code><a href=#the-optgroup-element>optgroup</a></code> elements, and never adds new children to existing
  <code><a href=#the-optgroup-element>optgroup</a></code> elements (though it can remove children from them).</p>

  <p>The <a href=#supported-property-names>supported property names</a> consist of the non-empty values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> and <code title=attr-option-name><a href=#attr-option-name>name</a></code> attributes of all the
  elements <a href=#represented-by-the-collection>represented by the collection</a>, in <a href=#tree-order>tree order</a>, ignoring later
  duplicates, with the <code title=attr-id><a href=#the-id-attribute>id</a></code> of an element preceding its <code title=attr-option-name><a href=#attr-option-name>name</a></code> if it contributes both, they differ from each other, and neither is
  the duplicate of an earlier entry.</p>

  <p>The <dfn id=dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return the first node in the collection that has
  either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, if there is one and if <var title="">name</var> is not the empty string;
  otherwise, it must return null.</p>

  <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
  indexed property</dfn> for a given property index <var title="">index</var> to a new value <var title="">value</var>, it must run the following algorithm:</p>

  <ol><li><p>If <var title="">value</var> is null, invoke the steps for the <code title=dom-HTMLOptionsCollection-remove><a href=#dom-htmloptionscollection-remove>remove</a></code> method with <var title="">index</var> as
   the argument, and abort these steps.</li>

   <li><p>Let <var title="">length</var> be the number of nodes <a href=#represented-by-the-collection>represented by the
   collection</a>.</li>

   <li><p>Let <var title="">n</var> be <var title="">index</var> minus <var title="">length</var>.</li>

   <li><p>If <var title="">n</var> is greater than zero, then <a href=#concept-node-append title=concept-node-append>append</a> a <code><a href=#documentfragment>DocumentFragment</a></code> consisting of <span title=""><var title="">n</var>-1</span> new <code><a href=#the-option-element>option</a></code> elements with no attributes and
   no child nodes to the <code><a href=#the-select-element>select</a></code> element on which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code>
   is rooted.</li>

   <li><p>If <var title="">n</var> is greater than or equal to zero, <a href=#concept-node-append title=concept-node-append>append</a> <var title="">value</var> to the <code><a href=#the-select-element>select</a></code>
   element. Otherwise, <a href=#concept-node-replace title=concept-node-replace>replace</a> the <var title="">index</var>th element in the collection by <var title="">value</var>.</li>

  </ol><p>The <dfn id=dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add><code>add(<var title="">element</var>, <var title="">before</var>)</code></dfn> method must act according to the following algorithm:</p>

  <ol><li><p>If <var title="">element</var> is an ancestor of the <code><a href=#the-select-element>select</a></code> element on which
   the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, then throw a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code>
   exception and abort these steps.</li>

   <li><p>If <var title="">before</var> is an element, but that element isn't a descendant of the
   <code><a href=#the-select-element>select</a></code> element on which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, then throw
   a <code><a href=#notfounderror>NotFoundError</a></code> exception and abort these steps.</li>

   <li><p>If <var title="">element</var> and <var title="">before</var> are the same element, then
   return and abort these steps.</li>

   <li><p>If <var title="">before</var> is a node, then let <var title="">reference</var> be that
   node. Otherwise, if <var title="">before</var> is an integer, and there is a <var title="">before</var>th node in the collection, let <var title="">reference</var> be that node.
   Otherwise, let <var title="">reference</var> be null.</li>

   <li><p>If <var title="">reference</var> is not null, let <var title="">parent</var> be the parent
   node of <var title="">reference</var>. Otherwise, let <var title="">parent</var> be the
   <code><a href=#the-select-element>select</a></code> element on which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted.</li>

   <li><p>Act as if the DOM <code title=dom-Node-insertBefore><a href=#dom-node-insertbefore>insertBefore()</a></code> method was
   invoked on the <var title="">parent</var> node, with <var title="">element</var> as the first
   argument and <var title="">reference</var> as the second argument.</p>

  </ol><p>The <dfn id=dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove><code>remove(<var title="">index</var>)</code></dfn> method must act according to the following algorithm:</p>

  <ol><li><p>If the number of nodes <a href=#represented-by-the-collection>represented by the collection</a> is zero, abort these
   steps.</li>

   <li><p>If <var title="">index</var> is not a number greater than or equal to 0 and less than the
   number of nodes <a href=#represented-by-the-collection>represented by the collection</a>, abort these steps.</li>

   <!-- note that Web IDL converts 'a', NaN, -0.5, 0.5, and null to 0, and numbers in general
   truncate. so what we're checking against here in a way has very little to do with what's going on
   in the JS -->

   <li><p>Let <var title="">element</var> be the <var title="">index</var>th element in the
   collection.</li>

   <li><p>Remove <var title="">element</var> from its parent node.</li>

  </ol><p>The <dfn id=dom-htmloptionscollection-selectedindex title=dom-HTMLOptionsCollection-selectedIndex><code>selectedIndex</code></dfn> IDL
  attribute must act like the identically named attribute on the <code><a href=#the-select-element>select</a></code> element on
  which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted</p>

  <!-- see also http://ln.hixie.ch/?start=1161042744&count=1 -->

  </div>


<!--TOPIC:Microdata-->
  <h5 id=htmlpropertiescollection-0><span class=secno>2.7.2.4 </span>HTMLPropertiesCollection</h5>

  <p>The <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> interface is used for <a href=#collections>collections</a> of
  elements that add <a href=#the-properties-of-an-item title="the properties of an item">name-value pairs</a> to a particular
  <a href=#concept-item title=concept-item>item</a> in the <a href=#microdata>microdata</a> model.</p>

  <pre class=idl>interface <dfn id=htmlpropertiescollection>HTMLPropertiesCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
  // inherits <span title=dom-HTMLCollection-length>length</span> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
  getter <a href=#propertynodelist>PropertyNodeList</a>? <a href=#dom-htmlpropertiescollection-nameditem title=dom-HTMLPropertiesCollection-namedItem>namedItem</a>(DOMString name); // shadows inherited namedItem()
  readonly attribute DOMString[] <a href=#dom-htmlpropertiescollection-names title=dom-HTMLPropertiesCollection-names>names</a>;
};

typedef sequence&lt;any&gt; <dfn id=propertyvaluearray>PropertyValueArray</dfn>;

interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <a href=#nodelist>NodeList</a> {
  <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-getvalues title=dom-PropertyNodeList-getValues>getValues</a>();
};</pre>

  <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length>length</code></dt>
   <dd>
    <p>Returns the number of elements in the collection.</p>
   </dd>

   <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">collection</var>[<var title="">index</var>]</dt>
   <dd>
    <p>Returns the element with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
   </dd>

   <dt><var title="">propertyNodeList</var> = <var title="">collection</var> . <code title=dom-HTMLPropertiesCollection-namedItem><a href=#dom-htmlpropertiescollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
   <dd>
    <p>Returns a <code><a href=#propertynodelist>PropertyNodeList</a></code> object containing any elements that add a property named <var title="">name</var>.</p>
   </dd>

   <dt><var title="">collection</var>[<var title="">name</var>]</dt>
   <dd>
    <p>Returns a <code><a href=#propertynodelist>PropertyNodeList</a></code> object containing any elements that add a property named <var title="">name</var>. The <var title="">name</var> index has to be one of the values listed in the <code title=dom-HTMLPropertiesCollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code> list.</p>
   </dd>

   <dt><var title="">collection</var> . <code title=dom-HTMLPropertiesCollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code></dt>
   <dd>
    <p>Returns an array with the <a href=#property-names>property names</a> of the elements in the collection.</p>
   </dd>

   <dt><var title="">propertyNodeList</var> . <code title=dom-PropertyNodeList-getVlues>getValues</code>()</dt>
   <dd>
    <p>Returns an array of the various values that the relevant elements have.</p>
   </dd>

  </dl><div class=impl>

  <p>The object's <a href=#supported-property-indices>supported property indices</a> are as defined for
  <code><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>

  <p>The <a href=#supported-property-names>supported property names</a> consist of the <a href=#property-names>property names</a> of all the
  elements <a href=#represented-by-the-collection>represented by the collection</a>, in <a href=#tree-order>tree order</a>, ignoring later
  duplicates.</p>

  <p>The <dfn id=dom-htmlpropertiescollection-names title=dom-HTMLPropertiesCollection-names><code>names</code></dfn> attribute must
  return a <a href=#live>live</a> <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array object giving
  the <a href=#property-names>property names</a> of all the elements <a href=#represented-by-the-collection>represented by the collection</a>,
  listed in <a href=#tree-order>tree order</a>, but with duplicates removed, leaving only the first occurrence
  of each name. The same object must be returned each time.</p>

  <p>The <dfn id=dom-htmlpropertiescollection-nameditem title=dom-HTMLPropertiesCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return a <code><a href=#propertynodelist>PropertyNodeList</a></code> object
  representing a <a href=#live>live</a> view of the <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object, further
  filtered so that the only nodes in the <code><a href=#propertynodelist>PropertyNodeList</a></code> object are those that have a
  <a href=#property-names title="property names">property name</a> equal to <var title="">name</var>. The nodes in
  the <code><a href=#propertynodelist>PropertyNodeList</a></code> object must be sorted in <a href=#tree-order>tree order</a>, and the same
  object must be returned each time a particular <var title="">name</var> is queried.</p>

  <hr><p>Members of the <code><a href=#propertynodelist>PropertyNodeList</a></code> interface inherited from the <code><a href=#nodelist>NodeList</a></code>
  interface must behave as they would on a <code><a href=#nodelist>NodeList</a></code> object.</p>

  <p>The <dfn id=dom-propertynodelist-getvalues title=dom-PropertyNodeList-getValues><code>getValues</code></dfn> method the
  <code><a href=#propertynodelist>PropertyNodeList</a></code> object must return a newly constructed array whose values are the
  values obtained from the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute of each of the
  elements represented by the object, in <a href=#tree-order>tree order</a>.</p>

  </div>


<!--TOPIC:DOM APIs-->
  <h4 id=domstringmap-0><span class=secno>2.7.3 </span>DOMStringMap</h4>

  <p>The <code><a href=#domstringmap>DOMStringMap</a></code> interface represents a set of name-value pairs. It exposes these
  using the scripting language's native mechanisms for property access.</p>

  <div class=impl>

  <p>When a <code><a href=#domstringmap>DOMStringMap</a></code> object is instantiated, it is associated with three
  algorithms, one for getting the list of name-value pairs, one for setting names to certain values,
  and one for deleting names.</p>

  <pre class=idl>[OverrideBuiltins]
interface <dfn id=domstringmap>DOMStringMap</dfn> {
  <a href=#dom-domstringmap-nameditem title=dom-DOMStringMap-namedItem>getter</a> DOMString (DOMString name);
  <a href=#dom-domstringmap-setitem title=dom-DOMStringMap-setItem>setter</a> <a href=#dom-domstringmap-additem title=dom-DOMStringMap-addItem>creator</a> void (DOMString name, DOMString value);
  <a href=#dom-domstringmap-removeitem title=dom-DOMStringMap-removeItem>deleter</a> void (DOMString name);
};</pre>

  <p>The <a href=#supported-property-names>supported property names</a> on a <code><a href=#domstringmap>DOMStringMap</a></code> object at any instant
  are the names of each pair returned from the algorithm for getting the list of name-value pairs at
  that instant, in the order returned.</p>

  <p>To <dfn id=dom-domstringmap-nameditem title=dom-DOMStringMap-namedItem>determine the value of a named property</dfn> <var title="">name</var> in a <code><a href=#domstringmap>DOMStringMap</a></code>, the user agent must return the value component
  of the name-value pair whose name component is <var title="">name</var> in the list returned by
  the algorithm for getting the list of name-value pairs.</p>

  <p>To set the value of a <dfn id=dom-domstringmap-additem title=dom-DOMStringMap-addItem>new</dfn> or <dfn id=dom-domstringmap-setitem title=dom-DOMStringMap-setItem>existing</dfn> named property <var title="">name</var> to value
  <var title="">value</var>, the algorithm for setting names to certain values must be run, passing
  <var title="">name</var> as the name and the result of converting <var title="">value</var> to a
  <code>DOMString</code> as the value.</p>

  <p>To <dfn id=dom-domstringmap-removeitem title=dom-DOMStringMap-removeItem>delete an existing named property</dfn> <var title="">name</var>, the algorithm for deleting names must be run, passing <var title="">name</var> as the name.</p>

  <p class=note>The <code><a href=#domstringmap>DOMStringMap</a></code> interface definition here is only intended for
  JavaScript environments. Other language bindings will need to define how <code><a href=#domstringmap>DOMStringMap</a></code>
  is to be implemented for those languages.</p>

  </div>

  <div class=example>

   <p>The <code title=dom-dataset><a href=#dom-dataset>dataset</a></code> attribute on elements exposes the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes on the element.</p>

   <p>Given the following fragment and elements with similar constructions:</p>

   <pre>&lt;img class="tower" id="tower5" data-x="12" data-y="5"
     data-ai="robotarget" data-hp="46" data-ability="flames"
     src="towers/rocket.png alt="Rocket Tower"&gt;</pre>

   <p>...one could imagine a function <code title="">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') &amp;&amp; // checking the 'class' attribute
      node.dataset.x == x &amp;&amp; // 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 &lt; 0) {
      hp = 0;
      node.dataset.ai = 'dead'; // setting the 'data-ai' attribute
      delete node.dataset.ability; // removing the 'data-ability' attribute
    }
    node.dataset.hp = hp; // setting the 'data-hp' attribute
  }
}</pre>

  </div>


  <h4 id=domelementmap-0><span class=secno>2.7.4 </span>DOMElementMap</h4>

  <p>The <code><a href=#domelementmap>DOMElementMap</a></code> interface represents a set of name-element mappings. It exposes
  these using the scripting language's native mechanisms for property access.</p>

  <div class=impl>

  <p>When a <code><a href=#domelementmap>DOMElementMap</a></code> object is instantiated, it is associated with three
  algorithms, one for getting the list of name-element mappings, one for mapping a name to a certain
  element, and one for deleting mappings by name.</p>

  <pre class=idl>interface <dfn id=domelementmap>DOMElementMap</dfn> {
  <a href=#dom-domelementmap-nameditem title=dom-DOMElementMap-namedItem>getter</a> <a href=#element>Element</a> (DOMString name);
  <a href=#dom-domelementmap-setitem title=dom-DOMElementMap-setItem>setter</a> <a href=#dom-domelementmap-additem title=dom-DOMElementMap-addItem>creator</a> void (DOMString name, <a href=#element>Element</a> value);
  <a href=#dom-domelementmap-removeitem title=dom-DOMElementMap-removeItem>deleter</a> void (DOMString name);
};</pre>

  <p>The <a href=#supported-property-names>supported property names</a> on a <code><a href=#domelementmap>DOMElementMap</a></code> object at any instant
  are the names for each mapping returned from the algorithm for getting the list of name-element
  mappings at that instant, in the order returned.</p>

  <p>To <dfn id=dom-domelementmap-nameditem title=dom-DOMElementMap-namedItem>determine the value of a named property</dfn> <var title="">name</var> in a <code><a href=#domelementmap>DOMElementMap</a></code>, the user agent must return the element
  component of the name-element mapping whose name component is <var title="">name</var> in the list
  returned by the algorithm for getting the list of name-element mappings.</p>

  <p>To set the value of a <dfn id=dom-domelementmap-additem title=dom-DOMElementMap-addItem>new</dfn> or <dfn id=dom-domelementmap-setitem title=dom-DOMElementMap-setItem>existing</dfn> named property <var title="">name</var> to value
  <var title="">value</var>, the algorithm for mapping a name to a certain element must be run,
  passing <var title="">name</var> as the name <var title="">value</var> as the element.</p>

  <p>To <dfn id=dom-domelementmap-removeitem title=dom-DOMElementMap-removeItem>delete an existing named property</dfn> <var title="">name</var>, the algorithm for deleting mappings must be run, passing <var title="">name</var> as the name component of the mapping to be deleted.</p>

  <p class=note>The <code><a href=#domelementmap>DOMElementMap</a></code> interface definition here is only intended for
  JavaScript environments. Other language bindings will need to define how
  <code><a href=#domelementmap>DOMElementMap</a></code> is to be implemented for those languages.</p>

  </div>



  <h4 id=transferable-objects><span class=secno>2.7.5 </span>Transferable objects</h4>

  <p>Some objects support being copied and closed in one operation.
  This is called <i>transferring</i> the object, and is used in
  particular to transfer ownership of unsharable or expensive
  resources across worker boundaries.</p>

  <p>The following <code><a href=#transferable>Transferable</a></code> types exist:</p>

  <ul class=brief><li><code><a href=#arraybuffer>ArrayBuffer</a></code> <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a>
   <li><code><a href=#canvasproxy>CanvasProxy</a></code> (defined in this specification)
   <li><code><a href=#messageport>MessagePort</a></code> (defined in this specification)
  </ul><div class=impl>

  <p>The following IDL block formalizes this:</p>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=transferable>Transferable</dfn> { };
<a href=#arraybuffer>ArrayBuffer</a> implements <a href=#transferable>Transferable</a>;
<a href=#canvasproxy>CanvasProxy</a> implements <a href=#transferable>Transferable</a>;
<a href=#messageport>MessagePort</a> implements <a href=#transferable>Transferable</a>;</pre>

  <p>To <dfn id=transfer-a-transferable-object>transfer a <code>Transferable</code> object</dfn> to a
  new owner, the user agent must run the steps defined for the type of
  object in question. The steps will return a new object of the same
  type, and will permanently <dfn id=concept-transferable-neutered title=concept-Transferable-neutered>neuter</dfn> the original
  object. (This is an irreversible and non-idempotent operation; once
  an object has been transferred, it cannot be transferred, or indeed
  used, again.)</p>

  <p id=transferArrayBuffer>To <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfer</a> an
  <code><a href=#arraybuffer>ArrayBuffer</a></code> object <var title="">old</var> to a new owner <var title="">owner</var>,
  a user agent must create a new <code><a href=#arraybuffer>ArrayBuffer</a></code> object pointing at the same underlying
  data as <var title="">old</var>, thus obtaining <var title="">new</var>, must <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neuter</a> the <var title="">old</var> object, and must
  finally return <var title="">new</var>. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

  <p class=note>Rules for how to <a href=#transferCanvasProxy>transfer a
  <code>CanvasProxy</code> object</a> and how to <a href=#transferMessagePort>transfer a
  <code>MessagePort</code> object</a> are given in the relevant sections of this specification.</p>

  </div>


  <div class=impl>

  <h4 id=safe-passing-of-structured-data><span class=secno>2.7.6 </span>Safe passing of structured data</h4>

  <p>When a user agent is required to obtain a <dfn id=structured-clone>structured clone</dfn> of a value, optionally
  with a <i>transfer map</i>, it must run the following algorithm, which either returns a separate
  value, or throws an exception. If a <i>transfer map</i> is provided, it consists of an association
  list of <code><a href=#transferable>Transferable</a></code> objects to placeholder objects.</p>

  <ol><li><p>Let <var title="">input</var> be the value being cloned.</li>

   <li><p>Let <var title="">transfer map</var> be the <i>transfer map</i> passed to the algorithm,
   if any, or the empty list otherwise.</li>

   <li><p>Let <var title="">memory</var> be an association list of pairs of objects, initially
   empty. This is used to handle duplicate references. In each pair of objects, one is called the
   <em><a href=#the-source-element>source</a></em> object and the other the <em>destination</em> object.</li>

   <li><p>For each mapping in <var title="">transfer map</var>, add a mapping from the
   <code><a href=#transferable>Transferable</a></code> object (the source object) to the placeholder object (the destination
   object) to <var title="">memory</var>.</li>

   <li><p>Let <var title="">output</var> be the value resulting from calling the <a href=#internal-structured-cloning-algorithm>internal
   structured cloning algorithm</a> with <var title="">input</var> as the "<var title="">input</var>" argument, and <var title="">memory</var> as the "<var title="">memory</var>" argument.</li>

   <li><p>Return <var title="">output</var>.</li>

  </ol><p>The <dfn id=internal-structured-cloning-algorithm>internal structured cloning algorithm</dfn> is always called with two arguments, <var title="">input</var> and <var title="">memory</var>, and its behavior is as follows:</p>

  <ol><li><p>If <var title="">input</var> is the source object of a pair of objects in <var title="">memory</var>, then return the destination object in that pair of objects and abort these
   steps.</li>

   <li><p>If <var title="">input</var> is a primitive value, then return that value and abort these
   steps.</li>

   <li><p>Let <var title="">deep clone</var> be false.</li>

   <li>

    <p>The <var title="">input</var> value is an object. Jump to the appropriate step below:</p>

    <dl class=switch><dt>If <var title="">input</var> is a <code>Boolean</code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed Boolean object with the same value
     as <var title="">input</var>.</dd>

     <dt>If <var title="">input</var> is a <code>Number</code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed Number object with the same value
     as <var title="">input</var>.</dd>

     <dt>If <var title="">input</var> is a <code>String</code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed String object with the same value
     as <var title="">input</var>.</dd>

     <dt>If <var title="">input</var> is a <code>Date</code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed <code>Date</code> object with the
     same value as <var title="">input</var>.</dd>

     <dt>If <var title="">input</var> is a <code>RegExp</code> object</dt>

     <dd>

      <p>Let <var title="">output</var> be a newly constructed <code>RegExp</code> object with the
      same pattern and flags as <var title="">input</var>.</p>

      <p class=note>The value of the <code title="">lastIndex</code> property is not copied.</p>

     </dd>

     <dt>If <var title="">input</var> is a <code><a href=#file>File</a></code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#file>File</a></code> object
     corresponding to the same underlying data.</dd>

     <dt>If <var title="">input</var> is a <code><a href=#blob>Blob</a></code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#blob>Blob</a></code> object
     corresponding to the same underlying data.</dd>

     <dt>If <var title="">input</var> is a <code><a href=#filelist>FileList</a></code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#filelist>FileList</a></code> object
     containing a list of newly constructed <code><a href=#file>File</a></code> objects corresponding to the same
     underlying data as those in <var title="">input</var>, maintaining their relative
     order.</dd>

     <dt>If <var title="">input</var> is an <code><a href=#imagedata>ImageData</a></code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#imagedata>ImageData</a></code> object
     whose <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code>, <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code>, and <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attributes have values equal to the
     corresponding attributes on <var title="">input</var>, and whose <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has the value obtained from invoking the
     <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with the value of the <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute on <var title="">input</var> as the new "<var title="">input</var>" argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</dd>

     <dt>If <var title="">input</var> is an <code><a href=#imagebitmap>ImageBitmap</a></code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#imagebitmap>ImageBitmap</a></code> object
     whose bitmap data is a copy of <var title="">input</var>'s bitmap data.</dd>

     <dt>If <var title="">input</var> is an <code><a href=#arraybuffer>ArrayBuffer</a></code> object</dt>

     <dd><p>If <var title="">input</var> has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, throw a <code><a href=#datacloneerror>DataCloneError</a></code>
     exception and abort the overall <a href=#structured-clone>structured clone</a> algorithm. Otherwise, let <var title="">output</var> be a newly constructed <code><a href=#arraybuffer>ArrayBuffer</a></code> object whose contents are
     a copy of <var title="">input</var>'s contents, with the same length.</dd>

     <dt>If <var title="">input</var> is an <code><a href=#arraybufferview>ArrayBufferView</a></code> object</dt>

     <dd>

      <p>Let <var title="">output</var> be a newly constructed object of the same class as <var title="">input</var>, with each IDL attribute defined for that class being set to the value
      obtained from invoking the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> recursively with
      the value of the attribute on <var title="">input</var> as the new "<var title="">input</var>"
      argument and <var title="">memory</var> as the new "<var title="">memory</var>" argument.</p>

      <p class=note>Only IDL attributes defined on the class (including the
      <code><a href=#arraybufferview>ArrayBufferView</a></code> attributes) are cloned. Properties added by a script, for
      example, are not cloned.</p>

     </dd>

     <dt>If <var title="">input</var> is an <code>Array</code> object</dt>

     <dd>

      <p>Let <var title="">output</var> be a newly constructed empty <code>Array</code> object whose
      <code title="">length</code> is equal to the <code title="">length</code> of <var title="">input</var>, and set <var title="">deep clone</var> to true.</p>

      <p class=note>This means that the length of sparse arrays is preserved.</p>

     </dd>

     <dt>If <var title="">input</var> is an <code><a href=#the-object-element>Object</a></code> object</dt>

     <dd><p>Let <var title="">output</var> be a newly constructed empty <code title="">Object</code>
     object, and set <var title="">deep clone</var> to true.</dd>

     <dt>If <var title="">input</var> is an object that another specification defines how to clone</dt>

     <dd><p>Let <var title="">output</var> be a clone of the object as defined by the other
     specification.</dd>

     <dt>If <var title="">input</var> is another native object type (e.g. <code>Error</code>, <code>Function</code>)</dt>
     <dt>If <var title="">input</var> is a host object (e.g. a DOM node)</dt>

     <dd><p>Throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone>structured
     clone</a> algorithm.</dd>

    </dl><p>For the purposes of the algorithm above, an object is a particular type of object <var title="">class</var> if its [[Class]] internal property is equal to <var title="">class</var>.</p>

    <p class=example>For example, "<var title="">input</var> is an <code><a href=#the-object-element>Object</a></code> object" if
    <var title="">input</var>'s [[Class]] internal property is equal to the string "<code title="">Object</code>".</p>

   </li>

   <li><p>Add a mapping from <var title="">input</var> (the source object) to <var title="">output</var> (the destination object) to <var title="">memory</var>.</li>

   <li>

    <p>If <var title="">deep clone</var> is set, then, for each enumerable own property in <var title="">input</var>, run the following steps:</p>

    <ol><li><p>Let <var title="">name</var> be the name of the property.</li>

     <li><p>Let <var title="">source value</var> be the result of calling the [[Get]] internal
     method of <var title="">input</var> with the argument <var title="">name</var>. If the [[Get]]
     internal method of a property involved executing script, and that script threw an uncaught
     exception, then abort the overall <a href=#structured-clone>structured clone</a> algorithm, with that exception
     being passed through to the caller.</li>

     <li><p>Let <var title="">cloned value</var> be the result of invoking the <a href=#internal-structured-cloning-algorithm>internal
     structured cloning algorithm</a> recursively with <var title="">source value</var> as the
     "<var title="">input</var>" argument and <var title="">memory</var> as the "<var title="">memory</var>" argument. If this results in an exception, then abort the overall
     <a href=#structured-clone>structured clone</a> algorithm, with that exception being passed through to the
     caller.</li>

     <li><p>Add a new property to <var title="">output</var> having the name <var title="">name</var>, and having the value <var title="">cloned value</var>.</li>

    </ol><p>The order of the properties in the <var title="">input</var> and <var title="">output</var>
    objects must be the same, and any properties whose [[Get]] internal method involves running
    script must be processed in that same order.</p>

    <p class=note>This does not walk the prototype chain.</p>

    <p class=note>Property descriptors, setters, getters, and analogous features are not copied in
    this process. For example, the property in the input could be marked as read-only, but in the
    output it would just have the default state (typically read-write, though that could depend on
    the scripting environment).</p>

    <p class=note>Properties of Array objects are not treated any differently than those of other
    Objects. In particular, this means that non-index properties of arrays are copied as well.</p>

   </li>

   <li><p>Return <var title="">output</var>.</li>

  </ol><p class=note>This algorithm preserves cycles and preserves the identity of duplicate objects in
  graphs.</p>

  </div>


  <h4 id=callbacks><span class=secno>2.7.7 </span>Callbacks</h4>

  <p>The following callback function type is used in various APIs that interact with
  <code><a href=#file>File</a></code> objects:</p>

  <pre class=idl>callback <dfn id=filecallback>FileCallback</dfn> = void (<a href=#file>File</a> file);</pre>


  <div class=impl>

  <h4 id=garbage-collection><span class=secno>2.7.8 </span>Garbage collection</h4>

  <p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL
  attribute that returns a pre-existing object to that object.</p>

  <div class=example>

   <p>For example, the <code>document.location</code> attribute means
   that there is a strong reference from a <code><a href=#document>Document</a></code>
   object to its <code><a href=#location>Location</a></code> object. Similarly, there is
   always a strong reference from a <code><a href=#document>Document</a></code> to any
   descendant nodes, and from any node to its owner
   <code><a href=#document>Document</a></code>.</p>

  </div>

  </div>


<!--TOPIC:HTML Syntax and Parsing-->
  <h3 id=namespaces><span class=secno>2.8 </span>Namespaces</h3>

  <p>The <dfn id=html-namespace-0>HTML namespace</dfn> is: <code>http://www.w3.org/1999/xhtml</code></p>

  <p>The <dfn id=mathml-namespace>MathML namespace</dfn> is: <code>http://www.w3.org/1998/Math/MathML</code></p>

  <p>The <dfn id=svg-namespace>SVG namespace</dfn> is: <code>http://www.w3.org/2000/svg</code></p>

  <p>The <dfn id=xlink-namespace>XLink namespace</dfn> is: <code>http://www.w3.org/1999/xlink</code></p>

  <p>The <dfn id=xml-namespace>XML namespace</dfn> is: <code>http://www.w3.org/XML/1998/namespace</code></p>

  <p>The <dfn id=xmlns-namespace>XMLNS namespace</dfn> is: <code>http://www.w3.org/2000/xmlns/</code></p>

  <hr><p>Data mining tools and other user agents that perform operations
  on content without running scripts, evaluating CSS or XPath
  expressions, or otherwise exposing the resulting DOM to arbitrary
  content, may "support namespaces" by just asserting that their DOM
  node analogues are in certain namespaces, without actually exposing
  the above strings.</p>

  <hr><p class=note>In <a href=#syntax>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>


<!--TOPIC:DOM APIs-->
  <h2 id=dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</h2>

  <h3 id=documents><span class=secno>3.1 </span>Documents</h3>

  <p>Every XML and HTML document in an HTML UA is represented by a <code><a href=#document>Document</a></code> object. <a href=#refsDOM>[DOM]</a></p>

  <p><dfn id="the-document's-address">The document's address</dfn> is an <a href=#absolute-url>absolute URL</a> that is initially set when
  the <code><a href=#document>Document</a></code> is created but that can change during the lifetime of the
  <code><a href=#document>Document</a></code>, for example when the user <a href=#navigate title=navigate>navigates</a> to a
  <a href=#scroll-to-fragid title=navigate-fragid>fragment identifier</a> on the page or when the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> method is called with a new <a href=#url>URL</a>.</p>
  <!--
    http://www.hixie.ch/tests/adhoc/dom/level0/history/pushState/002/
    http://www.hixie.ch/tests/adhoc/html/navigation/fragids/016.html
  -->

  <p class=warning>Interactive user agents typically expose <a href="#the-document's-address">the document's address</a> in
  their user interface. This is the primary mechanism by which a user can tell if a site is
  attempting to impersonate another.</p>

  <p>When a <code><a href=#document>Document</a></code> is created by a <a href=#concept-script title=concept-script>script</a> using
  the <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> or <code title=dom-DOMImplementation-createHTMLDocument><a href=#dom-domimplementation-createhtmldocument>createHTMLDocument()</a></code> APIs, <a href="#the-document's-address">the
  document's address</a> is the same as <a href="#the-document's-address">the document's address</a> of the <a href="#script's-document">script's
  document</a>, and the <code><a href=#document>Document</a></code> is both <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> and
  <a href=#completely-loaded>completely loaded</a> immediately.</p>

  <p><dfn id="the-document's-referrer">The document's referrer</dfn> is an <a href=#absolute-url>absolute URL</a> that can be set when the
  <code><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><a href=#document>Document</a></code> object has a <dfn id=reload-override-flag>reload override flag</dfn> that is originally
  unset. The flag is set by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> and <code title=dom-document-open><a href=#dom-document-open>document.write()</a></code> methods in certain situations. When the flag is
  set, the <code><a href=#document>Document</a></code> also has a <dfn id=reload-override-buffer>reload override buffer</dfn> which is a Unicode
  string that is used as the source of the document when it is reloaded.</p>

  <p>When the user agent is to perform <dfn id=an-overridden-reload>an overridden reload</dfn>, it must act as follows:</p>

  <ol><li><p>Let <var title="">source</var> be the value of the <a href=#browsing-context>browsing context</a>'s
   <a href=#active-document>active document</a>'s <a href=#reload-override-buffer>reload override buffer</a>.</li>

   <li><p>Let <var title="">address</var> be the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active
   document</a>'s <a href="#the-document's-address" title="the document's address">address</a>.</li>

   <li><p><a href=#navigate>Navigate</a><!--DONAV reload after d.open()--> the <a href=#browsing-context>browsing context</a>
   to a resource whose source is <var title="">source</var>, with <a href=#replacement-enabled>replacement enabled</a>.
   When the <a href=#navigate>navigate</a> algorithm creates a <code><a href=#document>Document</a></code> object for this purpose,
   set that <code><a href=#document>Document</a></code>'s <a href=#reload-override-flag>reload override flag</a> and set its <a href=#reload-override-buffer>reload
   override buffer</a> to <var title="">source</var>.</p>

    <p>When it comes time to <a href="#set-the-document's-address">set the document's address</a> in the <a href=#navigate title=navigate>navigation algorithm</a>, use <var title="">address</var> as the
    <a href=#override-url>override URL</a>.</p>

   </li>


  </ol><h4 id=the-document-object><span class=secno>3.1.1 </span>The <code><a href=#document>Document</a></code> object</h4>

  <p>The DOM specification defines a <code title="DOM Document"><a href=#dom-document>Document</a></code> interface, which
  this specification extends significantly:</p>

  <pre class=idl>enum <dfn id=documentreadystate>DocumentReadyState</dfn> { "loading", "interactive", "complete" };

[OverrideBuiltins]
partial /*sealed*/ interface <dfn id=document>Document</dfn> {
  // <a href=#resource-metadata-management>resource metadata management</a>
  [PutForwards=<a href=#dom-url-href title=dom-url-href>href</a>, Unforgeable] readonly attribute <a href=#location>Location</a>? <a href=#dom-document-location title=dom-document-location>location</a>;
           attribute DOMString <a href=#dom-document-domain title=dom-document-domain>domain</a>;
  readonly attribute DOMString <a href=#dom-document-referrer title=dom-document-referrer>referrer</a>;
           attribute DOMString <a href=#dom-document-cookie title=dom-document-cookie>cookie</a>;
  readonly attribute DOMString <a href=#dom-document-lastmodified title=dom-document-lastModified>lastModified</a>;
  readonly attribute <a href=#documentreadystate>DocumentReadyState</a> <a href=#dom-document-readystate title=dom-document-readyState>readyState</a>;

  // <a href=#dom-tree-accessors>DOM tree accessors</a>
  <a href=#dom-document-nameditem title=dom-document-namedItem>getter</a> object (DOMString name);
           attribute DOMString <a href=#document.title title=dom-document-title>title</a>;
           attribute DOMString <a href=#dom-document-dir title=dom-document-dir>dir</a>;
           attribute <a href=#htmlelement>HTMLElement</a>? <a href=#dom-document-body title=dom-document-body>body</a>;
  readonly attribute <a href=#htmlheadelement>HTMLHeadElement</a>? <a href=#dom-document-head title=dom-document-head>head</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-images title=dom-document-images>images</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-embeds title=dom-document-embeds>embeds</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-plugins title=dom-document-plugins>plugins</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-links title=dom-document-links>links</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-forms title=dom-document-forms>forms</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-scripts title=dom-document-scripts>scripts</a>;
  NodeList <a href=#dom-document-getelementsbyname title=dom-document-getElementsByName>getElementsByName</a>(DOMString elementName);
  NodeList <a href=#dom-document-getitems title=dom-document-getItems>getItems</a>(optional DOMString typeNames = ""); // <a href=#microdata>microdata</a>
  readonly attribute <a href=#domelementmap>DOMElementMap</a> <a href=#dom-document-csselementmap title=dom-document-cssElementMap>cssElementMap</a>;
  readonly attribute <a href=#htmlscriptelement>HTMLScriptElement</a>? <a href=#dom-document-currentscript title=dom-document-currentScript>currentScript</a>;

  // <a href=#dynamic-markup-insertion>dynamic markup insertion</a>
  <a href=#document>Document</a> <a href=#dom-document-open title=dom-document-open>open</a>(optional DOMString type = "text/html", optional DOMString replace = "");
  <a href=#windowproxy>WindowProxy</a> <a href=#dom-document-open title=dom-document-open>open</a>(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
  void <a href=#dom-document-close title=dom-document-close>close</a>();
  void <a href=#dom-document-write title=dom-document-write>write</a>(DOMString... text);
  void <a href=#dom-document-writeln title=dom-document-writeln>writeln</a>(DOMString... text);

  // <a href=#editing>user interaction</a>
  readonly attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-document-defaultview title=dom-document-defaultView>defaultView</a>;
  readonly attribute <a href=#element>Element</a>? <a href=#dom-document-activeelement title=dom-document-activeElement>activeElement</a>;
  boolean <a href=#dom-document-hasfocus title=dom-document-hasFocus>hasFocus</a>();
           attribute DOMString <a href=#designMode title=dom-document-designMode>designMode</a>;
  boolean <a href=#execCommand title=dom-document-execCommand>execCommand</a>(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
  boolean <a href=#dom-document-querycommandenabled title=dom-document-queryCommandEnabled>queryCommandEnabled</a>(DOMString commandId);
  boolean <a href=#dom-document-querycommandindeterm title=dom-document-queryCommandIndeterm>queryCommandIndeterm</a>(DOMString commandId);
  boolean <a href=#dom-document-querycommandstate title=dom-document-queryCommandState>queryCommandState</a>(DOMString commandId);
  boolean <a href=#dom-document-querycommandsupported title=dom-document-queryCommandSupported>queryCommandSupported</a>(DOMString commandId);
  DOMString <a href=#dom-document-querycommandvalue title=dom-document-queryCommandValue>queryCommandValue</a>(DOMString commandId);
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-commands title=dom-document-commands>commands</a>;

  // special <a href=#event-handler-idl-attributes>event handler IDL attributes</a> that only apply to Document objects
  [LenientThis] attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onreadystatechange title=handler-onreadystatechange>onreadystatechange</a>;

  // <a href="#Document-partial">also has obsolete members</a>
};
<a href=#document>Document</a> implements <a href=#globaleventhandlers>GlobalEventHandlers</a>;</pre>


<!--ADD-TOPIC:Security-->
  <h4 id=security-document><span class=secno>3.1.2 </span>Security</h4>

  <p id=security>User agents must throw a <code><a href=#securityerror>SecurityError</a></code> exception whenever any
  properties of a <code><a href=#document>Document</a></code> object are accessed when the <a href=#incumbent-script>incumbent script</a>
  has an <a href=#effective-script-origin>effective script origin</a> that is not the <a href=#same-origin title="same origin">same</a>
  as the <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a>.</p>

  <p>When the <a href=#incumbent-script>incumbent script</a>'s <a href=#effective-script-origin>effective script origin</a> is different than
  a <code><a href=#document>Document</a></code> object's <a href=#effective-script-origin>effective script origin</a>, the user agent must act as
  if <!--(redundant since you can't access any anyway) any changes to that <code>Document</code>
  object's properties, getters, setters, etc, were not present, and as if--> all the properties of
  that <code><a href=#document>Document</a></code> object had their [[Enumerable]] attribute set to false.</p>
<!--REMOVE-TOPIC:Security-->



  <h4 id=resource-metadata-management><span class=secno>3.1.3 </span><dfn>Resource metadata management</dfn></h4>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-referrer><a href=#dom-document-referrer>referrer</a></code></dt>
   <dd>

    <p>Returns <a href="#the-document's-address" title="the document's address">the address</a> of the <code><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 title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> link type can be used to block the
    referrer.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-referrer title=dom-document-referrer><code>referrer</code></dfn> attribute must return
  <a href="#the-document's-referrer">the document's referrer</a>.</p>

  </div>

  <p class=note>In the case of HTTP, the <code title=dom-document-referrer><a href=#dom-document-referrer>referrer</a></code> IDL
  attribute will match the <code title=http-referer>Referer</code> (sic) header that was sent when
  <a href=#fetch title=fetch>fetching</a> the current page.</p>

  <p class=note>Typically user agents are configured to not report referrers in the case where the
  referrer uses an encrypted protocol and the current page does not (e.g. when navigating from an
  <code title="">https:</code> page to an <code title="">http:</code> page).</p>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-cookie><a href=#dom-document-cookie>cookie</a></code> [ = <var title="">value</var> ]</dt>
   <dd>

    <p>Returns the HTTP cookies that apply to the <code><a href=#document>Document</a></code>. If there are no cookies or
    cookies can't be applied to this resource, the empty string will be returned.</p>

    <p>Can be set, to add a new cookie to the element's set of HTTP cookies.</p>

    <p>If the contents are <a href=#sandboxed-origin-browsing-context-flag title="sandboxed origin browsing context flag">sandboxed into a
    unique origin</a> (e.g. in an <code><a href=#the-iframe-element>iframe</a></code> with the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute), a <code><a href=#securityerror>SecurityError</a></code> exception
    will be thrown on getting and setting.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-cookie title=dom-document-cookie><code>cookie</code></dfn> attribute represents the cookies
  of the resource identified by <a href="#the-document's-address">the document's address</a>.</p>

  <p>A <code><a href=#document>Document</a></code> object that falls into one of the following conditions is a
  <dfn id=cookie-averse-document-object>cookie-averse <code>Document</code> object</dfn>:</p>

  <ul><li>A <code><a href=#document>Document</a></code> that has no <a href=#browsing-context>browsing context</a>.</li>

   <li>A <code><a href=#document>Document</a></code> whose <a href="#the-document's-address" title="the document's address">address</a> does not
   use a server-based naming authority.</li>

  </ul><!--Other specifications can also define <code>Document</code> objects as being <span
  title="cookie-averse Document object">cookie-averse <code>Document</code> objects</span>.--><p id=sandboxCookies>On getting, if the document is a <a href=#cookie-averse-document-object>cookie-averse <code>Document</code>
  object</a>, then the user agent must return the empty string. Otherwise, if the
  <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a> is not a scheme/host/port tuple, the user agent must
  throw a <code><a href=#securityerror>SecurityError</a></code> exception. Otherwise, the user agent must first <a href=#obtain-the-storage-mutex>obtain
  the storage mutex</a> and then return the cookie-string for <a href="#the-document's-address">the document's address</a>
  for a "non-HTTP" API, decoded using the <a href=#utf-8-decoder>UTF-8 decoder</a>. <a href=#refsCOOKIES>[COOKIES]</a>
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>On setting, if the document is a <a href=#cookie-averse-document-object>cookie-averse <code>Document</code> object</a>, then
  the user agent must do nothing. Otherwise, if the <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a> is
  not a scheme/host/port tuple, the user agent must throw a <code><a href=#securityerror>SecurityError</a></code> exception.
  Otherwise, the user agent must <a href=#obtain-the-storage-mutex>obtain the storage mutex</a> and then act as it would when
  <a href=#receives-a-set-cookie-string title="receives a set-cookie-string">receiving a set-cookie-string</a> for <a href="#the-document's-address">the
  document's address</a> via a "non-HTTP" API, consisting of the new value encoded as UTF-8. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsRFC3629>[RFC3629]</a></p>

  <p class=note>Since the <code title=dom-document-cookie><a href=#dom-document-cookie>cookie</a></code> attribute is accessible
  across frames, the path restrictions on cookies are only a tool to help manage which cookies are
  sent to which parts of the site, and are not in any way a security feature.</p>

  <hr></div>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-lastmodified><a href=#dom-document-lastmodified>lastModified</a></code></dt>
   <dd>
    <p>Returns the date of the last modification to the document, as reported by the server, in the
    form "<code title="">MM/DD/YYYY&nbsp;hh:mm:ss</code>", in the user's local time zone.</p>
    <p>If the last modification date is not known, the current time is returned instead.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-lastmodified title=dom-document-lastModified><code>lastModified</code></dfn> attribute, on
  getting, must return the date and time of the <code><a href=#document>Document</a></code>'s source file's last
  modification, in the user's local time zone, in the following format:</p>

  <ol><li> The month component of the date. </li>

   <li> A U+002F SOLIDUS character (/). </li>

   <li> The day component of the date. </li>

   <li> A U+002F SOLIDUS character (/). </li>

   <li> The year component of the date. </li>

   <li> A U+0020 SPACE character. </li>

   <li> The hours component of the time. </li>

   <li> A U+003A COLON character (:). </li>

   <li> The minutes component of the time. </li>

   <li> A U+003A COLON character (:). </li>

   <li> The seconds component of the time. </li>

  </ol><p>All the numeric components above, other than the year, must be given as two <a href=#ascii-digits>ASCII
  digits</a> representing the number in base ten, zero-padded if necessary. The year must be
  given as the shortest possible string of four or more <a href=#ascii-digits>ASCII digits</a> representing the
  number in base ten, zero-padded if necessary.</p>

  <p>The <code><a href=#document>Document</a></code>'s source file's last modification date and time must be derived from
  relevant features of the networking protocols used, e.g. from the value of the HTTP <code title=http-last-modified>Last-Modified</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></div>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-readyState><a href=#dom-document-readystate>readyState</a></code></dt>
   <dd>
    <p>Returns "<code title="">loading</code>" while the <code><a href=#document>Document</a></code> is loading, "<code title="">interactive</code>" once it is finished parsing but still loading sub-resources, and
    "<code title="">complete</code>" once it has loaded.</p>
    <p>The <code title=event-readystatechange><a href=#event-readystatechange>readystatechange</a></code> event fires on the
    <code><a href=#document>Document</a></code> object when this value changes.</p>
   </dd>

  </dl><div class=impl>

  <p>Each document has a <dfn id=current-document-readiness>current document readiness</dfn>. When a <code><a href=#document>Document</a></code> object
  is created, it must have its <a href=#current-document-readiness>current document readiness</a> set to the string "<code title="">loading</code>" if the document is associated with an <a href=#html-parser>HTML parser</a>, an
  <a href=#xml-parser>XML parser</a>, or an XSLT processor, and to the string "<code title="">complete</code>"
  otherwise. Various algorithms during page loading affect this value. When the value is set, the
  user agent must <a href=#fire-a-simple-event>fire a simple event</a> named <dfn id=event-readystatechange title=event-readystatechange><code>readystatechange</code></dfn> at the <code><a href=#document>Document</a></code>
  object.</p>

  <p>A <code><a href=#document>Document</a></code> is said to have an <dfn id=active-parser>active parser</dfn> if it is associated with an
  <a href=#html-parser>HTML parser</a> or an <a href=#xml-parser>XML parser</a> that has not yet been <a href=#stop-parsing title="stop
  parsing">stopped</a> or <a href=#abort-a-parser title="abort a parser">aborted</a>.</p>

  <p>The <dfn id=dom-document-readystate title=dom-document-readyState><code>readyState</code></dfn> IDL attribute must, on
  getting, return the <a href=#current-document-readiness>current document readiness</a>.</p>

  </div>



  <h4 id=dom-tree-accessors><span class=secno>3.1.4 </span><dfn>DOM tree accessors</dfn></h4>

  <p><dfn id=the-html-element-0>The <code>html</code> element</dfn> of a document is the
  document's root element, if there is one and it's an
  <code><a href=#the-html-element>html</a></code> element, or null otherwise.</p>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-head><a href=#dom-document-head>head</a></code></dt>
   <dd>
    <p>Returns <a href=#the-head-element-0>the <code>head</code> element</a>.</p>
   </dd>

  </dl><p><dfn id=the-head-element-0>The <code>head</code> element</dfn> of a document is the
  first <code><a href=#the-head-element>head</a></code> element that is a child of <a href=#the-html-element-0>the
  <code>html</code> element</a>, if there is one, or null
  otherwise.</p>

  <div class=impl>

  <p>The <dfn id=dom-document-head title=dom-document-head><code>head</code></dfn>
  attribute, on getting, must return <a href=#the-head-element-0>the <code>head</code>
  element</a> of the document (a <code><a href=#the-head-element>head</a></code> element or
  null).</p>

  </div>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-title><a href=#document.title>title</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the document's title, as given by <a href=#the-title-element-0>the
    <code>title</code> element</a>.</p>
    <p>Can be set, to update the document's title. If there is no
    <a href=#the-head-element-0 title="the head element"><code>head</code> element</a>,
    the new value is ignored.</p>
    <p>In SVG documents, the <code>SVGDocument</code> interface's
    <code title=dom-svg-title>title</code> attribute takes
    precedence.</p>
   </dd>

  </dl><p><dfn id=the-title-element-0>The <code>title</code> element</dfn> of a document is the
  first <code><a href=#the-title-element>title</a></code> element in the document (in tree order), if
  there is one, or null otherwise.</p>

  <div class=impl>

  <p>The <dfn id=document.title title=dom-document-title><code>title</code></dfn> attribute must,
  on getting, run the following algorithm:</p>

  <ol><li><p>If the <a href=#root-element>root element</a> is an <code><a href=#svg>svg</a></code>
   element in the "<code title="">http://www.w3.org/2000/svg</code>"
   namespace, and the user agent supports SVG, then return the value
   that would have been returned by the IDL attribute of the same name
   on the <code>SVGDocument</code> interface. <a href=#refsSVG>[SVG]</a></li>

   <li><p>Otherwise, let <var title="">value</var> be a concatenation
   of the data of all the child <code><a href=#text>Text</a></code> nodes of <a href=#the-title-element-0>the
   <code>title</code> element</a>, in <a href=#tree-order>tree order</a>, or
   the empty string if <a href=#the-title-element-0>the <code>title</code> element</a> is
   null.</li>

   <li><p><a href=#strip-and-collapse-whitespace>Strip and collapse whitespace</a> in <var title="">value</var>.</li>

   <li><p>Return <var title="">value</var>.</li>

  </ol><p>On setting, the following algorithm must be run. Mutation events
  must be fired as appropriate.</p>

  <ol><li><p>If the <a href=#root-element>root element</a> is an <code><a href=#svg>svg</a></code>
   element in the "<code title="">http://www.w3.org/2000/svg</code>"
   namespace, and the user agent supports SVG, then the setter must
   act as if it was the setter for the IDL attribute of the same name
   on the <code><a href=#document>Document</a></code> interface defined by the SVG
   specification. Stop the algorithm here. <a href=#refsSVG>[SVG]</a></li>

   <li>If <a href=#the-title-element-0>the <code>title</code> element</a> is null and
   <a href=#the-head-element-0>the <code>head</code> element</a> is null, then the
   attribute must do nothing. Stop the algorithm here.</li>

   <li>If <a href=#the-title-element-0>the <code>title</code> element</a> is null, then a
   new <code><a href=#the-title-element>title</a></code> element must be created and appended to
   <a href=#the-head-element-0>the <code>head</code> element</a>. Let <var title="">element</var> be that element. Otherwise, let <var title="">element</var> be <a href=#the-title-element-0>the <code>title</code>
   element</a>.</li>

   <li>The children of <var title="">element</var> (if any) must all
   be removed.</li>

   <li>A single <code><a href=#text>Text</a></code> node whose data is the new value
   being assigned must be appended to <var title="">element</var>.</li>

  </ol><p>The <code title=dom-document-title><a href=#document.title>title</a></code> IDL attribute
  defined above must replace the attribute of the same name on the
  <code><a href=#document>Document</a></code> interface defined by the SVG specification
  when the user agent supports both HTML and SVG. <a href=#refsSVG>[SVG]</a></p>

  </div>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-body><a href=#dom-document-body>body</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns <a href=#the-body-element-0>the body element</a>.</p>
    <p>Can be set, to replace <a href=#the-body-element-0>the body element</a>.</p>
    <p>If the new value is not a <code><a href=#the-body-element>body</a></code> or <code><a href=#frameset>frameset</a></code> element, this will throw a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
   </dd>

  </dl><p><dfn id=the-body-element-0>The body element</dfn> of a document is the first child of <a href=#the-html-element-0>the <code>html</code>
  element</a> that is either a <code><a href=#the-body-element>body</a></code> element or a <code><a href=#frameset>frameset</a></code> element. If
  there is no such element, it is null.</p>

  <div class=impl>

  <p>The <dfn id=dom-document-body title=dom-document-body><code>body</code></dfn> attribute, on getting, must return
  <a href=#the-body-element-0>the body element</a> of the document (either a <code><a href=#the-body-element>body</a></code> element, a
  <code><a href=#frameset>frameset</a></code> element, or null). On setting, the following algorithm must be run:</p>

  <ol><!-- if changes are requested:
    http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsHTMLDocument.cpp
    search for ::GetBody ::SetBody
    http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/html/HTMLDocument.cpp
    search for ::setBody
    http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/dom/Document.cpp
    search for ::body
   --><li>If the new value is not a <code><a href=#the-body-element>body</a></code> or <code><a href=#frameset>frameset</a></code> element, then throw a
   <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception and abort these steps.</li>

   <li>Otherwise, if the new value is the same as <a href=#the-body-element-0>the body element</a>, do nothing. Abort
   these steps.</li>

   <li>Otherwise, if <a href=#the-body-element-0>the body element</a> is not null, then replace that element with the
   new value in the DOM, as if the root element's <code title="">replaceChild()</code> method had
   been called with the new value and <a href=#the-body-element-0 title="the body element">the incumbent body
   element</a> as its two arguments respectively, then abort these steps.</li>

   <li>Otherwise, if there is no root element, throw a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception
   and abort these steps.</li>

   <li>Otherwise, <a href=#the-body-element-0>the body element</a> is null, but there's a root element. Append
   the new value to the root element.</li>

  </ol></div>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-images><a href=#dom-document-images>images</a></code></dt>
   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-img-element>img</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
   </dd>

   <dt><var title="">document</var> . <code title=dom-document-embeds><a href=#dom-document-embeds>embeds</a></code></dt>
   <dt><var title="">document</var> . <code title=dom-document-plugins><a href=#dom-document-plugins>plugins</a></code></dt>
   <dd>
    <p>Return an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-embed-element>embed</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
   </dd>

   <dt><var title="">document</var> . <code title=dom-document-links><a href=#dom-document-links>links</a></code></dt>
   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements in the <code><a href=#document>Document</a></code> that have <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes.</p>
   </dd>

   <dt><var title="">document</var> . <code title=dom-document-forms><a href=#dom-document-forms>forms</a></code></dt>
   <dd>
    <p>Return an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-form-element>form</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
   </dd>

   <dt><var title="">document</var> . <code title=dom-document-scripts><a href=#dom-document-scripts>scripts</a></code></dt>
   <dd>
    <p>Return an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-script-element>script</a></code> elements in the <code><a href=#document>Document</a></code>.</p>
   </dd>

  </dl><div class=impl>

  <!-- these all return the same object each time because of a rule in
  the collection section -->

  <p>The <dfn id=dom-document-images title=dom-document-images><code>images</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only
  <code><a href=#the-img-element>img</a></code> elements.</p>

  <p>The <dfn id=dom-document-embeds title=dom-document-embeds><code>embeds</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only
  <code><a href=#the-embed-element>embed</a></code> elements.</p>

  <p>The <dfn id=dom-document-plugins title=dom-document-plugins><code>plugins</code></dfn>
  attribute must return the same object as that returned by the <code title=dom-document-embeds><a href=#dom-document-embeds>embeds</a></code> attribute.</p>

  <p>The <dfn id=dom-document-links title=dom-document-links><code>links</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only <code><a href=#the-a-element>a</a></code>
  elements with <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
  attributes and <code><a href=#the-area-element>area</a></code> elements with <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes.</p>

  <p>The <dfn id=dom-document-forms title=dom-document-forms><code>forms</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only
  <code><a href=#the-form-element>form</a></code> elements.</p>

  <p>The <dfn id=dom-document-scripts title=dom-document-scripts><code>scripts</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only
  <code><a href=#the-script-element>script</a></code> elements.</p>

  <hr></div>

  <dl class=domintro><dt><var title="">collection</var> = <var title="">document</var> . <code title=dom-document-getElementsByName><a href=#dom-document-getelementsbyname>getElementsByName</a></code>(<var title="">name</var>)</dt>
   <dd>
    <p>Returns a <code><a href=#nodelist>NodeList</a></code> of elements in the
    <code><a href=#document>Document</a></code> that have a <code title="">name</code>
    attribute with the value <var title="">name</var>.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-getelementsbyname title=dom-document-getElementsByName><code>getElementsByName(<var title="">name</var>)</code></dfn> method takes a string <var title="">name</var>, and must return a <a href=#live>live</a>
  <code><a href=#nodelist>NodeList</a></code> containing all the <a href=#html-elements>HTML elements</a>
  in that document that have a <code title="">name</code> attribute
  whose value is equal to the <var title="">name</var> argument (in a
  <a href=#case-sensitive>case-sensitive</a> manner), in <a href=#tree-order>tree order</a>.
  When the method is invoked on a <code><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><a href=#nodelist>NodeList</a></code> object must be returned.</p>

  </div>

  <hr><dl class=domintro><dt><var title="">element</var> . <code title=dom-document-cssElementMap><a href=#dom-document-csselementmap>cssElementMap</a></code></dt>
   <dd>

    <p>Returns a <code><a href=#domelementmap>DOMElementMap</a></code> object for the
    <code><a href=#document>Document</a></code> representing the current <a href=#css-element-reference-identifier title="CSS
    element reference identifier">CSS element reference
    identifiers</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-csselementmap title=dom-document-cssElementMap><code>cssElementMap</code></dfn> IDL attribute
  allows authors to define <a href=#css-element-reference-identifier title="CSS element reference identifier">CSS element reference
  identifiers</a>, which are used in certain CSS features to override the normal <a href=#concept-id title=concept-id>ID</a>-based mapping. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

  <p>When a <code><a href=#document>Document</a></code> is created, it must be associated with an initially-empty <dfn id=css-id-overrides-list>CSS
  ID overrides list</dfn>, which consists of a list of mappings each of which consists of a string
  name mapped to an <code><a href=#element>Element</a></code> node.</p>

  <p>Each entry in the <a href=#css-id-overrides-list>CSS ID overrides list</a>, while it is in the list and is either
  <a href=#in-a-document title="in a Document">in the <code>Document</code></a> or is an <code><a href=#the-img-element>img</a></code>,
  <code><a href=#the-video-element>video</a></code>, or <code><a href=#the-canvas-element>canvas</a></code> element, defines a <a href=#css-element-reference-identifier>CSS element reference
  identifier</a> mapping the given name to the given <code><a href=#element>Element</a></code>. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

  <p>On getting, the <code title=dom-document-cssElementMap><a href=#dom-document-csselementmap>cssElementMap</a></code> IDL attribute
  must return a <code><a href=#domelementmap>DOMElementMap</a></code> object, associated with the following algorithms, which
  expose the current mappings:</p>

  <dl><dt>The algorithm for getting the list of name-element mappings</dt>

   <dd>

    <p>Return the <code><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list>CSS ID overrides list</a>, maintaining the order
    in which the entries were originally added to the list.</p>

   </dd>

   <dt>The algorithm for mapping a name to a certain element</dt>

   <dd>

    <p>Let <var title="">name</var> be the name passed to the algorithm and <var title="">element</var> be the <code><a href=#element>Element</a></code> passed to the algorithm.</p>

    <p>If <var title="">element</var> is null, run the algorithm for deleting mappings by name,
    passing it <var title="">name</var>.</p>

    <p>Otherwise, if there is an entry in the <code><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list>CSS ID overrides
    list</a> whose name is <var title="">name</var>, replace its current value with <var title="">element</var>.</p>

    <p>Otherwise, add a mapping to the <code><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list>CSS ID overrides list</a>
    whose name is <var title="">name</var> and whose element is <var title="">element</var>.</p>

   </dd>

   <dt>The algorithm for deleting mappings by name</dt>

   <dd>

    <p>If there is an entry in the <code><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list>CSS ID overrides list</a> whose
    name is the name passed to this algorithm, remove it. This also undefines the <a href=#css-element-reference-identifier>CSS element
    reference identifier</a> for that name. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

   </dd>

  </dl><p>The same object must be returned each time.</p>

  </div>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code></dt>
   <dd>

    <p>Returns the <code><a href=#the-script-element>script</a></code> element that is currently executing. In the case of reentrant
    <code><a href=#the-script-element>script</a></code> execution, returns the one that most recently started executing amongst
    those that have not yet finished executing.</p>

    <p>Returns null if the <code><a href=#document>Document</a></code> is not currently executing a <code><a href=#the-script-element>script</a></code>
    element (e.g. because the running script is an event handler, or a timeout).</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-currentscript title=dom-document-currentScript><code>currentScript</code></dfn> attribute, on
  getting, must return the value to which it was most recently initialized. When the
  <code><a href=#document>Document</a></code> is created, the <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> must be initialized to null.</p>

  </div>

  <div class=impl>

  <hr><p id=dom-document-namedItem-which>The <code><a href=#document>Document</a></code> interface <a href=#support-named-properties title="support
  named properties">supports named properties</a>. The <a href=#supported-property-names>supported property names</a> at
  any moment consist of the values of the <code title="">name</code> content attributes of
  all the
    <code><a href=#the-applet-element>applet</a></code>,
    <a href=#exposed>exposed</a> <code><a href=#the-embed-element>embed</a></code>,
    <code><a href=#the-form-element>form</a></code>,
    <code><a href=#the-iframe-element>iframe</a></code>,
    <code><a href=#the-img-element>img</a></code>, and
    <a href=#exposed>exposed</a> <code><a href=#the-object-element>object</a></code>
  elements in the <code><a href=#document>Document</a></code> that have non-empty <code title="">name</code> content
  attributes, and the values of the <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes of all the
    <code><a href=#the-applet-element>applet</a></code> and
    <a href=#exposed>exposed</a> <code><a href=#the-object-element>object</a></code>
  elements in the <code><a href=#document>Document</a></code> that have non-empty <code title=attr-id><a href=#the-id-attribute>id</a></code> content
  attributes, and the values of the <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes of all the
    <code><a href=#the-img-element>img</a></code>
  elements in the <code><a href=#document>Document</a></code> that have both non-empty <code title=attr-name>name</code> content
  attributes and non-empty <code title=attr-id><a href=#the-id-attribute>id</a></code> content attributes. The <a href=#supported-property-names>supported property
  names</a> must be in <a href=#tree-order>tree order</a>, ignoring later duplicates, with values from <code title=attr-id><a href=#the-id-attribute>id</a></code>
  attributes coming before values from <code title="">name</code> attributes when the same element
  contributes both.</p>

  <p>To <a href=#determine-the-value-of-a-named-property>determine the value of a named property</a> <var title="">name</var> when <dfn id=dom-document-nameditem title=dom-document-namedItem>the <code>Document</code> object is indexed for property
  retrieval</dfn>, the user agent must return the value obtained using the following steps:</p>

  <ol><li>

    <p>Let <var title="">elements</var> be the list of <a href=#dom-document-nameditem-filter title=dom-document-namedItem-filter>named elements</a> with the name <var title="">name</var> in the <code><a href=#document>Document</a></code>.

    <p class=note>There will be at least one such element, by definition.<!-- (If there wasn't,
    then this algorithm wouldn't have been invoked by Web IDL.) --></p>

   </li>

   <li>

    <p>If <var title="">elements</var> has only one element, and that element is an
    <code><a href=#the-iframe-element>iframe</a></code> element, then return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#nested-browsing-context>nested
    browsing context</a> represented by that <code><a href=#the-iframe-element>iframe</a></code> element, and abort these
    steps.</p>

   </li>

   <li>

    <p>Otherwise, if <var title="">elements</var> has only one element, return that element and
    abort these steps.</p>

   </li>

   <li>

    <p>Otherwise return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code><a href=#document>Document</a></code> node,
    whose filter matches only <a href=#dom-document-nameditem-filter title=dom-document-namedItem-filter>named elements</a> with
    the name <var title="">name</var>.</p> <!-- the same one each time is returned, because of the
    rule under collections -->

   </li>

  <!--
  Note that this named getter overrides built-in properties, as in:
     http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%20name%3Dbody%3E%3C%2Fiframe%3E%3Cscript%3Ew(document.body)%3C%2Fscript%3E
  This is what the "OverrideBuiltins" bit means in the IDL.
  -->

  </ol><p><dfn id=dom-document-nameditem-filter title=dom-document-nameditem-filter>Named elements</dfn> with the name <var title="">name</var>, for the purposes of the above algorithm, are those that are either:</p>

  <ul><li><code><a href=#the-applet-element>applet</a></code>, <a href=#exposed>exposed</a> <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>,
   <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, or <a href=#exposed>exposed</a> <code><a href=#the-object-element>object</a></code> elements that
   have a <code title=attr-name>name</code> content attribute whose value is <var title="">name</var>, or</li>

   <li><code><a href=#the-applet-element>applet</a></code> or <a href=#exposed>exposed</a> <code><a href=#the-object-element>object</a></code> elements that have an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute whose value is <var title="">name</var>, or</li>

   <li><code><a href=#the-img-element>img</a></code> elements that have an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute
   whose value is <var title="">name</var>, and that have a non-empty <code title=attr-name>name</code>
   content attribute present also.</li>

  </ul><p>An <code><a href=#the-embed-element>embed</a></code> or <code><a href=#the-object-element>object</a></code> element is said to be <dfn id=exposed>exposed</dfn> if it has
  no <a href=#exposed>exposed</a> <code><a href=#the-object-element>object</a></code> ancestor, and, for <code><a href=#the-object-element>object</a></code> elements, is
  additionally either not showing its <a href=#fallback-content>fallback content</a> or has no <code><a href=#the-object-element>object</a></code> or
  <code><a href=#the-embed-element>embed</a></code> descendants.</p>

  </div>

  <hr><p class=note>The <code title=dom-document-dir><a href=#dom-document-dir>dir</a></code> attribute on the
  <code><a href=#document>Document</a></code> interface is defined along with the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
  content attribute.</p>



  <div class=impl> <!-- very deprecated API; use XHR instead -->

  <h4 id=loading-xml-documents><span class=secno>3.1.5 </span>Loading XML documents</h4>

  <pre class=idl>partial interface <dfn id=xmldocument>XMLDocument</dfn> {
<!--SYNCLOAD           attribute boolean <span title="dom-XMLDocument-async">async</span>;
-->  boolean <a href=#dom-xmldocument-load title=dom-XMLDocument-load>load</a>(DOMString url);
};</pre>

  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/576 -->
  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/577 -->
  <!-- http://www.hixie.ch/tests/adhoc/dom/level0/document/load/001.html -->

<!--SYNCLOAD
  <p>The <dfn title="dom-XMLDocument-async"><code>async</code></dfn> attribute must initially be
  true. On getting, it must return its current value. On setting, its current value must be changed
  to the new value.</p>
-->

  <p>The <dfn id=dom-xmldocument-load title=dom-XMLDocument-load><code>load(<var title="">url</var>)</code></dfn> method
  must run the following steps:</p>

  <ol><!--SYNCLOAD
   <li><p>If <code title="dom-XMLDocument-async">async</code> is set to false and the <var
   title="">document</var> is <span>load-blocked</span>, return false and abort these
   steps.</p></li>
--><li><p>Let <var title="">document</var> be the <code><a href=#xmldocument>XMLDocument</a></code> object on which the
   method was invoked.</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the method's first argument, relative to the
   <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>. If this is not
   successful, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. Otherwise, let <var title="">url</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>

   <li><p>If the <a href=#origin>origin</a> of <var title="">url</var> is not the same as the
   <a href=#origin>origin</a> of <var title="">document</var>, throw a <code><a href=#securityerror>SecurityError</a></code> exception
   and abort these steps.</li>

<!--SYNCLOAD
   <li><p>If <code title="dom-XMLDocument-async">async</code> is set to false, let <var
   title="">document</var> be <dfn>load-blocked</dfn>.</p></li>
-->

   <li><p>Remove all child nodes of <var title="">document</var>, without firing any mutation
   events.</li> <!-- as of 2010-07-26, only Opera fired mutation events here. -->

   <li><p>Set the <a href=#current-document-readiness>current document readiness</a> of <var title="">document</var> to "<code title="">loading</code>".</li>

   <li><p><!--SYNCLOAD If <code title="dom-XMLDocument-async">async</code> is set to true, then
   run--> Run the remainder of these steps asynchronously, and return true from the
   method.<!--SYNCLOAD Otherwise, continue running these steps without yet returning.--></li>

   <li><p>Let <var title="">result</var> be a <code><a href=#document>Document</a></code> object.</li>

   <li><p>Let <var title="">success</var> be false.</li>

   <li><p><a href=#fetch>Fetch</a><!--FETCH--> <var title="">url</var> from the <a href=#origin>origin</a> of
   <var title="">document</var>, using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's
   referrer source">referrer source</a>, with the <i title="">synchronous flag</i> set and the <i title="">force same-origin flag</i> set.</li>

   <li>

    <p>If the fetch attempt was successful, and the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a> is an <a href=#xml-mime-type>XML MIME type</a>, then run
    these substeps:</p>

    <ol><li><p>Create a new <a href=#xml-parser>XML parser</a> associated with the <var title="">result</var>
     document.</li>

     <li><p>Pass this parser the fetched document.</li> <!-- no worries about scripts running;
     there's no browsing context for the document so scripts are automatically disabled -->

     <li><p>If there is an XML well-formedness or XML namespace well-formedness error, then remove
     all child nodes from <var title="">result</var>. Otherwise let <var title="">success</var> be
     true.</li>

    </ol></li>

   <li>

    <p><!--SYNCLOAD If <code title="dom-XMLDocument-async">async</code> is set to true, then
    <span>queue--> <a href=#queue-a-task>Queue a task</a> to run the following steps. <!--SYNCLOAD Otherwise, run
    them synchronously.--></p>

    <ol><li><p>Set the <a href=#current-document-readiness>current document readiness</a> of <var title="">document</var> to
     "<code title="">complete</code>".</li>

     <li><p>Replace all the children of <var title="">document</var> by the children of <var title="">result</var> (even if it has no children), firing mutation events as if a
     <code><a href=#documentfragment>DocumentFragment</a></code> containing the new children had been inserted.</li> <!-- as
     of 2010-07-26, both Firefox and Opera fired mutation events here. -->

     <!-- If the document doesn't have no nodes here, at time of writing, Opera would leave the new
     nodes and drop the parsed ones, while Firefox would basically abort instead, failing to fire
     the 'load' event -->

     <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-load>load</code> at <var title="">document</var>.</li>

    </ol></li>
<!--SYNCLOAD
   <li><p>If <code title="dom-XMLDocument-async">async</code> was set to false when this algorithm
   started, let <var title="">document</var> be no longer <span>load-blocked</span>.</p></li>

   <li><p>If <code title="dom-XMLDocument-async">async</code> was set to false when this algorithm
   started, return <var title="">success</var>.</p></li>
-->
  </ol></div>


<!--TOPIC:HTML-->
  <h3 id=elements><span class=secno>3.2 </span>Elements</h3>

  <h4 id=semantics-0><span class=secno>3.2.1 </span>Semantics</h4>

  <p>Elements, attributes, and attribute values in HTML are defined (by this specification) to have
  certain meanings (semantics). For example, the <code><a href=#the-ol-element>ol</a></code> element represents an ordered list,
  and the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute represents the language of the content.</p>

  <p>These definitions allow HTML processors, such as Web browsers or search engines, to present and
  use documents and applications in a wide variety of contexts that the author might not have
  considered.</p>

  <div class=example>

   <p>As a simple example, consider a Web page written by an author who only considered desktop
   computer Web browsers:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;My Page&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;Welcome to my page&lt;/h1&gt;
  &lt;p&gt;I like cars and lorries and have a big Jeep!&lt;/p&gt;
  &lt;h2&gt;Where I live&lt;/h2&gt;
  &lt;p&gt;I live in a small hut on a mountain!&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

   <p>Because HTML conveys <em>meaning</em>, rather than presentation, the same
   page can also be used by a small browser on a mobile phone, without any change to the page.
   Instead of headings being in large letters as on the desktop, for example, the browser on the
   mobile phone might use the same size text for the whole the page, but with the headings in
   bold.</p>

   <p>But it goes further than just differences in screen size: the same page could equally be used
   by a blind user using a browser based around speech synthesis, which instead of displaying the
   page on a screen, reads the page to the user, e.g. using headphones. Instead of large text for
   the headings, the speech browser might use a different volume or a slower voice.</p>

   <p>That's not all, either. Since the browsers know which parts of the page are the headings, they
   can create a document outline that the user can use to quickly navigate around the document,
   using keys for "jump to next heading" or "jump to previous heading". Such features are especially
   common with speech browsers, where users would otherwise find quickly navigating a page quite
   difficult.</p>

   <p>Even beyond browsers, software can make use of this information. Search engines can use the
   headings to more effectively index a page, or to provide quick links to subsections of the page
   from their results. Tools can use the headings to create a table of contents (that is in fact how
   this very specification's table of contents is generated).</p>

   <p>This example has focused on headings, but the same principle applies to all of the semantics
   in HTML.</p>

  </div>

  <p>Authors must not use elements, attributes, or attribute values for purposes other than their
  appropriate intended semantic purpose, as doing so prevents software from correctly processing the
  page.</p>

  <div class=example>

   <p>For example, the following document is non-conforming, despite being syntactically
   correct:</p>

   <pre class=bad>&lt;!DOCTYPE HTML&gt;
&lt;html lang="en-GB"&gt;
 &lt;head&gt; &lt;title&gt; Demonstration &lt;/title&gt; &lt;/head&gt;
 &lt;body&gt;
  &lt;table&gt;
   &lt;tr&gt; &lt;td&gt; My favourite animal is the cat. &lt;/td&gt; &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;
     &mdash;&lt;a href="http://example.org/~ernest/"&gt;&lt;cite&gt;Ernest&lt;/cite&gt;&lt;/a&gt;,
     in an essay from 1992
    &lt;/td&gt;
   &lt;/tr&gt;
  &lt;/table&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

   <p>...because the data placed in the cells is clearly not tabular data (and the <code><a href=#the-cite-element>cite</a></code>
   element mis-used). This would make software that relies on these semantics fail: for example, a
   speech browser that allowed a blind user to navigate tables in the document would report the
   quote above as a table, confusing the user; similarly, a tool that extracted titles of works from
   pages would extract "Ernest" as the title of a work, even though it's actually a person's name,
   not a title.</p>

   <p>A corrected version of this document might be:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html lang="en-GB"&gt;
 &lt;head&gt; &lt;title&gt; Demonstration &lt;/title&gt; &lt;/head&gt;
 &lt;body&gt;
  &lt;blockquote&gt;
   &lt;p&gt; My favourite animal is the cat. &lt;/p&gt;
  &lt;/blockquote&gt;
  &lt;p&gt;
   &mdash;&lt;a href="http://example.org/~ernest/"&gt;Ernest&lt;/a&gt;,
   in an essay from 1992
  &lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>

  <div class=example>

   <p>This next document fragment, intended to represent the heading of a corporate site, is
   similarly non-conforming because the second line is not intended to be a heading of a subsection,
   but merely a subheading or subtitle (a subordinate heading for the same section).</p>

   <pre class=bad>&lt;body&gt;
 &lt;h1&gt;ABC Company&lt;/h1&gt;
 &lt;h2&gt;Leading the way in widget design since 1432&lt;/h2&gt;
 ...</pre>

   <p>The <code><a href=#the-hgroup-element>hgroup</a></code> element is intended for these kinds of situations:</p>

   <pre>&lt;body&gt;
 &lt;hgroup&gt;
  &lt;h1&gt;ABC Company&lt;/h1&gt;
  &lt;h2&gt;Leading the way in widget design since 1432&lt;/h2&gt;
 &lt;/hgroup&gt;
 ...</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>other applicable specifications</a>, as doing so makes it significantly
  harder for the language to be extended in the future.</p>

  <div class=example>

   <p>In the next example, there is a non-conforming attribute value ("carpet") and a non-conforming
   attribute ("texture"), which is not permitted by this specification:</p>

   <pre class=bad>&lt;label&gt;Carpet: &lt;input type="carpet" name="c" texture="deep pile"&gt;&lt;/label&gt;</pre>

   <p>Here would be an alternative and correct way to mark this up:</p>

   <pre>&lt;label&gt;Carpet: &lt;input type="text" class="carpet" name="c" data-texture="deep pile"&gt;&lt;/label&gt;</pre>

  </div>

  <p>Through scripting and using other mechanisms, the values of attributes, text, and indeed the
  entire structure of the document may change dynamically while a user agent is processing it. The
  semantics of a document at an instant in time are those represented by the state of the document
  at that instant in time, and the semantics of a document can therefore change over time. User
  agents <span class=impl>must</span> update their presentation of the document as this
  occurs.</p>

  <p class=example>HTML has a <code><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>



<!--TOPIC:DOM APIs-->
  <h4 id=elements-in-the-dom><span class=secno>3.2.2 </span>Elements in the DOM</h4>

  <p>The nodes representing <a href=#html-elements>HTML elements</a> in the DOM <span class=impl>must</span>
  implement, and expose to scripts, the interfaces listed for them in the relevant sections of this
  specification. This includes <a href=#html-elements>HTML elements</a> in <a href=#xml-documents>XML documents</a>, even when
  those documents are in another context (e.g. inside an XSLT transform).</p>

  <p>Elements in the DOM <dfn id=represents title=represents>represent</dfn> things; that is, they have
  intrinsic <em>meaning</em>, also known as semantics.</p>

  <p class=example>For example, an <code><a href=#the-ol-element>ol</a></code> element represents an ordered list.</p>

  <p>The basic interface, from which all the <a href=#html-elements>HTML elements</a>' interfaces inherit, <span class=impl>and which must be used by elements that have no additional requirements,</span> is
  the <code><a href=#htmlelement>HTMLElement</a></code> interface.</p>

  <pre class=idl>interface <dfn id=htmlelement>HTMLElement</dfn> : <a href=#element>Element</a> {
  // metadata attributes
           attribute DOMString <a href=#dom-title title=dom-title>title</a>;
           attribute DOMString <a href=#dom-lang title=dom-lang>lang</a>;
           attribute boolean <a href=#dom-translate title=dom-translate>translate</a>;
           attribute DOMString <a href=#dom-dir title=dom-dir>dir</a>;
  readonly attribute <a href=#domstringmap>DOMStringMap</a> <a href=#dom-dataset title=dom-dataset>dataset</a>;

  // <a href=#microdata>microdata</a>
           attribute boolean <a href=#dom-itemscope title=dom-itemScope>itemScope</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemtype title=dom-itemType>itemType</a>;
           attribute DOMString <a href=#dom-itemid title=dom-itemId>itemId</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemref title=dom-itemRef>itemRef</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemprop title=dom-itemProp>itemProp</a>;
  readonly attribute <a href=#htmlpropertiescollection>HTMLPropertiesCollection</a> <a href=#dom-properties title=dom-properties>properties</a>;
           attribute any <a href=#dom-itemvalue title=dom-itemValue>itemValue</a>; // acts as DOMString on setting

  // <a href=#editing>user interaction</a>
           attribute boolean <a href=#dom-hidden title=dom-hidden>hidden</a>;
           attribute boolean <a href=#dom-inert title=dom-inert>inert</a>;
  void <a href=#dom-click title=dom-click>click</a>();
           attribute long <a href=#dom-tabindex title=dom-tabindex>tabIndex</a>;
  void <a href=#dom-focus title=dom-focus>focus</a>();
  void <a href=#dom-blur title=dom-blur>blur</a>();
           attribute DOMString <a href=#dom-accesskey title=dom-accessKey>accessKey</a>;
  readonly attribute DOMString <a href=#dom-accesskeylabel title=dom-accessKeyLabel>accessKeyLabel</a>;
           attribute boolean <a href=#dom-draggable title=dom-draggable>draggable</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-dropzone title=dom-dropzone>dropzone</a>;
           attribute DOMString <a href=#dom-contenteditable title=dom-contentEditable>contentEditable</a>;
  readonly attribute boolean <a href=#dom-iscontenteditable title=dom-isContentEditable>isContentEditable</a>;
           attribute <a href=#htmlmenuelement>HTMLMenuElement</a>? <a href=#dom-contextmenu title=dom-contextMenu>contextMenu</a>;
           attribute boolean <a href=#dom-spellcheck title=dom-spellcheck>spellcheck</a>;
  void <a href=#dom-forcespellcheck title=dom-forceSpellCheck>forceSpellCheck</a>();

  // <a href=#command-api>command API</a>
  readonly attribute DOMString? <a href=#dom-command-ro-commandtype title=dom-command-ro-commandType>commandType</a>;
  readonly attribute DOMString? <a href=#dom-command-ro-commandlabel title=dom-command-ro-commandLabel>commandLabel</a>;
  readonly attribute DOMString? <a href=#dom-command-ro-commandicon title=dom-command-ro-commandIcon>commandIcon</a>;
  readonly attribute boolean? <a href=#dom-command-ro-commandhidden title=dom-command-ro-commandHidden>commandHidden</a>;
  readonly attribute boolean? <a href=#dom-command-ro-commanddisabled title=dom-command-ro-commandDisabled>commandDisabled</a>;
  readonly attribute boolean? <a href=#dom-command-ro-commandchecked title=dom-command-ro-commandChecked>commandChecked</a>;<!-- v2COMMAND
  readonly attribute <span>HTMLCollection</span> <span title="dom-command-ro-commandTriggers">commandTriggers</span>;-->
};
<a href=#htmlelement>HTMLElement</a> implements <a href=#globaleventhandlers>GlobalEventHandlers</a>;

interface <dfn id=htmlunknownelement>HTMLUnknownElement</dfn> : <a href=#htmlelement>HTMLElement</a> { };</pre>

  <p>The <code><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>

  <div class=impl>

  <p>The <code><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface must be used for <a href=#html-elements>HTML elements</a> that
  are not defined by this specification (or <a href=#other-applicable-specifications>other applicable specifications</a>).</p>

  </div>


<!--TOPIC:HTML-->
  <h4 id=global-attributes><span class=secno>3.2.3 </span><dfn>Global attributes</dfn></h4>

  <p>The following attributes are common to and may be specified on all <a href=#html-elements>HTML
  elements</a><span class=impl> (even those not defined in this specification)</span>:</p>

  <ul class=brief><li><code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code></li>
   <li><code title=attr-class><a href=#classes>class</a></code></li>
   <li><code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code></li>
   <li><code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code></li>
   <li><code title=attr-dir><a href=#the-dir-attribute>dir</a></code></li>
   <li><code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code></li>
   <li><code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code></li>
   <li><code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code></li>
   <li><code title=attr-id><a href=#the-id-attribute>id</a></code></li>
   <li><code title=attr-inert><a href=#the-inert-attribute>inert</a></code></li>
   <li><code title=attr-itemid><a href=#attr-itemid>itemid</a></code></li>
   <li><code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code></li>
   <li><code title=attr-itemref><a href=#attr-itemref>itemref</a></code></li>
   <li><code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code></li>
   <li><code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code></li>
   <li><code title=attr-lang><a href=#attr-lang>lang</a></code></li>
   <li><code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code></li>
   <li><code title=attr-style><a href=#the-style-attribute>style</a></code></li>
   <li><code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code></li>
   <li><code title=attr-title><a href=#attr-title>title</a></code></li>
   <li><code title=attr-translate><a href=#attr-translate>translate</a></code></li>
  </ul><div class=impl>

  <p>These attributes are only defined by this specification as attributes for <a href=#html-elements>HTML
  elements</a>. When this specification refers to elements having these attributes, elements from
  namespaces that are not defined as having these attributes must not be considered as being
  elements with these attributes.</p>

  <div class=example>

   <p>For example, in the following XML fragment, the "<code title="">bogus</code>" element does not
   have a <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute as defined in this specification, despite
   having an attribute with the literal name "<code title="">dir</code>". Thus, <a href=#the-directionality>the
   directionality</a> of the inner-most <code><a href=#the-span-element>span</a></code> element is '<a href=#concept-rtl title=concept-rtl>rtl</a>', inherited from the <code><a href=#the-div-element>div</a></code> element indirectly through
   the "<code title="">bogus</code>" element.</p>

   <pre class=bad>&lt;div xmlns="http://www.w3.org/1999/html" dir="rtl"&gt;
 &lt;bogus xmlns="http://example.net/ns" dir="ltr"&gt;
  &lt;span xmlns="http://www.w3.org/1999/html"&gt;
  &lt;/span&gt;
 &lt;/bogus&gt;
&lt;/div&gt;</pre>

  </div>

  </div>

  <hr><p>To enable assistive technology products to expose a more fine-grained interface than is
  otherwise possible with HTML elements and attributes, a set of <a href=#wai-aria title=WAI-ARIA>annotations
  for assistive technology products</a> can be specified (the ARIA <code title=attr-aria-role><a href=#attr-aria-role>role</a></code> and <code title=attr-aria-*>aria-*</code> attributes). <a href=#refsARIA>[ARIA]</a></p>

  <hr><p>The following <a href=#event-handler-content-attributes>event handler content attributes</a> may be specified on any <a href=#html-elements title="HTML elements">HTML element</a>:</p>

  <ul class=brief><li><code title=handler-onabort><a href=#handler-onabort>onabort</a></code></li>
   <li><code title=handler-onblur><a href=#handler-onblur>onblur</a></code>*</li>
   <li><code title=handler-oncancel><a href=#handler-oncancel>oncancel</a></code></li>
   <li><code title=handler-oncanplay><a href=#handler-oncanplay>oncanplay</a></code></li>
   <li><code title=handler-oncanplaythrough><a href=#handler-oncanplaythrough>oncanplaythrough</a></code></li>
   <li><code title=handler-onchange><a href=#handler-onchange>onchange</a></code></li>
   <li><code title=handler-onclick><a href=#handler-onclick>onclick</a></code></li>
   <li><code title=handler-onclose><a href=#handler-onclose>onclose</a></code></li>
   <li><code title=handler-oncontextmenu><a href=#handler-oncontextmenu>oncontextmenu</a></code></li>
   <li><code title=handler-oncuechange><a href=#handler-oncuechange>oncuechange</a></code></li>
   <li><code title=handler-ondblclick><a href=#handler-ondblclick>ondblclick</a></code></li>
   <li><code title=handler-ondrag><a href=#handler-ondrag>ondrag</a></code></li>
   <li><code title=handler-ondragend><a href=#handler-ondragend>ondragend</a></code></li>
   <li><code title=handler-ondragenter><a href=#handler-ondragenter>ondragenter</a></code></li>
   <li><code title=handler-ondragexit><a href=#handler-ondragexit>ondragexit</a></code></li>
   <li><code title=handler-ondragleave><a href=#handler-ondragleave>ondragleave</a></code></li>
   <li><code title=handler-ondragover><a href=#handler-ondragover>ondragover</a></code></li>
   <li><code title=handler-ondragstart><a href=#handler-ondragstart>ondragstart</a></code></li>
   <li><code title=handler-ondrop><a href=#handler-ondrop>ondrop</a></code></li>
   <li><code title=handler-ondurationchange><a href=#handler-ondurationchange>ondurationchange</a></code></li>
   <li><code title=handler-onemptied><a href=#handler-onemptied>onemptied</a></code></li>
   <li><code title=handler-onended><a href=#handler-onended>onended</a></code></li>
   <li><code title=handler-onerror><a href=#handler-onerror>onerror</a></code>*</li>
   <li><code title=handler-onfocus><a href=#handler-onfocus>onfocus</a></code>*</li>
   <li><code title=handler-oninput><a href=#handler-oninput>oninput</a></code></li>
   <li><code title=handler-oninvalid><a href=#handler-oninvalid>oninvalid</a></code></li>
   <li><code title=handler-onkeydown><a href=#handler-onkeydown>onkeydown</a></code></li>
   <li><code title=handler-onkeypress><a href=#handler-onkeypress>onkeypress</a></code></li>
   <li><code title=handler-onkeyup><a href=#handler-onkeyup>onkeyup</a></code></li>
   <li><code title=handler-onload><a href=#handler-onload>onload</a></code>*</li>
   <li><code title=handler-onloadeddata><a href=#handler-onloadeddata>onloadeddata</a></code></li>
   <li><code title=handler-onloadedmetadata><a href=#handler-onloadedmetadata>onloadedmetadata</a></code></li>
   <li><code title=handler-onloadstart><a href=#handler-onloadstart>onloadstart</a></code></li>
   <li><code title=handler-onmousedown><a href=#handler-onmousedown>onmousedown</a></code></li>
   <li><code title=handler-onmouseenter><a href=#handler-onmouseenter>onmouseenter</a></code></li>
   <li><code title=handler-onmouseleave><a href=#handler-onmouseleave>onmouseleave</a></code></li>
   <li><code title=handler-onmousemove><a href=#handler-onmousemove>onmousemove</a></code></li>
   <li><code title=handler-onmouseout><a href=#handler-onmouseout>onmouseout</a></code></li>
   <li><code title=handler-onmouseover><a href=#handler-onmouseover>onmouseover</a></code></li>
   <li><code title=handler-onmouseup><a href=#handler-onmouseup>onmouseup</a></code></li>
   <li><code title=handler-onmousewheel><a href=#handler-onmousewheel>onmousewheel</a></code></li>
   <li><code title=handler-onpause><a href=#handler-onpause>onpause</a></code></li>
   <li><code title=handler-onplay><a href=#handler-onplay>onplay</a></code></li>
   <li><code title=handler-onplaying><a href=#handler-onplaying>onplaying</a></code></li>
   <li><code title=handler-onprogress><a href=#handler-onprogress>onprogress</a></code></li>
   <li><code title=handler-onratechange><a href=#handler-onratechange>onratechange</a></code></li>
   <li><code title=handler-onreset><a href=#handler-onreset>onreset</a></code></li>
   <li><code title=handler-onscroll><a href=#handler-onscroll>onscroll</a></code>*</li>
   <li><code title=handler-onseeked><a href=#handler-onseeked>onseeked</a></code></li>
   <li><code title=handler-onseeking><a href=#handler-onseeking>onseeking</a></code></li>
   <li><code title=handler-onselect><a href=#handler-onselect>onselect</a></code></li>
   <li><code title=handler-onshow><a href=#handler-onshow>onshow</a></code></li>
   <li><code title=handler-onsort><a href=#handler-onsort>onsort</a></code></li>
   <li><code title=handler-onstalled><a href=#handler-onstalled>onstalled</a></code></li>
   <li><code title=handler-onsubmit><a href=#handler-onsubmit>onsubmit</a></code></li>
   <li><code title=handler-onsuspend><a href=#handler-onsuspend>onsuspend</a></code></li>
   <li><code title=handler-ontimeupdate><a href=#handler-ontimeupdate>ontimeupdate</a></code></li>
   <li><code title=handler-onvolumechange><a href=#handler-onvolumechange>onvolumechange</a></code></li>
   <li><code title=handler-onwaiting><a href=#handler-onwaiting>onwaiting</a></code></li>
  </ul><p class=note>The attributes marked with an asterisk have a different meaning when specified on
  <code><a href=#the-body-element>body</a></code> elements as those elements expose <a href=#event-handlers>event handlers</a> of the
  <code><a href=#window>Window</a></code> object with the same names.</p>

  <p class=note>While these attributes apply to all elements, they are not useful on all elements.
  For example, only <a href=#media-element title="media element">media elements</a> will ever receive a <code title=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 title="custom data attribute">Custom data attributes</a> (e.g. <code title="">data-foldername</code> or <code title="">data-msgid</code>) can be specified on any <a href=#html-elements title="HTML elements">HTML element</a>, to store custom data specific to the page.</p>

  <hr><p>In <a href=#html-documents>HTML documents</a>, elements in the <a href=#html-namespace-0>HTML namespace</a> may have an <code title="">xmlns</code> attribute specified, if, and only if, it has the exact value
  "<code>http://www.w3.org/1999/xhtml</code>". This does not apply to <a href=#xml-documents>XML
  documents</a>.</p>

  <p class=note>In HTML, the <code title="">xmlns</code> attribute has absolutely no effect. It is
  basically a talisman. It is allowed merely to make migration to and from XHTML mildly easier. When
  parsed by an <a href=#html-parser>HTML parser</a>, the attribute ends up in no namespace, not the
  "<code>http://www.w3.org/2000/xmlns/</code>" namespace like namespace declaration attributes in
  XML do.</p>

  <p class=note>In XML, an <code title="">xmlns</code> attribute is part of the namespace
  declaration mechanism, and an element cannot actually have an <code title="">xmlns</code>
  attribute in no namespace specified.</p>

  <hr><p>The XML specification also allows the use of the <code title=attr-xml-space>xml:space</code>
  attribute in the <a href=#xml-namespace>XML namespace</a> on any element in an <a href=#xml-documents title="XML documents">XML
  document</a>. This attribute has no effect on <a href=#html-elements>HTML elements</a>, as the default
  behavior in HTML is to preserve whitespace. <a href=#refsXML>[XML]</a></p>

  <p class=note>There is no way to serialize the <code title=attr-xml-space>xml:space</code>
  attribute on <a href=#html-elements>HTML elements</a> in the <code><a href=#text/html>text/html</a></code> syntax.</p>


  <h5 id=the-id-attribute><span class=secno>3.2.3.1 </span>The <dfn title=attr-id><code>id</code></dfn> attribute</h5>

  <p>The <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute specifies its element's <a href=#concept-id title=concept-id>unique identifier (ID)</a>. <a href=#refsDOM>[DOM]</a></p>

  <p>The value must be unique amongst all the <a href=#concept-id title=concept-id>IDs</a> in the element's
  <a href=#home-subtree>home subtree</a> and must contain at least one character. The value must not contain any
  <a href=#space-character title="space character">space characters</a>.</p>

  <!-- space characters are disallowed because space-separated lists of IDs otherwise would not be
  able to reach all valid IDs -->

  <p class=note>There are no other restrictions on what form an ID can take; in particular, IDs
  can consist of just digits, start with a digit, start with an underscore, consist of just
  punctuation, etc.</p>

  <p class=note>An element's <a href=#concept-id title=concept-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 fragment
  identifiers, as a way to target an element when scripting, and as a way to style a specific
  element from CSS.</p>

  <div class=impl>

  <p>Identifiers are opaque strings. Particular meanings should not be derived from the value of the
  <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute.</p>

  </div>


  <h5 id=the-title-attribute><span class=secno>3.2.3.2 </span>The <code title=attr-title><a href=#attr-title>title</a></code> attribute</h5>

  <p>The <dfn id=attr-title title=attr-title><code>title</code></dfn> attribute <a href=#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>interactive content</a>,
  it could be a label for, or instructions for, use of the element; and so forth. The value is
  text.</p>

  <!-- search for title-warning if modifying this paragraph -->
  <p class=note>Relying on the <code title=attr-title><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 title=attr-title><a href=#attr-title>title</a></code> attribute of the nearest ancestor <a href=#html-elements title="HTML elements">HTML
  element</a> with a <code title=attr-title><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 title=attr-title><a href=#attr-title>title</a></code> attribute's value contains U+000A LINE FEED (LF)
  characters, the content is split into multiple lines. Each U+000A LINE FEED (LF) character
  represents a line break.</p>

  <div class=example>

   <p>Caution is advised with respect to the use of newlines in <code title=attr-title><a href=#attr-title>title</a></code> attributes.</p>

   <p>For instance, the following snippet actually defines an abbreviation's expansion <em>with a
   line break in it</em>:</p>

   <pre class=bad>&lt;p&gt;My logs show that there was some interest in &lt;abbr title="Hypertext
Transport Protocol"&gt;HTTP&lt;/abbr&gt; today.&lt;/p&gt;</pre> <!-- DO NOT REWRAP THIS LINE -->

  </div>

  <p>Some elements, such as <code><a href=#the-link-element>link</a></code>, <code><a href=#the-abbr-element>abbr</a></code>, and <code><a href=#the-input-element>input</a></code>, define
  additional semantics for the <code title=attr-title><a href=#attr-title>title</a></code> attribute beyond the semantics
  described above.</p> <!-- the other two are <code>style</code> and <code>dfn</code> -->

  <div class=impl>

  <p>The <dfn id=advisory-information>advisory information</dfn> of an element is the value that the following algorithm
  returns, with the algorithm being aborted once a value is returned. When the algorithm returns the
  empty string, then there is no advisory information.</p>

  <ol><li><p>If the element is a <code><a href=#the-link-element>link</a></code>, <code><a href=#the-style-element>style</a></code>, <code><a href=#the-dfn-element>dfn</a></code>,
   <code><a href=#the-abbr-element>abbr</a></code>, or <code><a href=#the-menuitem-element>menuitem</a></code> element, then: if the element has a <code title="">title</code> attribute, <!-- not attr-title --> return the value of that attribute,
   otherwise, return the empty string.</li> <!-- note: <code>input</code> doesn't do this -->

   <li><p>Otherwise, if the element has a <code title=attr-title><a href=#attr-title>title</a></code> attribute, then
   return its value.</li>

   <li><p>Otherwise, if the element has a parent element, then return the parent element's
   <a href=#advisory-information>advisory information</a>.</li>

   <li><p>Otherwise, return the empty string.</li>

  </ol><p>User agents should inform the user when elements have <a href=#advisory-information>advisory information</a>,
  otherwise the information would not be discoverable.</p>

  <hr><p>The <dfn id=dom-title title=dom-title><code>title</code></dfn> IDL attribute must <a href=#reflect>reflect</a> the
  <code title=attr-title><a href=#attr-title>title</a></code> content attribute.</p>

  </div>



  <h5 id=the-lang-and-xml:lang-attributes><span class=secno>3.2.3.3 </span>The <code title=attr-lang><a href=#attr-lang>lang</a></code> and <code title=attr-xml-lang><a href=#attr-xml-lang>xml:lang</a></code> attributes</h5>

  <p>The <dfn id=attr-lang title=attr-lang><code>lang</code></dfn> attribute (in no namespace) specifies the
  primary language for the element's contents and for any of the element's attributes that contain
  text. Its value must be a valid BCP 47 language tag, or the empty string. Setting the attribute to
  the empty string indicates that the primary language is unknown<!-- UA conformance requirements
  for this are below -->. <a href=#refsBCP47>[BCP47]</a></p>

  <p>The <dfn id=attr-xml-lang title=attr-xml-lang><code title="">lang</code></dfn> attribute in the <a href=#xml-namespace>XML
  namespace</a> is defined in XML. <a href=#refsXML>[XML]</a></p>

  <p>If these attributes are omitted from an element, then the language of this element is the same
  as the language of its parent element, if any.</p>

  <p>The <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace may be used on any <a href=#html-elements title="HTML elements">HTML element</a>.</p>

  <p>The <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML
  namespace</span></a> may be used on <a href=#html-elements>HTML elements</a> in <a href=#xml-documents>XML documents</a>,
  as well as elements in other namespaces if the relevant specifications allow it (in particular,
  MathML and SVG allow <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attributes in the
  <span>XML namespace</span></a> to be specified on their elements). If both the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace and the <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML namespace</span></a> are specified on the same
  element, they must have exactly the same value when compared in an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> manner.</p>

  <p>Authors must not use the <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in
  the <span>XML namespace</span></a> on <a href=#html-elements>HTML elements</a> in <a href=#html-documents>HTML
  documents</a>. To ease migration to and from XHTML, authors may specify an attribute in no
  namespace with no prefix and with the literal localname "<code title="">xml:lang</code>" on
  <a href=#html-elements>HTML elements</a> in <a href=#html-documents>HTML documents</a>, but such attributes must only be
  specified if a <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace is also specified,
  and both attributes must have the same value when compared in an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> manner.</p>

  <p class=note>The attribute in no namespace with no prefix and with the literal localname "<code title="">xml:lang</code>" has no effect on language processing.</p>

  <div class=impl>

  <hr><p>To determine the <dfn id=language>language</dfn> of a node, user agents must look at the nearest ancestor
  element (including the element itself if the node is an element) that has a <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML
  namespace</span></a> set or is an <a href=#html-elements title="HTML elements">HTML element</a> and has a
  <code title=attr-lang><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 title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace and the <a href=#attr-xml-lang title=attr-xml-lang><code title="">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 title=attr-xml-lang><code title="">lang</code> attribute in the <span>XML
  namespace</span></a>, and the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute in no namespace
  must be <a href=#ignore title=ignore>ignored</a> for the purposes of determining the element's
  language.</p>

  <p>If neither the node nor any of the node's ancestors, including the <a href=#root-element>root element</a>,
  have either attribute set, but there is a <a href=#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>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 class=example>Thus, for instance, an element with <code title="">lang="xyzzy"</code> would be
  matched by the selector <code title="">:lang(xyzzy)</code> (e.g. in CSS), but it would not be
  matched by <code title="">:lang(abcde)</code>, even though both are equally invalid. Similarly, if
  a Web browser and screen reader working in unison communicated about the language of the element,
  the browser would tell the screen reader that the language was "xyzzy", even if it knew it was
  invalid, just in case the screen reader actually supported a language with that tag after all.
  Even if the screen reader supported both BCP 47 and another syntax for encoding language names,
  and in that other syntax the string "xyzzy" was a way to denote the Belarusian language, it would
  be <em>incorrect</em> for the screen reader to then start treating text as Belarusian, because
  "xyzzy" is not how Belarusian is described in BCP 47 codes (BCP 47 uses the code "be" for
  Belarusian).</p>

  <p>If the resulting value is the empty string, then it must be interpreted as meaning that the
  language of the node is explicitly unknown.</p>

  <hr><p>User agents may use the element's language to determine proper processing or rendering (e.g. in
  the selection of appropriate fonts or pronunciations, for dictionary selection, or for the user
  interfaces of form controls such as date pickers). <!--User agents must not use the element's
  language to determine text directionality. (commented out because text directionality is a
  rendering-level concern.)--></p>

  <!-- Date pickers would use the language information for determining the language of months, for
  example. They should use the page's _locale_ to figure out the format itself, not the language.
  There's currently no way to determine the page's locale except by guessing from the charset and
  language... -->

  <hr><p>The <dfn id=dom-lang title=dom-lang><code>lang</code></dfn> IDL attribute must <a href=#reflect>reflect</a> the
  <code title=attr-lang><a href=#attr-lang>lang</a></code> content attribute in no namespace.</p>

  </div>



  <h5 id=the-translate-attribute><span class=secno>3.2.3.4 </span>The <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute</h5>

  <!-- v2: a way to translate the declensions of the word(s), but keep the actual roots the same
           for examples, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=17954 -->

  <p>The <dfn id=attr-translate title=attr-translate><code>translate</code></dfn> attribute is an <a href=#enumerated-attribute>enumerated
  attribute</a> that is used to specify whether an element's attribute values and the values of
  its <code><a href=#text>Text</a></code> node children are to be translated when the page is localized, or whether to
  leave them unchanged.</p>

  <p>The attribute's keywords are the empty string, <code title="">yes</code>, and <code title="">no</code>. The empty string and the <code title="">yes</code> keyword map to the
  <i>yes</i> state. The <code title="">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>missing value default</i> (and
  the <i>invalid value default</i>).</p>

  <p>Each element (even non-HTML elements) has a <dfn id=translation-mode>translation mode</dfn>, which is in either the
  <a href=#translate-enabled>translate-enabled</a> state or the <a href=#no-translate>no-translate</a> state. If an <a href=#html-elements title="HTML elements">HTML element</a>'s <code title=attr-translate><a href=#attr-translate>translate</a></code>
  attribute is in the <i>yes</i> state, then the element's <a href=#translation-mode>translation mode</a> is in the
  <a href=#translate-enabled>translate-enabled</a> state; otherwise, if the element's <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute is in the <i>no</i> state, then the element's
  <a href=#translation-mode>translation mode</a> is in the <a href=#no-translate>no-translate</a> state. Otherwise, either the
  element's <code title=attr-translate><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 title="HTML elements">HTML element</a> and thus does not have a
  <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute; in either case, the element's
  <a href=#translation-mode>translation mode</a> is in the same state as its parent element's, if any, or in the
  <a href=#translate-enabled>translate-enabled</a> state, if the element is a <a href=#root-element>root element</a>.</p>

  <p>When an element is in the <dfn id=translate-enabled>translate-enabled</dfn> state, the element's <a href=#translatable-attributes>translatable
  attributes</a> and the values of its <code><a href=#text>Text</a></code> node children are to be translated when
  the page is localized.</p>

  <p>When an element is in the <dfn id=no-translate>no-translate</dfn> state, the element's attribute values and the
  values of its <code><a href=#text>Text</a></code> node children are to be left as-is when the page is localized,
  e.g. because the element contains a person's name or a the name of a computer program.</p>

  <p>The following attributes are <dfn id=translatable-attributes>translatable attributes</dfn>:</p>

  <ul class=brief><li><code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code><a href=#the-th-element>th</a></code> elements</li>
   <li><code title="">alt</code> on <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>,
                                    <code title=attr-img-alt><a href=#attr-img-alt>img</a></code>, and
                                    <code title=attr-input-alt><a href=#attr-input-alt>input</a></code> elements</li>
   <li><code title=attr-meta-content><a href=#attr-meta-content>content</a></code> on <code><a href=#the-meta-element>meta</a></code> elements, if the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is known to be translatable</li>
   <li><code title="">download</code> on <code title=attr-a-download>a</code> and
                                         <code title=attr-area-download>area</code> elements</li>
   <li><code title="">label</code> on <code title=attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
                                      <code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>,
                                      <code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
                                      <code title=attr-option-label><a href=#attr-option-label>option</a></code>, and
                                      <code title=attr-track-label><a href=#attr-track-label>track</a></code> elements</li>
   <li><code title=attr-lang><a href=#attr-lang>lang</a></code> on <a href=#html-elements>HTML elements</a>; must be "translated" to match the language used in the translation</li>
   <li><code title="">placeholder</code> on <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
                                            <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements</li>
   <li><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> on <code><a href=#the-iframe-element>iframe</a></code> elements; must be parsed and recursively processed</li>
   <li><code title=attr-style><a href=#the-style-attribute>style</a></code> on <a href=#html-elements>HTML elements</a> elements; must be parsed and recursively processed (e.g. for the values of 'content' properties)</li>
   <li><code title=attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements>HTML elements</a> elements</li>
   <!-- <input value> is excluded since we can't predict if it interferes with server-side processing -->
  </ul><div class=impl>

  <hr><p>The <dfn id=dom-translate title=dom-translate><code>translate</code></dfn> IDL attribute must, on getting,
  return true if the element's <a href=#translation-mode>translation mode</a> is <a href=#translate-enabled>translate-enabled</a>, and
  false otherwise. On setting, it must set the content attribute's value to "<code title="">yes</code>" if the new value is true, and set the content attribute's value to "<code title="">no</code>" otherwise.</p>

  </div>

  <div class=example>

   <p>In this example, everything in the document is to be translated when the page is localized,
   except the sample keyboard input and sample program output:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt; &lt;!-- default on the root element is translate=yes --&gt;
 &lt;head&gt;
  &lt;title&gt;The Bee Game&lt;/title&gt; &lt;!-- implied translate=yes inherited from ancestors --&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;The Bee Game is a text adventure game in English.&lt;/p&gt;
  &lt;p&gt;When the game launches, the first thing you should do is type
  &lt;kbd <strong>translate=no</strong>&gt;eat honey&lt;/kbd&gt;. The game will respond with:&lt;/p&gt;
  &lt;pre&gt;&lt;samp <strong>translate=no</strong>&gt;Yum yum! That was some good honey!&lt;/samp&gt;&lt;/pre&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>



  <h5 id=the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.5 </span>The <dfn title=attr-xml-base><code>xml:base</code></dfn> attribute (XML only)</h5>

  <p>The <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute is defined in XML Base. <a href=#refsXMLBASE>[XMLBASE]</a></p>

  <p>The <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute may be used on <a href=#html-elements>HTML
  elements</a> of <a href=#xml-documents>XML documents</a>. Authors must not use the <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute on <a href=#html-elements>HTML elements</a> in <a href=#html-documents>HTML
  documents</a>.</p>


  <h5 id=the-dir-attribute><span class=secno>3.2.3.6 </span>The <dfn title=attr-dir><code>dir</code></dfn> attribute</h5>

  <p>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute specifies the element's text directionality.
  The attribute is an <a href=#enumerated-attribute>enumerated attribute</a> with the following keywords and states:</p>

  <dl><dt>The <dfn id=attr-dir-ltr title=attr-dir-ltr><code>ltr</code></dfn> keyword, which maps to the <dfn id=attr-dir-ltr-state title=attr-dir-ltr-state>ltr</dfn> state</dt>

   <dd>

    <p>Indicates that the contents of the element are explicitly
    directionally embedded left-to-right text.</p>

   </dd>

   <dt>The <dfn id=attr-dir-rtl title=attr-dir-rtl><code>rtl</code></dfn> keyword, which maps to the <dfn id=attr-dir-rtl-state title=attr-dir-rtl-state>rtl</dfn> state</dt>

   <dd>

    <p>Indicates that the contents of the element are explicitly
    directionally embedded right-to-left text.</p>

   </dd>

   <dt>The <dfn id=attr-dir-auto title=attr-dir-auto><code>auto</code></dfn> keyword, which maps to the <dfn id=attr-dir-auto-state title=attr-dir-auto-state>auto</dfn> state</dt>

   <dd>

    <p>Indicates that the contents of the element are explicitly embedded text, but that the
    direction is to be determined programmatically using the contents of the element (as described
    below).</p>

    <p class=note>The heuristic used by this state is very crude (it just looks at the first
    character with a strong directionality, in a manner analogous to the Paragraph Level
    determination in the bidirectional algorithm). Authors are urged to only use this value as a
    last resort when the direction of the text is truly unknown and no better server-side heuristic
    can be applied. <a href=#refsBIDI>[BIDI]</a></p>

    <p class=note>For <code><a href=#the-textarea-element>textarea</a></code> and <code><a href=#the-pre-element>pre</a></code> elements, the heuristic is
    applied on a per-paragraph level.</p>

   </dd>

  </dl><p>The attribute has no <i>invalid value default</i> and no <i>missing value default</i>.</p>

  <hr><p><dfn id=the-directionality>The directionality</dfn> of an element (any element, not just an <a href=#html-elements title="HTML
  elements">HTML element</a>) is either '<dfn id=concept-ltr title=concept-ltr>ltr</dfn>' or '<dfn id=concept-rtl title=concept-rtl>rtl</dfn>', and is determined as per the first appropriate set of steps from
  the following list:</p>

  <dl class=switch><dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-ltr-state title=attr-dir-ltr-state>ltr</a> state</dt>

   <dt>If the element is a <a href=#root-element>root element</a> and the <code title=attr-dir><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>

   <dt>If the element is an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a> state, and the <code title=attr-dir><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>

   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>


   <dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-rtl-state title=attr-dir-rtl-state>rtl</a> state</dt>

   <dd><p><a href=#the-directionality>The directionality</a> of the element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</dd>

   <dt>If the element is an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>,
   <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a>, <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>,
   or <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> state, and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state title=attr-dir-auto-state>auto</a>
   state</dt>

   <dt>If the element is a <code><a href=#the-textarea-element>textarea</a></code> element and the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
   attribute is in the <a href=#attr-dir-auto-state title=attr-dir-auto-state>auto</a> state</dt>

   <dd>

    <p>If the element's <a href=#concept-fe-value title=concept-fe-value>value</a> contains a character of
    bidirectional character type AL or R, and there is no character of bidirectional character type
    L anywhere before it in the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, then
    <a href=#the-directionality>the directionality</a> of the element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'. <a href=#refsBIDI>[BIDI]</a></p>

    <p>Otherwise, if the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is not the empty
    string, or if the element is a <a href=#root-element>root element</a>, <a href=#the-directionality>the directionality</a> of the
    element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

    <p>Otherwise, <a href=#the-directionality>the directionality</a> of the element is the same as the element's parent
    element's <a href=#the-directionality title="the directionality">directionality</a>.</p>

   </dd>



   <dt>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state title=attr-dir-auto-state>auto</a> state</dt>

   <dt>If the element is a <code><a href=#the-bdi-element>bdi</a></code> element and the <code title=attr-dir><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>

   <dd>

    <p>Find the first character in <a href=#tree-order>tree order</a> that matches the following criteria:</p>

    <ul><li><p>The character is from a <code><a href=#text>Text</a></code> node that is a descendant of the element whose
     <a href=#the-directionality title="the directionality">directionality</a> is being determined.</li>

     <li><p>The character is of bidirectional character type L, AL, or R. <a href=#refsBIDI>[BIDI]</a></li>

     <li>

      <p>The character is not in a <code><a href=#text>Text</a></code> node that has an ancestor element that is a
      descendant of the element whose <a href=#the-directionality title="the directionality">directionality</a> is
      being determined and that is either:</p>

      <ul class=brief><li>A <code><a href=#the-bdi-element>bdi</a></code> element.
       <li>A <code><a href=#the-script-element>script</a></code> element.
       <li>A <code><a href=#the-style-element>style</a></code> element.
       <li>A <code><a href=#the-textarea-element>textarea</a></code> element.
       <li>An element with a <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute in a defined state.
      </ul></li>

    </ul><p>If such a character is found and it is of bidirectional character type AL or R, <a href=#the-directionality>the
    directionality</a> of the element is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>

    <p>If such a character is found and it is of bidirectional character type L, <a href=#the-directionality>the
    directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

    <p>Otherwise, if the element is empty and is not a <a href=#root-element>root element</a>, <a href=#the-directionality>the
    directionality</a> of the element is the same as the element's parent element's <a href=#the-directionality title="the directionality">directionality</a>.</p>

    <p>Otherwise, <a href=#the-directionality>the directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

   </dd>


   <dt>If the element has a parent element and the <code title=attr-dir><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>

   <dd><p><a href=#the-directionality>The directionality</a> of the element is the same as the element's parent
   element's <a href=#the-directionality title="the directionality">directionality</a>.</dd>


  </dl><p class=note>Since the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is only defined for
  <a href=#html-elements>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 title="the
  directionality">directionality</a> from their parent element, or, if they don't have one,
  default to '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

  <hr><p>The <dfn id=directionality-of-the-attribute title="directionality of the attribute">directionality of an attribute</dfn> of an
  <a href=#html-elements title="HTML elements">HTML element</a>, which is used when the text of that attribute is
  to be included in the rendering in some manner, is determined as per the first appropriate set of
  steps from the following list:</p>

  <dl class=switch><dt>If the attribute is a <a href=#directionality-capable-attribute>directionality-capable attribute</a> and the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state title=attr-dir-auto-state>auto</a>
   state</dt>

   <dd>

    <p>Find the first character (in logical order) of the attribute's value that is of bidirectional
    character type L, AL, or R. <a href=#refsBIDI>[BIDI]</a></p>

    <p>If such a character is found and it is of bidirectional character type AL or R, the
    <a href=#directionality-of-the-attribute>directionality of the attribute</a> is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>

    <p>Otherwise, the <a href=#directionality-of-the-attribute>directionality of the attribute</a> is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

   </dd>

   <dt>Otherwise</dt>

   <dd>The <a href=#directionality-of-the-attribute>directionality of the attribute</a> is the same as <a href=#the-directionality title="the
   directionality">the element's directionality</a>.</dd>

  </dl><p>The following attributes are <dfn id=directionality-capable-attribute title="directionality-capable
  attribute">directionality-capable attributes</dfn>:</p>

  <ul class=brief><li><code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code><a href=#the-th-element>th</a></code> elements</li>
   <li><code title="">alt</code> on <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>,
                                    <code title=attr-img-alt><a href=#attr-img-alt>img</a></code>, and
                                    <code title=attr-input-alt><a href=#attr-input-alt>input</a></code> elements</li>
   <li><code title=attr-meta-content><a href=#attr-meta-content>content</a></code> on <code><a href=#the-meta-element>meta</a></code> elements, if the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is primarily intended to be human-readable rather than machine-readable</li>
   <li><code title="">label</code> on <code title=attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
                                      <code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>,
                                      <code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
                                      <code title=attr-option-label><a href=#attr-option-label>option</a></code>, and
                                      <code title=attr-track-label><a href=#attr-track-label>track</a></code> elements</li>
   <li><code title="">placeholder</code> on <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
                                            <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements</li>
   <li><code title=attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements>HTML elements</a> elements</li>
  </ul><hr><p>The effect of this attribute is primarily on the presentation layer. For example, the rendering
  section in this specification defines a mapping from this attribute to the CSS 'direction' and
  'unicode-bidi' properties, and CSS defines rendering in terms of those properties.</p>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-dir><a href=#dom-dir>dir</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns <a href=#the-html-element-0>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value, if any.</p>
    <p>Can be set, to either "<code title="">ltr</code>", "<code title="">rtl</code>", or "<code title="">auto</code>" to replace <a href=#the-html-element-0>the <code>html</code> element</a>'s <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
    <p>If there is no <a href=#the-html-element-0 title="the html element"><code>html</code> element</a>, returns the empty string and ignores new values.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-dir title=dom-dir><code>dir</code></dfn> IDL attribute on an element must
  <a href=#reflect>reflect</a> the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> content attribute of that element,
  <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <dfn id=dom-document-dir title=dom-document-dir><code>dir</code></dfn> IDL attribute on <code><a href=#document>Document</a></code>
  objects must <a href=#reflect>reflect</a> the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> content attribute of
  <a href=#the-html-element-0>the <code>html</code> element</a>, if any, <a href=#limited-to-only-known-values>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>

  </div>

  <p class=note>Authors are strongly encouraged to use the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
  attribute to indicate text direction rather than using CSS, since that way their documents will
  continue to render correctly even in the absence of CSS (e.g. as interpreted by search
  engines).</p>

  <div class=example>

   <p>This markup fragment is of an IM conversation.</p>

   <pre>&lt;p dir=auto class="u1"&gt;&lt;b&gt;&lt;bdi&gt;Student&lt;/bdi&gt;:&lt;/b&gt; How do you write "What's your name?" in Arabic?&lt;/p&gt;
&lt;p dir=auto class="u2"&gt;&lt;b&gt;&lt;bdi&gt;Teacher&lt;/bdi&gt;:&lt;/b&gt; &#x645;&#x627; &#x627;&#x633;&#x645;&#x643;&#x61f;&lt;/p&gt;
&lt;p dir=auto class="u1"&gt;&lt;b&gt;&lt;bdi&gt;Student&lt;/bdi&gt;:&lt;/b&gt; Thanks.&lt;/p&gt;
&lt;p dir=auto class="u2"&gt;&lt;b&gt;&lt;bdi&gt;Teacher&lt;/bdi&gt;:&lt;/b&gt; That's written "&#x634;&#x643;&#x631;&#x64b;&#x627;".&lt;/p&gt;
&lt;p dir=auto class="u2"&gt;&lt;b&gt;&lt;bdi&gt;Teacher&lt;/bdi&gt;:&lt;/b&gt; Do you know how to write "Please"?&lt;/p&gt;
&lt;p dir=auto class="u1"&gt;&lt;b&gt;&lt;bdi&gt;Student&lt;/bdi&gt;:&lt;/b&gt; "&#x645;&#x646; &#x641;&#x636;&#x644;&#x643;", right?&lt;/p&gt;</pre>

<!--
<!DOCTYPE html>
<style>
 div { border: groove #FFFF99; padding: 0.25em; width: 22em; background: #FFFFEE; color: black; }
 p { margin: 0.25em 0; font: 1em/1 InaiMathi; color: purple; }
 .u1 { color: teal; }
</style>
<div>
<p dir=ltr class="u1"><b><bdi>Student</bdi>:</b> How do you write "What's your name?" in Arabic?</p>
<p dir=rtl class="u2"><b><bdi>Teacher</bdi>:</b> &#x645;&#x627; &#x627;&#x633;&#x645;&#x643;&#x61f;</p>
<p dir=ltr class="u1"><b><bdi>Student</bdi>:</b> Thanks.</p>
<p dir=ltr class="u2"><b><bdi>Teacher</bdi>:</b> That's written "&#x634;&#x643;&#x631;&#x64b;&#x627;".</p>
<p dir=ltr class="u2"><b><bdi>Teacher</bdi>:</b> Do you know how to write "Please"?</p>
<p dir=rtl class="u1"><b><bdi>Student</bdi>:</b> "&#x645;&#x646; &#x641;&#x636;&#x644;&#x643;", right?</p>
-->

   <p>Given a suitable style sheet and the default alignment styles for the <code><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 src=http://images.whatwg.org/im.png width=366 alt="Each paragraph rendered as a separate block, with the paragraphs left-aligned except the second paragraph and the last one, which would  be right aligned, with the usernames ('Student' and 'Teacher' in this example) flush right, with a colon to their left, and the text first to the left of that." height=157></p>

   <p>As noted earlier, the <code title=attr-dir-auto><a href=#attr-dir-auto>auto</a></code> value is not a panacea. The
   final paragraph in this example is misinterpreted as being right-to-left text, since it begins
   with an Arabic character, which causes the "right?" to be to the left of the Arabic text.</p>

  </div>



  <h5 id=classes><span class=secno>3.2.3.7 </span>The <dfn title=attr-class><code>class</code></dfn> attribute</h5>

  <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have a <code title=attr-class><a href=#classes>class</a></code> attribute specified.</p>

  <p>The attribute, if specified, must have a value that is a <a href=#set-of-space-separated-tokens>set of space-separated
  tokens</a> representing the various classes that the element belongs to.</p>

  <div class=impl>

  <p>The classes that an <a href=#html-elements title="HTML elements">HTML element</a> has assigned to it consists
  of all the classes returned when the value of the <code title=attr-class><a href=#classes>class</a></code> attribute
  is <a href=#split-a-string-on-spaces title="split a string on spaces">split on spaces</a>. (Duplicates are ignored.)</p>

  </div>

  <p class=note>Assigning classes to an element affects class matching in selectors in CSS, the
  <code title=dom-document-getElementsByClassName>getElementsByClassName()</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 title=attr-class><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 class=impl>

  <hr><p class=note>The <dfn id=dom-classname title=dom-className><code>className</code></dfn> and <dfn id=dom-classlist title=dom-classList><code>classList</code></dfn> IDL attributes, defined in the DOM
  specification, <a href=#reflect>reflect</a> the <code title=attr-class><a href=#classes>class</a></code> content attribute.
  <a href=#refsDOM>[DOM]</a></p>

  </div>



  <h5 id=the-style-attribute><span class=secno>3.2.3.8 </span>The <dfn title=attr-style><code>style</code></dfn> attribute</h5>

  <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-style><a href=#the-style-attribute>style</a></code> content
  attribute set. This is a <a href=#css-styling-attribute>CSS styling attribute</a> as defined by the CSS Styling
  Attribute Syntax specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>

  <div class=impl>

  <p>In user agents that support CSS, the attribute's value must be parsed when the attribute is
  added or has its value changed<!-- so dynamic changes to the base URL don't affect the CSS -->,
  according to the rules given for <a href=#css-styling-attribute title="CSS styling attribute">CSS styling
  attributes</a>. <a href=#refsCSSATTR>[CSSATTR]</a></p>

  </div>

  <p>Documents that use <code title=attr-style><a href=#the-style-attribute>style</a></code> attributes on any of their elements
  must still be comprehensible and usable if those attributes were removed.</p>

  <p class=note>In particular, using the <code title=attr-style><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 title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>
  attribute.)</p>

  <hr><dl class=domintro><dt><var title="">element</var> . <code title=dom-style><a href=#dom-style>style</a></code></dt>
   <dd>
    <p>Returns a <code><a href=#cssstyledeclaration>CSSStyleDeclaration</a></code> object for the element's <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-style title=dom-style><code>style</code></dfn> IDL attribute is defined in the CSS Object
  Model (CSSOM) specification. <a href=#refsCSSOM>[CSSOM]</a></p>

  </div>

  <div class=example>

   <p>In the following example, the words that refer to colors are marked up using the
   <code><a href=#the-span-element>span</a></code> element and the <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute to make those
   words show up in the relevant colors in visual media.</p>

   <pre>&lt;p&gt;My sweat suit is &lt;span style="color: green; background:
transparent"&gt;green&lt;/span&gt; and my eyes are &lt;span style="color: blue;
background: transparent"&gt;blue&lt;/span&gt;.&lt;/p&gt;</pre>

  </div>



  <h5 id=embedding-custom-non-visible-data-with-the-data-*-attributes><span class=secno>3.2.3.9 </span><dfn>Embedding custom non-visible data</dfn> with the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes</h5>

  <p>A <dfn id=custom-data-attribute>custom data attribute</dfn> is an attribute in no namespace whose name starts with the
  string "<dfn id=attr-data-* title=attr-data-*><code>data-</code></dfn>", has at least one character after the
  hyphen, is <a href=#xml-compatible>XML-compatible</a>, and contains no <a href=#uppercase-ascii-letters>uppercase ASCII letters</a>.</p>

  <p class=note>All attribute names on <a href=#html-elements>HTML elements</a> in <a href=#html-documents>HTML documents</a>
  get ASCII-lowercased automatically, so the restriction on ASCII uppercase letters doesn't affect
  such documents.</p>

  <p><a href=#custom-data-attribute title="custom data attribute">Custom data attributes</a> are intended to store custom
  data private to the page or application, for which there are no more appropriate attributes or
  elements.</p>

  <p>These attributes are not intended for use by software that is independent of the site that uses
  the attributes.</p>

  <div class=example>

   <p>For instance, a site about music could annotate list items representing tracks in an album
   with custom data attributes containing the length of each track. This information could then be
   used by the site itself to allow the user to sort the list by track length, or to filter the list
   for tracks of certain lengths.</p>

   <pre>&lt;ol&gt;
 &lt;li data-length="2m11s"&gt;Beyond The Sea&lt;/li&gt;
 ...
&lt;/ol&gt;</pre>

   <p>It would be inappropriate, however, for the user to use generic software not associated with
   that music site to search for tracks of a certain length by looking at this data.</p>

   <p>This is because these attributes are intended for use by the site's own scripts, and are not a
   generic extension mechanism for publicly-usable metadata.</p>

  </div>

  <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have any number of <a href=#custom-data-attribute title="custom data attribute">custom data attributes</a> specified, with any value.</p>

  <hr><dl class=domintro><dt><var title="">element</var> . <code title=dom-dataset><a href=#dom-dataset>dataset</a></code></dt>
   <dd>

    <p>Returns a <code><a href=#domstringmap>DOMStringMap</a></code> object for the element's <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes.</p>

    <p>Hyphenated names become camel-cased. For example, <code title="">data-foo-bar=""</code>
    becomes <code title="">element.dataset.fooBar</code>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-dataset title=dom-dataset><code>dataset</code></dfn> IDL attribute provides convenient
  accessors for all the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes on an element. On
  getting, the <code title=dom-dataset><a href=#dom-dataset>dataset</a></code> IDL attribute must return a
  <code><a href=#domstringmap>DOMStringMap</a></code> object, associated with the following algorithms, which expose these
  attributes on their element:</p>

  <dl><dt>The algorithm for getting the list of name-value pairs</dt>

   <dd>
    <ol><li>Let <var title="">list</var> be an empty list of name-value
     pairs.</li>

     <li>For each content attribute on the element whose first five characters are the string "<code title="">data-</code>" and whose remaining characters (if any) do not include any
     <a href=#uppercase-ascii-letters>uppercase ASCII letters</a>, in the order that those attributes are listed in the
     element's <span>attributes list</span>, add a name-value pair to <var title="">list</var> whose
     name is the attribute's name with the first five characters removed and whose value is the
     attribute's value.</li>

     <li>For each name <var title="">list</var>, for each U+002D HYPHEN-MINUS character (-) in the
     name that is followed by a <a href=#lowercase-ascii-letters title="lowercase ASCII letters">lowercase ASCII letter</a>,
     remove the U+002D HYPHEN-MINUS character (-) and replace the character that followed it by the
     same character <a href=#converted-to-ascii-uppercase>converted to ASCII uppercase</a>.</li>

     <li>Return <var title="">list</var>.</li>

    </ol></dd>

   <dt>The algorithm for setting names to certain values</dt>

   <dd>
    <ol><li>Let <var title="">name</var> be the name passed to the algorithm.</li>

     <li>Let <var title="">value</var> be the value passed to the algorithm.</li>

     <li>If <var title="">name</var> contains a U+002D HYPHEN-MINUS character (-) followed by a
     <a href=#lowercase-ascii-letters title="lowercase ASCII letters">lowercase ASCII letter</a>, throw a
     <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>

     <li>For each <a href=#uppercase-ascii-letters title="uppercase ASCII letters">uppercase ASCII letter</a> in <var title="">name</var>, insert a U+002D HYPHEN-MINUS character (-) before the character and
     replace the character with the same character <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>

     <li>Insert the string <code title="">data-</code> at the front of <var title="">name</var>.</li>

     <li>Set the value of the attribute with the name <var title="">name</var>, to the value <var title="">value</var>, replacing any previous value if the attribute already existed. If <code title="">setAttribute()</code> would have thrown an exception when setting an attribute with
     the name <var title="">name</var>, then this must throw the same exception.</li>

    </ol></dd>

   <dt>The algorithm for deleting names</dt>

   <dd>
    <ol><li>Let <var title="">name</var> be the name passed to the algorithm.</li>

<!--(can't happen while the DOMStringMap deleter has no name)
     <li>If <var title="">name</var> contains a U+002D HYPHEN-MINUS character (-) followed by a
     <span title="lowercase ASCII letters">lowercase ASCII letter</span>, throw a
     <code>SyntaxError</code> exception and abort these steps.</li>
-->

     <li>For each <a href=#uppercase-ascii-letters title="uppercase ASCII letters">uppercase ASCII letter</a> in <var title="">name</var>, insert a U+002D HYPHEN-MINUS character (-) before the character and
     replace the character with the same character <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>

     <li>Insert the string <code title="">data-</code> at the front of <var title="">name</var>.</li>

     <li>Remove the attribute with the name <var title="">name</var>, if such an attribute exists.
     Do nothing otherwise.</li>

    </ol></dd>

  </dl><p>The same object must be returned each time.</p>

  </div>

  <div class=example>

   <p>If a Web page wanted an element to represent a space ship, e.g. as part of a game, it would
   have to use the <code title=attr-class><a href=#classes>class</a></code> attribute along with <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes:</p>

   <pre>&lt;div class="spaceship" data-ship-id="92432"
     data-weapons="laser 2" data-shields="50%"
     data-x="30" data-y="10" data-z="90"&gt;
 &lt;button class="fire"
         onclick="spaceships[this.parentNode.dataset.shipId].fire()"&gt;
  Fire
 &lt;/button&gt;
&lt;/div&gt;</pre>

   <p>Notice how the hyphenated attribute name becomes camel-cased in the API.</p>

  </div>

  <p>Authors should carefully design such extensions so that when the attributes are ignored and any
  associated CSS dropped, the page is still usable.</p>

  <div class=impl>

  <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>

  </div>

  <p>JavaScript libraries may use the <a href=#custom-data-attribute title="custom data attribute">custom data
  attributes</a>, as they are considered to be part of the page on which they are used. Authors
  of libraries that are reused by many authors are encouraged to include their name in the attribute
  names, to reduce the risk of clashes. Where it makes sense, library authors are also encouraged to
  make the exact name used in the attribute names customizable, so that libraries whose authors
  unknowingly picked the same name can be used on the same page, and so that multiple versions of a
  particular library can be used on the same page even when those versions are not mutually
  compatible.</p>

  <div class=example>

   <p>For example, a library called "DoQuery" could use attribute names like <code title="">data-doquery-range</code>, and a library called "jJo" could use attributes names like
   <code title="">data-jjo-range</code>. The jJo library could also provide an API to set which
   prefix to use (e.g. <code title="">J.setDataPrefix('j2')</code>, making the attributes have names
   like <code title="">data-j2-range</code>).</p>

  </div>


  <h4 id=element-definitions><span class=secno>3.2.4 </span>Element definitions</h4>

  <p>Each element in this specification has a definition that includes the following
  information:</p>

  <dl><dt><dfn id=element-dfn-categories title=element-dfn-categories>Categories</dfn></dt>

   <dd><p>A list of <a href=#content-categories title="content categories">categories</a> to which the element belongs.
   These are used when defining the <a href=#content-models>content models</a> for each element.</dd>


   <dt><dfn id=element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</dfn></dt>

   <dd>

    <p>A <em>non-normative</em> description of where the element can be used. This information is
    redundant with the content models of elements that allow this one as a child, and is provided
    only as a convenience.</p>

    <p class=note>For simplicity, only the most specific expectations are listed. For example, an
    element that is both <a href=#flow-content>flow content</a> and <a href=#phrasing-content>phrasing content</a> can be used
    anywhere that either <a href=#flow-content>flow content</a> or <a href=#phrasing-content>phrasing content</a> is expected, but
    since anywhere that <a href=#flow-content>flow content</a> is expected, <a href=#phrasing-content>phrasing content</a> is also
    expected (since all <a href=#phrasing-content>phrasing content</a> is <a href=#flow-content>flow content</a>), only "where
    <a href=#phrasing-content>phrasing content</a> is expected" will be listed.</p>

   </dd>


   <dt><dfn id=element-dfn-content-model title=element-dfn-content-model>Content model</dfn></dt>

   <dd><p>A normative description of what content must be included as children and descendants of
   the element.</dd>


   <dt><dfn id=element-dfn-tag-omission title=element-dfn-tag-omission>Tag omission in text/html</dfn></dt>

   <dd><p>A <em>non-normative</em> description of whether, in the <code><a href=#text/html>text/html</a></code> syntax, the
   <a href=#syntax-start-tag title=syntax-start-tag>start</a> and <a href=#syntax-end-tag title=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 title=syntax-tag-omission>optional tags</a> section, and is provided in the element
   definitions only as a convenience.</dd>


   <dt><dfn id=element-dfn-attributes title=element-dfn-attributes>Content attributes</dfn></dt>

   <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.)</dd>


   <dt><dfn id=element-dfn-dom title=element-dfn-dom>DOM interface</dfn></dt>

   <dd><p>A normative definition of a DOM interface that such elements must implement.</dd>

  </dl><p>This is then followed by a description of what the element <a href=#represents>represents</a>, along with
  any additional normative conformance criteria that may apply to authors<span class=impl title=""> and implementations</span>. Examples are sometimes also included.</p>


  <h5 id=attributes><span class=secno>3.2.4.1 </span>Attributes</h5>

  <p id=attribute-text>Except where otherwise specified, attributes on <a href=#html-elements>HTML elements</a>
  may have any string value, including the empty string. Except where explicitly stated, there is no
  restriction on what text can be specified in such attributes.</p>



  <h4 id=content-models><span class=secno>3.2.5 </span><dfn>Content models</dfn></h4>

  <p>Each element defined in this specification has a content model: a description of the element's
  expected <a href=#concept-html-contents title=concept-html-contents>contents</a>. An <a href=#html-elements title="HTML elements">HTML
  element</a> must have contents that match the requirements described in the element's content
  model. The <dfn id=concept-html-contents title=concept-html-contents>contents</dfn> of an element are its children in the
  DOM, except for <code><a href=#the-template-element>template</a></code> elements, where the children are those in the <a href=#template-contents>template
  contents</a> (a separate <code><a href=#documentfragment>DocumentFragment</a></code> assigned to the element when the element
  is created).</p>

  <p>The <a href=#space-character title="space character">space characters</a> are always allowed between elements.
  User agents represent these characters between elements in the source markup as <code><a href=#text>Text</a></code>
  nodes in the DOM.<!-- not a conf criteria since the parser now requires this --> Empty
  <code><a href=#text>Text</a></code> nodes and <code><a href=#text>Text</a></code> nodes consisting of just sequences of those
  characters are considered <dfn id=inter-element-whitespace>inter-element whitespace</dfn>.</p>

  <p><a href=#inter-element-whitespace>Inter-element whitespace</a>, comment nodes, and processing instruction nodes must be
  ignored when establishing whether an element's contents match the element's content model or not,
  and must be ignored when following algorithms that define document and element semantics.</p>

  <p class=note>Thus, an element <var title="">A</var> is said to be <i>preceded or followed</i>
  by a second element <var title="">B</var> if <var title="">A</var> and <var title="">B</var> have
  the same parent node and there are no other element nodes or <code><a href=#text>Text</a></code> nodes (other than
  <a href=#inter-element-whitespace>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>inter-element
  whitespace</a>, comment nodes, and processing instruction nodes.</p>

  <p>Authors must not use <a href=#html-elements>HTML elements</a> anywhere except where they are explicitly
  allowed, as defined for each element, or as explicitly required by other specifications. For XML
  compound documents, these contexts could be inside elements from other namespaces, if those
  elements are defined as providing the relevant contexts.</p>

  <div class=example>
   <p>For example, the Atom specification defines a <code title="">content</code> element. When its
   <code title="">type</code> attribute has the value <code title="">xhtml</code>, the Atom
   specification requires that it contain a single HTML <code><a href=#the-div-element>div</a></code> element. Thus, a
   <code><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>HTML elements</a> may be orphan nodes (i.e. without a parent node).</p>

  <div class=example>

   <p>For example, creating a <code><a href=#the-td-element>td</a></code> element and storing it in a global variable in a
   script is conforming, even though <code><a href=#the-td-element>td</a></code> elements are otherwise only supposed to be used
   inside <code><a href=#the-tr-element>tr</a></code> elements.</p>

   <pre>var data = {
  name: "Banana",
  cell: document.createElement('td'),
};</pre>

  </div>


  <h5 id=kinds-of-content><span class=secno>3.2.5.1 </span>Kinds of content</h5>

  <p>Each element in HTML falls into zero or more <dfn id=content-categories title="content categories">categories</dfn>
  that group elements with similar characteristics together. The following broad categories are used
  in this specification:</p>

  <ul class=brief><li><a href=#metadata-content>Metadata content</a></li>
   <li><a href=#flow-content>Flow content</a></li>
   <li><a href=#sectioning-content>Sectioning content</a></li>
   <li><a href=#heading-content>Heading content</a></li>
   <li><a href=#phrasing-content>Phrasing content</a></li>
   <li><a href=#embedded-content>Embedded content</a></li>
   <li><a href=#interactive-content>Interactive content</a></li>
  </ul><p class=note>Some elements also fall into other categories, which are defined in other parts of
  this specification.</p>

  <p>These categories are related as follows:</p>

  <!-- The following image is decorative; the 'as follows' bit above refers to the paragraph after it, which entirely duplicates the content of
       this image. So setting an alt="" on this would be bogus (indeed, it would be non-conforming and bad for accessibility.) -->
  <p><object width=1000 height=288 data=images/content-venn.svg><img src=http://images.whatwg.org/content-venn.png width=512 alt="" height=288></object></p>

  <p>Sectioning content, heading content, phrasing content, embedded content, and interactive
  content are all types of flow content. Metadata is sometimes flow content. Metadata and
  interactive content are sometimes phrasing content. Embedded content is also a type of phrasing
  content, and sometimes is interactive content.</p>

  <p>Other categories are also used for specific purposes, e.g. form controls are specified using a
  number of categories to define common requirements. Some elements have unique requirements and do
  not fit into any particular category.</p>


  <h6 id=metadata-content-0><span class=secno>3.2.5.1.1 </span>Metadata content</h6>

  <p><dfn id=metadata-content>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>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-base-element>base</a></code></li>
   <li><code><a href=#the-link-element>link</a></code></li>
   <li><code><a href=#the-meta-element>meta</a></code></li>
   <li><code><a href=#the-noscript-element>noscript</a></code></li>
   <li><code><a href=#the-script-element>script</a></code></li>
   <li><code><a href=#the-style-element>style</a></code></li>
   <li><code><a href=#the-template-element>template</a></code></li>
   <li><code><a href=#the-title-element>title</a></code></li>
  </ul><p>Elements from other namespaces whose semantics are primarily metadata-related (e.g. RDF) are
  also <a href=#metadata-content>metadata content</a>.</p>

  <div class=example>

   <p>Thus, in the XML serialization, one can use RDF, like this:</p>

   <pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
 &lt;head&gt;
  &lt;title&gt;Hedral's Home Page&lt;/title&gt;
  &lt;r:RDF&gt;
   &lt;Person xmlns="http://www.w3.org/2000/10/swap/pim/contact#"
           r:about="http://hedral.example.com/#"&gt;
    &lt;fullName&gt;Cat Hedral&lt;/fullName&gt;
    &lt;mailbox r:resource="mailto:hedral@damowmow.com"/&gt;
    &lt;personalTitle&gt;Sir&lt;/personalTitle&gt;
   &lt;/Person&gt;
  &lt;/r:RDF&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;My home page&lt;/h1&gt;
  &lt;p&gt;I like playing with string, I guess. Sister says squirrels are fun
  too so sometimes I follow her to play with them.&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

   <p>This isn't possible in the HTML serialization, however.</p>

  </div>


  <h6 id=flow-content-0><span class=secno>3.2.5.1.2 </span>Flow content</h6>

  <p>Most elements that are used in the body of documents and applications are categorized as
  <dfn id=flow-content>flow content</dfn>.</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code></li>
   <li><code><a href=#the-abbr-element>abbr</a></code></li>
   <li><code><a href=#the-address-element>address</a></code></li>
   <li><code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element)</li>
   <li><code><a href=#the-article-element>article</a></code></li>
   <li><code><a href=#the-aside-element>aside</a></code></li>
   <li><code><a href=#the-audio-element>audio</a></code></li>
   <li><code><a href=#the-b-element>b</a></code></li>
   <li><code><a href=#the-bdi-element>bdi</a></code></li>
   <li><code><a href=#the-bdo-element>bdo</a></code></li>
   <li><code><a href=#the-blockquote-element>blockquote</a></code></li>
   <li><code><a href=#the-br-element>br</a></code></li>
   <li><code><a href=#the-button-element>button</a></code></li>
   <li><code><a href=#the-canvas-element>canvas</a></code></li>
   <li><code><a href=#the-cite-element>cite</a></code></li>
   <li><code><a href=#the-code-element>code</a></code></li>
   <li><code><a href=#the-data-element>data</a></code></li>
   <li><code><a href=#the-datalist-element>datalist</a></code></li>
   <li><code><a href=#the-del-element>del</a></code></li>
   <li><code><a href=#the-details-element>details</a></code></li>
   <li><code><a href=#the-dfn-element>dfn</a></code></li>
   <li><code><a href=#the-dialog-element>dialog</a></code></li>
   <li><code><a href=#the-div-element>div</a></code></li>
   <li><code><a href=#the-dl-element>dl</a></code></li>
   <li><code><a href=#the-em-element>em</a></code></li>
   <li><code><a href=#the-embed-element>embed</a></code></li>
   <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
   <li><code><a href=#the-figure-element>figure</a></code></li>
   <li><code><a href=#the-footer-element>footer</a></code></li>
   <li><code><a href=#the-form-element>form</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></li>
   <li><code><a href=#the-header-element>header</a></code></li>
   <li><code><a href=#the-hgroup-element>hgroup</a></code></li>
   <li><code><a href=#the-hr-element>hr</a></code></li>
   <li><code><a href=#the-i-element>i</a></code></li>
   <li><code><a href=#the-iframe-element>iframe</a></code></li>
   <li><code><a href=#the-img-element>img</a></code></li>
   <li><code><a href=#the-input-element>input</a></code></li>
   <li><code><a href=#the-ins-element>ins</a></code></li>
   <li><code><a href=#the-kbd-element>kbd</a></code></li>
   <li><code><a href=#the-keygen-element>keygen</a></code></li>
   <li><code><a href=#the-label-element>label</a></code></li>
   <li><code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
   <li><code><a href=#the-main-element>main</a></code></li>
   <li><code><a href=#the-map-element>map</a></code></li>
   <li><code><a href=#the-mark-element>mark</a></code></li>
   <li><code><a href=#math>math</a></code></li>
   <li><code><a href=#the-menu-element>menu</a></code></li>
   <li><code><a href=#the-meta-element>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
   <li><code><a href=#the-meter-element>meter</a></code></li>
   <li><code><a href=#the-nav-element>nav</a></code></li>
   <li><code><a href=#the-noscript-element>noscript</a></code></li>
   <li><code><a href=#the-object-element>object</a></code></li>
   <li><code><a href=#the-ol-element>ol</a></code></li>
   <li><code><a href=#the-output-element>output</a></code></li>
   <li><code><a href=#the-p-element>p</a></code></li>
   <li><code><a href=#the-pre-element>pre</a></code></li>
   <li><code><a href=#the-progress-element>progress</a></code></li>
   <li><code><a href=#the-q-element>q</a></code></li>
   <li><code><a href=#the-ruby-element>ruby</a></code></li>
   <li><code><a href=#the-s-element>s</a></code></li>
   <li><code><a href=#the-samp-element>samp</a></code></li>
   <li><code><a href=#the-script-element>script</a></code></li>
   <li><code><a href=#the-section-element>section</a></code></li>
   <li><code><a href=#the-select-element>select</a></code></li>
   <li><code><a href=#the-small-element>small</a></code></li>
   <li><code><a href=#the-span-element>span</a></code></li>
   <li><code><a href=#the-strong-element>strong</a></code></li>
   <li><code><a href=#the-style-element>style</a></code> (if the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present)</li>
   <li><code><a href=#the-sub-and-sup-elements>sub</a></code></li>
   <li><code><a href=#the-sub-and-sup-elements>sup</a></code></li>
   <li><code><a href=#svg>svg</a></code></li>
   <li><code><a href=#the-table-element>table</a></code></li>
   <li><code><a href=#the-template-element>template</a></code></li>
   <li><code><a href=#the-textarea-element>textarea</a></code></li>
   <li><code><a href=#the-time-element>time</a></code></li>
   <li><code><a href=#the-u-element>u</a></code></li>
   <li><code><a href=#the-ul-element>ul</a></code></li>
   <li><code><a href=#the-var-element>var</a></code></li>
   <li><code><a href=#the-video-element>video</a></code></li>
   <li><code><a href=#the-wbr-element>wbr</a></code></li>
   <li><a href=#text-content title="text content">Text</a></li>
  </ul><h6 id=sectioning-content-0><span class=secno>3.2.5.1.3 </span>Sectioning content</h6>

  <p><dfn id=sectioning-content>Sectioning content</dfn> is content that defines the scope of <a href=#heading-content title="heading
  content">headings</a> and <a href=#the-footer-element title=footer>footers</a>.</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-article-element>article</a></code></li>
   <li><code><a href=#the-aside-element>aside</a></code></li>
   <li><code><a href=#the-nav-element>nav</a></code></li>
   <li><code><a href=#the-section-element>section</a></code></li>
  </ul><p>Each <a href=#sectioning-content>sectioning content</a> element potentially has a heading and an
  <a href=#outline>outline</a>. See the section on <a href=#headings-and-sections>headings and sections</a> for further
  details.</p>

  <p class=note>There are also certain elements that are <a href=#sectioning-root title="sectioning root">sectioning
  roots</a>. These are distinct from <a href=#sectioning-content>sectioning content</a>, but they can also have an
  <a href=#outline>outline</a>.</p>


  <h6 id=heading-content-0><span class=secno>3.2.5.1.4 </span>Heading content</h6>

  <p><dfn id=heading-content>Heading content</dfn> defines the header of a section (whether explicitly marked up using
  <a href=#sectioning-content>sectioning content</a> elements, or implied by the heading content itself).</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></li>
   <li><code><a href=#the-hgroup-element>hgroup</a></code></li>
  </ul><h6 id=phrasing-content-0><span class=secno>3.2.5.1.5 </span>Phrasing content</h6>

  <p><dfn id=phrasing-content>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>phrasing content</a> form <a href=#paragraph title=paragraph>paragraphs</a>.</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code></li>
   <li><code><a href=#the-abbr-element>abbr</a></code></li>
   <li><code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element)</li>
   <li><code><a href=#the-audio-element>audio</a></code></li>
   <li><code><a href=#the-b-element>b</a></code></li>
   <li><code><a href=#the-bdi-element>bdi</a></code></li>
   <li><code><a href=#the-bdo-element>bdo</a></code></li>
   <li><code><a href=#the-br-element>br</a></code></li>
   <li><code><a href=#the-button-element>button</a></code></li>
   <li><code><a href=#the-canvas-element>canvas</a></code></li>
   <li><code><a href=#the-cite-element>cite</a></code></li>
   <li><code><a href=#the-code-element>code</a></code></li>
   <li><code><a href=#the-data-element>data</a></code></li>
   <li><code><a href=#the-datalist-element>datalist</a></code></li>
   <li><code><a href=#the-del-element>del</a></code></li>
   <li><code><a href=#the-dfn-element>dfn</a></code></li>
   <li><code><a href=#the-em-element>em</a></code></li>
   <li><code><a href=#the-embed-element>embed</a></code></li>
   <li><code><a href=#the-i-element>i</a></code></li>
   <li><code><a href=#the-iframe-element>iframe</a></code></li>
   <li><code><a href=#the-img-element>img</a></code></li>
   <li><code><a href=#the-input-element>input</a></code></li>
   <li><code><a href=#the-ins-element>ins</a></code></li>
   <li><code><a href=#the-kbd-element>kbd</a></code></li>
   <li><code><a href=#the-keygen-element>keygen</a></code></li>
   <li><code><a href=#the-label-element>label</a></code></li>
   <li><code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
   <li><code><a href=#the-map-element>map</a></code></li>
   <li><code><a href=#the-mark-element>mark</a></code></li>
   <li><code><a href=#math>math</a></code></li>
   <li><code><a href=#the-meta-element>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)</li>
   <li><code><a href=#the-meter-element>meter</a></code></li>
   <li><code><a href=#the-noscript-element>noscript</a></code></li>
   <li><code><a href=#the-object-element>object</a></code></li>
   <li><code><a href=#the-output-element>output</a></code></li>
   <li><code><a href=#the-progress-element>progress</a></code></li>
   <li><code><a href=#the-q-element>q</a></code></li>
   <li><code><a href=#the-ruby-element>ruby</a></code></li>
   <li><code><a href=#the-s-element>s</a></code></li>
   <li><code><a href=#the-samp-element>samp</a></code></li>
   <li><code><a href=#the-script-element>script</a></code></li>
   <li><code><a href=#the-select-element>select</a></code></li>
   <li><code><a href=#the-small-element>small</a></code></li>
   <li><code><a href=#the-span-element>span</a></code></li>
   <li><code><a href=#the-strong-element>strong</a></code></li>
   <li><code><a href=#the-sub-and-sup-elements>sub</a></code></li>
   <li><code><a href=#the-sub-and-sup-elements>sup</a></code></li>
   <li><code><a href=#svg>svg</a></code></li>
   <li><code><a href=#the-template-element>template</a></code></li>
   <li><code><a href=#the-textarea-element>textarea</a></code></li>
   <li><code><a href=#the-time-element>time</a></code></li>
   <li><code><a href=#the-u-element>u</a></code></li>
   <li><code><a href=#the-var-element>var</a></code></li>
   <li><code><a href=#the-video-element>video</a></code></li>
   <li><code><a href=#the-wbr-element>wbr</a></code></li>
   <li><a href=#text-content title="text content">Text</a></li>
  </ul><p class=note>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 id=text-content title="text content">Text</dfn>, in the context of content models, means either nothing,
  or <code><a href=#text>Text</a></code> nodes. <a href=#text-content title="text content">Text</a> is sometimes used as a content
  model on its own, but is also <a href=#phrasing-content>phrasing content</a>, and can be <a href=#inter-element-whitespace>inter-element
  whitespace</a> (if the <code><a href=#text>Text</a></code> nodes are empty or contain just <a href=#space-character title="space
  character">space characters</a>).</p>

  <p><code><a href=#text>Text</a></code> nodes and attribute values must consist of <a href=#unicode-character title="Unicode
  character">Unicode characters</a>, must not contain U+0000 characters, must not contain
  permanently undefined Unicode characters (noncharacters), and must not contain control characters
  other than <a href=#space-character title="space character">space characters</a>.

  <!--<code>Text</code> nodes and attribute values may begin with an <i>isolated combining
  character</i>.--> <!-- commented out since nothing disallows it currently, so it's implicit;
  however, if we ever make charmod a normative reference, this will be needed to override it -->

  This specification includes extra constraints on the exact value of <code><a href=#text>Text</a></code> nodes and
  attribute values depending on their precise context.

  <!-- <a href="#refsUNICODE">[UNICODE]</a>-->

  </p>



  <h6 id=embedded-content-0><span class=secno>3.2.5.1.6 </span>Embedded content</h6>

  <p><dfn id=embedded-content>Embedded content</dfn> is content that imports another
  resource into the document, or content from another vocabulary that
  is inserted into the document.</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-audio-element>audio</a></code></li>
   <li><code><a href=#the-canvas-element>canvas</a></code></li>
   <li><code><a href=#the-embed-element>embed</a></code></li>
   <li><code><a href=#the-iframe-element>iframe</a></code></li>
   <li><code><a href=#the-img-element>img</a></code></li>
   <li><code><a href=#math>math</a></code></li>
   <li><code><a href=#the-object-element>object</a></code></li>
   <li><code><a href=#svg>svg</a></code></li>
   <li><code><a href=#the-video-element>video</a></code></li>
  </ul><p>Elements that are from namespaces other than the <a href=#html-namespace-0>HTML namespace</a> and that convey
  content but not metadata, are <a href=#embedded-content>embedded content</a> for the purposes of the content models
  defined in this specification. (For example, MathML, or SVG.)</p>

  <p>Some embedded content elements can have <dfn id=fallback-content>fallback content</dfn>: content that is to be used
  when the external resource cannot be used (e.g. because it is of an unsupported format). The
  element definitions state what the fallback is, if any.</p>
  <!-- we might not need to define fallback content at all. consider removing it if we don't end up
  using it anywhere (e.g. Selection) -->


  <h6 id=interactive-content-0><span class=secno>3.2.5.1.7 </span>Interactive content</h6>

<!--
TESTS:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cp%20tabindex%3D1%3Etest%20%3Ca%20href%3D%22%22%3E%20%3Cem%3Etest%3C/em%3E%20%3C/a%3E%0A%3Cscript%3E%0A%20function%20test%20%28e%29%20%7B%20w%28e.type%20+%20%27%20on%20%27%20+%20e.target.tagName%20+%20%27%20through%20%27%20+%20e.currentTarget.tagName%29%3B%20%7D%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%3C/script%3E%0A
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Ca%20href%3Dhttp%3A//google.com/%20target%3Da%3EA%3C/a%3E%3Ca%20href%3Dhttp%3A//yahoo.com/%20target%3Db%3EB%3C/a%3E%3Cbr%3E%0A%3Ciframe%20name%3Da%3E%3C/iframe%3E%3Ciframe%20name%3Db%3E%3C/iframe%3E%0A%3Cscript%3E%0A%20var%20a%20%3D%20document.getElementsByTagName%28%27a%27%29%5B0%5D%3B%0A%20var%20b%20%3D%20document.getElementsByTagName%28%27a%27%29%5B1%5D%3B%0A%20a.appendChild%28b%29%3B%0A%3C/script%3E
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Cform%20action%3D%22http%3A//google.com/%22%20onsubmit%3D%22w%28%27onsubmit%27%29%22%3E%3Cem%3EA%3C/em%3E%3C/form%3E%0A%3Cscript%3E%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.attachEvent%28%27onsubmit%27%2C%20function%20%28%29%20%7B%20w%28%27submit%20fired%27%29%20%7D%29%3B%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.fireEvent%28%27onsubmit%27%29%3B%0A%3C/script%3E
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Cform%20action%3D%22http%3A//google.com/%22%3EX%3C/form%3E%0A%3Cscript%3E%0Avar%20evt%20%3D%20document.createEvent%28%22Events%22%29%3B%0Aevt.initEvent%28%22submit%22%2C%20true%2C%20true%29%3B%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.dispatchEvent%28evt%29%3B%0A%3C/script%3E
-->

  <p><dfn id=interactive-content>Interactive content</dfn> is content that is specifically
  intended for user interaction.</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code></li>
   <li><code><a href=#the-audio-element>audio</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)</li>
   <li><code><a href=#the-button-element>button</a></code></li>
   <li><code><a href=#the-details-element>details</a></code></li>
   <li><code><a href=#the-embed-element>embed</a></code></li>
   <li><code><a href=#the-iframe-element>iframe</a></code></li>
   <li><code><a href=#the-img-element>img</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)</li>
   <li><code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state)</li>
   <li><code><a href=#the-keygen-element>keygen</a></code></li>
   <li><code><a href=#the-label-element>label</a></code></li>
   <li><code><a href=#the-object-element>object</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)<!-- see also comment in <object> section --></li>
   <li><code><a href=#the-select-element>select</a></code></li>
   <li><code><a href=#the-textarea-element>textarea</a></code></li>
   <li><code><a href=#the-video-element>video</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)</li>
  </ul><p>Certain elements in HTML have an <a href=#activation-behavior>activation behavior</a>, which means that the user
  can activate them. This triggers a sequence of events dependent on the activation mechanism, and
  normally culminating in a <code title=event-click><a href=#event-click>click</a></code> event<span class=impl>, as
  described below</span>.</p>

  <div class=impl>

  <p>The user agent should allow the user to manually trigger elements that have an <a href=#activation-behavior>activation
  behavior</a>, for instance using keyboard or voice input, or through mouse clicks. When the
  user triggers an element with a defined <a href=#activation-behavior>activation behavior</a> in a manner other than
  clicking it, the default action of the interaction event must be to <a href=#run-synthetic-click-activation-steps>run synthetic click
  activation steps</a> on the element.</p> <!-- interaction event spec point -->

  <p>Each element has a <var title="">click in progress</var> flag, initially set to false.</p>

  <p>When a user agent is to <dfn id=run-synthetic-click-activation-steps>run synthetic click activation steps</dfn> on an element, the user
  agent must run the following steps:</p>

  <ol><li><p>If the element's <var title="">click in progress</var> flag is set to true, then abort
   these steps.</li>

   <li><p>Set the <var title="">click in progress</var> flag on the element to true.</li>

   <li><p><a href=#run-pre-click-activation-steps>Run pre-click activation steps</a> on the element.</li>

   <li><p><a href=#fire-a-click-event>Fire a <code title=event-click>click</code> event</a> at the element. If the
   <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> algorithm was invoked because the <code title=dom-click><a href=#dom-click>click()</a></code> method was invoked, then the <code title=dom-event-isTrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute must be initialized to false.</li>

   <li>

    <p>If this <code title=event-click><a href=#event-click>click</a></code> event is not canceled, <a href=#run-post-click-activation-steps>run post-click
    activation steps</a> on the element.</p>

    <p>If the event <em>is</em> canceled, the user agent must <a href=#run-canceled-activation-steps>run canceled activation
    steps</a> on the element instead.</p>

   </li>

   <li><p>Set the <var title="">click in progress</var> flag on the element to false.</li>

  </ol><p>When a pointing device is clicked, the user agent must run these steps:</p>

  <ol><li><p>If the element's <var title="">click in progress</var> flag is set to true, then abort
   these steps.</li>

   <li><p>Set the <var title="">click in progress</var> flag on the element to true.</li>

   <li><p>Let <var title="">e</var> be the <a href=#nearest-activatable-element>nearest activatable element</a> of the element
   designated by the user (defined below), if any.</li>

   <li><p>If there is an element <var title="">e</var>, <a href=#run-pre-click-activation-steps>run pre-click activation steps</a>
   on it.</li>

   <li>

    <p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> the required <code title=event-click><a href=#event-click>click</a></code> event.</p> <!-- interaction event spec point -->

    <p>If there is an element <var title="">e</var> and the <code title=event-click><a href=#event-click>click</a></code>
    event is not canceled, <a href=#run-post-click-activation-steps>run post-click activation steps</a> on element <var title="">e</var>.</p>

    <p>If there is an element <var title="">e</var> and the event <em>is</em> canceled, <a href=#run-canceled-activation-steps>run
    canceled activation steps</a> on element <var title="">e</var>.</p>

   </li>

   <li><p>Set the <var title="">click in progress</var> flag on the element to false.</li>

  </ol><p class=note>The algorithms above don't run for arbitrary synthetic events dispatched by author
  script. The <code title=dom-click><a href=#dom-click>click()</a></code> method can be used to make the <a href=#run-synthetic-click-activation-steps>run
  synthetic click activation steps</a> algorithm happen programmatically.</p>

  <p class=note>Click-focusing behavior (e.g. the focusing of a text field when user clicks in
  one) typically happens before the click, when the mouse button is first depressed, and is
  therefore not discussed here.</p> <!-- interaction event spec point -->

  <p>Given an element <var title="">target</var>, the <dfn id=nearest-activatable-element>nearest activatable element</dfn> is the
  element returned by the following algorithm:</p>

  <ol><li><p>If <var title="">target</var> has a defined <a href=#activation-behavior>activation behavior</a>, then return
   <var title="">target</var> and abort these steps.</li>

   <li><p>If <var title="">target</var> has a parent element, then set <var title="">target</var> to
   that parent element and return to the first step.</li>

   <li><p>Otherwise, there is no <a href=#nearest-activatable-element>nearest activatable element</a>.</li>

  </ol><p>When a user agent is to <dfn id=run-pre-click-activation-steps>run pre-click activation steps</dfn> on an element, it must run
  the <dfn id=pre-click-activation-steps>pre-click activation steps</dfn> defined for that element, if any.</p>

  <p>When a user agent is to <dfn id=run-canceled-activation-steps>run canceled activation steps</dfn> on an element, it must run the
  <dfn id=canceled-activation-steps>canceled activation steps</dfn> defined for that element, if any.</p>

  <p>When a user agent is to <dfn id=run-post-click-activation-steps>run post-click activation steps</dfn> on an element, it must run
  the <dfn id=activation-behavior>activation behavior</dfn> defined for that element, if any. Activation behaviors can
  refer to the <code title=event-click><a href=#event-click>click</a></code> event that was fired by the steps above
  leading up to this point.</p>

  </div>



  <h6 id=palpable-content-0><span class=secno>3.2.5.1.8 </span>Palpable content</h6>

  <p>As a general rule, elements whose content model allows any <a href=#flow-content>flow content</a> or
  <a href=#phrasing-content>phrasing content</a> should have at least one node in its <a href=#concept-html-contents title=concept-html-contents>contents</a> that is <dfn id=palpable-content>palpable
  content</dfn> and that does not have the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute
  specified.</p>

  <p>This requirement is not a hard requirement, however, as there are many cases where an element
  can be empty legitimately, for example when it is used as a placeholder which will later be filled
  in by a script, or when the element is part of a template and would on most pages be filled in but
  on some pages is not relevant.</p>

  <p>Conformance checkers are encouraged to provide a mechanism for authors to find elements that
  fail to fulfill this requirement, as an authoring aid.</p>

  <p>The following elements are palpable content:</p>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-a-element>a</a></code></li>
   <li><code><a href=#the-abbr-element>abbr</a></code></li>
   <li><code><a href=#the-address-element>address</a></code></li>
   <li><code><a href=#the-article-element>article</a></code></li>
   <li><code><a href=#the-aside-element>aside</a></code></li>
   <li><code><a href=#the-audio-element>audio</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)</li>
   <li><code><a href=#the-b-element>b</a></code></li>
   <li><code><a href=#the-bdi-element>bdi</a></code></li>
   <li><code><a href=#the-bdo-element>bdo</a></code></li>
   <li><code><a href=#the-blockquote-element>blockquote</a></code></li>
   <li><code><a href=#the-button-element>button</a></code></li>
   <li><code><a href=#the-canvas-element>canvas</a></code></li>
   <li><code><a href=#the-cite-element>cite</a></code></li>
   <li><code><a href=#the-code-element>code</a></code></li>
   <li><code><a href=#the-data-element>data</a></code></li>
   <li><code><a href=#the-details-element>details</a></code></li>
   <li><code><a href=#the-dfn-element>dfn</a></code></li>
   <li><code><a href=#the-div-element>div</a></code></li>
   <li><code><a href=#the-dl-element>dl</a></code> (if the element's children include at least one name-value group)</li>
   <li><code><a href=#the-em-element>em</a></code></li>
   <li><code><a href=#the-embed-element>embed</a></code></li>
   <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
   <li><code><a href=#the-figure-element>figure</a></code></li>
   <li><code><a href=#the-footer-element>footer</a></code></li>
   <li><code><a href=#the-form-element>form</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code></li>
   <li><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></li>
   <li><code><a href=#the-header-element>header</a></code></li>
   <li><code><a href=#the-hgroup-element>hgroup</a></code></li>
   <li><code><a href=#the-i-element>i</a></code></li>
   <li><code><a href=#the-iframe-element>iframe</a></code></li>
   <li><code><a href=#the-img-element>img</a></code></li>
   <li><code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state)</li>
   <li><code><a href=#the-ins-element>ins</a></code></li>
   <li><code><a href=#the-kbd-element>kbd</a></code></li>
   <li><code><a href=#the-keygen-element>keygen</a></code></li>
   <li><code><a href=#the-label-element>label</a></code></li>
   <li><code><a href=#the-main-element>main</a></code></li>
   <li><code><a href=#the-map-element>map</a></code></li>
   <li><code><a href=#the-mark-element>mark</a></code></li>
   <li><code><a href=#math>math</a></code></li>
   <li><code><a href=#the-menu-element>menu</a></code> (if the <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state)</li>
   <li><code><a href=#the-meter-element>meter</a></code></li>
   <li><code><a href=#the-nav-element>nav</a></code></li>
   <li><code><a href=#the-object-element>object</a></code></li>
   <li><code><a href=#the-ol-element>ol</a></code> (if the element's children include at least one <code><a href=#the-li-element>li</a></code> element)</li>
   <li><code><a href=#the-output-element>output</a></code></li>
   <li><code><a href=#the-p-element>p</a></code></li>
   <li><code><a href=#the-pre-element>pre</a></code></li>
   <li><code><a href=#the-progress-element>progress</a></code></li>
   <li><code><a href=#the-q-element>q</a></code></li>
   <li><code><a href=#the-ruby-element>ruby</a></code></li>
   <li><code><a href=#the-s-element>s</a></code></li>
   <li><code><a href=#the-samp-element>samp</a></code></li>
   <li><code><a href=#the-section-element>section</a></code></li>
   <li><code><a href=#the-select-element>select</a></code></li>
   <li><code><a href=#the-small-element>small</a></code></li>
   <li><code><a href=#the-span-element>span</a></code></li>
   <li><code><a href=#the-strong-element>strong</a></code></li>
   <li><code><a href=#the-sub-and-sup-elements>sub</a></code></li>
   <li><code><a href=#the-sub-and-sup-elements>sup</a></code></li>
   <li><code><a href=#svg>svg</a></code></li>
   <li><code><a href=#the-table-element>table</a></code></li>
   <li><code><a href=#the-textarea-element>textarea</a></code></li>
   <li><code><a href=#the-time-element>time</a></code></li>
   <li><code><a href=#the-u-element>u</a></code></li>
   <li><code><a href=#the-ul-element>ul</a></code> (if the element's children include at least one <code><a href=#the-li-element>li</a></code> element)</li>
   <li><code><a href=#the-var-element>var</a></code></li>
   <li><code><a href=#the-video-element>video</a></code></li>
   <li><a href=#text-content title="text content">Text</a> that is not <a href=#inter-element-whitespace>inter-element whitespace</a></li>
  </ul><h6 id=script-supporting-elements-0><span class=secno>3.2.5.1.9 </span>Script-supporting elements</h6>

  <p><dfn id=script-supporting-elements>Script-supporting elements</dfn> are those that do not <a href=#represents title=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>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-script-element>script</a></code></li>
   <li><code><a href=#the-template-element>template</a></code></li>
  </ul><h5 id=transparent-content-models><span class=secno>3.2.5.2 </span>Transparent content models</h5>

  <p>Some elements are described as <dfn id=transparent>transparent</dfn>; they have "transparent" in the
  description of their content model. The content model of a <a href=#transparent>transparent</a> element is
  derived from the content model of its parent element: the elements required in the part of the
  content model that is "transparent" are the same elements as required in the part of the content
  model of the parent of the transparent element in which the transparent element finds itself.</p>

  <div class=example>

   <p>For instance, an <code><a href=#the-ins-element>ins</a></code> element inside a <code><a href=#the-ruby-element>ruby</a></code> element cannot contain an
   <code><a href=#the-rt-element>rt</a></code> element, because the part of the <code><a href=#the-ruby-element>ruby</a></code> element's content model that
   allows <code><a href=#the-ins-element>ins</a></code> elements is the part that allows <a href=#phrasing-content>phrasing content</a>, and the
   <code><a href=#the-rt-element>rt</a></code> element is not <a href=#phrasing-content>phrasing content</a>.</p>

  </div>

<!--(as far as I can tell, there's no way to violate this requirement
     without first violating the earlier requirement)
  <p>Furthermore, when a content model includes a part that is "transparent", those parts must not
  contain content that would not be conformant if all transparent elements in the tree were
  replaced, in their parent element, by the <span title="concept-html-contents">contents</span> in the "transparent" part of their content
  model, retaining order.</p>

  <div class="example">

   <p>Consider the following markup fragment:</p>

   <pre>&lt;p>Hello &lt;a href="world.html">&lt;em>wonderful&lt;/em> world&lt;/a>!&lt;/p></pre>

   <p>Its DOM looks like the following:</p>

   <ul class="domTree"><li class="t1"><code>p</code><ul><li class="t3"><code>#text</code>: <span title="">Hello </span></li><li class="t1"><code>a</code> <span class="t2" title=""><code class="attribute name">href</code>="<code class="attribute value">world.html</code>"</span><ul><li class="t1"><code>em</code><ul><li class="t3"><code>#text</code>: <span title="">wonderful</span></li></ul></li><li class="t3"><code>#text</code>: <span title=""> world</span></li></ul></li><li class="t3"><code>#text</code>: <span title="">!</span></li></ul></li></ul>

   <p>The content model of the <code>a</code> element is <span>transparent</span>. To see if its
   contents are conforming, therefore, the element is replaced by its contents:</p>

   <ul class="domTree"><li class="t1"><code>p</code><ul><li class="t3"><code>#text</code>: <span title="">Hello </span></li><li class="t1"><code>em</code><ul><li class="t3"><code>#text</code>: <span title="">wonderful</span></li></ul></li><li class="t3"><code>#text</code>: <span title=""> world</span></li><li class="t3"><code>#text</code>: <span title="">!</span></li></ul></li></ul>

   <p>Since that is conforming, the contents of the <code>a</code> are conforming in the original
   fragment (there is no complication regarding the various parts of the <code>p</code> element's
   content model, since that element's content model has only one part).</p>

  </div>
-->

  <p class=note>In some cases, where transparent elements are nested in each other, the process
  has to be applied iteratively.</p>

  <div class=example>

   <p>Consider the following markup fragment:</p>

   <pre>&lt;p&gt;&lt;object&gt;&lt;param&gt;&lt;ins&gt;&lt;map&gt;&lt;a href="/"&gt;Apples&lt;/a&gt;&lt;/map&gt;&lt;/ins&gt;&lt;/object&gt;&lt;/p&gt;</pre>

   <p>To check whether "Apples" is allowed inside the <code><a href=#the-a-element>a</a></code> element, the content models are
   examined. The <code><a href=#the-a-element>a</a></code> element's content model is transparent, as is the <code><a href=#the-map-element>map</a></code>
   element's, as is the <code><a href=#the-ins-element>ins</a></code> element's, as is the part of the <code><a href=#the-object-element>object</a></code>
   element's in which the <code><a href=#the-ins-element>ins</a></code> element is found. The <code><a href=#the-object-element>object</a></code> element is
   found in the <code><a href=#the-p-element>p</a></code> element, whose content model is <a href=#phrasing-content>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>flow content</a>.</p>


  <h5 id=paragraphs><span class=secno>3.2.5.3 </span>Paragraphs</h5>

  <p class=note>The term <a href=#paragraph>paragraph</a> as defined in this section is used for more than
  just the definition of the <code><a href=#the-p-element>p</a></code> element. The <a href=#paragraph>paragraph</a> concept defined here
  is used to describe how to interpret documents. The <code><a href=#the-p-element>p</a></code> element is merely one of
  several ways of marking up a <a href=#paragraph>paragraph</a>.</p>

  <!-- note: the actual definition is below -->
  <p>A <dfn id=paragraph>paragraph</dfn> is typically a run of <a href=#phrasing-content>phrasing content</a> that forms a block
  of text with one or more sentences that discuss a particular topic, as in typography, but can also
  be used for more general thematic grouping. For instance, an address is also a paragraph, as is a
  part of a form, a byline, or a stanza in a poem.</p>

  <div class=example>

   <p>In the following example, there are two paragraphs in a section. There is also a heading,
   which contains phrasing content that is not a paragraph. Note how the comments and
   <a href=#inter-element-whitespace>inter-element whitespace</a> do not form paragraphs.</p>

   <pre>&lt;section&gt;
  &lt;h1&gt;Example of paragraphs&lt;/h1&gt;
  This is the &lt;em&gt;first&lt;/em&gt; paragraph in this example.
  &lt;p&gt;This is the second.&lt;/p&gt;
  &lt;!-- This is not a paragraph. --&gt;
&lt;/section&gt;</pre>

  </div>

  <p>Paragraphs in <a href=#flow-content>flow content</a> are defined relative to what the document looks like
  without the <code><a href=#the-a-element>a</a></code>, <code><a href=#the-ins-element>ins</a></code>, <code><a href=#the-del-element>del</a></code>, and <code><a href=#the-map-element>map</a></code> elements
  complicating matters, since those elements, with their hybrid content models, can straddle
  paragraph boundaries, as shown in the first two examples below.</p>

  <p class=note>Generally, having elements straddle paragraph boundaries is best avoided.
  Maintaining such markup can be difficult.</p>

  <div class=example>

   <p>The following example takes the markup from the earlier example and puts <code><a href=#the-ins-element>ins</a></code> and
   <code><a href=#the-del-element>del</a></code> elements around some of the markup to show that the text was changed (though in
   this case, the changes admittedly don't make much sense). Notice how this example has exactly the
   same paragraphs as the previous one, despite the <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements
   &mdash; the <code><a href=#the-ins-element>ins</a></code> element straddles the heading and the first paragraph, and the
   <code><a href=#the-del-element>del</a></code> element straddles the boundary between the two paragraphs.</p>

   <pre>&lt;section&gt;
  &lt;ins&gt;&lt;h1&gt;Example of paragraphs&lt;/h1&gt;
  This is the &lt;em&gt;first&lt;/em&gt; paragraph in&lt;/ins&gt; this example&lt;del&gt;.
  &lt;p&gt;This is the second.&lt;/p&gt;&lt;/del&gt;
  &lt;!-- This is not a paragraph. --&gt;
&lt;/section&gt;</pre>

  </div>

  <div class=impl>

  <p>Let <var title="">view</var> be a view of the DOM that replaces all <code><a href=#the-a-element>a</a></code>,
  <code><a href=#the-ins-element>ins</a></code>, <code><a href=#the-del-element>del</a></code>, and <code><a href=#the-map-element>map</a></code> elements in the document with their
  <a href=#concept-html-contents title=concept-html-contents>contents</a>. Then, in <var title="">view</var>, for each run of sibling <a href=#phrasing-content>phrasing content</a>
  nodes uninterrupted by other types of content, in an element that accepts content other than
  <a href=#phrasing-content>phrasing content</a> as well as <a href=#phrasing-content>phrasing content</a>, let <var title="">first</var> be the first node of the run, and let <var title="">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>embedded content</a> nor <a href=#inter-element-whitespace>inter-element whitespace</a>, a paragraph exists in the
  original DOM from immediately before <var title="">first</var> to immediately after <var title="">last</var>. (Paragraphs can thus span across <code><a href=#the-a-element>a</a></code>, <code><a href=#the-ins-element>ins</a></code>,
  <code><a href=#the-del-element>del</a></code>, and <code><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><a href=#the-object-element>object</a></code>, <code><a href=#the-video-element>video</a></code>, <code><a href=#the-audio-element>audio</a></code>, and
  <code><a href=#the-canvas-element>canvas</a></code> elements, and indirectly through elements in other namespaces that allow HTML
  to be further embedded therein, like <code><a href=#svg>svg</a></code> or <code><a href=#math>math</a></code>).</p>
  <!-- example below -->

  </div>

  <p>A <a href=#paragraph>paragraph</a> is also formed explicitly by <code><a href=#the-p-element>p</a></code> elements.</p>

  <p class=note>The <code><a href=#the-p-element>p</a></code> element can be used to wrap individual paragraphs when there
  would otherwise not be any content other than phrasing content to separate the paragraphs from
  each other.</p>

  <div class=example>

   <p>In the following example, the link spans half of the first paragraph, all of the heading
   separating the two paragraphs, and half of the second paragraph. It straddles the paragraphs and
   the heading.</p>

   <pre>&lt;header&gt;
 Welcome!
 &lt;a href="about.html"&gt;
  This is home of...
  &lt;h1&gt;The Falcons!&lt;/h1&gt;
  The Lockheed Martin multirole jet fighter aircraft!
 &lt;/a&gt;
 This page discusses the F-16 Fighting Falcon's innermost secrets.
&lt;/header&gt;</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>&lt;header&gt;
 &lt;p&gt;Welcome! &lt;a href="about.html"&gt;This is home of...&lt;/a&gt;&lt;/p&gt;
 &lt;h1&gt;&lt;a href="about.html"&gt;The Falcons!&lt;/a&gt;&lt;/h1&gt;
 &lt;p&gt;&lt;a href="about.html"&gt;The Lockheed Martin multirole jet
 fighter aircraft!&lt;/a&gt; This page discusses the F-16 Fighting
 Falcon's innermost secrets.&lt;/p&gt;
&lt;/header&gt;</pre>

  </div>

  <div class=example>

   <!-- I don't know if there's a better way to deal with this, but if there is, let me know... -->

   <p>It is possible for paragraphs to overlap when using certain elements that define fallback
   content. For example, in the following section:</p>

   <pre>&lt;section&gt;
 &lt;h1&gt;My Cats&lt;/h1&gt;
 You can play with my cat simulator.
 &lt;object data="cats.sim"&gt;
  To see the cat simulator, use one of the following links:
  &lt;ul&gt;
   &lt;li&gt;&lt;a href="cats.sim"&gt;Download simulator file&lt;/a&gt;
   &lt;li&gt;&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU"&gt;Use online simulator&lt;/a&gt;
  &lt;/ul&gt;
  Alternatively, upgrade to the Mellblom Browser.
 &lt;/object&gt;
 I'm quite proud of it.
&lt;/section&gt;</pre>

   <p>There are five paragraphs:</p>

   <ol class=brief><li>The paragraph that says "You can play with my cat simulator. <i title="">object</i> I'm
    quite proud of it.", where <i title="">object</i> is the <code><a href=#the-object-element>object</a></code> element.</li>

    <li>The paragraph that says "To see the cat simulator, use one of the following links:".</li>

    <li>The paragraph that says "Download simulator file".</li>

    <li>The paragraph that says "Use online simulator".</li>

    <li>The paragraph that says "Alternatively, upgrade to the Mellblom Browser.".</li>

   </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><a href=#the-p-element>p</a></code> elements can be used. For example:</p>

   <!-- My Fish -->
   <pre>&lt;section&gt;
 &lt;h1&gt;My Cats&lt;/h1&gt;
 &lt;p&gt;You can play with my cat simulator.&lt;/p&gt;
 &lt;object data="cats.sim"&gt;
  &lt;p&gt;To see the cat simulator, use one of the following links:&lt;/p&gt;
  &lt;ul&gt;
   &lt;li&gt;&lt;a href="cats.sim"&gt;Download simulator file&lt;/a&gt;
   &lt;li&gt;&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU"&gt;Use online simulator&lt;/a&gt;
  &lt;/ul&gt;
  &lt;p&gt;Alternatively, upgrade to the Mellblom Browser.&lt;/p&gt;
 &lt;/object&gt;
 &lt;p&gt;I'm quite proud of it.&lt;/p&gt;
&lt;/section&gt;</pre>

  </div>



  <h4 id=requirements-relating-to-bidirectional-algorithm-formatting-characters><span class=secno>3.2.6 </span>Requirements relating to bidirectional-algorithm formatting characters</h4>

  <p><a href=#text-content>Text content</a> in <a href=#html-elements>HTML elements</a> with <code><a href=#text>Text</a></code> nodes in their <a href=#concept-html-contents title=concept-html-contents>contents</a>, and
  text in attributes of <a href=#html-elements>HTML elements</a> that allow free-form text, may contain characters
  in the ranges U+202A to U+202E and U+2066 to U+2069 (the bidirectional-algorithm formatting
  characters). However, the use of these characters is restricted so that any embedding or overrides
  generated by these characters do not start and end with different parent elements, and so that all
  such embeddings and overrides are explicitly terminated by a U+202C POP DIRECTIONAL FORMATTING
  character. This helps reduce incidences of text being reused in a manner that has unforeseen
  effects on the bidirectional algorithm. <a href=#refsBIDI>[BIDI]</a></p>

  <p>The aforementioned restrictions are defined by specifying that certain parts of documents form
  <a href=#bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm formatting character ranges</a>, and then imposing a requirement
  on such ranges.</p>

  <p>The strings resulting from applying the following algorithm to an <a href=#html-elements title="HTML
  elements">HTML element</a> <var title="">element</var> are <a href=#bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm
  formatting character ranges</a>:</p>

  <ol><li><p>Let <var title="">output</var> be an empty list of strings.</li>

   <li><p>Let <var title="">string</var> be an empty string.</li>

   <li><p>Let <var title="">node</var> be the first child node of <var title="">element</var>, if
   any, or null otherwise.</li>

   <!-- while node != null do -->
   <li><p><i>Loop</i>: If <var title="">node</var> is null, jump to the step labeled
   <i>end</i>.</li>

   <li>

    <p>Process <var title="">node</var> according to the first matching step from the following
    list:</p>

    <dl class=switch><dt>If <var title="">node</var> is a <code><a href=#text>Text</a></code> node</dt>

     <dd><p>Append the text data of <var title="">node</var> to <var title="">string</var>.</dd>


     <dt>If <var title="">node</var> is a <code><a href=#the-br-element>br</a></code> element</dt>
     <dt>If <var title="">node</var> is an <a href=#html-elements title="HTML elements">HTML element</a> that is <a href=#flow-content>flow content</a> but that is not also <a href=#phrasing-content>phrasing content</a></dt>

     <dd><p>If <var title="">string</var> is not the empty string, push <var title="">string</var>
     onto <var title="">output</var>, and let <var title="">string</var> be empty string.</dd>


     <dt>Otherwise</dt>

     <dd>Do nothing.</dd>

    </dl></li>

   <li><p>Let <var title="">node</var> be <var title="">node</var>'s next sibling, if any, or null
   otherwise.</li>

   <li><p>Jump to the step labeled <i>loop</i>.</li>
   <!-- end while -->

   <li><p><i>End</i>: If <var title="">string</var> is not the empty string, push <var title="">string</var> onto <var title="">output</var>.</li>

   <li><p>Return <var title="">output</var> as the <a href=#bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm formatting
   character ranges</a>.</li>

  </ol><p>The value of a namespace-less attribute of an <a href=#html-elements title="HTML elements">HTML element</a>
  is a <a href=#bidirectional-algorithm-formatting-character-ranges title="bidirectional-algorithm formatting character ranges">bidirectional-algorithm
  formatting character range</a>.</p>

<!--(this is unnecessarily pedantic)
  <p>The text data of a comment node is a <span title="bidirectional-algorithm formatting character
  ranges">bidirectional-algorithm formatting character range</span>.</p>
-->

  <p>Any strings that, as described above, are <dfn id=bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm formatting character
  ranges</dfn> must match the <code title="">string</code> production in the following ABNF, the
  character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

  <pre>string        = *( plaintext ( embedding / override / isolation ) ) plaintext
embedding     = ( lre / rle ) string pdf
override      = ( lro / rlo ) string pdf
isolation     = ( lri / rli / fsi ) string pdi
lre           = %x202A ; U+202A LEFT-TO-RIGHT EMBEDDING
rle           = %x202B ; U+202B RIGHT-TO-LEFT EMBEDDING
lro           = %x202D ; U+202D LEFT-TO-RIGHT OVERRIDE
rlo           = %x202E ; U+202E RIGHT-TO-LEFT OVERRIDE
pdf           = %x202C ; U+202C POP DIRECTIONAL FORMATTING
lri           = %x2066 ; U+2066 LEFT-TO-RIGHT ISOLATE
rli           = %x2067 ; U+2067 RIGHT-TO-LEFT ISOLATE
fsi           = %x2068 ; U+2068 FIRST STRONG ISOLATE
pdi           = %x2069 ; U+2069 POP DIRECTIONAL ISOLATE
plaintext     = *( %x0000-2029 / %x202F-2065 / %x206A-10FFFF )
                ; any string with no bidirectional-algorithm formatting characters</pre>

  <p class=note>While the U+2069 POP DIRECTIONAL ISOLATE character implicitly also ends open
  embeddings and overrides, text that relies on this implicit scope closure is not conforming to
  this specification. All strings of embeddings, overrides, and isolations need to be explicitly
  terminated to conform to this section's requirements.</p>

  <p class=note>Authors are encouraged to use the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute, the
  <code><a href=#the-bdo-element>bdo</a></code> element, and the <code><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>



  <h4 id=wai-aria><span class=secno>3.2.7 </span><dfn>WAI-ARIA</dfn></h4>

  <p>Authors may use the ARIA <code title=attr-aria-role><a href=#attr-aria-role>role</a></code> and <code title=attr-aria-*>aria-*</code> attributes on <a href=#html-elements>HTML elements</a>, in accordance with the
  requirements described in the ARIA specifications, except where these conflict with the
  <a href=#strong-native-semantics>strong native semantics</a> or are equal to the <a href=#default-implicit-aria-semantics>default implicit ARIA
  semantics</a> described below. These exceptions are intended to prevent authors from making
  assistive technology products report nonsensical states that do not represent the actual state of
  the document. <a href=#refsARIA>[ARIA]</a></p>

  <p>Authors must not set the ARIA <code title=attr-aria-role><a href=#attr-aria-role>role</a></code> and <code title=attr-aria-*>aria-*</code> attributes in a manner that conflicts with the semantics
  described in the following table, except that the <code title=attr-aria-role-presentation>presentation</code> role may always be used. Authors must not
  set the ARIA <code title=attr-aria-role><a href=#attr-aria-role>role</a></code> and <code title=attr-aria-*>aria-*</code>
  attributes to values that match the <a href=#default-implicit-aria-semantics>default implicit ARIA semantics</a> defined in the
  following two tables.</p>

  <div class=impl>

  <p>User agents are required to implement ARIA semantics on all <a href=#html-elements>HTML elements</a>, as
  defined in the ARIA specifications. The <a href=#default-implicit-aria-semantics>default implicit ARIA semantics</a> defined below
  must be recognized by implementations for the purposes of ARIA processing. <a href=#refsARIAIMPL>[ARIAIMPL]</a></p>

  <p class=note>The ARIA attributes defined in the ARIA specifications, and the <a href=#strong-native-semantics>strong
  native semantics</a> and <a href=#default-implicit-aria-semantics>default implicit ARIA semantics</a> defined below, do not
  have any effect on CSS pseudo-class matching, user interface modalities that don't use assistive
  technologies, or the default actions of user interaction events as described in this
  specification.</p> <!-- this is a truism, in that there are no requirements that require that
  those attributes have such an effect, and no requirements that relax the requirements on those
  effects such that they could be affected by those attributes -->

  </div>

  <p>The following table defines the <a href=#strong-native-semantics>strong native semantics</a> and corresponding
  <a href=#default-implicit-aria-semantics>default implicit ARIA semantics</a> that apply to <a href=#html-elements>HTML elements</a>. Each
  language feature (element or attribute) in a cell in the first column implies the ARIA semantics
  (any role, states, and properties) given in the cell in the second column of the same row. <span class=impl>When multiple rows apply to an element, the role from the last row to define a role
  must be applied, and the states and properties from all the rows must be combined.</span></p>

  <table id=table-aria-strong><thead><tr><th>Language feature
     <th><a href=#strong-native-semantics>Strong native semantics</a> and <a href=#default-implicit-aria-semantics>default implicit ARIA semantics</a>

   <tbody><tr><td><code><a href=#the-area-element>area</a></code> element that creates a <a href=#hyperlink>hyperlink</a>
     <td><code title=attr-aria-role-link>link</code> role

    <tr><td><code><a href=#the-base-element>base</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-datalist-element>datalist</a></code> element
     <td><code title=attr-aria-role-listbox>listbox</code> role, with the <code title=attr-aria-multiselectable>aria-multiselectable</code> property set to "false"

    <tr><td><code><a href=#the-details-element>details</a></code> element
     <td><code title=attr-aria-expanded>aria-expanded</code> state set to "true" if the element's <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute is present, and set to "false" otherwise

    <tr><td><code><a href=#the-dialog-element>dialog</a></code> element without an <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code> attribute
     <td>The <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td><code><a href=#the-head-element>head</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td><code><a href=#the-hgroup-element>hgroup</a></code> element
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>

    <tr><td><code><a href=#the-hr-element>hr</a></code> element
     <td><code title=attr-aria-role-separator>separator</code> role

    <tr><td><code><a href=#the-html-element>html</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-img-element>img</a></code> element whose <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value is empty
     <td><code title=attr-aria-role-presentation>presentation</code> role

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state
     <td><code title=attr-aria-checked>aria-checked</code> state set to "mixed" if the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is true, or "true" if the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is true, or "false" otherwise

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#color-state-(type=color)" title=attr-input-type-color>Color</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#local-date-and-time-state-(type=datetime-local)" title=attr-input-type-datetime-local>Local Date and Time</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#month-state-(type=month)" title=attr-input-type-month>Month</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state
     <td><code title=attr-aria-role-spinbutton>spinbutton</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute, the <code title=attr-aria-valuemax>aria-valuemax</code> property set to the element's <a href=#concept-input-max title=concept-input-max>maximum</a>, the <code title=attr-aria-valuemin>aria-valuemin</code> property set to the element's <a href=#concept-input-min title=concept-input-min>minimum</a>, and, if the result of applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> to the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, with the <code title=attr-aria-valuenow>aria-valuenow</code> property set to that number

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#password-state-(type=password)" title=attr-input-type-password>Password</a> state
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state
     <td><code title=attr-aria-checked>aria-checked</code> state set to "true" if the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is true, or "false" otherwise

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#range-state-(type=range)" title=attr-input-type-range>Range</a> state
     <td><code title=attr-aria-role-slider>slider</code> role, with the <code title=attr-aria-valuemax>aria-valuemax</code> property set to the element's <a href=#concept-input-max title=concept-input-max>maximum</a>, the <code title=attr-aria-valuemin>aria-valuemin</code> property set to the element's <a href=#concept-input-min title=concept-input-min>minimum</a>, and the <code title=attr-aria-valuenow>aria-valuenow</code> property set to the result of applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> to the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, if that results in a number, or the <a href=#concept-input-value-default-range title=concept-input-value-default-range>default value</a> otherwise

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset Button</a> state
     <td><code title=attr-aria-role-button>button</code> role

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a> state
     <td><code title=attr-aria-role-button>button</code> role

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>, <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a>, <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>, or <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> states with a <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
     <td><code title=attr-aria-role-combobox>combobox</code> role, with the <code title=attr-aria-owns>aria-owns</code> property set to the same value as the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute, and the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#time-state-(type=time)" title=attr-input-type-time>Time</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a> state with no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#week-state-(type=week)" title=attr-input-type-week>Week</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-input-element>input</a></code> element that is <a href=#concept-input-required title=concept-input-required>required</a>
     <td>The <code title=attr-aria-required>aria-required</code> state set to "true"

    <tr><td><code><a href=#the-keygen-element>keygen</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-label-element>label</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-link-element>link</a></code> element that creates a <a href=#hyperlink>hyperlink</a>
     <td><code title=attr-aria-role-link>link</code> role

    <tr><td><code><a href=#the-menu-element>menu</a></code> element with a <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-meta-element>meta</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-meter-element>meter</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-nav-element>nav</a></code> element
     <td><code title=attr-aria-role-navigation>navigation</code> role

    <tr><td><code><a href=#the-noscript-element>noscript</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td><code><a href=#the-optgroup-element>optgroup</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-option-element>option</a></code> element that is in a <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> or that represents a suggestion in a <code><a href=#the-datalist-element>datalist</a></code> element
     <td><code title=attr-aria-role-option>option</code> role, with the <code title=attr-aria-selected>aria-selected</code> state set to "true" if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, or "false" otherwise.

    <tr><td><code><a href=#the-param-element>param</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-progress-element>progress</a></code> element
     <td><code title=attr-aria-role-progressbar>progressbar</code> role, with, if the progress bar is determinate, the <code title=attr-aria-valuemax>aria-valuemax</code> property set to the maximum value of the progress bar, the <code title=attr-aria-valuemin>aria-valuemin</code> property set to zero, and the <code title=attr-aria-valuenow>aria-valuenow</code> property set to the current value of the progress bar

    <tr><td><code><a href=#the-script-element>script</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td><code><a href=#the-select-element>select</a></code> element with a <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
     <td><code title=attr-aria-role-listbox>listbox</code> role, with the <code title=attr-aria-multiselectable>aria-multiselectable</code> property set to "true"

    <tr><td><code><a href=#the-select-element>select</a></code> element with no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
     <td><code title=attr-aria-role-listbox>listbox</code> role, with the <code title=attr-aria-multiselectable>aria-multiselectable</code> property set to "false"

    <tr><td><code><a href=#the-select-element>select</a></code> element with a <code title=attr-select-required><a href=#attr-select-required>required</a></code> attribute
     <td>The <code title=attr-aria-required>aria-required</code> state set to "true"

    <tr><td><code><a href=#the-source-element>source</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-style-element>style</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td><code><a href=#the-summary-element>summary</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td><code><a href=#the-template-element>template</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>, with the <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td><code><a href=#the-textarea-element>textarea</a></code> element
     <td><code title=attr-aria-role-textbox>textbox</code> role, with the <code title=attr-aria-multiline>aria-multiline</code> property set to "true", and the <code title=attr-aria-readonly>aria-readonly</code> property set to "true" if the element has a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute

    <tr><td><code><a href=#the-textarea-element>textarea</a></code> element with a <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code> attribute
     <td>The <code title=attr-aria-required>aria-required</code> state set to "true"

    <tr><td><code><a href=#the-title-element>title</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>

    <tr><td>Element that is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>
     <td>The <code title=attr-aria-disabled>aria-disabled</code> state set to "true"

    <tr><td>Element that is <a href=#inert>inert</a>
     <td>The <code title=attr-aria-disabled>aria-disabled</code> state set to "true"

    <tr><td>Element with a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute
     <td>The <code title=attr-aria-hidden>aria-hidden</code> state set to "true"

    <tr><td>Element that is a <a href=#candidate-for-constraint-validation>candidate for constraint validation</a> but that does not <a href=#concept-fv-valid title=concept-fv-valid>satisfy its constraints</a>
     <td>The <code title=attr-aria-invalid>aria-invalid</code> state set to "true"

  </table><p>Some <a href=#html-elements>HTML elements</a> have native semantics that can be overridden. The following
  table lists these elements and their <a href=#default-implicit-aria-semantics>default implicit ARIA semantics</a>, along with the
  restrictions that apply to those elements. Each language feature (element or attribute) in a cell
  in the first column implies, unless otherwise overridden, the ARIA semantic (role, state, or
  property) given in the cell in the second column of the same row, but this semantic may be
  overridden under the conditions listed in the cell in the third column of that row. In addition,
  any element may be given the <code title=attr-aria-role-presentation>presentation</code> role,
  regardless of the restrictions below.</p>

  <table id=table-aria-weak><thead><tr><th>Language feature
     <th>Default implicit ARIA semantic
     <th>Restrictions

   <tbody><tr><td><code><a href=#the-a-element>a</a></code> element that creates a <a href=#hyperlink>hyperlink</a>
     <td><code title=attr-aria-role-link>link</code> role
     <td>Role must be either <code title=attr-aria-role-link>link</code>, <code title=attr-aria-role-menuitem>menuitem</code>, <code title=attr-aria-role-tab>tab</code>, or <code title=attr-aria-role-treeitem>treeitem</code>

    <tr><td><code><a href=#the-address-element>address</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be <code title=attr-aria-role-contentinfo>contentinfo</code>

    <tr><td><code><a href=#the-article-element>article</a></code> element
     <td><code title=attr-aria-role-article>article</code> role
     <td>Role must be either <code title=attr-aria-role-article>article</code>, <code title=attr-aria-role-document>document</code>, <code title=attr-aria-role-application>application</code>, or <code title=attr-aria-role-main>main</code>

    <tr><td><code><a href=#the-aside-element>aside</a></code> element
     <td><code title=attr-aria-role-complementary>complementary</code> role
     <td>Role must be either <code title=attr-aria-role-complementary>complementary</code>, <code title=attr-aria-role-note>note</code>, or <code title=attr-aria-role-search>search</code>

    <tr><td><code><a href=#the-audio-element>audio</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be <code title=attr-aria-role-application>application</code>

    <tr><td><code><a href=#the-button-element>button</a></code> element
     <td><code title=attr-aria-role-button>button</code> role
     <td>Role must be either <code title=attr-aria-role-button>button</code>, <code title=attr-aria-role-menuitem>menuitem</code>

    <tr><td><code><a href=#the-details-element>details</a></code> element
     <td><code title=attr-aria-role-group>group</code> role
     <td>Role must be a role that supports <code title=attr-aria-expanded>aria-expanded</code>

    <tr><td><code><a href=#the-dialog-element>dialog</a></code> element
     <td><code title=attr-aria-role-dialog>dialog</code> role
     <td>Role must be either
      <code title=attr-aria-role-alert>alert</code>,
      <code title=attr-aria-role-alertdialog>alertdialog</code>,
      <code title=attr-aria-role-application>application</code>,
      <code title=attr-aria-role-contentinfo>contentinfo</code>,
      <code title=attr-aria-role-dialog>dialog</code>,
      <code title=attr-aria-role-document>document</code>,
      <code title=attr-aria-role-log>log</code>,
      <code title=attr-aria-role-main>main</code>,
      <code title=attr-aria-role-marquee>marquee</code>,
      <code title=attr-aria-role-region>region</code>,
      <code title=attr-aria-role-search>search</code>, or
      <code title=attr-aria-role-status>status</code>

    <tr><td><code><a href=#the-embed-element>embed</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be either <code title=attr-aria-role-application>application</code>, <code title=attr-aria-role-document>document</code>, or <code title=attr-aria-role-img>img</code>

    <tr><td><code><a href=#the-footer-element>footer</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be <code title=attr-aria-role-contentinfo>contentinfo</code>

    <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
     <td>Role must be either <code title=attr-aria-role-heading>heading</code> or <code title=attr-aria-role-tab>tab</code>

    <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
     <td>Role must be either <code title=attr-aria-role-heading>heading</code> or <code title=attr-aria-role-tab>tab</code>

    <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
     <td>Role must be either <code title=attr-aria-role-heading>heading</code> or <code title=attr-aria-role-tab>tab</code>

    <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
     <td>Role must be either <code title=attr-aria-role-heading>heading</code> or <code title=attr-aria-role-tab>tab</code>

    <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
     <td>Role must be either <code title=attr-aria-role-heading>heading</code> or <code title=attr-aria-role-tab>tab</code>

    <tr><td><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element that does not have an <code><a href=#the-hgroup-element>hgroup</a></code> ancestor
     <td><code title=attr-aria-role-heading>heading</code> role, with the <code title=attr-aria-level>aria-level</code> property set to the element's <a href=#outline-depth>outline depth</a>
     <td>Role must be either <code title=attr-aria-role-heading>heading</code> or <code title=attr-aria-role-tab>tab</code>

    <tr><td><code><a href=#the-header-element>header</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be <code title=attr-aria-role-banner>banner</code>

    <tr><td><code><a href=#the-iframe-element>iframe</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be either <code title=attr-aria-role-application>application</code>, <code title=attr-aria-role-document>document</code>, or <code title=attr-aria-role-img>img</code>

    <tr><td><code><a href=#the-img-element>img</a></code> element whose <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value is absent
     <td><code title=attr-aria-role-img>img</code> role
     <td>No restrictions

    <tr><!--!--><!--(there's no reason to convey <img> elements with alt="" text as images to an AT)--><td><code><a href=#the-img-element>img</a></code> element whose <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value is present and not empty
     <td><code title=attr-aria-role-img>img</code> role
     <td>No restrictions

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#button-state-(type=button)" title=attr-input-type-button>Button</a> state
     <td><code title=attr-aria-role-button>button</code> role
     <td>Role must be either <code title=attr-aria-role-button>button</code>, <code title=attr-aria-role-menuitem>menuitem</code>

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state
     <td><code title=attr-aria-role-checkbox>checkbox</code> role
     <td>Role must be either <code title=attr-aria-role-checkbox>checkbox</code> or <code title=attr-aria-role-menuitemcheckbox>menuitemcheckbox</code>

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state
     <td><code title=attr-aria-role-button>button</code> role
     <td>Role must be either <code title=attr-aria-role-button>button</code>, <code title=attr-aria-role-menuitem>menuitem</code>

    <tr><td><code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state
     <td><code title=attr-aria-role-radio>radio</code> role
     <td>Role must be either <code title=attr-aria-role-radio>radio</code> or <code title=attr-aria-role-menuitemradio>menuitemradio</code>

    <tr><td><code><a href=#the-li-element>li</a></code> element whose parent is an <code><a href=#the-ol-element>ol</a></code> or <code><a href=#the-ul-element>ul</a></code> element
     <td><code title=attr-aria-role-listitem>listitem</code> role
     <td>Role must be either <code title=attr-aria-role-listitem>listitem</code>, <code title=attr-aria-role-menuitemcheckbox>menuitemcheckbox</code>, <code title=attr-aria-role-menuitemradio>menuitemradio</code>, <code title=attr-aria-role-option>option</code>, <code title=attr-aria-role-tab>tab</code>, or <code title=attr-aria-role-treeitem>treeitem</code>

    <tr><td><code><a href=#the-main-element>main</a></code> element
     <td><code title=attr-aria-role-main>main</code> role
     <td>Role must be either <code title=attr-aria-role-document>document</code>, <code title=attr-aria-role-application>application</code>, or <code title=attr-aria-role-main>main</code>

    <tr><td><code><a href=#the-menu-element>menu</a></code> element with a <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the <a href=#toolbar-state title="toolbar state">toolbar</a> state
     <td><code title=attr-aria-role-toolbar>toolbar</code> role
     <td>Role must be either <code title=attr-aria-role-directory>directory</code>, <code title=attr-aria-role-list>list</code>, <code title=attr-aria-role-listbox>listbox</code>, <code title=attr-aria-role-menu>menu</code>, <code title=attr-aria-role-menubar>menubar</code>, <code title=attr-aria-role-tablist>tablist</code>, <code title="attr-aria-role-toolbar ">toolbar</code>, or <code title=attr-aria-role-tree>tree</code>

    <tr><td><code><a href=#the-object-element>object</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be either <code title=attr-aria-role-application>application</code>, <code title=attr-aria-role-document>document</code>, or <code title=attr-aria-role-img>img</code>

    <tr><td><code><a href=#the-ol-element>ol</a></code> element
     <td><code title=attr-aria-role-list>list</code> role
     <td>Role must be either <code title=attr-aria-role-directory>directory</code>, <code title=attr-aria-role-list>list</code>, <code title=attr-aria-role-listbox>listbox</code>, <code title=attr-aria-role-menu>menu</code>, <code title=attr-aria-role-menubar>menubar</code>, <code title=attr-aria-role-tablist>tablist</code>, <code title="attr-aria-role-toolbar ">toolbar</code>, or <code title=attr-aria-role-tree>tree</code>

    <tr><td><code><a href=#the-output-element>output</a></code> element
     <td><code title=attr-aria-role-status>status</code> role
     <td>No restrictions

    <tr><td><code><a href=#the-section-element>section</a></code> element
     <td><code title=attr-aria-role-region>region</code> role
     <td>Role must be either
      <code title=attr-aria-role-alert>alert</code>,
      <code title=attr-aria-role-alertdialog>alertdialog</code>,
      <code title=attr-aria-role-application>application</code>,
      <code title=attr-aria-role-contentinfo>contentinfo</code>,
      <code title=attr-aria-role-dialog>dialog</code>,
      <code title=attr-aria-role-document>document</code>,
      <code title=attr-aria-role-log>log</code>,
      <code title=attr-aria-role-main>main</code>,
      <code title=attr-aria-role-marquee>marquee</code>,
      <code title=attr-aria-role-region>region</code>,
      <code title=attr-aria-role-search>search</code>, or
      <code title=attr-aria-role-status>status</code>

    <tr><td><code><a href=#the-ul-element>ul</a></code> element
     <td><code title=attr-aria-role-list>list</code> role
     <td>Role must be either <code title=attr-aria-role-directory>directory</code>, <code title=attr-aria-role-list>list</code>, <code title=attr-aria-role-listbox>listbox</code>, <code title=attr-aria-role-menu>menu</code>, <code title=attr-aria-role-menubar>menubar</code>, <code title=attr-aria-role-tablist>tablist</code>, <code title="attr-aria-role-toolbar ">toolbar</code>, <code title=attr-aria-role-tree>tree</code>

    <tr><td><code><a href=#the-video-element>video</a></code> element
     <td><a href=#concept-role-none title=concept-role-none>No role</a>
     <td>If specified, role must be <code title=attr-aria-role-application>application</code>

    <tr><td><a href=#the-body-element-0>The body element</a>
     <td><code title=attr-aria-role-document>document</code> role
     <td>Role must be either <code title=attr-aria-role-document>document</code> or <code title=attr-aria-role-application>application</code>

  </table><p>The entry "<dfn id=concept-role-none title=concept-role-none>no role</dfn>", when used as a <a href=#strong-native-semantics title="strong
  native semantics">strong native semantic</a>, means that no role other than <code title=attr-aria-role-presentation>presentation</code> can be used. When used as a <a href=#default-implicit-aria-semantics title="default implicit ARIA semantics">default implicit ARIA semantic</a>, it means the user
  agent has no default mapping to ARIA roles. (However, it probably will have its own mappings to
  the accessibility layer.)</p>

  <div class=impl>

  <p>Conformance checkers are encouraged to phrase errors such that authors are encouraged to use
  more appropriate elements rather than remove accessibility annotations. For example, if an
  <code><a href=#the-a-element>a</a></code> element is marked as having the <code title=attr-aria-role-button>button</code>
  role, a conformance checker could say "Use a more appropriate element to represent a button, for
  example a <code><a href=#the-button-element>button</a></code> element or an <code><a href=#the-input-element>input</a></code> element" rather than "The <code title=attr-aria-role-button>button</code> role cannot be used with <code><a href=#the-a-element>a</a></code> elements".</p>

  </div>

  <div class=example>

   <p>These features can be used to make accessibility tools render content to their users in more
   useful ways. For example, ASCII art, which is really an image, appears to be text, and in the
   absence of appropriate annotations would end up being rendered by screen readers as a very
   painful reading of lots of punctuation. Using the features described in this section, one can
   instead make the ATs skip the ASCII art and just read the caption:</p>

   <pre>&lt;figure <strong>role="img" aria-labelledby="fish-caption"</strong>&gt; <!-- that's "l a b e l l e d" with TWO "l"s -->
 &lt;pre&gt;
 o           .'`/
     '      /  (
   O    .-'` ` `'-._      .')
      _/ (o)        '.  .' /
      )       )))     &gt;&lt;  &lt;
      `\  |_\      _.'  '. \
        '-._  _ .-'       '.)
    jgs     `\__\
 &lt;/pre&gt;
 &lt;figcaption <strong>id="fish-caption"</strong>&gt;
  Joan G. Stark, "&lt;cite&gt;fish&lt;/cite&gt;".
  October 1997. ASCII on electrons. 28&times;8.
 &lt;/figcaption&gt; 
&lt;/figure&gt; 
   </pre>

   <!-- source: http://www.geocities.com/SoHo/7373/aquatic.htm#fish -->

  </div>



  <div class=impl>

  <h3 id=interactions-with-xpath-and-xslt><span class=secno>3.3 </span>Interactions with XPath and XSLT</h3>

  <p id=xpath-1.0-processors>Implementations of XPath 1.0 that operate on <a href=#html-documents>HTML
  documents</a> parsed or created in the manners described in this specification (e.g. as part of
  the <code title="">document.evaluate()</code> API) must act as if the following edit was applied
  to the XPath 1.0 specification.</p>

  <p>First, remove this paragraph:</p>

  <blockquote cite=http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests>

   <p>A <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> in the node test is expanded
   into an <a href=http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name>expanded-name</a>
   using the namespace declarations from the expression context. This is the same way expansion is
   done for element type names in start and end-tags except that the default namespace declared with
   <code title="">xmlns</code> is not used: if the <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> does not have a prefix, then the
   namespace URI is null (this is the same way attribute names are expanded). It is an error if the
   <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> has a prefix for which there is
   no namespace declaration in the expression context.</p>

  </blockquote>

  <p>Then, insert in its place the following:</p>

  <blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">

   <p>A QName in the node test is expanded into an expanded-name using the namespace declarations
   from the expression context. If the QName has a prefix, then there must be a<!-- added 2009-10-27
   - http://www.w3.org/Bugs/Public/show_bug.cgi?id=8062 --> namespace declaration for this prefix in
   the expression context, and the corresponding<!-- typo fixed 2009-10-27 -
   http://www.w3.org/Bugs/Public/show_bug.cgi?id=8063 --> 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>

    <li>Otherwise, the default element namespace URI is null.</li>

   </ol><p class=note>This is equivalent to adding the default element namespace feature of XPath 2.0
   to XPath 1.0, and using the HTML namespace as the default element namespace for HTML documents.
   It is motivated by the desire to have implementations be compatible with legacy HTML content
   while still supporting the changes that this specification introduces to HTML regarding the
   namespace used for HTML elements, and by the desire to use XPath 1.0 rather than XPath 2.0.</p>

  </blockquote>

  <p class=note>This change is a <a href=#willful-violation>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> <!-- note: version matters for
  this ref -->

  <hr><p id=dom-based-xslt-1.0-processors>XSLT 1.0 processors outputting to a DOM when the output
  method is "html" (either explicitly or via the defaulting rule in XSLT 1.0) are affected as
  follows:</p>

  <p>If the transformation program outputs an element in no namespace, the processor must, prior to
  constructing the corresponding DOM element node, change the namespace of the element to the
  <a href=#html-namespace-0>HTML namespace</a>, <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">ASCII-lowercase</a> the
  element's local name, and <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">ASCII-lowercase</a> the
  names of any non-namespaced attributes on the element.</p>

  <p class=note>This requirement is a <a href=#willful-violation>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> <!-- note: version matters for this ref -->

  <hr><p>This specification does not specify precisely how XSLT processing interacts with the <a href=#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>stack of open elements</a>). However, XSLT processors must <a href=#stop-parsing>stop
  parsing</a> if they successfully complete, and must set the <a href=#current-document-readiness>current document
  readiness</a> first to "<code title="">interactive</code>"<!-- this synchronously fires an
  event --> and then to "<code title="">complete</code>"<!-- this also synchronously fires an event
  --> if they are aborted.</p>

  <hr><p>This specification does not specify how XSLT interacts with the <a href=#navigate title=navigate>navigation</a> algorithm, how it fits in with the <a href=#event-loop>event loop</a>, nor
  how error pages are to be handled (e.g. whether XSLT errors are to replace an incremental XSLT
  output, or are rendered inline, etc).</p>

  <p class=note>There are also additional non-normative comments regarding the interaction of XSLT
  and HTML <a href=#scriptTagXSLT>in the <code>script</code> element section</a>, and of
  XSLT, XPath, and HTML <a href=#template-XSLT-XPath>in the <code>template</code> element
  section</a>.</p>

  </div>



<!--TOPIC:HTML Syntax and Parsing-->
  <h3 id=dynamic-markup-insertion><span class=secno>3.4 </span><dfn>Dynamic markup insertion</dfn></h3>

  <p class=note>APIs for dynamically inserting markup into the document interact with the parser,
  and thus their behavior varies depending on whether they are used with <a href=#html-documents>HTML documents</a>
  (and the <a href=#html-parser>HTML parser</a>) or XHTML in <a href=#xml-documents>XML documents</a> (and the <a href=#xml-parser>XML
  parser</a>).</p>



  <h4 id=opening-the-input-stream><span class=secno>3.4.1 </span>Opening the input stream</h4>

  <p>The <dfn id=dom-document-open title=dom-document-open><code>open()</code></dfn> method comes in several variants
  with different numbers of arguments.</p>

  <dl class=domintro><dt><var title="">document</var> = <var title="">document</var> . <code title=dom-document-open><a href=#dom-document-open>open</a></code>( [ <var title="">type</var> [, <var title="">replace</var> ] ] )</dt>

   <dd>

    <p>Causes the <code><a href=#document>Document</a></code> to be replaced in-place, as if it was a new
    <code><a href=#document>Document</a></code> object, but reusing the previous object, which is then returned.</p>

    <p>If the <var title="">type</var> argument is omitted or has the value
    "<code><a href=#text/html>text/html</a></code>", then the resulting <code><a href=#document>Document</a></code> has an HTML parser associated
    with it, which can be given data to parse using <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code>. Otherwise, all content passed to <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> will be parsed as plain text.</p>

    <p>If the <var title="">replace</var> argument is present and has the value "<code title="">replace</code>", the existing entries in the session history for the
    <code><a href=#document>Document</a></code> object are removed.</p>

    <p>The method has no effect if the <code><a href=#document>Document</a></code> is still being parsed.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code><a href=#document>Document</a></code> is an <a href=#xml-documents title="XML documents">XML document</a>.</p>

   </dd>

   <dt><var title="">window</var> = <var title="">document</var> . <code title=dom-document-open><a href=#dom-document-open>open</a></code>( <var title="">url</var>, <var title="">name</var>, <var title="">features</var> [, <var title="">replace</var> ] )</dt>

   <dd>

    <p>Works like the <code title=dom-open><a href=#dom-open>window.open()</a></code> method.</p>

   </dd>

  </dl><div class=impl>

  <p><code><a href=#document>Document</a></code> objects have an <dfn id=ignore-opens-during-unload-counter>ignore-opens-during-unload counter</dfn>, which is
  used to prevent scripts from invoking the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code>
  method (directly or indirectly) while the document is <a href=#unload-a-document title="unload a document">being
  unloaded</a>. Initially, the counter must be set to zero.</p> <!--
  http://www.hixie.ch/tests/adhoc/dom/level0/document/open/unload/ -->

  <p>When called with two arguments, the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code>
  method must act as follows:</p>

  <ol><li><p>If the <code><a href=#document>Document</a></code> object is not flagged as an <a href=#html-documents title="HTML documents">HTML
   document</a>, throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>If the <code><a href=#document>Document</a></code> object is not an <a href=#active-document>active document</a>, then abort
   these steps.</li>

   <li><p>Let <var title="">type</var> be the value of the first argument.</li>

   <li>

    <p>If the second argument is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the value
    "replace", then let <var title="">replace</var> be true.</p>

    <p>Otherwise, if the <a href=#browsing-context>browsing context</a>'s <a href=#session-history>session history</a> contains only
    one <code><a href=#document>Document</a></code>, and that was the <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code>
    created when the <a href=#browsing-context>browsing context</a> was created, and that <code><a href=#document>Document</a></code> has
    never had the <a href=#unload-a-document>unload a document</a> algorithm invoked on it (e.g. by a previous call to
    <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code>), then let <var title="">replace</var> be
    true.</p>

    <p>Otherwise, let <var title="">replace</var> be false.</p>

   </li>

   <li>

    <p>If the <code><a href=#document>Document</a></code> has an <a href=#active-parser>active parser</a> whose <a href=#script-nesting-level>script nesting
    level</a> is greater than zero, then the method does nothing. Abort these steps and return
    the <code><a href=#document>Document</a></code> object on which the method was invoked.</p>

    <p class=note>This basically causes <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> to
    be ignored when it's called in an inline script found during parsing, while still letting it
    have an effect when called asynchronously.</p>

   </li>

   <li>

    <p>Similarly, if the <code><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> is
    greater than zero, then the method does nothing. Abort these steps and return the
    <code><a href=#document>Document</a></code> object on which the method was invoked.</p>

    <p class=note>This basically causes <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> to
    be ignored when it's called from a <code title=event-beforeunload>beforeunload</code> <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code>, or <code title=event-unload>unload</code> event
    handler while the <code><a href=#document>Document</a></code> is being unloaded.</p>

   </li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <li><p>Set the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.</li>

   <li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to unload</a> the
   <code><a href=#document>Document</a></code> object. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be
   unloaded</a>, then abort these steps and return the <code><a href=#document>Document</a></code> object on which the
   method was invoked.</li>

   <li><p><a href=#unload-a-document title="unload a document">Unload</a> the <code><a href=#document>Document</a></code> object, with the
   <var title="">recycle</var> parameter set to true.</li>

   <li><p><a href=#abort-a-document title="abort a document">Abort</a> the <code><a href=#document>Document</a></code>.</li>

   <li><p>Unregister all event listeners registered on the <code><a href=#document>Document</a></code> node and its
   descendants.</p>

   <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> associated with the
   <code><a href=#document>Document</a></code> in any <a href=#task-source>task source</a>.</li> <!-- removes callbacks that fired
   between this algorithm starting and the times and databases being aborted in the "unload" step
   above -->

   <li><p>Remove all child nodes of the document, without firing any mutation events.</li> <!--
   as of 2009-03-30, only WebKit fired mutation events here. -->

   <li><p>Replace the <code><a href=#document>Document</a></code>'s singleton objects with new instances of those objects.
   (This includes in particular the <code><a href=#window>Window</a></code>, <code><a href=#location>Location</a></code>,
   <code><a href=#history-0>History</a></code>, <code><a href=#applicationcache>ApplicationCache</a></code>, and <code><a href=#navigator>Navigator</a></code>, objects, the
   various <code><a href=#barprop>BarProp</a></code> objects, the two <code><a href=#storage-0>Storage</a></code> objects, the various
   <code><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
   <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
   IDL prototypes in the JavaScript binding, including the <code><a href=#document>Document</a></code> object's
   prototype.)</li>

   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%20src%3D%22document%22%3E%3C%2Fiframe%3E%0A%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20f%20%3D%20document.getElementsByTagName('iframe')%5B0%5D%3B%20d%20%3D%20f.contentWindow.document%3B%20%7D%3C%2Fscript%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22w(d.documentElement.innerHTML)%22%20value%3D%22dump%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cscript%3Evar%20x%20%3D%20new%20XMLHttpRequest()%3Bx.open(%26quot%3BGET%26quot%3B%2C%20%26quot%3BGET%26quot%3B)%3Bx.onreadystatechange%3Dfunction()%20%7B%20alert(x.readyState)%3B%20%7D%3Bx.send(null)%3B%3C%2Fscript%3E')%3Bd.close()%3B%20setTimeout(function()%20%7B%20d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%20%7D%2C%200)%3B%22%20value%3D%22xhr%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.onclick%20%3D%20function()%20%7B%20w('click')%20%7D%22%20value%3D%22add%20click%20handler%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3E%3Cscript%3Ei%20%3D%200%3B%20setTimeout(%26quot%3Bparent.w(i%2B%2B)%26quot%3B%2C%202000)%3C%2Fscript%3E%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%20with%20timer%22%3E -->
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%3E%3C%2Fiframe%3E%0D%0A%3Cscript%3E%0D%0Aonload%20%3D%20function%20()%20%7B%0D%0A%20frames%5B0%5D.test%20%3D%201%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20var%20a%20%3D%20frames%5B0%5D.document.location.assign%3B%0D%0A%20w(a)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%20frames%5B0%5D.document.open()%3B%0D%0A%20frames%5B0%5D.document.write('%3Cscript%3Edocument.write(test)%3C%5C%2Fscript%3E')%3B%0D%0A%20frames%5B0%5D.document.close()%3B%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E -->

   <li><p>Change the <a href="#document's-character-encoding">document's character encoding</a> to UTF-8.</li>

   <li><p>If the <code><a href=#document>Document</a></code> is <a href=#ready-for-post-load-tasks>ready for post-load tasks</a>, then set the
   <code><a href=#document>Document</a></code> object's <a href=#reload-override-flag>reload override flag</a> and set the
   <code><a href=#document>Document</a></code>'s <a href=#reload-override-buffer>reload override buffer</a> to the empty string.</li>

   <li><p>Set the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state back to true.</li>

   <li><p>Change <a href="#the-document's-address">the document's address</a> to the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's document">document</a>'s <a href="#the-document's-address" title="the document's
   address">address</a>.</li>

   <!-- <span>the document's referrer</span> stays the same -->

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#iframe-load-in-progress>iframe load in progress</a> flag is set, set the
   <code><a href=#document>Document</a></code>'s <a href=#mute-iframe-load>mute iframe load</a> flag.</li>

   <li><p>Create a new <a href=#html-parser>HTML parser</a> and associate it with the document. This is a
   <dfn id=script-created-parser>script-created parser</dfn> (meaning that it can be closed by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> and <code title=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 title=dom-document-close><a href=#dom-document-close>document.close()</a></code> before emitting an
   end-of-file token). The encoding <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
   <i>irrelevant</i>.</li>

   <li><p>Set the <a href=#current-document-readiness>current document readiness</a> of the document to "<code title="">loading</code>".</li>

   <li>

    <!-- text/plain handling -->

    <p>If <var title="">type</var> is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
    "<code>replace</code>", then, for historical reasons, set it to the string "<code title="">text/html</code>".</p>

    <p>Otherwise:</p>

    <p>If the <var title="">type</var> string contains a U+003B SEMICOLON character (;), remove the
    first such character and all characters from it up to the end of the string.</p>

    <p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var title="">type</var>.</p>

   </li>

   <li>

    <p>If <var title="">type</var> is <em>not</em> now an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match
    for the string "<code><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<!-- to get
    eaten, so that a leading LF in the written text doesn't get eaten itself-->, then switch the
    <a href=#html-parser>HTML parser</a>'s tokenizer to the <a href=#plaintext-state>PLAINTEXT state</a>.</p>

    <!--
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20%0D%0A%20%20var%20d%20%3D%20document.getElementsByTagName('iframe')%5B0%5D.contentDocument%3B%0D%0A%20%20d.open('image%2Fsvg%2Bxml')%3B%0D%0A%20%20d.write(%22%3Cinput%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%20value%3D'(x)html'%2F%3E%22)%3B%0D%0A%20%20d.close()%3B%0D%0A%7D%3B%3C%2Fscript%3E
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20%0D%0A%20%20var%20d%20%3D%20document.getElementsByTagName('iframe')%5B0%5D.contentDocument%3B%0D%0A%20%20d.open('image%2Fgif')%3B%0D%0A%20%20var%20a%20%3D%20%5B%200x47%2C%200x49%2C%200x46%2C%200x38%2C%200x39%2C%200x61%2C%200x01%2C%200x00%2C%200x01%2C%200x00%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x80%2C%200xff%2C%200x00%2C%200xc0%2C%200xc0%2C%200xc0%2C%200x00%2C%200x00%2C%200x00%2C%200x21%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200xf9%2C%200x04%2C%200x01%2C%200x00%2C%200x00%2C%200x00%2C%200x00%2C%200x2c%2C%200x00%2C%200x00%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x00%2C%200x00%2C%200x01%2C%200x00%2C%200x01%2C%200x00%2C%200x00%2C%200x02%2C%200x02%2C%200x44%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x01%2C%200x00%2C%200x3b%20%5D%3B%0D%0A%20%20var%20s%20%3D%20%22%22%3B%0D%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20a.length%3B%20i%20%2B%3D%201)%0D%0A%20%20%20%20s%20%2B%3D%20String.fromCharCode(a%5Bi%5D)%3B%0D%0A%20%20d.write(s)%3B%0D%0A%20%20d.close()%3B%0D%0A%7D%3B%3C%2Fscript%3E
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27Text%2Fplain%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27%20text%2Fplain%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27text%2Fplain%3B%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
    -->

   </li>

   <li>

    <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s <a href=#session-history>session history</a>
    after the <a href=#current-entry>current entry</a>. If the <a href=#current-entry>current entry</a> is the last entry in the
    session history, then no entries are removed.</p>

    <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
    agent's user interface.</p>

   </li>

   <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued by the <a href=#history-traversal-task-source>history traversal
   task source</a> that are associated with any <code><a href=#document>Document</a></code> objects in the
   <a href=#top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family>document family</a>.</li>

   <li>Remove any earlier entries that share the same <code><a href=#document>Document</a></code>.</li>

   <li><p>If <var title="">replace</var> is false, then add a new entry, just before the last entry,
   and associate with the new entry the text that was parsed by the previous parser associated with
   the <code><a href=#document>Document</a></code> object, as well as the state of the document at the start of these
   steps. This allows the user to step backwards in the session history to see the page before it
   was blown away by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> call. This new entry
   does not have a <code><a href=#document>Document</a></code> object, so a new one will be created if the session history
   is traversed to that entry.</li>

   <li><p>Finally, set the <a href=#insertion-point>insertion point</a> to point at just before the end of the
   <a href=#input-stream>input stream</a> (which at this point will be empty).</li>

   <li><p>Return the <code><a href=#document>Document</a></code> on which the method was invoked.</li>

  </ol><p class=note>The <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method does not affect
  whether a <code><a href=#document>Document</a></code> is <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> or <a href=#completely-loaded>completely
  loaded</a>.</p>

  <p>When called with four arguments, the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method on
  the <code><a href=#document>Document</a></code> object must call the <code title=dom-open><a href=#dom-open>open()</a></code> method on the
  <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code> object, with the same arguments as the
  original call to the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method, and return whatever
  that method returned. If the <code><a href=#document>Document</a></code> object has no <code><a href=#window>Window</a></code> object, then
  the method must throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.</p>

  </div>



  <h4 id=closing-the-input-stream><span class=secno>3.4.2 </span>Closing the input stream</h4>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-close><a href=#dom-document-close>close</a></code>()</dt>

   <dd>

    <p>Closes the input stream that was opened by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the
    <code><a href=#document>Document</a></code> is an <a href=#xml-documents title="XML documents">XML
    document</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-close title=dom-document-close><code>close()</code></dfn> method must run the following
  steps:</p>

  <ol><li><p>If the <code><a href=#document>Document</a></code> object is not flagged as an <a href=#html-documents title="HTML documents">HTML
   document</a>, throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
   steps.</li>

   <li><p>If there is no <a href=#script-created-parser>script-created parser</a> associated with the document, then abort
   these steps.</li>

   <li><p>Insert an <a href=#explicit-eof-character>explicit "EOF" character</a> at the end of the parser's <a href=#input-stream>input
   stream</a>.</li>

   <li><p>If there is a <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>, then abort these
   steps.</li>

   <li><p>Run the tokenizer, processing resulting tokens as they are emitted, and stopping when the
   tokenizer reaches the <a href=#explicit-eof-character>explicit "EOF" character</a> or <a href=#spin-the-event-loop title="spin the event
   loop">spins the event loop</a>.</li>

  </ol></div>



  <h4 id=document.write()><span class=secno>3.4.3 </span><code title=dom-document-write><a href=#dom-document-write>document.write()</a></code></h4>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-write><a href=#dom-document-write>write</a></code>(<var title="">text</var>...)</dt>

   <dd>

    <p>In general, adds the given string(s) to the <code><a href=#document>Document</a></code>'s input stream.</p>

    <p class=warning>This method has very idiosyncratic behavior. In some cases, this method can
    affect the state of the <a href=#html-parser>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 title="">&lt;plaintext&gt;</code>" or "<code title="">&lt;!--</code>"). In other cases,
    the call can clear the current page first, as if <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> had been called. In yet more cases, the method
    is simply ignored, or throws an exception. To make matters worse, the exact behavior of this
    method can in some cases be dependent on network latency<!--

     Namely, in the following case:

        <script>
         document.write('<link rel=stylesheet href=foo.css><script></script>x');
         // at this point, whether the DOM contains an "x" or not depends on how quickly the foo.css file could be processed
        </script>

    -->, which can lead to failures that are very hard to debug. <strong>For all these reasons, use
    of this method is strongly discouraged.</strong></p>

    <p>This method throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception when invoked on <a href=#xml-documents>XML
    documents</a>.</p>

   </dd>

  </dl><div class=impl>

  <p><code><a href=#document>Document</a></code> objects have an <dfn id=ignore-destructive-writes-counter>ignore-destructive-writes counter</dfn>, which is
  used in conjunction with the processing of <code><a href=#the-script-element>script</a></code> elements to prevent external
  scripts from being able to use <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> to blow
  away the document by implicitly calling <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code>.
  Initially, the counter must be set to zero.</p>

  <p>The <dfn id=dom-document-write title=dom-document-write><code>document.write(...)</code></dfn> method must act as
  follows:</p>

  <ol><li>

    <p>If the method was invoked on an <a href=#xml-documents title="XML documents">XML document</a>, throw an
    <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</p>

    <!--
    Where would document.write() insert?
    Consider: data:text/xml,<script xmlns="http://www.w3.org/1999/xhtml"><![CDATA[ document.write('<foo>Test</foo>'); ]]></script>
    -->

   </li>

   <li><p>If the <code><a href=#document>Document</a></code> object is not an <a href=#active-document>active document</a>, then abort
   these steps.</li>

   <li>

    <p>If the <a href=#insertion-point>insertion point</a> is undefined and either the <code><a href=#document>Document</a></code>'s
    <a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> is greater than zero or the
    <code><a href=#document>Document</a></code>'s <a href=#ignore-destructive-writes-counter>ignore-destructive-writes counter</a> is greater than zero,
    abort these steps.</p>

   </li>

   <li>

    <p>If the <a href=#insertion-point>insertion point</a> is undefined, call the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method on the <code title=Document><a href=#document>document</a></code>
    object (with no arguments). If the user <a href=#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>insertion point</a> will point
    at just before the end of the (empty) <a href=#input-stream>input stream</a>.</p>

   </li>

   <li>

    <p>Insert the string consisting of the concatenation of all the arguments to the method into the
    <a href=#input-stream>input stream</a> just before the <a href=#insertion-point>insertion point</a>.</p>

   </li>

   <li>

    <p>If the <code><a href=#document>Document</a></code> object's <a href=#reload-override-flag>reload override flag</a> is set, then append
    the string consisting of the concatenation of all the arguments to the method to the
    <code><a href=#document>Document</a></code>'s <a href=#reload-override-buffer>reload override buffer</a>.</p>

   </li>

   <li>

    <p>If there is no <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>, have the <a href=#html-parser>HTML
    parser</a> process the characters that were inserted, one at a time, processing resulting
    tokens as they are emitted, and stopping when the tokenizer reaches the insertion point or when
    the processing of the tokenizer is aborted by the tree construction stage (this can happen if a
    <code><a href=#the-script-element>script</a></code> end tag token is emitted by the tokenizer).

    <p class=note>If the <code title=dom-document-write><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><a href=#the-script-element>script</a></code> tags), then this is a <a href=#nestedParsing>reentrant invocation of the
    parser</a>.</p>

   </li>

   <li>

    <p>Finally, return from the method.</p>

   </li>

  </ol></div>


  <h4 id=document.writeln()><span class=secno>3.4.4 </span><code title=dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code></h4>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-writeln><a href=#dom-document-writeln>writeln</a></code>(<var title="">text</var>...)</dt>

   <dd>

    <p>Adds the given string(s) to the <code><a href=#document>Document</a></code>'s input stream, followed by a newline
    character. If necessary, calls the <code title=dom-document-open><a href=#dom-document-open>open()</a></code> method
    implicitly first.</p>

    <p>This method throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception when invoked on <a href=#xml-documents>XML
    documents</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-writeln title=dom-document-writeln><code>document.writeln(...)</code></dfn> method, when
  invoked, must act as if the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> method had
  been invoked with the same argument(s), plus an extra argument consisting of a string containing a
  single line feed character (U+000A).</p>

  </div>



<!--TOPIC:HTML-->
  <h2 id=semantics><span class=secno>4 </span>The elements of HTML</h2>

  <h3 id=the-root-element><span class=secno>4.1 </span>The root element</h3>

  <h4 id=the-html-element><span class=secno>4.1.1 </span>The <dfn><code>html</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the root element of a document.</dd>
   <dd>Wherever a subdocument fragment is allowed in a compound document.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>A <code><a href=#the-head-element>head</a></code> element followed by a <code><a href=#the-body-element>body</a></code> element.</dd>
   
   <dd>An <code><a href=#the-html-element>html</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> can be omitted
   if the first thing inside the <code><a href=#the-html-element>html</a></code> element is not a <a href=#syntax-comments title=syntax-comments>comment</a>.</dd>
   <dd>An <code><a href=#the-html-element>html</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if
   the <code><a href=#the-html-element>html</a></code> element is not immediately followed by a <a href=#syntax-comments title=syntax-comments>comment</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> &mdash; <a href=#concept-appcache-manifest title=concept-appcache-manifest>Application cache manifest</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlhtmlelement>HTMLHtmlElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLHtmlElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-html-element>html</a></code> element <a href=#represents>represents</a> the root of an HTML document.</p>

  <p>Authors are encouraged to specify a <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute on the root
  <code><a href=#the-html-element>html</a></code> element, giving the document's language. This aids speech synthesis tools to
  determine what pronunciations to use, translation tools to determine what rules to use, and so
  forth.</p>

<!--TOPIC:Offline Web Applications-->
  <p>The <dfn id=attr-html-manifest title=attr-html-manifest><code>manifest</code></dfn> attribute gives the address of
  the document's <a href=#application-cache>application cache</a> <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>, if there is one. If the attribute is present,
  the attribute's value must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
  spaces</a>.</p>

  <p>The <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute only <a href=#concept-appcache-init title=concept-appcache-init>has an effect</a> during the early stages of document load.
  Changing the attribute dynamically thus has no effect (and thus, no DOM API is provided for this
  attribute).</p>

  <p class=note>For the purposes of <a href=#concept-appcache-init title=concept-appcache-init>application cache
  selection</a>, later <code><a href=#the-base-element>base</a></code> elements cannot affect the <a href=#resolve-a-url title="resolve a
  url">resolving of relative URLs</a> in <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
  attributes, as the attributes are processed before those elements are seen.</p>

  <p class=note>The <code title=dom-applicationCache><a href=#dom-applicationcache>window.applicationCache</a></code> IDL
  attribute provides scripted access to the offline <a href=#application-cache>application cache</a> mechanism.</p>
<!--TOPIC:HTML-->

  <div class=example>

   <p>The <code><a href=#the-html-element>html</a></code> element in the following example declares that the document's language
   is English.</p>

   <pre>&lt;!DOCTYPE html&gt;
<strong>&lt;html lang="en"&gt;</strong>
&lt;head&gt;
&lt;title&gt;Swapping Songs&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Swapping Songs&lt;/h1&gt;
&lt;p&gt;Tonight I swapped some of the songs I wrote with some friends, who
gave me some of the songs they wrote. I love sharing my music.&lt;/p&gt;
&lt;/body&gt;
<strong>&lt;/html&gt;</strong></pre>

  </div>




  <h3 id=document-metadata><span class=secno>4.2 </span>Document metadata</h3>

  <h4 id=the-head-element><span class=secno>4.2.1 </span>The <dfn><code>head</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the first element in an <code><a href=#the-html-element>html</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a> or if title information is available from a higher-level protocol: Zero or more elements of <a href=#metadata-content>metadata content</a>, of which no more than one is a <code><a href=#the-title-element>title</a></code> element and no more than one is a <code><a href=#the-base-element>base</a></code> element.</dd>
   <dd>Otherwise: One or more elements of <a href=#metadata-content>metadata content</a>, of which exactly one is a <code><a href=#the-title-element>title</a></code> element and no more than one is a <code><a href=#the-base-element>base</a></code> element.</dd>
   
   <dd>A <code><a href=#the-head-element>head</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> can be omitted if
   the element is empty, or if the first thing inside the <code><a href=#the-head-element>head</a></code> element is an
   element.</dd>
   <dd>A <code><a href=#the-head-element>head</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-head-element>head</a></code> element is not immediately followed by a <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlheadelement>HTMLHeadElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-head-element>head</a></code> element <a href=#represents>represents</a> a collection of metadata for the
  <code><a href=#document>Document</a></code>.</p>

  <div class=example>

   <p>The collection of metadata in a <code><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>&lt;!doctype html&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;A document with a short head&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
 ...</pre>

   <p>Here is an example of a longer one:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;HTML&gt;
 &lt;HEAD&gt;
  &lt;META CHARSET="UTF-8"&gt;
  &lt;BASE HREF="http://www.example.com/"&gt;
  &lt;TITLE&gt;An application with a long head&lt;/TITLE&gt;
  &lt;LINK REL="STYLESHEET" HREF="default.css"&gt;
  &lt;LINK REL="STYLESHEET ALTERNATE" HREF="big.css" TITLE="Big Text"&gt;
  &lt;SCRIPT SRC="support.js"&gt;&lt;/SCRIPT&gt;
  &lt;META NAME="APPLICATION-NAME" CONTENT="Long headed application"&gt;
 &lt;/HEAD&gt;
 &lt;BODY&gt;
 ...</pre>

  </div>

  <p class=note>The <code><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><a href=#the-title-element>title</a></code> element can be omitted.</p>



  <h4 id=the-title-element><span class=secno>4.2.2 </span>The <dfn><code>title</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>In a <code><a href=#the-head-element>head</a></code> element containing no other <code><a href=#the-title-element>title</a></code> elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#text-content title="text content">Text</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmltitleelement>HTMLTitleElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-title-text title=dom-title-text>text</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-title-element>title</a></code> element <a href=#represents>represents</a> the document's title or name. Authors
  should use titles that identify their documents even when they are used out of context, for
  example in a user's history or bookmarks, or in search results. The document's title is often
  different from its first heading, since the first heading does not have to stand alone when taken
  out of context.</p>

  <p>There must be no more than one <code><a href=#the-title-element>title</a></code> element per document.</p>

  <p>The <code><a href=#the-title-element>title</a></code> element must not be empty.</p>

  <p class=note>If it's reasonable for the <code><a href=#document>Document</a></code> to have no title, then the
  <code><a href=#the-title-element>title</a></code> element is probably not required. See the <code><a href=#the-head-element>head</a></code> element's content
  model for a description of when the element is required.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">title</var> . <code title=dom-title-text><a href=#dom-title-text>text</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the contents of the element, ignoring child nodes that aren't <code><a href=#text>Text</a></code>
    nodes.</p>

    <p>Can be set, to replace the element's children with the given value.</p>

   </dd>

  </dl><div class=impl>

  <p>The IDL attribute <dfn id=dom-title-text title=dom-title-text><code>text</code></dfn> must return a
  concatenation of the contents of all the <code><a href=#text>Text</a></code> nodes that are children of the
  <code><a href=#the-title-element>title</a></code> element (ignoring any other nodes such as comments or elements), in tree order.
  On setting, it must act the same way as the <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>Here are some examples of appropriate titles, contrasted with the top-level headings that
   might be used on those same pages.</p>

   <pre>  &lt;title&gt;Introduction to The Mating Rituals of Bees&lt;/title&gt;
    ...
  &lt;h1&gt;Introduction&lt;/h1&gt;
  &lt;p&gt;This companion guide to the highly successful
  &lt;cite&gt;Introduction to Medieval Bee-Keeping&lt;/cite&gt; book is...</pre>

   <p>The next page might be a part of the same site. Note how the title describes the subject
   matter unambiguously, while the first heading assumes the reader knows what the context is and
   therefore won't wonder if the dances are Salsa or Waltz:</p>

   <pre>  &lt;title&gt;Dances used during bee mating rituals&lt;/title&gt;
    ...
  &lt;h1&gt;The Dances&lt;/h1&gt;</pre>

  </div>

  <p>The string to use as the document's title is given by the <code title=dom-document-title><a href=#document.title>document.title</a></code> IDL attribute.</p>

  <div class=impl>

  <p>User agents should use the document's title when referring to the document in their user
  interface. When the contents of a <code><a href=#the-title-element>title</a></code> element are used in this way, <a href=#the-directionality>the
  directionality</a> of that <code><a href=#the-title-element>title</a></code> element should be used to set the directionality
  of the document's title in the user interface.</p>

  </div>


  <h4 id=the-base-element><span class=secno>4.2.3 </span>The <dfn><code>base</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>In a <code><a href=#the-head-element>head</a></code> element containing no other <code><a href=#the-base-element>base</a></code> elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-base-href><a href=#attr-base-href>href</a></code> &mdash; <a href=#document-base-url>Document base URL</a></dd>
   <dd><code title=attr-base-target><a href=#attr-base-target>target</a></code> &mdash; Default <a href=#browsing-context>browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a> and <a href=#form-submission>form submission</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlbaseelement>HTMLBaseElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-base-href title=dom-base-href>href</a>;
           attribute DOMString <a href=#dom-base-target title=dom-base-target>target</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-base-element>base</a></code> element allows authors to specify the <a href=#document-base-url>document base URL</a> for
  the purposes of <a href=#resolve-a-url title="resolve a url">resolving relative URLs</a>, and the name of the
  default <a href=#browsing-context>browsing context</a> for the purposes of <a href=#following-hyperlinks>following hyperlinks</a>. The
  element does not <a href=#represents title=represents>represent</a> any content beyond this
  information.</p>

  <p>There must be no more than one <code><a href=#the-base-element>base</a></code> element per document.</p>

  <p>A <code><a href=#the-base-element>base</a></code> element must have either an <code title=attr-base-href><a href=#attr-base-href>href</a></code>
  attribute, a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, or both.</p>

  <p>The <dfn id=attr-base-href title=attr-base-href><code>href</code></dfn> content attribute, if specified, must
  contain a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</a>.</p>

  <p>A <code><a href=#the-base-element>base</a></code> element, if it has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute,
  must come before any other elements in the tree that have attributes defined as taking <a href=#url title=URL>URLs</a>, except the <code><a href=#the-html-element>html</a></code> element (its <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute isn't affected by <code><a href=#the-base-element>base</a></code>
  elements).</p>

  <div class=impl>

  <p class=note>If there are multiple <code><a href=#the-base-element>base</a></code> elements with <code title=attr-base-href><a href=#attr-base-href>href</a></code> attributes, all but the first are ignored.</p>

  </div>

  <p>The <dfn id=attr-base-target title=attr-base-target><code>target</code></dfn> attribute, if specified, must
  contain a <a href=#valid-browsing-context-name-or-keyword>valid browsing context name or keyword</a>, which specifies which
  <a href=#browsing-context>browsing context</a> is to be used as the default when <a href=#hyperlink title=hyperlink>hyperlinks</a> and <a href=#the-form-element title=form>forms</a> in the
  <code><a href=#document>Document</a></code> cause <a href=#navigate title=navigate>navigation</a>.</p>

  <p>A <code><a href=#the-base-element>base</a></code> element, if it has a <code title=attr-base-target><a href=#attr-base-target>target</a></code>
  attribute, must come before any elements in the tree that represent <a href=#hyperlink title=hyperlink>hyperlinks</a>.</p>

  <div class=impl>

  <p class=note>If there are multiple <code><a href=#the-base-element>base</a></code> elements with <code title=attr-base-target><a href=#attr-base-target>target</a></code> attributes, all but the first are ignored.</p>

  <p>A <code><a href=#the-base-element>base</a></code> element that is the first <code><a href=#the-base-element>base</a></code> element with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in a particular <code><a href=#document>Document</a></code> has a
  <dfn id=frozen-base-url>frozen base URL</dfn>. The <a href=#frozen-base-url>frozen base URL</a> must be <a href=#set-the-frozen-base-url title="set the frozen
  base URL">set</a>, synchronously, whenever any of the following situations occur:</p>

  <ul class=brief><li>The <code><a href=#the-base-element>base</a></code> element becomes the first <code><a href=#the-base-element>base</a></code> element in <a href=#tree-order>tree
   order</a> with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in its
   <code><a href=#document>Document</a></code>.</li>

   <li>The <code><a href=#the-base-element>base</a></code> element is the first <code><a href=#the-base-element>base</a></code> element in <a href=#tree-order>tree
   order</a> with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in its
   <code><a href=#document>Document</a></code>, and its <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute is
   changed.</li>

  </ul><p>To <dfn id=set-the-frozen-base-url>set the <span>frozen base URL</span></dfn>, <a href=#resolve-a-url title="resolve a URL">resolve</a>
  the value of the element's <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute relative to
  the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback base URL</a>; if this is successful, set the
  <a href=#frozen-base-url>frozen base URL</a> to the <a href=#resulting-absolute-url>resulting absolute URL</a>, otherwise, set the
  <a href=#frozen-base-url>frozen base URL</a> to the <a href=#fallback-base-url>fallback base URL</a>.</p>

  <p>The <dfn id=dom-base-href title=dom-base-href><code>href</code></dfn> IDL attribute, on getting, must return
  the result of running the following algorithm:

  <ol><!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1715 --><li><p>If the <code><a href=#the-base-element>base</a></code> element has no <code title=attr-base-href><a href=#attr-base-href>href</a></code> content
   attribute, then return the <a href=#document-base-url>document base URL</a> and abort these steps.</li>

   <li><p>Let <var title="">fallback base url</var> be the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback
   base URL</a>.</li>

   <li><p>Let <var title="">url</var> be the value of the <code title=attr-base-href><a href=#attr-base-href>href</a></code>
   attribute of the <code><a href=#the-base-element>base</a></code> element.</li>

   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> <var title="">url</var> relative to <var title="">fallback base url</var> (thus, the <code><a href=#the-base-element>base</a></code> <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute isn't affected by <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes or <code><a href=#the-base-element>base</a></code> elements).</li>

   <li><p>If the previous step was successful, return the resulting <a href=#absolute-url>absolute URL</a> and
   abort these steps.</li>

   <li><p>Otherwise, return the empty string.</li>

  </ol><p>The <code title=dom-base-href><a href=#dom-base-href>href</a></code> IDL attribute, on setting, must set the <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute to the given new value.</p>

  <p>The <dfn id=dom-base-target title=dom-base-target><code>target</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  </div>

  <div class=example>

   <p>In this example, a <code><a href=#the-base-element>base</a></code> element is used to set the <a href=#document-base-url>document base
   URL</a>:</p>

   <pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;This is an example for the &amp;lt;base&amp;gt; element&lt;/title&gt;
        &lt;base href="http://www.example.com/news/index.html"&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;p&gt;Visit the &lt;a href="archives.html"&gt;archives&lt;/a&gt;.&lt;/p&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre>

   <p>The link in the above example would be a link to "<code title="">http://www.example.com/news/archives.html</code>".</p>

  </div>




  <h4 id=the-link-element><span class=secno>4.2.4 </span>The <dfn><code>link</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#flow-content>flow content</a>.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#phrasing-content>phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#metadata-content>metadata content</a> is expected.</dd>
   <dd>In a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element>head</a></code> element.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-link-href><a href=#attr-link-href>href</a></code> &mdash; Address of the <a href=#hyperlink>hyperlink</a></dd>
   <dd><code title=attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code> &mdash; How the element handles crossorigin requests</dd>
   <dd><code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> &mdash; Relationship between the document containing the hyperlink and the destination resource</dd>
   <dd><code title=attr-link-media><a href=#attr-link-media>media</a></code> &mdash; Applicable media</dd>
   <dd><code title=attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code> &mdash; Language of the linked resource</dd>
   <dd><code title=attr-link-type><a href=#attr-link-type>type</a></code> &mdash; Hint for the type of the referenced resource</dd>
   <dd><code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> &mdash; Sizes of the icons (for <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code>="<code title=rel-icon><a href=#rel-icon>icon</a></code>")</dd>
   <dd>Also, the <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute has special semantics on this element. &mdash; Title of the link &mdash; Alternative style sheet set name</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmllinkelement>HTMLLinkElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-link-disabled title=dom-link-disabled>disabled</a>;
           attribute DOMString <a href=#dom-link-href title=dom-link-href>href</a>;
           attribute DOMString <a href=#dom-link-crossorigin title=dom-link-crossOrigin>crossOrigin</a>;
           attribute DOMString <a href=#dom-link-rel title=dom-link-rel>rel</a>;
  readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-link-rellist title=dom-link-relList>relList</a>;
           attribute DOMString <a href=#dom-link-media title=dom-link-media>media</a>;
           attribute DOMString <a href=#dom-link-hreflang title=dom-link-hreflang>hreflang</a>;
           attribute DOMString <a href=#dom-link-type title=dom-link-type>type</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-link-sizes title=dom-link-sizes>sizes</a>;

  // <a href="#HTMLLinkElement-partial">also has obsolete members</a>
};
<a href=#htmllinkelement>HTMLLinkElement</a> implements <a href=#linkstyle>LinkStyle</a>;</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-link-element>link</a></code> element allows authors to link their document to other resources.</p>

  <p>The destination of the link(s) is given by the <dfn id=attr-link-href title=attr-link-href><code>href</code></dfn> attribute, which must be present and must contain a
  <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>. <span class=impl>If the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute is absent, then the element does not define a
  link.</span></p>

  <p>A <code><a href=#the-link-element>link</a></code> element must have either a <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute
  or an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, but not both.</p>

  <p class=note>If the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute is used, the element is
  restricted to the <code><a href=#the-head-element>head</a></code> element. When used with the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, the element can be used both in the
  <code><a href=#the-head-element>head</a></code> element and in the <code><a href=#the-body-element>body</a></code> of the page, subject to the constraints of
  the microdata model.</p>

  <p>The types of link indicated (the relationships) are given by the value of the <dfn id=attr-link-rel title=attr-link-rel><code>rel</code></dfn> attribute, which, if present, must have a value that
  is a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>. The <a href=#linkTypes>allowed keywords and
  their meanings</a> are defined in a later section. <span class=impl>If the <code title=attr-link-rel><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.</span></p>

  <p>Two categories of links can be created using the <code><a href=#the-link-element>link</a></code> element: <a href=#external-resource-link title="external resource link">Links to external resources</a> and <a href=#hyperlink title=hyperlink>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><a href=#the-link-element>link</a></code>
  element can create multiple links (of which some might be external resource links and some might
  be hyperlinks); exactly which and how many links are created depends on the keywords given in the
  <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute. User agents must process the links on a per-link
  basis, not a per-element basis.</p>

  <p class=note>Each link created for a <code><a href=#the-link-element>link</a></code> element is handled separately. For
  instance, if there are two <code><a href=#the-link-element>link</a></code> elements with <code title="">rel="stylesheet"</code>,
  they each count as a separate external resource, and each is affected by its own attributes
  independently. Similarly, if a single <code><a href=#the-link-element>link</a></code> element has a <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute with the value <code title="">next stylesheet</code>,
  it creates both a <a href=#hyperlink>hyperlink</a> (for the <code title=rel-next><a href=#link-type-next>next</a></code> keyword) and
  an <a href=#external-resource-link>external resource link</a> (for the <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code>
  keyword), and they are affected by other attributes (such as <code title=attr-link-media><a href=#attr-link-media>media</a></code> or <code title=attr-link-title><a href=#attr-link-title>title</a></code>)
  differently.</p>

  <div class=example>

   <p>For example, the following <code><a href=#the-link-element>link</a></code> element creates two hyperlinks (to the same
   page):</p>

   <pre>&lt;link rel="author license" href="/about"&gt;</pre>

   <p>The two links created by this element are one whose semantic is that the target page has
   information about the current page's author, and one whose semantic is that the target page has
   information regarding the license under which the current page is provided.</p>

  </div>

  <p>The <dfn id=attr-link-crossorigin title=attr-link-crossorigin><code>crossorigin</code></dfn> attribute is a <a href=#cors-settings-attribute>CORS
  settings attribute</a>. It is intended for use with external resource links.</p>

  <p>The exact behavior for links to external resources depends on the exact relationship, as
  defined for the relevant link type. Some of the attributes control whether or not the external
  resource is to be applied (as defined below).</p>

  <div class=impl>

  <p>For external resources that are represented in the DOM (for example, style sheets), the DOM
  representation must be made available (modulo cross-origin restrictions) even if the resource is
  not applied. To <dfn id=concept-link-obtain title=concept-link-obtain>obtain the resource</dfn>, the user agent must
  run the following steps:</p>

  <ol><li><p>If the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute's value is the empty string,
   then abort these steps.</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> given by the <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute, relative to the element.</li>

   <li><p>If the previous step fails, then abort these steps.</li>

   <li>

    <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the resulting <a href=#absolute-url>absolute
    URL</a>, with the <i>mode</i> being the state of the element's <code title=attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code> content attribute, the <i title="">origin</i>
    being the <a href=#origin>origin</a> of the <code><a href=#the-link-element>link</a></code> element's <code><a href=#document>Document</a></code>, and the
    <i>default origin behaviour</i> set to <i>taint</i>.</p>

    <p>The resource obtained in this fashion can be either <a href=#cors-same-origin>CORS-same-origin</a> or
    <a href=#cors-cross-origin>CORS-cross-origin</a>.</p>

   </li>

  </ol><p>User agents may opt to only try to obtain such resources when they are needed, instead of
  pro-actively <a href=#fetch title=fetch>fetching</a> all the external resources that are not
  applied.</p>

  <p>The semantics of the protocol used (e.g. HTTP) must be followed when fetching external
  resources. (For example, redirects will be followed and 404 responses will cause the external
  resource to not be applied.)</p>

  <!-- the next few paragraph are similar to text in the <style> section -->
  <p>Once the attempts to obtain the resource and its <a href=#critical-subresources>critical subresources</a> are
  complete, the user agent must, if the loads were successful, <a href=#queue-a-task>queue a task</a> to
  <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the
  <code><a href=#the-link-element>link</a></code> element, or, if the resource or one of its <a href=#critical-subresources>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>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-error>error</code> at the <code><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>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM
  manipulation task source</a>.</p>

  <p>The element must <a href=#delay-the-load-event>delay the load event</a> of the element's document until all the
  attempts to obtain the resource and its <a href=#critical-subresources>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>delay the load event</a>.)</p>

  <hr><p id=linkui>Interactive user agents may provide users with a means to <a href=#following-hyperlinks title="following
  hyperlinks">follow the hyperlinks</a> created using the <code><a href=#the-link-element>link</a></code> element, somewhere
  within their user interface. The exact interface is not defined by this specification, but it
  could include the following information (obtained from the element's attributes, again as defined
  below), in some form or another (possibly simplified), for each hyperlink created with each
  <code><a href=#the-link-element>link</a></code> element in the document:</p>

  <ul><!-- the order here is the order that makes most sense for a UI --><li>The relationship between this document and the resource (given by the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute)</li>

   <li>The title of the resource (given by the <code title=attr-link-title><a href=#attr-link-title>title</a></code>
   attribute).</li>

   <li>The address of the resource (given by the <code title=attr-link-href><a href=#attr-link-href>href</a></code>
   attribute).</li>

   <li>The language of the resource (given by the <code title=attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code>
   attribute).</li>

   <li>The optimum media for the resource (given by the <code title=attr-link-media><a href=#attr-link-media>media</a></code>
   attribute).</li>

  </ul><p>User agents could also include other information, such as the type of the resource (as given by
  the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute).</p>

  </div>

  <p class=note>Hyperlinks created with the <code><a href=#the-link-element>link</a></code> element and its <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute apply to the whole page. This contrasts with the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute of <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements,
  which indicates the type of a link whose context is given by the link's location within the
  document.</p>

  <p>The <dfn id=attr-link-media title=attr-link-media><code>media</code></dfn> attribute says which media the
  resource applies to. The value must be a <a href=#valid-media-query>valid media query</a>.</p>

  <div class=impl>

  <p>If the link is a <a href=#hyperlink>hyperlink</a> then the <code title=attr-link-media><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>external resource link</a>, then the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute is prescriptive. The user agent must apply the
  external resource when the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute's value
  <a href=#matches-the-environment>matches the environment</a> and the other relevant conditions apply, and must not apply
  it otherwise.</p><!-- note similar text in <style> section -->

  <p class=note>The external resource might have further restrictions defined within that limit
  its applicability. For example, a CSS style sheet might have some <code title="">@media</code>
  blocks. This specification does not override such further restrictions or requirements.</p><!--
  note similar text in <style> section -->

  </div>

  <p id=default-media>The default, if the <code title=attr-link-media><a href=#attr-link-media>media</a></code> attribute is
  omitted, is "<code title="">all</code>", meaning that by default links apply to all media.</p>

  <p>The <dfn id=attr-link-hreflang title=attr-link-hreflang><code>hreflang</code></dfn> attribute on the
  <code><a href=#the-link-element>link</a></code> element has the same semantics as the <a href=#attr-hyperlink-hreflang title=attr-hyperlink-hreflang><code>hreflang</code> attribute on <code>a</code> and
  <code>area</code> elements</a>.</p>

  <p>The <dfn id=attr-link-type title=attr-link-type><code>type</code></dfn> attribute gives the <a href=#mime-type>MIME
  type</a> of the linked resource. It is purely advisory. The value must be a <a href=#valid-mime-type>valid MIME
  type</a>.</p>

  <p>For <a href=#external-resource-link title="external resource link">external resource links</a>, the <code title=attr-link-type><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. <span class=impl>If the attribute is present, then
  the user agent must assume that the resource is of the given type (even if that is not a
  <a href=#valid-mime-type>valid MIME type</a>, e.g. the empty string). If the attribute is omitted, but the
  external resource link type has a default type defined, then the user agent must assume that the
  resource is of that type. If the UA does not support the given <a href=#mime-type>MIME type</a> for the
  given link relationship, then the UA should not <a href=#concept-link-obtain title=concept-link-obtain>obtain</a>
  the resource; if the UA does support the given <a href=#mime-type>MIME type</a> for the given link
  relationship, then the UA should <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource at
  the appropriate time as specified for the <a href=#external-resource-link>external resource link</a>'s particular type.
  If the attribute is omitted, and the external resource link type does not have a default type
  defined, but the user agent would <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource if
  the type was known and supported, then the user agent should <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource under the assumption that it will be
  supported.</span></p>

  <div class=impl>

  <p>User agents must not consider the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute
  authoritative &mdash; upon fetching the resource, user agents must not use the <code title=attr-link-type><a href=#attr-link-type>type</a></code> attribute to determine its actual type. Only the actual type
  (as defined in the next paragraph) is used to determine whether to <em>apply</em> the resource,
  not the aforementioned assumed type.</p>

  <p id=concept-link-type-sniffing>If the external resource link type defines rules for processing
  the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a>, then those rules apply.
  Otherwise, if the resource is expected to be an image, user agents may apply the <a href=#content-type-sniffing:-image title="Content-Type sniffing: image">image sniffing rules</a>, with the <var title="">official
  type</var> being the type determined from the resource's <a href=#content-type title=Content-Type>Content-Type
  metadata</a>, and use the resulting sniffed type of the resource as if it was the actual type.
  Otherwise, if neither of these conditions apply or if the user agent opts not to apply the image
  sniffing rules, then the user agent must use the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a> to determine the type of the resource. If there
  is no type metadata, but the external resource link type has a default type defined, then the user
  agent must assume that the resource is of that type.</p>

  <p class=note>The <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> link type defines rules for
  processing the resource's <a href=#content-type title=Content-Type>Content-Type metadata</a>.</p>

  <p>Once the user agent has established the type of the resource, the user agent must apply the
  resource if it is of a supported type and the other relevant conditions apply, and must ignore the
  resource otherwise.</p>

  <div class=example>

   <p>If a document contains style sheet links labeled as follows:</p>

   <pre>&lt;link rel="stylesheet" href="A" type="text/plain"&gt;
&lt;link rel="stylesheet" href="B" type="text/css"&gt;
&lt;link rel="stylesheet" href="C"&gt;</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>text/plain</code> is not the <a href=#mime-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>text/css</code>, it would apply the styles, but for those labeled as
   <code>text/plain</code>, or any other type, it would not.</p>

   <p>If one of the two files was returned without a <a href=#content-type>Content-Type</a> metadata, or with a
   syntactically incorrect type like <code title="">Content-Type:&nbsp;"null"</code>, then the
   default type for <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> links would kick in. Since that
   default type is <code title="">text/css</code>, the style sheet <em>would</em> nonetheless be
   applied.</p>

  </div>

  </div>

  <p>The <dfn id=attr-link-title title=attr-link-title><code>title</code></dfn> attribute gives the title of the
  link. With one exception, it is purely advisory. The value is text. The exception is for style
  sheet links, where the <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute defines
  <a href=#alternative-style-sheet-sets>alternative style sheet sets</a>.</p>

  <p class=note>The <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute on <code><a href=#the-link-element>link</a></code>
  elements differs from the global <code title=attr-title><a href=#attr-title>title</a></code> attribute of most other
  elements in that a link without a title does not inherit the title of the parent element: it
  merely has no title.</p>

  <p>The <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attribute is used with the <code title=rel-icon><a href=#rel-icon>icon</a></code> link type. The attribute must not be specified on <code><a href=#the-link-element>link</a></code>
  elements that do not have a <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute that specifies the
  <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword.</p>

  <div class=impl>

  <!--!--><!-- s/header fields/headers/ for consistency with the rest of the spec -->

  <p>HTTP <code title=http-link>Link:</code> header fields, 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
  header fields are to be processed according to the rules given in the relevant specifications. <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p> <!-- WEBLINK is ref for Link:
  header -->

  <p class=note>Registration of relation types in HTTP Link: header fields is distinct from <a href=#linkTypes>HTML link types</a>, and thus their semantics can be different from same-named
  HTML types.</p>

  <p>The IDL attributes <dfn id=dom-link-href title=dom-link-href><code>href</code></dfn>, <dfn id=dom-link-rel title=dom-link-rel><code>rel</code></dfn>, <dfn id=dom-link-media title=dom-link-media><code>media</code></dfn>,
  <dfn id=dom-link-hreflang title=dom-link-hreflang><code>hreflang</code></dfn>, <dfn id=dom-link-type title=dom-link-type><code>type</code></dfn>, and <dfn id=dom-link-sizes title=dom-link-sizes><code>sizes</code></dfn> each must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <p>The <dfn id=dom-link-crossorigin title=dom-link-crossOrigin><code>crossOrigin</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code> content
  attribute, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The IDL attribute <dfn id=dom-link-rellist title=dom-link-rellist><code>relList</code></dfn> <span class=impl>must</span> <a href=#reflect title=reflect>reflect</a> the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> content attribute.</p>

  </div>

  <p>The IDL attribute <dfn id=dom-link-disabled title=dom-link-disabled><code>disabled</code></dfn> only applies to
  style sheet links. When the <code><a href=#the-link-element>link</a></code> element defines a style sheet link, then the <code title=dom-link-disabled><a href=#dom-link-disabled>disabled</a></code> attribute behaves as defined <a href=#dom-linkstyle-disabled title=dom-linkstyle-disabled>for the alternative style sheets DOM</a>. For all other
  <code><a href=#the-link-element>link</a></code> elements it always return false and does nothing on setting.</p> <!-- that is
  normatively required in the definition of dom-linkstyle-disabled -->

  <p>The <code><a href=#linkstyle>LinkStyle</a></code> interface is also implemented by this element; the <a href=#styling>styling
  processing model</a> defines how. <a href=#refsCSSOM>[CSSOM]</a></p>

  <div class=example>

   <p>Here, a set of <code><a href=#the-link-element>link</a></code> elements provide some style
   sheets:</p>

   <pre>&lt;!-- a persistent style sheet --&gt;
&lt;link rel="stylesheet" href="default.css"&gt;

&lt;!-- the preferred alternate style sheet --&gt;
&lt;link rel="stylesheet" href="green.css" title="Green styles"&gt;

&lt;!-- some alternate style sheets --&gt;
&lt;link rel="alternate stylesheet" href="contrast.css" title="High contrast"&gt;
&lt;link rel="alternate stylesheet" href="big.css" title="Big fonts"&gt;
&lt;link rel="alternate stylesheet" href="wide.css" title="Wide screen"&gt;</pre>

  </div>

  <div class=example>

   <p>The following example shows how you can specify versions of the page that use alternative
   formats, are aimed at other languages, and that are intended for other media:</p>

   <pre>&lt;link rel=alternate href="/en/html" hreflang=en type=text/html title="English HTML"&gt;
&lt;link rel=alternate href="/fr/html" hreflang=fr type=text/html title="French HTML"&gt;
&lt;link rel=alternate href="/en/html/print" hreflang=en type=text/html media=print title="English HTML (for printing)"&gt;
&lt;link rel=alternate href="/fr/html/print" hreflang=fr type=text/html media=print title="French HTML (for printing)"&gt;
&lt;link rel=alternate href="/en/pdf" hreflang=en type=application/pdf title="English PDF"&gt;
&lt;link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF"&gt;</pre>

  </div>





  <h4 id=the-meta-element><span class=secno>4.2.5 </span>The <dfn id=meta><code>meta</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#flow-content>flow content</a>.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#phrasing-content>phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>If the <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute is present, or if the element's <code title=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 title=attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code><a href=#the-head-element>head</a></code> element.</dd>
   <dd>If the <code title=attr-meta-http-equiv><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 title=attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code><a href=#the-head-element>head</a></code> element.</dd>
   <dd>If the <code title=attr-meta-http-equiv><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 title=attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element>head</a></code> element.</dd>
   <dd>If the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute is present: where <a href=#metadata-content>metadata content</a> is expected.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#metadata-content>metadata content</a> is expected.</dd>
   <dd>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-meta-name><a href=#attr-meta-name>name</a></code> &mdash; Metadata name</dd>
   <dd><code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> &mdash; Pragma directive</dd>
   <dd><code title=attr-meta-content><a href=#attr-meta-content>content</a></code> &mdash; Value of the element</dd>
   <dd><code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> &mdash; <a href=#character-encoding-declaration>Character encoding declaration</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlmetaelement>HTMLMetaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-meta-name title=dom-meta-name>name</a>;
           attribute DOMString <a href=#dom-meta-httpequiv title=dom-meta-httpEquiv>httpEquiv</a>;
           attribute DOMString <a href=#dom-meta-content title=dom-meta-content>content</a>;

  // <a href="#HTMLMetaElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-meta-element>meta</a></code> element <a href=#represents>represents</a> various kinds of metadata that cannot be
  expressed using the <code><a href=#the-title-element>title</a></code>, <code><a href=#the-base-element>base</a></code>, <code><a href=#the-link-element>link</a></code>, <code><a href=#the-style-element>style</a></code>,
  and <code><a href=#the-script-element>script</a></code> elements.</p>

  <p>The <code><a href=#the-meta-element>meta</a></code> element can represent document-level metadata with the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute, pragma directives with the <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute, and the file's <a href=#character-encoding-declaration>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 title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code>
  attribute.</p>

  <p>Exactly one of the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>, <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>, <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code>,
  and <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attributes must be specified.</p>

  <p>If either <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>, <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>, or <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> is
  specified, then the <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute must also be
  specified. Otherwise, it must be omitted.</p>

  <p>The <dfn id=attr-meta-charset title=attr-meta-charset><code>charset</code></dfn> attribute specifies the character
  encoding used by the document. This is a <a href=#character-encoding-declaration>character encoding declaration</a>. If the
  attribute is present in an <a href=#xml-documents title="XML documents">XML document</a>, its value must be an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">UTF-8</code>" (and the
  document is therefore forced to use UTF-8 as its encoding).</p>

  <p class=note>The <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute on the
  <code><a href=#the-meta-element>meta</a></code> element has no effect in XML documents, and is only allowed in order to
  facilitate migration to and from XHTML.</p>

  <p>There must not be more than one <code><a href=#the-meta-element>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute per document.</p>

  <p>The <dfn id=attr-meta-content title=attr-meta-content><code>content</code></dfn> attribute gives the value of the
  document metadata or pragma directive when the element is used for those purposes. The allowed
  values depend on the exact context, as described in subsequent sections of this specification.</p>

  <p>If a <code><a href=#the-meta-element>meta</a></code> element has a <dfn id=attr-meta-name title=attr-meta-name><code>name</code></dfn>
  attribute, it sets document metadata. Document metadata is expressed in terms of name-value pairs,
  the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute on the <code><a href=#the-meta-element>meta</a></code> element giving the
  name, and the <code title=attr-meta-content><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><a href=#the-meta-element>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, then the value part of the metadata name-value
  pair is the empty string.</p>

  <div class=impl>

  <p>The <dfn id=dom-meta-name title=dom-meta-name><code>name</code></dfn> and <dfn id=dom-meta-content title=dom-meta-content><code>content</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name. The IDL attribute <dfn id=dom-meta-httpequiv title=dom-meta-httpEquiv><code>httpEquiv</code></dfn> must <a href=#reflect>reflect</a> the content
  attribute <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>.</p>

  </div>


  <h5 id=standard-metadata-names><span class=secno>4.2.5.1 </span>Standard metadata names</h5>

  <p>This specification defines a few names for the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute of the
  <code><a href=#the-meta-element>meta</a></code> element.</p>

  <p>Names are case-insensitive<span class=impl>, and must be compared
  in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> manner</span>.</p>

  <dl><dt><dfn id=meta-application-name title=meta-application-name><code>application-name</code></dfn></dt>

   <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 title=meta-application-name><a href=#meta-application-name>application-name</a></code> metadata name
   must not be used. There must not be more than one <code><a href=#the-meta-element>meta</a></code>
   element with its <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute
   set to the value <code title=meta-application-name><a href=#meta-application-name>application-name</a></code> per
   document. <span class=impl>User agents may use the application
   name in UI in preference to the page's <code><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.</span></dd>

   <dt><dfn id=meta-author title=meta-author><code>author</code></dfn></dt>

   <dd><p>The value must be a free-form string giving the name of one
   of the page's authors.</dd>

   <dt><dfn id=meta-description title=meta-description><code>description</code></dfn></dt>

   <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><a href=#the-meta-element>meta</a></code> element with its <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute set to the value <code title=meta-description><a href=#meta-description>description</a></code> per document.</dd>

   <dt><dfn id=meta-generator title=meta-generator><code>generator</code></dfn></dt>

   <dd>

    <p>The value must be a free-form string that identifies one of the
    software packages used to generate the document. This value must
    not be used on pages whose markup is not generated by software,
    e.g. pages whose markup was written by a user in a text editor.</p>

    <div class=example>

     <p>Here is what a tool called "Frontweaver" could include in its
     output, in the page's <code><a href=#the-head-element>head</a></code> element, to identify
     itself as the tool used to generate the page:</p>

     <pre>&lt;meta name=generator content="Frontweaver 8.2"&gt;</pre>

    </div>

   </dd>

   <dt><dfn id=meta-keywords title=meta-keywords><code>keywords</code></dfn></dt>

   <dd>

    <p>The value must be a <a href=#set-of-comma-separated-tokens>set of comma-separated tokens</a>,
    each of which is a keyword relevant to the page.</p>

    <div class=example>

     <p>This page about typefaces on British motorways uses a
     <code><a href=#the-meta-element>meta</a></code> element to specify some keywords that users
     might use to look for the page:</p>

     <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Typefaces on UK motorways&lt;/title&gt;
  &lt;meta name="keywords" content="british,type face,font,fonts,highway,highways"&gt;
 &lt;/head&gt;
 &lt;body&gt;
  ...</pre>

    </div>

    <p class=note>Many search engines do not consider such keywords,
    because this feature has historically been used unreliably and
    even misleadingly as a way to spam search engine results in a way
    that is not helpful for users.</p>

    <div class=impl>

    <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 title="">keywords</var> be an empty
     list.</li>

     <li>

      <p>For each <code><a href=#the-meta-element>meta</a></code> element with a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and a <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute and whose
      <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute's value is
      <code title=meta-keywords><a href=#meta-keywords>keywords</a></code>, run the following
      substeps:</p>

      <ol><li><p><a href=#split-a-string-on-commas title="split a string on commas">Split the value
       of the element's <code title=attr-meta-content>content</code>
       attribute on commas</a>.</li>

       <li><p>Add the resulting tokens, if any, to <var title="">keywords</var>.</li>

      </ol></li>

     <li><p>Remove any duplicates from <var title="">keywords</var>.</li>

     <li><p>Return <var title="">keywords</var>. This is the list of
     keywords that the author has specified as applicable to the
     page.</li>

    </ol><p>User agents should not use this information when there is
    insufficient confidence in the reliability of the value.</p>

    <p class=example>For instance, it would be reasonable for a
    content management system to use the keyword information of pages
    within the system to populate the index of a site-specific search
    engine, but a large-scale content aggregator that used this
    information would likely find that certain users would try to game
    its ranking mechanism through the use of inappropriate
    keywords.</p>

    </div>

   </dd>

  </dl><h5 id=other-metadata-names><span class=secno>4.2.5.2 </span>Other metadata names</h5>

  <p><dfn id=concept-meta-extensions title=concept-meta-extensions>Extensions to the predefined
  set of metadata names</dfn> may be registered in the <a href=http://wiki.whatwg.org/wiki/MetaExtensions>WHATWG Wiki
  MetaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>

  <p>Anyone is free to edit the WHATWG Wiki MetaExtensions page at any
  time to add a type. These new names must be specified with the
  following information:</p>

  <dl><dt>Keyword</dt>

   <dd><p>The actual name being defined. The name should not be
   confusingly similar to any other defined name (e.g. differing only
   in case).</dd>


   <dt>Brief description</dt>

   <dd><p>A short non-normative description of what the metadata
   name's meaning is, including the format the value is required to be
   in.</dd>


   <dt>Specification</dt>

   <dd>A link to a more detailed description of the metadata name's
   semantics and requirements. It could be another page on the Wiki,
   or a link to an external page.</dd>


   <dt>Synonyms</dt>

   <dd><p>A list of other names that have exactly the same processing
   requirements. Authors should not use the names defined to be
   synonyms, they are only intended to allow user agents to support
   legacy content. Anyone may remove synonyms that are not used in
   practice; only names that need to be processed as synonyms for
   compatibility with legacy content are to be registered in this
   way.</dd>


   <dt>Status</dt>

   <dd>

    <p>One of the following:</p>

    <dl><dt>Proposed</dt>

     <dd>The name has not received wide peer review and
     approval. Someone has proposed it and is, or soon will be, using
     it.</dd>

     <dt>Ratified</dt>

     <dd>The name has received wide peer review and approval. It has a
     specification that unambiguously defines how to handle pages that
     use the name, including when they use it in incorrect ways.</dd>

     <dt>Discontinued</dt>

     <dd>The metadata name has received wide peer review and it has
     been found wanting. Existing pages are using this metadata name,
     but new pages should avoid it. The "brief description" and
     "specification" entries will give details of what authors should
     use instead, if anything.</dd>

    </dl><p>If a metadata name is found to be redundant with existing
    values, it should be removed and listed as a synonym for the
    existing value.</p>

    <p>If a metadata name is registered in the "proposed" state for a
    period of a month or more without being used or specified, then it
    may be removed from the registry.</p>

    <p>If a metadata name is added with the "proposed" status and
    found to be redundant with existing values, it should be removed
    and listed as a synonym for the existing value. If a metadata name
    is added with the "proposed" status and found to be harmful, then
    it should be changed to "discontinued" status.</p>

    <p>Anyone can change the status at any time, but should only do so
    in accordance with the definitions above.</p>

   </dd>

  </dl><div class=impl>

  <p>Conformance checkers must use the information given on the WHATWG
  Wiki MetaExtensions page to establish if a value is allowed or not:
  values defined in this specification or marked as "proposed" or
  "ratified" must be accepted, whereas values marked as "discontinued"
  or not listed in either this specification or on the aforementioned
  page must be rejected as invalid. Conformance checkers may cache
  this information (e.g. for performance reasons or to avoid the use
  of unreliable network connectivity).</p>

  <p>When an author uses a new metadata name not defined by either
  this specification or the Wiki page, conformance checkers should
  offer to add the value to the Wiki, with the details described
  above, with the "proposed" status.</p>

  </div>

  <p>Metadata names whose values are to be <a href=#url title=URL>URLs</a> must not be proposed or accepted. Links must
  be represented using the <code><a href=#the-link-element>link</a></code> element, not the
  <code><a href=#the-meta-element>meta</a></code> element.</p>



  <h5 id=pragma-directives><span class=secno>4.2.5.3 </span>Pragma directives</h5>

  <p>When the <dfn id=attr-meta-http-equiv title=attr-meta-http-equiv><code>http-equiv</code></dfn> attribute
  is specified on a <code><a href=#the-meta-element>meta</a></code> element, the element is a pragma
  directive.</p>

  <p>The <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>
  attribute is an <a href=#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. <span class=impl>Some of the keywords
  are non-conforming, as noted in the last column.</span></p>

<!-- things that are neither conforming nor do anything are commented out -->
  <table id=table-http-equiv><thead><tr><th>State
     <th>Keyword
     <th>Notes
   <tbody><tr class=impl><td><a href=#attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content Language</a>
     <td><code title="">content-language</code>
     <td>Non-conforming
    <tr><td><a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration</a>
     <td><code title="">content-type</code>
     <td>
<!--
    <tr class="impl">
     <td><span title="attr-meta-http-equiv-content-script-type">Content-Script-Type</span>
     <td><code title="">Content-Script-Type</code>
     <td>Non-conforming
    <tr class="impl">
     <td><span title="attr-meta-http-equiv-content-style-type">Content-Style-Type</span>
     <td><code title="">Content-Style-Type</code>
     <td>Non-conforming
-->
    <tr><td><a href=#attr-meta-http-equiv-default-style title=attr-meta-http-equiv-default-style>Default style</a>
     <td><code title="">default-style</code>
     <td>
    <tr><td><a href=#attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh</a>
     <td><code title="">refresh</code>
     <td>
    <tr class=impl><td><a href=#attr-meta-http-equiv-set-cookie title=attr-meta-http-equiv-set-cookie>Cookie setter</a>
     <td><code title="">set-cookie</code>
     <td>Non-conforming
  </table><!--
DATA: According to Henri's validator stats, here are common
non-conforming values used by people who validate (sample of 400
pages):

COUNT ERROR
   20 Bad value "Content-Language" for attribute "http-equiv" on element "meta".
   17 Bad value "Content-Style-Type" for attribute "http-equiv" on element "meta".
   12 Bad value "Expires" for attribute "http-equiv" on element "meta".
   11 Bad value "Pragma" for attribute "http-equiv" on element "meta".
   11 Bad value "imagetoolbar" for attribute "http-equiv" on element "meta".
   10 Bad value "Content-Script-Type" for attribute "http-equiv" on element "meta".
   10 Bad value "content-language" for attribute "http-equiv" on element "meta".
 [...]
http://hsivonen.iki.fi/test/moz/analysis.txt

Here's some more data, this time from Philip`, on a sample of 15k pages.

  COUNT VALUE
   1181 Content-Language
    430 Content-Style-Type
    342 imagetoolbar
    276 content-language
    269 Pragma
    260 expires
    227 Expires
    211 pragma
    146 Content-Script-Type
    132 keywords
    119 Page-Enter
    116 description
    106 reply-to
    102 Cache-Control
   [...]
http://philip.html5.org/data/meta-http-equiv.txt

These numbers are low; further study is required to establish what
people expect to have work and what is necessary.
--><div class=impl>

  <p>When a <code><a href=#the-meta-element>meta</a></code> element is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted
  into the document</a>, if its <code title=attr-meta-http-equiv><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>

  </div>

  <dl><dt class=impl><dfn id=attr-meta-http-equiv-content-language title=attr-meta-http-equiv-content-language>Content language state</dfn> (<code title="">http-equiv="content-language"</code>)

   <dd class=impl>

    <p class=note>This feature is non-conforming. Authors are encouraged to use the <code title=attr-lang><a href=#attr-lang>lang</a></code> attribute instead.</p>

    <p>This pragma sets the <dfn id=pragma-set-default-language>pragma-set default language</dfn>. Until such a pragma is
    successfully processed, there is no <a href=#pragma-set-default-language>pragma-set default language</a>.</p>

    <!-- http://www.hixie.ch/tests/adhoc/html/meta/content-language/ -->

    <ol><li><p>If the <code><a href=#the-meta-element>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
     attribute, then abort these steps.</li>

     <li><p>If the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute contains a
     U+002C COMMA character (,) then abort these steps.</li><!-- if you remove this,
     un-comment-out the corresponding bits in the step below. -->

     <li><p>Let <var title="">input</var> be the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute.</li>

     <li><p>Let <var title="">position</var> point at the first character of <var title="">input</var>.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not<!--neither--> <a href=#space-character title="space character">space characters</a><!-- nor a U+002C COMMA character
     (,)-->.</li>

     <li><p>Let <var title="">candidate</var> be the string that resulted from the previous
     step.</li>

     <li><p>If <var title="">candidate</var> is the empty string, abort these steps.</li>

     <li><p>Set the <a href=#pragma-set-default-language>pragma-set default language</a> to <var title="">candidate</var>.</li>

    </ol><p class=note>This pragma is not exactly equivalent to the HTTP <code>Content-Language</code>
    header. <a href=#refsHTTP>[HTTP]</a></p>

   </dd>

   <dt><dfn id=attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</dfn> (<code title="">http-equiv="content-type"</code>)

   <dd>

    <p>The <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</a> is just
    an alternative form of setting the <code title=meta-charset>charset</code> attribute: it is a
    <a href=#character-encoding-declaration>character encoding declaration</a>. <span class=impl>This state's user agent
    requirements are all handled by the parsing section of the specification.</span></p>

    <p>For <code><a href=#the-meta-element>meta</a></code> elements with an <code title=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 title=attr-meta-http-equiv-content-type>Encoding declaration
    state</a>, the <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute must have a value
    that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for a string that consists of: the literal
    string "<code title="">text/html;</code>", optionally followed by any number of <a href=#space-character title="space character">space characters</a>, followed by the literal string "<code title="">charset=</code>", followed by one of the <a href=#encoding-label title="encoding label">labels</a> of
    the <a href=#encoding title=encoding>character encoding</a> of the <a href=#character-encoding-declaration>character encoding
    declaration</a>.</p>

    <p>A document must not contain both a <code><a href=#the-meta-element>meta</a></code> element with an <code title=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 title=attr-meta-http-equiv-content-type>Encoding declaration state</a> and a
    <code><a href=#the-meta-element>meta</a></code> element with the <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute
    present.</p>

    <p>The <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration state</a> may be
    used in <a href=#html-documents>HTML documents</a>, but elements with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in that state must not be used in
    <a href=#xml-documents>XML documents</a>.</p>

   </dd>

   <dt><dfn id=attr-meta-http-equiv-default-style title=attr-meta-http-equiv-default-style>Default style state</dfn> (<code title="">http-equiv="default-style"</code>)

   <dd>

    <p>This pragma sets the name of the default <a href=#alternative-style-sheet-sets title="alternative style sheet
    sets">alternative style sheet set</a>.</p>

    <div class=impl>

    <ol><li><p>If the <code><a href=#the-meta-element>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
     attribute, or if that attribute's value is the empty string, then abort these steps.</li>

     <li><p>Set the <a href=#preferred-style-sheet-set>preferred style sheet set</a> to the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute. <a href=#refsCSSOM>[CSSOM]</a></li>

    </ol></div>

   </dd>

   <dt><dfn id=attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh state</dfn> (<code title="">http-equiv="refresh"</code>)

   <dd>

    <p>This pragma acts as timed redirect.</p>

    <div class=impl>

    <ol><!-- TESTS: http://www.hixie.ch/tests/adhoc/html/meta/refresh/ --><!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/734 --><li><p>If another <code><a href=#the-meta-element>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the <a href=#attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh state</a> has already been successfully
     processed (i.e. when it was inserted the user agent processed it and reached the last step of
     this list of steps), then abort these steps.</li>

     <li><p>If the <code><a href=#the-meta-element>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
     attribute, or if that attribute's value is the empty string, then abort these steps.</li>

     <li><p>Let <var title="">input</var> be the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute.</li>

     <li><p>Let <var title="">position</var> point at the first character of <var title="">input</var>.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>, and
     parse the resulting string using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>. If
     the sequence of characters collected is the empty string, then no number will have been parsed;
     abort these steps. Otherwise, let <var title="">time</var> be the parsed number.</li>

     <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a> and
     U+002E FULL STOP characters (.). Ignore any collected characters.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li><p>Let <var title="">url</var> be the address of the current page.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is a U+003B SEMICOLON character (;) or a U+002C COMMA character (,), then advance <var title="">position</var> to the next character. Otherwise, jump to the last step.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is a U+0055 LATIN CAPITAL LETTER U character (U) or a U+0075 LATIN SMALL LETTER U character
     (u), then advance <var title="">position</var> to the next character. Otherwise, jump to the
     last step.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is a U+0052 LATIN CAPITAL LETTER R character (R) or a U+0072 LATIN SMALL LETTER R character
     (r), then advance <var title="">position</var> to the next character. Otherwise, jump to the
     last step.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is s U+004C LATIN CAPITAL LETTER L character (L) or a U+006C LATIN SMALL LETTER L character
     (l), then advance <var title="">position</var> to the next character. Otherwise, jump to the
     last step.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is a U+003D EQUALS SIGN (=), then advance <var title="">position</var> to the next character.
     Otherwise, jump to the last step.</li>

     <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

     <li><p>If the character in <var title="">input</var> pointed to by <var title="">position</var>
     is either a U+0027 APOSTROPHE character (') or U+0022 QUOTATION MARK character ("), then let
     <var title="">quote</var> be that character, and advance <var title="">position</var> to the
     next character. Otherwise, let <var title="">quote</var> be the empty string.</li>

     <li><p>Let <var title="">url</var> be equal to the substring of <var title="">input</var> from
     the character at <var title="">position</var> to the end of the string.</li>

     <li><p>If <var title="">quote</var> is not the empty string, and there is a character in <var title="">url</var> equal to <var title="">quote</var>, then truncate <var title="">url</var> at
     that character, so that it and all subsequent characters are removed.</p>

     <li><p>Strip any trailing <a href=#space-character title="space character">space characters</a> from the end of
     <var title="">url</var>.</li>

     <li><p>Strip any U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), and U+000D CARRIAGE
     RETURN (CR) characters from <var title="">url</var>.</li>

     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">url</var> value to an
     <a href=#absolute-url>absolute URL</a>, relative to the <code><a href=#the-meta-element>meta</a></code> element. If this fails, abort
     these steps.</li>

     <li>

      <p>Perform one or more of the following steps:</p>

      <ul><li>

        <p>After the refresh has come due (as defined below), if the user has not canceled the
        redirect and if the <code><a href=#the-meta-element>meta</a></code> element's <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active
        sandboxing flag set</a> does not have the <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing
        context flag</a> set, <a href=#navigate title=navigate>navigate</a><!--DONAV meta refresh--> the
        <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> to <var title="">url</var>, with
        <a href=#replacement-enabled>replacement enabled</a>, and with the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing
        context</a> as the <a href=#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 title="">time</var> seconds have elapsed since the document has
         <a href=#completely-loaded>completely loaded</a>, adjusted to take into account user or user agent
         preferences.</li>
         <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/774 -->

         <li>At least <var title="">time</var> seconds have elapsed since the <code><a href=#the-meta-element>meta</a></code>
         element was <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into the
         <code>Document</code></a>, adjusted to take into account user or user agent
         preferences.</li>
         <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/772 -->

        </ul></li>

       <li><p>Provide the user with an interface that, when selected, <a href=#navigate title=navigate>navigates</a><!--DONAV meta refresh--> a <a href=#browsing-context>browsing context</a> to
       <var title="">url</var>, with the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> as
       the <a href=#source-browsing-context>source browsing context</a>.</li>

       <li><p>Do nothing.</li>

      </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>

     </li>

    </ol></div>

    <p>For <code><a href=#the-meta-element>meta</a></code> elements with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>
    attribute in the <a href=#attr-meta-http-equiv-refresh title=attr-meta-http-equiv-refresh>Refresh state</a>, the <code title=attr-meta-content><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>valid non-negative integer</a>, or</li>

     <li>a <a href=#valid-non-negative-integer>valid non-negative integer</a>, followed by a U+003B SEMICOLON character
     (;)<!--(add this at some point once the browsers all support it) or a U+002C COMMA character
     (,)-->, followed by one or more <a href=#space-character title="space character">space characters</a>, followed
     by a substring that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">URL</code>", followed by a U+003D EQUALS SIGN character (=), followed by a <a href=#valid-url>valid
     URL</a> that does not start with a literal U+0027 APOSTROPHE (') or U+0022 QUOTATION MARK
     (") character.</li>

    </ul><p>In the former case, the integer represents a number of seconds before the page is to be
    reloaded; in the latter case the integer represents a number of seconds before the page is to be
    replaced by the page at the given <a href=#url>URL</a>.</p>

    <div class=example>

     <p>A news organization's front page could include the following markup in the page's
     <code><a href=#the-head-element>head</a></code> element, to ensure that the page automatically reloads from the server every
     five minutes:</p>

     <pre>&lt;meta http-equiv="Refresh" content="300"&gt;</pre>

    </div>

    <div class=example>

     <p>A sequence of pages could be used as an automated slide show by making each page refresh to
     the next page in the sequence, using markup such as the following:</p>

     <pre>&lt;meta http-equiv="Refresh" content="20; URL=page4.html"&gt;</pre>

    </div>

   </dd>

   <dt class=impl><dfn id=attr-meta-http-equiv-set-cookie title=attr-meta-http-equiv-set-cookie>Cookie setter</dfn> (<code title="">http-equiv="set-cookie"</code>)

   <dd class=impl>

    <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><a href=#the-meta-element>meta</a></code> element has no <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
     attribute, or if that attribute's value is the empty string, then abort these steps.</li>

     <li><p><a href=#obtain-the-storage-mutex>Obtain the storage mutex</a>.</li>

     <li><p>Act as if <a href=#receives-a-set-cookie-string title="receives a set-cookie-string">receiving a
     set-cookie-string</a> for <a href="#the-document's-address">the document's address</a> via a "non-HTTP" API,
     consisting of the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>
     attribute encoded as UTF-8. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsRFC3629>[RFC3629]</a></li>

    </ol></dd>

  </dl><p>There must not be more than one <code><a href=#the-meta-element>meta</a></code> element with any particular state in the
  document at a time.</p>


  <h5 id=other-pragma-directives><span class=secno>4.2.5.4 </span>Other pragma directives</h5>

  <p><dfn id=concept-http-equiv-extensions title=concept-http-equiv-extensions>Extensions to the predefined set of pragma
  directives</dfn> may, under certain conditions, be registered in the <a href=http://wiki.whatwg.org/wiki/PragmaExtensions>WHATWG Wiki PragmaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>

  <p>Such extensions must use a name that is identical to an HTTP header registered in the Permanent
  Message Header Field Registry, and must have behavior identical to that described for the HTTP
  header. <a href=#refsIANAPERMHEADERS>[IANAPERMHEADERS]</a></p>

  <p>Pragma directives corresponding to headers describing metadata, or not requiring specific user
  agent processing, must not be registered; instead, use <a href=#concept-meta-extensions title=concept-meta-extensions>metadata names</a>. Pragma directives corresponding to headers
  that affect the HTTP processing model (e.g. caching) must not be registered, as they would result
  in HTTP-level behavior being different for user agents that implement HTML than for user agents
  that do not.</p>

  <p>Anyone is free to edit the WHATWG Wiki PragmaExtensions page at any time to add a pragma
  directive satisfying these conditions. Such registrations must specify the following
  information:</p>

  <dl><dt>Keyword</dt>

   <dd><p>The actual name being defined. The name must match a previously-registered HTTP name with
   the same requirements.</dd>


   <dt>Brief description</dt>

   <dd><p>A short non-normative description of the purpose of the pragma directive.</dd>


   <dt>Specification</dt>

   <dd>A link to the specification defining the corresponding HTTP header.</dd>

  </dl><div class=impl>

  <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>

  </div>




  <h5 id=charset><span class=secno>4.2.5.5 </span>Specifying the document's character encoding</h5>

  <!-- READ ME WHEN EDITING: if we ever move this to the "writing HTML" section, then we have to
  duplicate the requirements in the parsing section for conformance checkers, and we have to make
  sure that the requirements for charset="" apply even in XML, for the  polyglot
  hack. -->

  <p>A <dfn id=character-encoding-declaration>character encoding declaration</dfn> is a mechanism by which the <a href=#encoding title=encoding>character encoding</a> used to store or transmit a document is specified.</p>

  <p>The following restrictions apply to <a href=#character-encoding-declaration title="character encoding declaration">character
  encoding declarations</a>:</p>

  <ul><li>The character encoding name given must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
   one of the <a href=#encoding-label title="encoding label">labels</a> of the <a href=#encoding title=encoding>character
   encoding</a> used to serialize the file. <a href=#refsENCODING>[ENCODING]</a></li>

   <li>The character encoding declaration must be serialized without the use of <a href=#syntax-charref title=syntax-charref>character references</a> or character escapes of any kind.</li>

   <li id=charset1024><span id=charset512 title="">The element containing the character encoding
   declaration must be serialized completely within the first 1024 bytes of the
   document.</span></li> <!-- span is for historical reasons, to keep an old ID alive -->

  </ul><p>In addition, due to a number of restrictions on <code><a href=#the-meta-element>meta</a></code> elements, there can only be
  one <code><a href=#the-meta-element>meta</a></code>-based character encoding declaration per document.</p> <!-- conformance
  criteria for this one are given in the XML spec, the <meta> section just after defining
  charset="", and the character encoding pragma section. Note that you _can_ have two character
  encoding declarations per document, if the document is an XML document and one is an XML
  declaration, the other is <meta charset>, and the encoding is UTF-8. -->

  <p>If an <a href=#html-documents title="HTML documents">HTML document</a> does not start with a BOM, and its
  <a href=#encoding>encoding</a> is not explicitly given by <a href=#content-type title=Content-Type>Content-Type
  metadata</a>, and the document is not <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, then the character encoding used must be
  an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, and the encoding must be specified using a
  <code><a href=#the-meta-element>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
  <code><a href=#the-meta-element>meta</a></code> element with an <code title=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 title=attr-meta-http-equiv-content-type>Encoding declaration state</a>.</p>

  <p class=note>A character encoding declaration is required (either in the <a href=#content-type title=Content-Type>Content-Type metadata</a> or explicitly in the file) even if the encoding
  is US-ASCII, because a character encoding is needed to process non-ASCII characters entered by the
  user in forms, in URLs generated by scripts, and so forth.</p>

  <p>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code>
  document</a>, the document must not have a <a href=#character-encoding-declaration>character encoding declaration</a>. (In
  this case, the source is already decoded, since it is part of the document that contained the
  <code><a href=#the-iframe-element>iframe</a></code>.)</p>

  <p>If an <a href=#html-documents title="HTML documents">HTML document</a> contains a <code><a href=#the-meta-element>meta</a></code> element
  with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a <code><a href=#the-meta-element>meta</a></code> element
  with an <code title=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 title=attr-meta-http-equiv-content-type>Encoding declaration state</a>, then the character
  encoding used must be an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>.</p>

  <p>Authors should use UTF-8. Conformance checkers may advise authors against using legacy
  encodings. <a href=#refsRFC3629>[RFC3629]</a></p>

  <div class=impl>

  <p>Authoring tools should default to using UTF-8 for newly-created documents. <a href=#refsRFC3629>[RFC3629]</a></p>

  </div>

  <p>Encodings in which a series of bytes in the range 0x20 to 0x7E can encode characters other than
  the corresponding characters in the range U+0020 to U+007E represent a potential security
  vulnerability: a user agent that does not support the encoding (or does not support the label used
  to declare the encoding, or does not use the same mechanism to detect the encoding of unlabeled
  content as another user agent) might end up interpreting technically benign plain text content as
  HTML tags and JavaScript. Authors should therefore not use these encodings. For example, this
  applies to encodings in which the bytes corresponding to "<code title="">&lt;script&gt;</code>" in
  ASCII can encode a different string. Authors should not use such encodings, which are known to
  include JIS_C6226-1983<!-- aka JIS-X-0208, x-JIS0208 -->, JIS_X0212-1990<!-- aka JIS-X-0212 -->,
  HZ-GB-2312<!-- has crazy handling of ASCII "~" -->, JOHAB <!-- a supplementary encoding in KS C
  5601-1992 Annex 3 (= KS X 1001:1998 Annex 3) --> (Windows code page 1361), encodings based on
  ISO-2022<!-- http://krijnhoetmer.nl/irc-logs/whatwg/20090628#l-422 and
  http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-October/023797.html -->, and encodings
  based on EBCDIC. Furthermore, authors must not use the CESU-8, UTF-7, BOCU-1 and SCSU encodings,
  which also fall into this category; these encodings were never intended for use for Web content.
  <a href=#refsRFC1345>[RFC1345]</a><!-- for the JIS types -->
  <a href=#refsRFC1842>[RFC1842]</a><!-- HZ-GB-2312 -->
  <a href=#refsRFC1468>[RFC1468]</a><!-- ISO-2022-JP -->
  <a href=#refsRFC2237>[RFC2237]</a><!-- ISO-2022-JP-1 -->
  <a href=#refsRFC1554>[RFC1554]</a><!-- ISO-2022-JP-2 -->
  <a href=#refsCP50220>[CP50220]</a><!-- CP50220, the compatibility replacement for ISO-2022-JP -->
  <a href=#refsRFC1922>[RFC1922]</a><!-- ISO-2022-CN and ISO-2022-CN-EXT -->
  <a href=#refsRFC1557>[RFC1557]</a><!-- ISO-2022-KR -->
  <a href=#refsCESU8>[CESU8]</a>
  <a href=#refsUTF7>[UTF7]</a>
  <a href=#refsBOCU1>[BOCU1]</a>
  <a href=#refsSCSU>[SCSU]</a>
  <!-- no idea what to reference for JOHAB or EBCDIC, so... -->
  </p>

  <p>Authors should not use UTF-32, as the encoding detection algorithms described in this
  specification intentionally do not distinguish it from UTF-16. <a href=#refsUNICODE>[UNICODE]</a></p>

  <p class=note>Using non-UTF-8 encodings can have unexpected results on form submission and URL
  encodings, which use the <a href="#document's-character-encoding">document's character encoding</a> by default.</p>

  <p>In XHTML, the XML declaration should be used for inline character encoding information, if
  necessary.</p>

  <div class=example>

   <p>In HTML, to declare that the character encoding is UTF-8, the author could include the
   following markup near the top of the document (in the <code><a href=#the-head-element>head</a></code> element):</p>

   <pre>&lt;meta charset="utf-8"&gt;</pre>

   <p>In XML, the XML declaration would be used instead, at the very top of the markup:</p>

   <pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;</pre>

  </div>


  <h4 id=the-style-element><span class=secno>4.2.6 </span>The <dfn><code>style</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: <a href=#flow-content>flow content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is absent: where <a href=#metadata-content>metadata content</a> is expected.</dd>
   <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is absent: in a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element>head</a></code> element.</dd>
   <dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: where <a href=#flow-content>flow content</a> is expected, but before any other <a href=#flow-content>flow content</a> other than <a href=#inter-element-whitespace>inter-element whitespace</a> and <code><a href=#the-style-element>style</a></code> elements, and not as the child of an element whose content model is <a href=#transparent>transparent</a>.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Depends on the value of the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute, but must match requirements described in prose below.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-style-media><a href=#attr-style-media>media</a></code> &mdash; Applicable media</dd>
   <dd><code title=attr-style-type><a href=#attr-style-type>type</a></code> &mdash; Type of embedded resource</dd>
   <dd><code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> &mdash; Whether the styles apply to the entire document or just the parent subtree</dd>
   <dd>Also, the <code title=attr-style-title><a href=#attr-style-title>title</a></code> attribute has special semantics on this element. &mdash; Alternative style sheet set name</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlstyleelement>HTMLStyleElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-style-disabled title=dom-style-disabled>disabled</a>;
           attribute DOMString <a href=#dom-style-media title=dom-style-media>media</a>;
           attribute DOMString <a href=#dom-style-type title=dom-style-type>type</a>;
           attribute boolean <a href=#dom-style-scoped title=dom-style-scoped>scoped</a>;
};
<a href=#htmlstyleelement>HTMLStyleElement</a> implements <a href=#linkstyle>LinkStyle</a>;</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-style-element>style</a></code> element allows authors to embed style information in their documents.
  The <code><a href=#the-style-element>style</a></code> element is one of several inputs to the <a href=#styling>styling processing
  model</a>. The element does not <a href=#represents title=represents>represent</a> content for the
  user.</p>

  <p>The <dfn id=attr-style-type title=attr-style-type><code>type</code></dfn> attribute gives the styling language.
  If the attribute is present, its value must be a <a href=#valid-mime-type>valid MIME type</a> that designates a
  styling language. The <code title="">charset</code> parameter must not be specified. The default
  value for the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute, which is used if the attribute
  is absent, is "<code title="">text/css</code>". <a href=#refsRFC2318>[RFC2318]</a></p>

  <div class=impl>

  <!-- similar paragraph is also present in the <script> section --> <p>When examining types to
  determine if they support the language, user agents must not ignore unknown MIME parameters
  &mdash; types with unknown parameters must be assumed to be unsupported. The <code title="">charset</code> parameter must be treated as an unknown parameter for the purpose of
  comparing <a href=#mime-type title="MIME type">MIME types</a> here.</p>

  </div>

  <p>The <dfn id=attr-style-media title=attr-style-media><code>media</code></dfn> attribute says which media the
  styles apply to. The value must be a <a href=#valid-media-query>valid media query</a>. <span class=impl>The user
  agent must apply the styles when the <code title=attr-style-media><a href=#attr-style-media>media</a></code> attribute's value
  <a href=#matches-the-environment>matches the environment</a> and the other relevant conditions apply, and must not apply
  them otherwise.</span></p><!-- note similar text in <link> section -->

  <div class=impl>

  <p class=note>The styles might be further limited in scope, e.g. in CSS with the use of <code title="">@media</code> blocks. This specification does not override such further restrictions or
  requirements.</p><!-- note similar text in <link> section -->

  </div>

  <p id=style-default-media>The default, if the <code title=attr-style-media><a href=#attr-style-media>media</a></code>
  attribute is omitted, is "<code title="">all</code>", meaning that by default styles apply to all
  media.</p>

  <p>The <dfn id=attr-style-scoped title=attr-style-scoped><code>scoped</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. If present, it indicates that the styles are intended just for the subtree
  rooted at the <code><a href=#the-style-element>style</a></code> element's parent element, as opposed to the whole
  <code><a href=#document>Document</a></code>.</p>

  <p>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present and the element has a
  parent element, then the <code><a href=#the-style-element>style</a></code> element must precede any <a href=#flow-content>flow content</a> in
  its parent element other than <a href=#inter-element-whitespace>inter-element whitespace</a> and other <code><a href=#the-style-element>style</a></code>
  elements, and the parent element's content model must not have a <a href=#transparent>transparent</a>
  component.</p>

  <p class=note>This implies that scoped <code><a href=#the-style-element>style</a></code> elements cannot be children of, e.g.,
  <code><a href=#the-a-element>a</a></code> or <code><a href=#the-ins-element>ins</a></code> elements, even when those are used as <a href=#flow-content>flow content</a>
  containers.</p>

  <p class=note>A <code><a href=#the-style-element>style</a></code> element <em>without</em> a <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is restricted to appearing in the
  <code><a href=#the-head-element>head</a></code> of the document.</p>

  <div class=impl>

<!--ADD-TOPIC:CSS-->

  <p>A style sheet declared by a <code><a href=#the-style-element>style</a></code> element that has a <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute and has a parent node that is an element is
  <i>scoped</i>, with the <i>scoping element</i> being the <code><a href=#the-style-element>style</a></code> element's parent
  element. <a href=#refsCSSSCOPED>[CSSSCOPED]</a></p>

  <p class=critical>The following will eventually be moved to a CSS specification; it is specified
  here only on an interim basis until an editor can be found to own this.</p>

  <p>Within scoped CSS resources, authors may use an <code title="">@global</code> @-rule. The
  syntax of this rule is defined as follows.</p>

  <p>The following production is added to the grammar:</p>

  <pre>global
  : GLOBAL_SYM S* ruleset
  ;</pre>

  <p>The following rules are added to the Flex tokenizer:</p>

  <pre>B                     b|\\0{0,4}(42|62)(\r\n|[ \t\r\n\f])?
@{G}{L}{O}{B}{A}{L}   {return GLOBAL_SYM;}</pre>

  <p>Simple selectors in rule sets prefixed by the <code title="">@global</code> @-rule in scoped
  CSS resources must be processed in the same way as normal rule sets in non-scoped CSS
  resources.</p>

  <p>Simple selectors in scoped CSS resources that are not prefixed by an <code title="">@global</code> @-rule must only match the <code><a href=#the-style-element>style</a></code> element's parent element (if
  any), and that element's descendants.</p>
<!--REMOVE-TOPIC:CSS-->

  <hr></div>

  <p id=title-on-style>The <dfn id=attr-style-title title=attr-style-title><code>title</code></dfn> attribute on
  <code><a href=#the-style-element>style</a></code> elements defines <a href=#alternative-style-sheet-sets>alternative style sheet sets</a>. If the
  <code><a href=#the-style-element>style</a></code> element has no <code title=attr-style-title><a href=#attr-style-title>title</a></code> attribute, then it
  has no title; the <code title=attr-title><a href=#attr-title>title</a></code> attribute of ancestors does not apply to
  the <code><a href=#the-style-element>style</a></code> element. <a href=#refsCSSOM>[CSSOM]</a></p>

  <p class=note>The <code title=attr-style-title><a href=#attr-style-title>title</a></code> attribute on <code><a href=#the-style-element>style</a></code>
  elements, like the <code title=attr-link-title><a href=#attr-link-title>title</a></code> attribute on <code><a href=#the-link-element>link</a></code>
  elements, differs from the global <code title=attr-title><a href=#attr-title>title</a></code> attribute in that a
  <code><a href=#the-style-element>style</a></code> block without a title does not inherit the title of the parent element: it
  merely has no title.</p>

  <p>The <code><a href=#textcontent>textContent</a></code> of a <code><a href=#the-style-element>style</a></code> element must match the <code title="">style</code> production in the following ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

  <pre>style         = no-c-start *( c-start no-c-end c-end no-c-start )
no-c-start    = &lt; any string that doesn't contain a substring that matches c-start &gt;
c-start       = "&lt;!--"
no-c-end      = &lt; any string that doesn't contain a substring that matches c-end &gt;
c-end         = "--&gt;"</pre>

  <!-- Unmatched comment-like syntax is invalid on a temporary basis,
       waiting for IE, WebKit, and Opera to fix their parsing bug
       whereby such comments trigger a weird escape in which </style>
       is ignored. Otherwise, parsing behaviour in those browsers
       could differ substantially from the parsing behaviour of HTML5.
       Once everyone follows the HTML5 spec, we can drop this
       requirement.
  -->

  <div class=impl>

  <p>All descendant elements must be processed, according to their semantics, before the
  <code><a href=#the-style-element>style</a></code> element itself is evaluated. For styling languages that consist of pure text
  (as opposed to XML), user agents must evaluate <code><a href=#the-style-element>style</a></code> elements by passing the
  concatenation of the contents of all the <code><a href=#text>Text</a></code> nodes that are children of the
  <code><a href=#the-style-element>style</a></code> element (not any other nodes such as comments or elements), in <a href=#tree-order>tree
  order</a>, to the style system. For XML-based styling languages, user agents must pass all the
  child nodes of the <code><a href=#the-style-element>style</a></code> element to the style system.</p>

  <p>All <a href=#url title=URL>URLs</a> found by the styling language's processor must be <a href=#resolve-a-url title="resolve a url">resolved</a>, relative to the element (or as defined by the styling
  language), when the processor is invoked.<!-- so dynamic changes to the base URL don't affect the
  CSS --></p>

  <!-- the next few paragraph are similar to text in the <style> section -->
  <p>Once the attempts to obtain the style sheet's <a href=#critical-subresources>critical subresources</a>, if any, are
  complete, or, if the style sheet has no <a href=#critical-subresources>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>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#the-style-element>style</a></code> element, or, if one of the style sheet's
  <a href=#critical-subresources>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>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at
  the <code><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>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM
  manipulation task source</a>.</p>

  <p>The element must <a href=#delay-the-load-event>delay the load event</a> of the element's document until all the
  attempts to obtain the style sheet's <a href=#critical-subresources>critical subresources</a>, if any, are complete.</p>

  </div>

  <p class=note>This specification does not specify a style system, but CSS is expected to be
  supported by most Web browsers. <a href=#refsCSS>[CSS]</a></p>

  <div class=impl>

  <p>The <dfn id=dom-style-media title=dom-style-media><code>media</code></dfn>, <dfn id=dom-style-type title=dom-style-type><code>type</code></dfn> and <dfn id=dom-style-scoped title=dom-style-scoped><code>scoped</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  </div>

  <p>The <dfn id=dom-style-disabled title=dom-style-disabled><code>disabled</code></dfn> IDL attribute behaves as
  defined <a href=#dom-linkstyle-disabled title=dom-linkstyle-disabled>for the alternative style sheets DOM</a>.</p>

  <p>The <code><a href=#linkstyle>LinkStyle</a></code> interface is also implemented by this element; the <a href=#styling>styling
  processing model</a> defines how. <a href=#refsCSSOM>[CSSOM]</a></p>

  <div class=example>

   <p>The following document has its stress emphasis styled as bright red text rather than italics
   text, while leaving titles of works and Latin words in their default italics. It shows how using
   appropriate elements enables easier restyling of documents.</p>

   <pre>&lt;!DOCTYPE html&gt;
&lt;html lang="en-US"&gt;
 &lt;head&gt;
  &lt;title&gt;My favorite book&lt;/title&gt;
  &lt;style&gt;
   body { color: black; background: white; }
   em { font-style: normal; color: red; }
  &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;My &lt;em&gt;favorite&lt;/em&gt; book of all time has &lt;em&gt;got&lt;/em&gt; to be
  &lt;cite&gt;A Cat's Life&lt;/cite&gt;. It is a book by P. Rahmel that talks
  about the &lt;i lang="la"&gt;Felis Catus&lt;/i&gt; in modern human society.&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>




  <h4 id=styling><span class=secno>4.2.7 </span><dfn title="styling processing model">Styling</dfn></h4>

  <p>The <code><a href=#the-link-element>link</a></code> and <code><a href=#the-style-element>style</a></code> elements can provide styling information for the
  user agent to use when rendering the document. The CSS and CSSOM specifications specify what
  styling information is to be used by the user agent and how it is to be used. <a href=#refsCSS>[CSS]</a> <a href=#refsCSSOM>[CSSOM]</a></p>

  <p>The <code><a href=#the-style-element>style</a></code> and <code><a href=#the-link-element>link</a></code> elements implement the <code><a href=#linkstyle>LinkStyle</a></code>
  interface. <a href=#refsCSSOM>[CSSOM]</a></p>

  <div class=impl>

  <p>For <code><a href=#the-style-element>style</a></code> elements, if the user agent does not support the specified styling
  language, then the <code title=dom-LinkStyle-sheet><a href=#dom-linkstyle-sheet>sheet</a></code> attribute of the element's
  <code><a href=#linkstyle>LinkStyle</a></code> interface must return null. Similarly, <code><a href=#the-link-element>link</a></code> elements that do
  not represent <a href=#link-type-stylesheet title=rel-stylesheet>external resource links that contribute to the styling
  processing model</a> (i.e. that do not have a <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code>
  keyword in their <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute), for which <a href=#the-link-is-an-alternative-stylesheet>the link is an
  alternative stylesheet</a> but whose <code title=dom-title><a href=#dom-title>title</a></code> content attribute is
  absent or empty, or whose resource is <a href=#cors-cross-origin>CORS-cross-origin</a>, must have their
  <code><a href=#linkstyle>LinkStyle</a></code> interface's <code title=dom-LinkStyle-sheet><a href=#dom-linkstyle-sheet>sheet</a></code> attribute return
  null.</p>

  <p>Otherwise, the <code><a href=#linkstyle>LinkStyle</a></code> interface's <code title=dom-LinkStyle-sheet><a href=#dom-linkstyle-sheet>sheet</a></code> attribute must return null if the corresponding element
  is not <a href=#in-a-document>in a <code>Document</code></a>,
  <!-- link: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1934 -->
  <!-- style: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1935 -->
  and otherwise must return a <code><a href=#stylesheet>StyleSheet</a></code> object with the following properties: <a href=#refsCSSOM>[CSSOM]</a></p>

  <dl><dt>The style sheet type</dt>

   <dd><p>The style sheet type must be the same as the style's specified type. For
   <code><a href=#the-style-element>style</a></code> elements, this is the same as the <code title=attr-style-type><a href=#attr-style-type>type</a></code>
   content attribute's value, or <code title="">text/css</code> if that is omitted. For
   <code><a href=#the-link-element>link</a></code> elements, this is the <a href=#content-type title=Content-Type>Content-Type metadata of the
   specified resource</a>.</dd>

   <dt>The style sheet location</dt>

   <dd><p>For <code><a href=#the-link-element>link</a></code> elements, the location must be the result of <a href=#resolve-a-url title="resolve a
   url">resolving</a> the <a href=#url>URL</a> given by the element's <code title=attr-link-href><a href=#attr-link-href>href</a></code> content attribute, relative to the element, or the empty
   string if that fails. For <code><a href=#the-style-element>style</a></code> elements, there is no location.</dd> <!-- note
   that this might not match the style sheet URL, if the base URL has changed for instance -->

   <dt>The style sheet media</dt>

   <dd><p>The media must be the same as the value of the element's <code title="">media</code>
   content attribute, or the empty string, if the attribute is omitted.</dd>

   <dt>The style sheet title</dt>

   <dd><p>The title must be the same as the value of the element's <code title=dom-title><a href=#dom-title>title</a></code> content attribute, if the attribute is present and has a non-empty
   value. If the attribute is absent or its value is the empty string, then the style sheet does not
   have a title (it is the empty string). The title is used for defining <a href=#alternative-style-sheet-sets>alternative style
   sheet sets</a>.</dd>

   <dt>The style sheet alternate flag</dt>

   <dd><p>For <code><a href=#the-link-element>link</a></code> elements, true if <a href=#the-link-is-an-alternative-stylesheet>the link is an alternative
   stylesheet</a>. In all other cases, false.</dd>

<!--
   <dt>The style sheet disabled flag</dt> (not included, because I assume CSSOM will change to not
   require this spec to initialise the value, but will instead initialise it based on the other
   values)
-->

  </dl><p>The same object must be returned each time.</p>

  <p>The <dfn id=dom-linkstyle-disabled title=dom-LinkStyle-disabled><code>disabled</code></dfn> IDL attribute on
  <code><a href=#the-link-element>link</a></code> and <code><a href=#the-style-element>style</a></code> elements must return false and do nothing on setting, if
  the <code title=dom-linkstyle-sheet><a href=#dom-linkstyle-sheet>sheet</a></code> attribute of their <code><a href=#linkstyle>LinkStyle</a></code>
  interface is null. Otherwise, it must return the value of the <code><a href=#stylesheet>StyleSheet</a></code> interface's
  <code title=dom-stylesheet-disabled><a href=#dom-stylesheet-disabled>disabled</a></code> attribute on getting, and forward the new
  value to that same attribute on setting.</p>

  <!-- [CSSOM] covers the following: the term "alternative style sheet sets", the term "default
  style sheet set", preferred stylesheets, alternative stylesheets, persistent stylesheets, ordering
  of stylesheets, dynamic additions/removals, window.styleSheets, style sheets given by HTTP Link:
  headers, and the alternative style sheet API -->

  <p id=alternate-style-sheets>The rules for handling alternative style sheets are defined in the
  CSS object model specification. <a href=#refsCSSOM>[CSSOM]</a></p>

  <hr><p>Style sheets, whether added by a <code><a href=#the-link-element>link</a></code> element, a <code><a href=#the-style-element>style</a></code> element, an
  <code>&lt;?xml-stylesheet&gt;</code> PI, an HTTP <code title=http-link>Link:</code> header, or some
  other mechanism, have a <dfn id=style-sheet-ready>style sheet ready</dfn> flag, which is initially unset.</p>

  <p>When a style sheet is ready to be applied, its <a href=#style-sheet-ready>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><a href=#the-style-element>style</a></code> element with no <code title="">@import</code> rules), then the style rules must
  be synchronously made available to script; otherwise, the style rules must only be made available
  to script once the <a href=#event-loop>event loop</a> reaches its "update the rendering" step.</p>

  <p>A style sheet in the context of the <code><a href=#document>Document</a></code> of an <a href=#html-parser>HTML parser</a> or
  <a href=#xml-parser>XML parser</a> is said to be <dfn id=a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts</dfn> if the
  element was created by that <code><a href=#document>Document</a></code>'s parser, and the element is either a
  <code><a href=#the-style-element>style</a></code> element or a <code><a href=#the-link-element>link</a></code> element that was an <a href=#link-type-stylesheet title=rel-stylesheet>external resource link that contributes to the styling processing
  model</a> when the element was created by the parser, and the element's style sheet was enabled
  when the element was created by the parser, and the element's <a href=#style-sheet-ready>style sheet ready</a> flag
  is not yet set, and, the last time the <a href=#event-loop>event loop</a> reached step 1, the element was
  <a href=#in-a-document title="in a document">in that <code>Document</code></a>, and the user agent hasn't given
  up on that particular style sheet yet. A user agent may give up on a style sheet at any time.</p>

  <p class=note>Giving up on a style sheet before the style sheet loads, if the style sheet
  eventually does still load, means that the script might end up operating with incorrect
  information. For example, if a style sheet sets the 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><a href=#document>Document</a></code> <dfn id=has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking scripts</dfn> if there is
  either <a href=#a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts</a> in the context of that
  <code><a href=#document>Document</a></code>, or if that <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing context</a> that
  has a <a href=#parent-browsing-context>parent browsing context</a>, and the <a href=#active-document>active document</a> of that
  <a href=#parent-browsing-context>parent browsing context</a> itself <a href=#has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking
  scripts</a>.</p>

  <p>A <code><a href=#document>Document</a></code> <dfn id=has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts</dfn> if it does not
  <a href=#has-a-style-sheet-that-is-blocking-scripts title="has a style sheet that is blocking scripts">have a style sheet that is blocking
  scripts</a> as defined in the previous paragraph.</p>

  </div>



  <h3 id=scripting-1><span class=secno>4.3 </span>Scripting</h3>

  <p>Scripts allow authors to add interactivity to their documents.</p>

  <p>Authors are encouraged to use declarative alternatives to scripting where possible, as
  declarative mechanisms are often more maintainable, and many users disable scripting.</p>

  <div class=example>

   <p>For example, instead of using script to show or hide a section to show more details, the
   <code><a href=#the-details-element>details</a></code> element could be used.</p>

  </div>

  <p>Authors are also encouraged to make their applications degrade gracefully in the absence of
  scripting support.</p>

  <div class=example>

   <p>For example, if an author provides a link in a table header to dynamically resort the table,
   the link could also be made to function without scripts by requesting the sorted table from the
   server.</p>

  </div>


  <h4 id=the-script-element><span class=secno>4.3.1 </span>The <dfn id=script><code>script</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#script-supporting-elements title="script-supporting elements">Script-supporting element</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#metadata-content>metadata content</a> is expected.</dd>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dd>Where <a href=#script-supporting-elements>script-supporting elements</a> are expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>If there is no <code title=attr-script-src><a href=#attr-script-src>src</a></code>
   attribute, depends on the value of the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, but must match
   <a href=#restrictions-for-contents-of-script-elements>script content restrictions</a>.</dd>
   <dd>If there <em>is</em> a <code title=attr-script-src><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>script documentation</a> that also matches <a href=#restrictions-for-contents-of-script-elements>script
   content restrictions</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-script-src><a href=#attr-script-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-script-type><a href=#attr-script-type>type</a></code> &mdash; Type of embedded resource</dd>
   <dd><code title=attr-script-charset><a href=#attr-script-charset>charset</a></code> &mdash; Character encoding of the external script resource</dd>
   <dd><code title=attr-script-async><a href=#attr-script-async>async</a></code> &mdash; Execute script asynchronously</dd>
   <dd><code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> &mdash; Defer script execution</dd>
   <dd><code title=attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code> &mdash; How the element handles crossorigin requests</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlscriptelement>HTMLScriptElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-script-src title=dom-script-src>src</a>;
           attribute DOMString <a href=#dom-script-type title=dom-script-type>type</a>;
           attribute DOMString <a href=#dom-script-charset title=dom-script-charset>charset</a>;
           attribute boolean <a href=#dom-script-async title=dom-script-async>async</a>;
           attribute boolean <a href=#dom-script-defer title=dom-script-defer>defer</a>;
           attribute DOMString <a href=#dom-script-crossorigin title=dom-script-crossorigin>crossOrigin</a>;
           attribute DOMString <a href=#dom-script-text title=dom-script-text>text</a>;

  // <a href="#HTMLScriptElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><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 title=represents>represent</a> content for the
  user.</p>

  <p>When used to include dynamic scripts, the scripts may either be embedded inline or may be
  imported from an external file using the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute. If
  the language is not that described by "<code title="">text/javascript</code>", then the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute must be present, as described below. Whatever
  language is used, the contents of the <code><a href=#the-script-element>script</a></code> element must conform with the
  requirements of that language's specification.</p>

  <p>When used to include data blocks (as opposed to scripts), the data must be embedded inline, the
  format of the data must be given using the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute,
  the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute must not be specified, and the contents of
  the <code><a href=#the-script-element>script</a></code> element must conform to the requirements defined for the format used.</p>

  <p>The <dfn id=attr-script-type title=attr-script-type><code>type</code></dfn> attribute gives the language of the
  script or format of the data. If the attribute is present, its value must be a <a href=#valid-mime-type>valid MIME
  type</a>. The <code title="">charset</code> parameter must not be specified. The default, which
  is used if the attribute is absent, is "<code title="">text/javascript</code>".</p>

  <p>The <dfn id=attr-script-src title=attr-script-src><code>src</code></dfn> attribute, if specified, gives the
  address of the external script resource to use. The value of the attribute must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid
  non-empty URL potentially surrounded by spaces</a> identifying a script resource of the type
  given by the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, if the attribute is present, or
  of the type "<code title="">text/javascript</code>", if the attribute is absent. A resource is a
  script resource of a given type if that type identifies a scripting language and the resource
  conforms with the requirements of that language's specification.</p>

  <p>The <dfn id=attr-script-charset title=attr-script-charset><code>charset</code></dfn> attribute gives the character
  encoding of the external script resource. The attribute must not be specified if the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is not present. If the attribute is set, its value
  must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the <a href=#encoding-label title="encoding
  label">labels</a> of an <a href=#encoding>encoding</a>, and must specify the same <a href=#encoding>encoding</a> as
  the <code title="">charset</code> parameter of the <a href=#content-type title=Content-Type>Content-Type
  metadata</a> of the external file, if any. <a href=#refsENCODING>[ENCODING]</a></p>

  <p>The <dfn id=attr-script-async title=attr-script-async><code>async</code></dfn> and <dfn id=attr-script-defer title=attr-script-defer><code>defer</code></dfn> attributes are <a href=#boolean-attribute title="boolean
  attribute">boolean attributes</a> that indicate how the script should be executed. The <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> and <code title=attr-script-async><a href=#attr-script-async>async</a></code> attributes
  must not be specified if the <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is not
  present.</p>

  <p>There are three possible modes that can be selected using these attributes. If the <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute is present, then the script will be executed
  asynchronously, as soon as it is available. If the <code title=attr-script-async><a href=#attr-script-async>async</a></code>
  attribute is not present but the <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attribute is
  present, then the script is executed when the page has finished parsing. If neither attribute is
  present, then the script is fetched and executed immediately, before the user agent continues
  parsing the page.</p>

  <p class=note>The exact processing details for these attributes are, for mostly historical
  reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation
  requirements are therefore by necessity scattered throughout the specification. The algorithms
  below (in this section) describe the core of this processing, but these algorithms reference and
  are referenced by the parsing rules for <code><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 title=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 title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attribute may be specified even if the <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute is specified, to cause legacy Web browsers that
  only support <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> (and not <code title=attr-script-async><a href=#attr-script-async>async</a></code>) to fall back to the <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> behavior instead of the synchronous blocking behavior that
  is the default.</p>

  <p>The <dfn id=attr-script-crossorigin title=attr-script-crossorigin><code>crossorigin</code></dfn> attribute is a
  <a href=#cors-settings-attribute>CORS settings attribute</a>. It controls, for scripts that are obtained from other <a href=#origin title=origin>origins</a>, whether error information will be exposed.</p>

  <p>Changing the <code title=attr-script-src><a href=#attr-script-src>src</a></code>, <code title=attr-script-type><a href=#attr-script-type>type</a></code>, <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code>, <code title=attr-script-async><a href=#attr-script-async>async</a></code>, <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code>, and <code title=attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code> attributes dynamically has no direct effect;
  these attribute are only used at specific times described below.</p> <!-- by implication, changes
  to the base URL also have no effect -->

  <div class=impl>

  <p>A <code><a href=#the-script-element>script</a></code> element has several associated pieces of state.</p>

  <p>The first is a flag indicating whether or not the script block has been <dfn id=already-started>"already
  started"</dfn>. Initially, <code><a href=#the-script-element>script</a></code> elements must have this flag unset (script blocks,
  when created, are not "already started"). The <a href=#concept-node-clone-ext title=concept-node-clone-ext>cloning
  steps</a> for <code><a href=#the-script-element>script</a></code> elements must set the "already started" flag on the copy if
  it is set on the element being cloned.</p>

  <p>The second is a flag indicating whether the element was <dfn id=parser-inserted>"parser-inserted"</dfn>.
  Initially, <code><a href=#the-script-element>script</a></code> elements must have this flag unset. It is set by the <a href=#html-parser>HTML
  parser</a> and the <a href=#xml-parser>XML parser</a> on <code><a href=#the-script-element>script</a></code> elements they insert and
  affects the processing of those elements.</p>

  <p>The third is a flag indicating whether the element will <dfn id=force-async>"force-async"</dfn>. Initially,
  <code><a href=#the-script-element>script</a></code> elements must have this flag set. It is unset by the <a href=#html-parser>HTML parser</a>
  and the <a href=#xml-parser>XML parser</a> on <code><a href=#the-script-element>script</a></code> elements they insert. In addition, whenever
  a <code><a href=#the-script-element>script</a></code> element whose <a href=#force-async>"force-async"</a> flag is set has a <code title=attr-script-async><a href=#attr-script-async>async</a></code> content attribute added, the element's
  <a href=#force-async>"force-async"</a> flag must be unset.</p> <!-- there's no need to unset it when the
  attribute is removed since you can't have the attribute and the flag set at once. -->

  <p>The fourth is a flag indicating whether or not the script block is <dfn id=ready-to-be-parser-executed>"ready to be
  parser-executed"</dfn>. Initially, <code><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>"parser-inserted"</a>, to let the parser know when to execute the
  script.</p>

  <p>The last few pieces of state are <dfn id="the-script-block's-type"><var>the script block's type</var></dfn>, <dfn id="the-script-block's-character-encoding"><var>the
  script block's character encoding</var></dfn>, and <dfn id="the-script-block's-fallback-character-encoding"><var>the script block's fallback character
  encoding</var></dfn>. They are determined when the script is prepared, based on the attributes on
  the element at that time, and the <code><a href=#document>Document</a></code> of the <code><a href=#the-script-element>script</a></code> element.</p>

  <p>When a <code><a href=#the-script-element>script</a></code> element that is not marked as being <a href=#parser-inserted>"parser-inserted"</a>
  experiences one of the events listed in the following list, the user agent must synchronously
  <a href=#prepare-a-script title="prepare a script">prepare</a> the <code><a href=#the-script-element>script</a></code> element:</p>

  <ul><li>The <code><a href=#the-script-element>script</a></code> element gets <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted
   into a document</a>, at the time the <a href=#nodes-are-inserted title="nodes are inserted">node is inserted</a>
   according to the DOM, after any other <code><a href=#the-script-element>script</a></code> elements inserted at the same time that
   are earlier in the <code><a href=#document>Document</a></code> in <a href=#tree-order>tree order</a>.</li>

   <li>The <code><a href=#the-script-element>script</a></code> element is <a href=#in-a-document>in a <code>Document</code></a> and a node or
   document fragment is <a href=#nodes-are-inserted title="nodes are inserted">inserted</a> into the
   <code><a href=#the-script-element>script</a></code> element, after any <code><a href=#the-script-element>script</a></code> elements <a href=#nodes-are-inserted title="nodes are
   inserted">inserted</a> at that time.</li>

   <li>The <code><a href=#the-script-element>script</a></code> element is <a href=#in-a-document>in a <code>Document</code></a> and has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute set where previously the element had no such
   attribute.</li>

  </ul><p>To <dfn id=prepare-a-script title="prepare a script">prepare a script</dfn>, the user agent must act as
  follows:</p>

  <ol><li>

    <p>If the <code><a href=#the-script-element>script</a></code> element is marked as having <a href=#already-started>"already started"</a>, then
    the user agent must abort these steps at this point. The script is not executed.</p>

   </li>

   <li>

    <p>If the element has its <a href=#parser-inserted>"parser-inserted"</a> flag set, then set <var title="">was-parser-inserted</var> to true and unset the element's
    <a href=#parser-inserted>"parser-inserted"</a> flag. Otherwise, set <var title="">was-parser-inserted</var> to
    false.</p>

    <p class=note>This is done so that if parser-inserted <code><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>

    <!-- q.v. http://hsivonen.iki.fi/test/moz/script-setting-src-on-parser-inserted-script.html -->

   </li>

   <li>

    <p>If <var title="">was-parser-inserted</var> is true and the element does not have an <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute, then set the element's
    <a href=#force-async>"force-async"</a> flag to true.</p>

    <p class=note>This is done so that if a parser-inserted <code><a href=#the-script-element>script</a></code> element fails to
    run when the parser tries to run it, but it is later executed after a script dynamically updates
    it, it will execute asynchronously even if the <code title=attr-script-async><a href=#attr-script-async>async</a></code>
    attribute isn't set.</p>

   </li>

   <li id=script-processing-empty>

    <p>If the element has no <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, and its child
    nodes, if any, consist only of comment nodes and empty <code><a href=#text>Text</a></code> nodes, then the user
    agent must abort these steps at this point. The script is not executed.</p>

   </li>

   <li>

    <p>If the element is not <a href=#in-a-document>in a <code>Document</code></a>, then the user agent must abort
    these steps at this point. The script is not executed.</p>

   </li>

   <li id=script-processing-prepare>

    <p>If either:</p>

    <ul class=brief><li>the <code><a href=#the-script-element>script</a></code> element has a <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute
     and its value is the empty string, or</li>

     <li>the <code><a href=#the-script-element>script</a></code> element has no <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute
     but it has a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute and <em>that</em>
     attribute's value is the empty string, or</li>

     <li>the <code><a href=#the-script-element>script</a></code> element has neither a <code title=attr-script-type><a href=#attr-script-type>type</a></code>
     attribute nor a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute, then</li>

    </ul><p>...let <var><a href="#the-script-block's-type">the script block's type</a></var> for this <code><a href=#the-script-element>script</a></code> element be "<code title="">text/javascript</code>".</p>

    <p>Otherwise, if the <code><a href=#the-script-element>script</a></code> element has a <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute, let <var><a href="#the-script-block's-type">the script block's type</a></var> for this
    <code><a href=#the-script-element>script</a></code> element be the value of that attribute with any leading or trailing
    sequences of <a href=#space-character title="space character">space characters</a> removed.</p> <!-- <span>Strip
    leading and trailing whitespace</span> from... -->

    <p>Otherwise, the element has a non-empty <code title=attr-script-language><a href=#attr-script-language>language</a></code>
    attribute; let <var><a href="#the-script-block's-type">the script block's type</a></var> for this <code><a href=#the-script-element>script</a></code> element be the
    concatenation of the string "<code title="">text/</code>" followed by the value of the <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute.</p> <!-- user agents already support,
    e.g., type="text/javascript1.3", so we don't have to support that separately. -->

    <p class=note>The <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute is never
    conforming, and is always ignored if there is a <code title=attr-script-type><a href=#attr-script-type>type</a></code>
    attribute present.</p>

   </li>

   <li>

    <p>If the user agent does not <a href=#support-the-scripting-language>support the scripting language</a> given by <var><a href="#the-script-block's-type">the
    script block's type</a></var> for this <code><a href=#the-script-element>script</a></code> element, then the user agent must abort
    these steps at this point. The script is not executed.</p>

   </li>

   <li>

    <p>If <var title="">was-parser-inserted</var> is true, then flag the element as
    <a href=#parser-inserted>"parser-inserted"</a> again, and set the element's <a href=#force-async>"force-async"</a> flag to
    false.</p>

   </li>

   <li id=script-processing-start>

    <p>The user agent must set the element's <a href=#already-started>"already started"</a> flag.</p>

    <p class=note>The state of the element at this moment <a href=#establish-script-block-source>is later used</a> to determine the script source.</p>

   </li>

   <li>

    <p>If the element is flagged as <a href=#parser-inserted>"parser-inserted"</a>, but the element's
    <code><a href=#document>Document</a></code> is not the <code><a href=#document>Document</a></code> of the parser that created the element,
    then abort these steps.</p>

   </li>

   <li id=script-processing-noscript>

    <p>If <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the <code><a href=#the-script-element>script</a></code>
    element, then the user agent must abort these steps at this point. The script is not
    executed.</p>

    <p class=note>The definition of <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>
    means that, amongst others, the following scripts will not execute: scripts in
    <code>XMLHttpRequest</code>'s <code title=dom-XMLHttpRequest-responseXML>responseXML</code>
    documents, scripts in <code>DOMParser</code>-created documents, scripts in documents created by
    <code>XSLTProcessor</code>'s <code title=dom-XSLTProcessor-transformToDocument>transformToDocument</code> feature, and scripts
    that are first inserted by a script into a <code><a href=#document>Document</a></code> that was created using the
    <code title=dom-DOMImplementation-createDocument><a href=#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>

   <li id=script-processing-for>

    <p>If the <code><a href=#the-script-element>script</a></code> element has an <code title=attr-script-event><a href=#attr-script-event>event</a></code>
    attribute and a <code title=attr-script-for><a href=#attr-script-for>for</a></code> attribute, then run these substeps:</p>

    <ol><li><p>Let <var title="">for</var> be the value of the <code title=attr-script-for><a href=#attr-script-for>for</a></code>
     attribute.</li>

     <li><p>Let <var title="">event</var> be the value of the <code title=attr-script-event><a href=#attr-script-event>event</a></code> attribute.</li>

     <li><p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var title="">event</var> and
     <var title="">for</var>.</li>

     <li><p>If <var title="">for</var> is not an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
     string "<code title="">window</code>", then the user agent must abort these steps at this
     point. The script is not executed.</li>

     <li><p>If <var title="">event</var> is not an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
     either the string "<code title="">onload</code>" or the string "<code title="">onload()</code>", then the user agent must abort these steps at this point. The script
     is not executed.</li>

    </ol></li>

   <li id=script-processing-encoding>

    <p>If the <code><a href=#the-script-element>script</a></code> element has a <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code>
    attribute, then let <var><a href="#the-script-block's-character-encoding">the script block's character encoding</a></var> for this
    <code><a href=#the-script-element>script</a></code> element be the result of <a href=#getting-an-encoding>getting an encoding</a> from the value of
    the <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code> attribute.</p>

    <p>Otherwise, let <var><a href="#the-script-block's-fallback-character-encoding">the script block's fallback character encoding</a></var> for this
    <code><a href=#the-script-element>script</a></code> element be the same as <a href="#document's-character-encoding" title="document's character encoding">the
    encoding of the document itself</a>.</p>

    <p class=note>Only one of these two pieces of state is set.</p>

   </li>

   <li id=script-processing-src-prepare>

    <p>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> content attribute, run these
    substeps:</p>

    <ol><li><p>Let <var title="">src</var> be the value of the element's <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute.</li>

     <li><p>If <var title="">src</var> is the empty string, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
     a simple event</a> named <code title=event-error>error</code> at the element, and abort
     these steps.</li>

     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">src</var> relative to the
     element.</li>

     <li><p>If the previous step failed, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
     event</a> named <code title=event-error>error</code> at the element, and abort these
     steps.</li>

     <li>

      <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the resulting
      <a href=#absolute-url>absolute URL</a>, with the <i>mode</i> being the state of the element's <code title=attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code> content attribute, the <i title="">origin</i> being the <a href=#origin>origin</a> of the <code><a href=#the-script-element>script</a></code> element's
      <code><a href=#document>Document</a></code>, and the <i>default origin behaviour</i> set to <i>taint</i>.</p>

      <p>The resource obtained in this fashion can be either <a href=#cors-same-origin>CORS-same-origin</a> or
      <a href=#cors-cross-origin>CORS-cross-origin</a>. This only affects how error reporting happens.</p>

      <p>For historical reasons, if the <a href=#url>URL</a> is a <a href=#javascript-protocol title="javascript
      protocol"><code title="">javascript:</code> URL</a>, then the user agent must not, despite
      the requirements in the definition of the <a href=#fetch title=fetch>fetching</a> algorithm,
      actually execute the script in the URL; instead the user agent must act as if it had received
      an empty HTTP 400 response.</p>

      <p>For performance reasons, user agents may start fetching the script (as defined above) as
      soon as the <code title=attr-script-src><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 title=attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code> attribute won't change value in the
      meantime). Either way, once the element is <a href=#insert-an-element-into-a-document title="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 title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is dynamically changed,<!-- or the
      base URL is dynamically changed,--> or the <code title=attr-script-crossorigin><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>

     </li>

    </ol></li>

   <!-- at this point if the element is "parser-inserted" then we know it is not "force-async". -->

   <li>

    <p>Then, the first of the following options that describes the situation must be followed:</p>

    <dl class=switch><dt id=script-processing-defer>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code>
     attribute, and the element has a <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> attribute, and
     the element has been flagged as <a href=#parser-inserted>"parser-inserted"</a>, and the element does not have
     an <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute</dt>

     <dd>

      <p>The element must be added to the end of the <dfn id=list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the
      document has finished parsing</dfn> associated with the <code><a href=#document>Document</a></code> of the parser
      that created the element.</p>

      <p>The <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a>
      places on the <a href=#task-queue>task queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a>
      has completed must set the element's <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag. The
      parser will handle executing the script.</p>

     </dd>


     <dt id=script-processing-parser-inserted>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, and the element has been flagged as
     <a href=#parser-inserted>"parser-inserted"</a>, and the element does not have an <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute</dt>

     <dd>

      <p>The element is the <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a> of the
      <code><a href=#document>Document</a></code> of the parser that created the element. (There can only be one such
      script per <code><a href=#document>Document</a></code> at a time.)</p>

      <p>The <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a>
      places on the <a href=#task-queue>task queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a>
      has completed must set the element's <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag. The
      parser will handle executing the script.</p>

     </dd>


     <dt id=script-processing-style-delayed>If the element does not have a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, and the element has been flagged as
     <a href=#parser-inserted>"parser-inserted"</a>, and either the parser that created the <code><a href=#the-script-element>script</a></code> is
     an <a href=#xml-parser>XML parser</a> or it's an <a href=#html-parser>HTML parser</a> whose <a href=#script-nesting-level>script nesting
     level</a> is not greater than one, and the <code><a href=#document>Document</a></code> of the <a href=#html-parser>HTML
     parser</a> or <a href=#xml-parser>XML parser</a> that created the <code><a href=#the-script-element>script</a></code> element <a href=#has-a-style-sheet-that-is-blocking-scripts>has
     a style sheet that is blocking scripts</a></dt>

     <dd>

      <p>The element is the <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a> of the
      <code><a href=#document>Document</a></code> of the parser that created the element. (There can only be one such
      script per <code><a href=#document>Document</a></code> at a time.)</p>

      <p>Set the element's <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag. The parser will handle
      executing the script.</p>

     </dd>


     <dt id=script-processing-src-sync>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute, does not have an <code title=attr-script-async><a href=#attr-script-async>async</a></code> attribute, and does not have the
     <a href=#force-async>"force-async"</a> flag set</dt>

     <dd>

      <p>The element must be added to the end of the <dfn id=list-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will execute in order
      as soon as possible</dfn> associated with the <code><a href=#document>Document</a></code> of the <code><a href=#the-script-element>script</a></code>
      element at the time the <a href=#prepare-a-script>prepare a script</a> algorithm started.</p>

      <p>The <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a>
      places on the <a href=#task-queue>task queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a>
      has completed must run the following steps:</p>

      <ol><li><p>If the element is not now the first element in the <a href=#list-of-scripts-that-will-execute-in-order-as-soon-as-possible>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>

       <li><p><i>Execution</i>: <a href=#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>list of scripts that will execute in order as soon as
       possible</a>.</li>

       <li><p>Remove the first element from this <a href=#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>.</li>

       <li><p>If this <a href=#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> is
       still not empty and the first entry has already been marked as ready, then jump back to the
       step labeled <i>execution</i>.</li>

      </ol></dd>


     <dt id=script-processing-src>If the element has a <code title=attr-script-src><a href=#attr-script-src>src</a></code>
     attribute</dt>

     <dd>

      <p>The element must be added to the <dfn id=set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as
      possible</dfn> of the <code><a href=#document>Document</a></code> of the <code><a href=#the-script-element>script</a></code> element at the time the
      <a href=#prepare-a-script>prepare a script</a> algorithm started.</p>

      <p>The <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a>
      places on the <a href=#task-queue>task queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a>
      has completed must <a href=#execute-the-script-block>execute the script block</a> and then remove the element from the
      <a href=#set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as possible</a>.</p>

     </dd>


     <dt id=script-processing-inline>Otherwise</dt>

     <dd>The user agent must immediately <a href=#execute-the-script-block>execute the script block</a>, even if other
     scripts are already executing.</dd>

    </dl></li>

  </ol><!-- similar text in various places --><p>Fetching an external script must <a href=#delay-the-load-event>delay the load event</a> of the element's document
  until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a>
  by the <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> (defined above) has been run.</p>

  <p>The <dfn id=pending-parsing-blocking-script>pending parsing-blocking script</dfn> of a <code><a href=#document>Document</a></code> is used by the
  <code><a href=#document>Document</a></code>'s parser(s).</p>

  <p class=note>If a <code><a href=#the-script-element>script</a></code> element that blocks a parser gets moved to another
  <code><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>pending parsing-blocking script</a> because there
  was <a href=#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><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>

  <!-- also (and this would be worth testing): the way the spec is written, if you do not have a
  style sheet that is blocking scripts, then you parse a <script src>, then while waiting for the
  script to load you insert an external style sheet, the script will delay until the sheet is
  loaded, because there's just a binary "are style sheets blocking scripts" state, things aren't
  defined in terms of which style sheets are blocking which scripts -->

  <p>When the user agent is required to <dfn id=execute-the-script-block title="execute the script block">execute a script
  block</dfn>, it must run the following steps:</p>

  <ol><li>

    <p>If the element is flagged as <a href=#parser-inserted>"parser-inserted"</a>, but the element's
    <code><a href=#document>Document</a></code> is not the <code><a href=#document>Document</a></code> of the parser that created the element,
    then abort these steps.</p>

   </li>

   <li>

    <p>Jump to the appropriate set of steps from the list below:</p>

    <dl class=switch><dt>If the load resulted in an error (for example a DNS error, or an HTTP 404 error)</dt>

     <dd><p>Executing the script block must just consist of <a href=#fire-a-simple-event title="fire a simple event">firing
     a simple event</a> named <code title=event-error>error</code> at the element.</dd>

     <dt>If the load was successful</dt>

     <!-- SCRIPT EXEC -->
     <dd>

      <p>Executing the script block must consist of running the following steps. For the purposes of
      these steps, the script is considered to be from an <i>external file</i> if, while the
      <a href=#prepare-a-script>prepare a script</a> algorithm above was running for this script, the
      <code><a href=#the-script-element>script</a></code> element had a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute
      specified.</p>

      <ol><li id=establish-script-block-source>

        <p>Initialize <dfn id="the-script-block's-source"><var>the script block's source</var></dfn> as follows:</p>

        <dl class=switch><dt>If the script is from an external file and <var><a href="#the-script-block's-type">the script block's type</a></var> is a
         text-based language</dt>

         <dd>

          <p>The contents of that file, interpreted as a Unicode string, are the script source.</p>

          <p>To obtain the Unicode string, the user agent run the following steps:</p>

          <ol><li><p>If the resource's <a href=#content-type title=Content-Type>Content Type metadata</a>, if any,
           specifies a character encoding, and the user agent supports that encoding, then let <var title="">character encoding</var> be that encoding, and jump to the bottom step in this
           series of steps.</li>

           <li><p>If the algorithm above set <var><a href="#the-script-block's-character-encoding">the script block's character encoding</a></var>, then
           let <var title="">character encoding</var> be that encoding, and jump to the bottom step
           in this series of steps.</li>

           <li><p>Let <var title="">character encoding</var> be <var><a href="#the-script-block's-fallback-character-encoding">the script block's fallback
           character encoding</a></var>.</li>

           <li>

            <p>If the specification for <var><a href="#the-script-block's-type">the script block's type</a></var> gives specific rules for
            decoding files in that format to Unicode, follow them, using <var>character
            encoding</var> as the character encoding specified by higher-level protocols, if
            necessary.</p> <!-- e.g. XML -->

            <p>Otherwise, <a href=#decode>decode</a> the file to Unicode, using <var>character
            encoding</var> as the fallback encoding.</p>

            <p class=note>The <a href=#decode>decode</a> algorithm overrides <var>character
            encoding</var> if the file contains a BOM.</p>

           </li>

          </ol></dd>

         <dt>If the script is from an external file and <var><a href="#the-script-block's-type">the script block's type</a></var> is an
         XML-based language</dt>

         <dd>

          <p>The external file is the script source. When it is later executed, it must be
          interpreted in a manner consistent with the specification defining the language given by
          <var><a href="#the-script-block's-type">the script block's type</a></var>.</p>

         </dd>

         <dt>If the script is inline and <var><a href="#the-script-block's-type">the script block's type</a></var> is a text-based
         language</dt>

         <dd>

          <p>The value of the <code title=dom-script-text><a href=#dom-script-text>text</a></code> IDL attribute at the time
          the element's <a href=#already-started>"already started"</a> flag was last set is the script source.</p>

         </dd>

         <dt>If the script is inline and <var><a href="#the-script-block's-type">the script block's type</a></var> is an XML-based
         language</dt>

         <dd>

          <p>The child nodes of the <code><a href=#the-script-element>script</a></code> element at the time the element's
          <a href=#already-started>"already started"</a> flag was last set are the script source.</p>

         </dd>

        </dl></li>

       <li>

        <p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-beforescriptexecute>beforescriptexecute</code> that bubbles and is cancelable
        at the <code><a href=#the-script-element>script</a></code> element.</p>

        <p>If the event is canceled, then abort these steps.</p>

       </li>

       <li>

        <p>If the script is from an external file, then increment the
        <a href=#ignore-destructive-writes-counter>ignore-destructive-writes counter</a> of the <code><a href=#the-script-element>script</a></code> element's
        <code><a href=#document>Document</a></code>. Let <var title="">neutralized doc</var> be that
        <code><a href=#document>Document</a></code>.</p>

       </li>

       <li>

        <p>Let <var title="">old script element</var> be the value to which the
        <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object was most recently
        initialized.</p>

       </li>

       <li>

        <p>Initialize the <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to the <code><a href=#the-script-element>script</a></code>
        element.</p>

       </li>

       <li>

        <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a script</a> from the
        <code><a href=#the-script-element>script</a></code> element node, using <var><a href="#the-script-block's-source">the script block's source</a></var>, the
        <a href=#url>URL</a> from which the script was obtained, and <var><a href="#the-script-block's-type">the script block's
        type</a></var>.</p>

        <p>If the script came from a resource that was <a href=#fetch title=fetch>fetched</a> in the
        steps above, and the resource was <a href=#cors-cross-origin>CORS-cross-origin</a>, then pass the <var title="">muted errors</var> flag to the <a href=#create-a-script-from-a-node>create a script from a node</a>
        algorithm.</p>

        <p class=note>This is where the script is compiled and actually executed.</p>

       </li>

       <li>

        <p>Initialize the <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to <var title="">old script
        element</var>.</p>

       </li>

       <li>

        <p>Decrement the <a href=#ignore-destructive-writes-counter>ignore-destructive-writes counter</a> of <var title="">neutralized
        doc</var>, if it was incremented in the earlier step.</p>

       </li>

       <li>

        <p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-afterscriptexecute>afterscriptexecute</code> that bubbles (but is not
        cancelable) at the <code><a href=#the-script-element>script</a></code> element.</p>

       </li>

       <li>

        <p>If the script is from an external file, <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#the-script-element>script</a></code> element.</p>

        <p>Otherwise, the script is internal; <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
        event</a> named <code title=event-load>load</code> at the <code><a href=#the-script-element>script</a></code>
        element.</p>

       </li>

      </ol></dd>

    </dl></li>

  </ol><p>The IDL attributes <dfn id=dom-script-src title=dom-script-src><code>src</code></dfn>, <dfn id=dom-script-type title=dom-script-type><code>type</code></dfn>, <dfn id=dom-script-charset title=dom-script-charset><code>charset</code></dfn>, <dfn id=dom-script-defer title=dom-script-defer><code>defer</code></dfn>, each must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <p>The <dfn id=dom-script-crossorigin title=dom-script-crossOrigin><code>crossOrigin</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code> content
  attribute, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <dfn id=dom-script-async title=dom-script-async><code>async</code></dfn> IDL attribute controls whether the
  element will execute asynchronously or not. If the element's <a href=#force-async>"force-async"</a> flag is
  set, then, on getting, the <code title=dom-script-async><a href=#dom-script-async>async</a></code> IDL attribute must return
  true, and on setting, the <a href=#force-async>"force-async"</a> flag must first be unset, and then the
  content attribute must be removed if the IDL attribute's new value is false, and must be set to
  the empty string if the IDL attribute's new value is true. If the element's
  <a href=#force-async>"force-async"</a> flag is <em>not</em> set, the IDL attribute must <a href=#reflect>reflect</a>
  the <code title=attr-script-async><a href=#attr-script-async>async</a></code> content attribute.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">script</var> . <code title=dom-script-text><a href=#dom-script-text>text</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the contents of the element, ignoring child nodes that aren't <code><a href=#text>Text</a></code>
    nodes.</p>

    <p>Can be set, to replace the element's children with the given value.</p>

   </dd>

  </dl><div class=impl>

  <p>The IDL attribute <dfn id=dom-script-text title=dom-script-text><code>text</code></dfn> must return a
  concatenation of the contents of all the <code><a href=#text>Text</a></code> nodes that are children of the
  <code><a href=#the-script-element>script</a></code> element (ignoring any other nodes such as comments or elements), in tree
  order. On setting, it must act the same way as the <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>

  </div>
<!--TOPIC:HTML-->

  <p class=note>When inserted using the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code>
  method, <code><a href=#the-script-element>script</a></code> elements execute (typically synchronously), but when inserted using
  <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> and <code title=dom-outerHTML><a href=#dom-outerhtml>outerHTML</a></code>
  attributes, they do not execute at all.</p>

  <div class=example>

   <p>In this example, two <code><a href=#the-script-element>script</a></code> elements are used. One embeds an external script, and
   the other includes some data.</p>

   <pre>&lt;script src="game-engine.js"&gt;&lt;/script&gt;
&lt;script type="text/x-game-map"&gt;
........U.........e
o............A....e
.....A.....AAA....e
.A..AAA...AAAAA...e
&lt;/script&gt;</pre>

   <p>The data in this case might be used by the script to generate the map of a video game. The
   data doesn't have to be used that way, though; maybe the map data is actually embedded in other
   parts of the page's markup, and the data block here is just used by the site's search engine to
   help users who are looking for particular features in their game maps.</p>

  </div>

  <div class=example>

   <p>The following sample shows how a script element can be used to define a function that is then
   used by other parts of the document. It also shows how a <code><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 form's
   output.</p>

   <pre>&lt;script&gt;
 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;
 }
&lt;/script&gt;
&lt;form name="pricecalc" onsubmit="return false" onchange="calculate(this)"&gt;
 &lt;fieldset&gt;
  &lt;legend&gt;Work out the price of your car&lt;/legend&gt;
  &lt;p&gt;Base cost: &pound;52000.&lt;/p&gt;
  &lt;p&gt;Select additional options:&lt;/p&gt;
  &lt;ul&gt;
   &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=brakes&gt; Ceramic brakes (&pound;1000)&lt;/label&gt;&lt;/li&gt;
   &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=radio&gt; Satellite radio (&pound;2500)&lt;/label&gt;&lt;/li&gt;
   &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=turbo&gt; Turbo charger (&pound;5000)&lt;/label&gt;&lt;/li&gt;
   &lt;li&gt;&lt;label&gt;&lt;input type=checkbox name=sticker&gt; "XZ" sticker (&pound;250)&lt;/label&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;p&gt;Total: &pound;&lt;output name=result&gt;&lt;/output&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;script&gt;
  calculate(document.forms.pricecalc);
 &lt;/script&gt;
&lt;/form&gt;</pre>

  </div>



  <h5 id=scriptingLanguages><span class=secno>4.3.1.1 </span>Scripting languages</h5>

  <div class=impl>

  <p>A user agent is said to <dfn id=support-the-scripting-language>support the scripting language</dfn> if each component of <var><a href="#the-script-block's-type">the
  script block's type</a></var> is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the corresponding
  component in the <a href=#mime-type>MIME type</a> string of a scripting language that the user agent
  implements.</p>

  </div>

  <p>The following lists the <a href=#mime-type>MIME type</a> strings that user agents must recognize, and the
  languages to which they refer:</p>

  <dl><dt>"<code>application/ecmascript</code>"</dt>
   <dt>"<code>application/javascript</code>"</dt>
   <dt>"<code>application/x-ecmascript</code>"</dt>
   <dt>"<code>application/x-javascript</code>"</dt>
   <dt>"<code>text/ecmascript</code>"</dt>
   <dt>"<code>text/javascript</code>"</dt>
   <dt>"<code>text/javascript1.0</code>"</dt>
   <dt>"<code>text/javascript1.1</code>"</dt>
   <dt>"<code>text/javascript1.2</code>"</dt>
   <dt>"<code>text/javascript1.3</code>"</dt>
   <dt>"<code>text/javascript1.4</code>"</dt>
   <dt>"<code>text/javascript1.5</code>"</dt>
   <dt>"<code>text/jscript</code>"</dt>
   <dt>"<code>text/livescript</code>"</dt>
   <dt>"<code>text/x-ecmascript</code>"</dt>
   <dt>"<code>text/x-javascript</code>"</dt>
   <dd>JavaScript. <a href=#refsECMA262>[ECMA262]</a></dd>

<!--(historical footnote)
   <dt>"<code>text/javascript;e4x=1</code>"</dt>
   <dd>JavaScript with ECMAScript for XML. <a href="#refsECMA357">[ECMA357]</a></dd>
-->

  </dl><div class=impl>

  <p>User agents may support other <a href=#mime-type title="MIME type">MIME types</a> for other languages,
  but must not support other <a href=#mime-type title="MIME type">MIME types</a> for the languages in the list
  above. User agents are not required to support the languages listed above.</p>

  <p>The following <a href=#mime-type title="MIME type">MIME types</a> (with or without parameters) must not
  be interpreted as scripting languages:</p>

  <ul class=brief><li>"<code>text/plain</code>"
   <li>"<code>text/xml</code>"
   <!--<li>"<code>text/html</code>"-->
   <li>"<code>application/octet-stream</code>"
   <li>"<code>application/xml</code>"
   <!--<li>"<code>application/xhtml+xml</code>"-->
   <!--<li>"<code>image/svg+xml</code>"-->

   <!-- the commented-out ones aren't listed here because they couldn't sanely be interpreted as a
   scripting language anyway: they're defined to be something else. I just don't want this to
   devolve into a list of every non-scripting type in existence. -->

  </ul><p class=note>These types are explicitly listed here because they are poorly-defined types that
  are nonetheless likely to be used as formats for data blocks, and it would be problematic if they
  were suddenly to be interpreted as script by a user agent.</p>

  <!-- a similar paragraph is also present in the <style> section -->

  <p>When examining types to determine if they represent supported languages, user agents must not
  ignore MIME parameters. Types are to be compared including all parameters.</p> <!-- whether the
  order of parameters matters is left undefined until such time as it matters; so far the only
  relevant parameter was 'e4x', and it's gone for now -->

  <p class=note>For example, types that include the <code title="">charset</code> parameter will
  not be recognized as referencing any of the scripting languages listed above.</p>

  </div>


  <h5 id=restrictions-for-contents-of-script-elements><span class=secno>4.3.1.2 </span><dfn title="script content restrictions">Restrictions for contents of <code>script</code> elements</dfn></h5>

  <p>The <code><a href=#textcontent>textContent</a></code> of a <code><a href=#the-script-element>script</a></code> element must match the <code title="">script</code> production in the following ABNF, the character set for which is Unicode.
  <a href=#refsABNF>[ABNF]</a></p>

  <pre>script        = data1 *( escape [ script-start data3 ] "--&gt;" data1 ) [ escape ]
escape        = "&lt;!--" data2 *( script-start data3 script-end data2 )

data1         = &lt; any string that doesn't contain a substring that matches not-data1 &gt;
not-data1     = <!-- script-end / -->"&lt;!--"             <!-- the script-end is redundant here since it would close the element -->

data2         = &lt; any string that doesn't contain a substring that matches not-data2 &gt;
not-data2     = <!-- script-end / -->script-start / "--&gt;"  <!-- the script-end is redundant here since it would close the element -->

data3         = &lt; any string that doesn't contain a substring that matches not-data3 &gt;
not-data3     = script-end / "--&gt;"

script-start  = lt       s c r i p t tag-end
script-end    = lt slash s c r i p t tag-end

lt            =  %x003C ; U+003C LESS-THAN SIGN character (&lt;)
slash         =  %x002F ; U+002F SOLIDUS character (/)

s             =  %x0053 ; U+0053 LATIN CAPITAL LETTER S
s             =/ %x0073 ; U+0073 LATIN SMALL LETTER S
c             =  %x0043 ; U+0043 LATIN CAPITAL LETTER C
c             =/ %x0063 ; U+0063 LATIN SMALL LETTER C
r             =  %x0052 ; U+0052 LATIN CAPITAL LETTER R
r             =/ %x0072 ; U+0072 LATIN SMALL LETTER R
i             =  %x0049 ; U+0049 LATIN CAPITAL LETTER I
i             =/ %x0069 ; U+0069 LATIN SMALL LETTER I
p             =  %x0050 ; U+0050 LATIN CAPITAL LETTER P
p             =/ %x0070 ; U+0070 LATIN SMALL LETTER P
t             =  %x0054 ; U+0054 LATIN CAPITAL LETTER T
t             =/ %x0074 ; U+0074 LATIN SMALL LETTER T

tag-end       =  %x0009 ; U+0009 CHARACTER TABULATION (tab)
tag-end       =/ %x000A ; U+000A LINE FEED (LF)
tag-end       =/ %x000C ; U+000C FORM FEED (FF)
tag-end       =/ %x0020 ; U+0020 SPACE
tag-end       =/ %x002F ; U+002F SOLIDUS (/)
tag-end       =/ %x003E ; U+003E GREATER-THAN SIGN (&gt;)</pre>

  <p>When a <code><a href=#the-script-element>script</a></code> element contains <a href=#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>


  <h5 id=inline-documentation-for-external-scripts><span class=secno>4.3.1.3 </span><dfn title="script documentation">Inline documentation for external scripts</dfn></h5>

  <p>If a <code><a href=#the-script-element>script</a></code> element's <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is
  specified, then the contents of the <code><a href=#the-script-element>script</a></code> element, if any, must be such that the
  value of the <code title=dom-script-text><a href=#dom-script-text>text</a></code> IDL attribute, which is derived from the
  element's contents, matches the <code title="">documentation</code> production in the following
  ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

  <pre>documentation = *( *( space / tab / comment ) [ line-comment ] newline )
comment       = slash star *( not-star / star not-slash ) 1*star slash
line-comment  = slash slash *not-newline

; characters
tab           = %x0009 ; U+0009 CHARACTER TABULATION (tab)
newline       = %x000A ; U+000A LINE FEED (LF)
space         = %x0020 ; U+0020 SPACE
star          = %x002A ; U+002A ASTERISK (*)
slash         = %x002F ; U+002F SOLIDUS (/)
not-newline   = %x0000-0009 / %x000B-10FFFF
                ; a <a href=#unicode-character>Unicode character</a> other than U+000A LINE FEED (LF)
not-star      = %x0000-0029 / %x002B-10FFFF
                ; a <a href=#unicode-character>Unicode character</a> other than U+002A ASTERISK (*)
not-slash     = %x0000-002E / %x0030-10FFFF
                ; a <a href=#unicode-character>Unicode character</a> other than U+002F SOLIDUS (/)</pre>

  <p class=note>This corresponds to putting the contents of the element in JavaScript
  comments.</p>

  <p class=note>This requirement is in addition to the earlier restrictions on the syntax of
  contents of <code><a href=#the-script-element>script</a></code> elements.</p>

  <div class=example>

   <p>This allows authors to include documentation, such as license information or API information,
   inside their documents while still referring to external script files. The syntax is constrained
   so that authors don't accidentally include what looks like valid script while also providing a
   <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute.</p>

   <pre>&lt;script src="cool-effects.js"&gt;
 // create new instances using:
 //    var e = new Effect();
 // start the effect using .play, stop using .stop:
 //    e.play();
 //    e.stop();
&lt;/script&gt;</pre>

  </div>


  <div class=impl>

  <h5 id=scriptTagXSLT><span class=secno>4.3.1.4 </span>Interaction of <code><a href=#the-script-element>script</a></code> elements and XSLT</h5>

  <p><i>This section is non-normative.</i></p>

  <p>This specification does not define how XSLT interacts with the <code><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 title="">&lt;?xml-stylesheet?&gt;</code> processing instruction and the browser implements a
   direct-to-DOM transformation, <code><a href=#the-script-element>script</a></code> elements created by the XSLT processor need to
   be marked <a href=#parser-inserted>"parser-inserted"</a> and run in document order (modulo scripts marked <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code> or <code title=attr-script-async><a href=#attr-script-async>async</a></code>),
   asynchronously while the transformation is occurring.</li>

   <li><p>The <code title=dom-XSLTProcessor-transformToDocument>XSLTProcessor.transformToDocument()</code> method
   adds elements to a <code><a href=#document>Document</a></code> that is not in a <a href=#browsing-context>browsing context</a>, and,
   accordingly, any <code><a href=#the-script-element>script</a></code> elements they create need to have their <a href=#already-started>"already
   started"</a> flag set in the <a href=#prepare-a-script>prepare a script</a> algorithm and never get executed
   (<a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a>). Such <code><a href=#the-script-element>script</a></code>
   elements still need to be marked <a href=#parser-inserted>"parser-inserted"</a>, though, such that their <code title=dom-script-async><a href=#dom-script-async>async</a></code> IDL attribute will return false in the absence of an <code title=attr-script-async><a href=#attr-script-async>async</a></code> content attribute.</li>

   <li><p>The <code title=dom-XSLTProcessor-transformToFragment>XSLTProcessor.transformToFragment()</code> method
   needs to create a fragment that is equivalent to one built manually by creating the elements
   using <code title=dom-document-createElementNS><a href=#dom-document-createelementns>document.createElementNS()</a></code>. For instance,
   it needs to create <code><a href=#the-script-element>script</a></code> elements that aren't <a href=#parser-inserted>"parser-inserted"</a> and
   that don't have their <a href=#already-started>"already started"</a> flag set, so that they will execute when the
   fragment is inserted into a document.</li>

  </ul><p>The main distinction between the first two cases and the last case is that the first two
  operate on <code><a href=#document>Document</a></code>s and the last operates on a fragment.</p>

  </div>



  <h4 id=the-noscript-element><span class=secno>4.3.2 </span>The <dfn><code>noscript</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>In a <code><a href=#the-head-element>head</a></code> element of an <a href=#html-documents title="HTML documents">HTML document</a>, if there are no ancestor <code><a href=#the-noscript-element>noscript</a></code> elements.</dd>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected in <a href=#html-documents>HTML documents</a>, if there are no ancestor <code><a href=#the-noscript-element>noscript</a></code> elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>When <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>, in a <code><a href=#the-head-element>head</a></code> element: in any order, zero or more <code><a href=#the-link-element>link</a></code> elements, zero or more <code><a href=#the-style-element>style</a></code> elements, and zero or more <code><a href=#the-meta-element>meta</a></code> elements.</dd>
   <dd>When <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>, not in a <code><a href=#the-head-element>head</a></code> element: <a href=#transparent>transparent</a>, but there must be no <code><a href=#the-noscript-element>noscript</a></code> element descendants.</dd>
   <dd>Otherwise: text that conforms to the requirements given in the prose.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-noscript-element>noscript</a></code> element <a href=#represents>represents</a> nothing if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>, and <a href=#represents>represents</a> its children if
  <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a>. It is used to present different
  markup to user agents that support scripting and those that don't support scripting, by affecting
  how the document is parsed.</p>

  <p>When used in <a href=#html-documents>HTML documents</a>, the allowed content model is as follows:</p>

  <dl><dt>In a <code><a href=#the-head-element>head</a></code> element, if <a href=#concept-n-noscript title=concept-n-noscript>scripting is
   disabled</a> for the <code><a href=#the-noscript-element>noscript</a></code> element</dt>

   <dd><p>The <code><a href=#the-noscript-element>noscript</a></code> element must contain only <code><a href=#the-link-element>link</a></code>, <code><a href=#the-style-element>style</a></code>,
   and <code><a href=#the-meta-element>meta</a></code> elements.</dd>

   <dt>In a <code><a href=#the-head-element>head</a></code> element, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a>
   for the <code><a href=#the-noscript-element>noscript</a></code> element</dt>

   <dd><p>The <code><a href=#the-noscript-element>noscript</a></code> element must contain only text, except that invoking the
   <a href=#html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a> <!-- (which disables <script> execution) --> with
   the <code><a href=#the-noscript-element>noscript</a></code> element as the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var>
   element and the text contents as the <var title="">input</var> must result in a list of nodes
   that consists only of <code><a href=#the-link-element>link</a></code>, <code><a href=#the-style-element>style</a></code>, and <code><a href=#the-meta-element>meta</a></code> elements that
   would be conforming if they were children of the <code><a href=#the-noscript-element>noscript</a></code> element, and no <a href=#parse-error title="parse error">parse errors</a>.</dd>

   <dt>Outside of <code><a href=#the-head-element>head</a></code> elements, if <a href=#concept-n-noscript title=concept-n-noscript>scripting is
   disabled</a> for the <code><a href=#the-noscript-element>noscript</a></code> element</dt>

   <dd><p>The <code><a href=#the-noscript-element>noscript</a></code> element's content model is <a href=#transparent>transparent</a>, with the
   additional restriction that a <code><a href=#the-noscript-element>noscript</a></code> element must not have a <code><a href=#the-noscript-element>noscript</a></code>
   element as an ancestor (that is, <code><a href=#the-noscript-element>noscript</a></code> can't be nested).</dd>

   <dt>Outside of <code><a href=#the-head-element>head</a></code> elements, if <a href=#concept-n-script title=concept-n-script>scripting is
   enabled</a> for the <code><a href=#the-noscript-element>noscript</a></code> element</dt>

   <dd>

    <p>The <code><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><a href=#the-noscript-element>noscript</a></code> elements and no <code><a href=#the-script-element>script</a></code> elements, and such that no step in the
    algorithm causes an <a href=#html-parser>HTML parser</a> to flag a <a href=#parse-error>parse error</a>:</p>

    <ol><li>Remove every <code><a href=#the-script-element>script</a></code> element from the document.</li>

     <li>Make a list of every <code><a href=#the-noscript-element>noscript</a></code> element in the document. For every
     <code><a href=#the-noscript-element>noscript</a></code> element in that list, perform the following steps:

      <ol><li>Let the <var title="">parent element</var> be the parent element of the
       <code><a href=#the-noscript-element>noscript</a></code> element.</li>

       <li>Take all the children of the <var title="">parent element</var> that come before the
       <code><a href=#the-noscript-element>noscript</a></code> element, and call these elements <var title="">the before
       children</var>.</li>

       <li>Take all the children of the <var title="">parent element</var> that come <em>after</em>
       the <code><a href=#the-noscript-element>noscript</a></code> element, and call these elements <var title="">the after
       children</var>.</li>

       <li>Let <var title="">s</var> be the concatenation of all the <code><a href=#text>Text</a></code> node children
       of the <code><a href=#the-noscript-element>noscript</a></code> element.</li>

       <li>Set the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> attribute of the <var title="">parent element</var> to the value of <var title="">s</var>. (This, as a side-effect,
       causes the <code><a href=#the-noscript-element>noscript</a></code> element to be removed from the document.)</li>

       <li>Insert <var title="">the before children</var> at the start of the <var title="">parent
       element</var>, preserving their original relative order.</li>

       <li>Insert <var title="">the after children</var> at the end of the <var title="">parent
       element</var>, preserving their original relative order.</li>

      </ol></li>

    </ol></dd>

  </dl><p class=note>All these contortions are required because, for historical reasons, the
  <code><a href=#the-noscript-element>noscript</a></code> element is handled differently by the <a href=#html-parser>HTML parser</a> based on
  whether <a href=#scripting-flag title="scripting flag">scripting was enabled or not</a> when the parser was
  invoked.</p>

  <p>The <code><a href=#the-noscript-element>noscript</a></code> element must not be used in <a href=#xml-documents>XML documents</a>.</p>

  <p class=note>The <code><a href=#the-noscript-element>noscript</a></code> element is only effective in <a href=#syntax>the HTML
  syntax</a>, it has no effect in <a href=#the-xhtml-syntax>the XHTML syntax</a>. This is because the way it works
  is by essentially "turning off" the parser when scripts are enabled, so that the contents of the
  element are treated as pure text and not as real elements. XML does not define a mechanism by
  which to do this.</p>

  <div class=impl>

  <p>The <code><a href=#the-noscript-element>noscript</a></code> element has no other requirements. In particular, children of the
  <code><a href=#the-noscript-element>noscript</a></code> element are not exempt from <a href=#form-submission>form submission</a>, scripting, and so
  forth, even when <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the element.</p>

  </div>

  <div class=example>

   <p>In the following example, a <code><a href=#the-noscript-element>noscript</a></code> element is
   used to provide fallback for a script.</p>

   <pre>&lt;form action="calcSquare.php"&gt;
 &lt;p&gt;
  &lt;label for=x&gt;Number&lt;/label&gt;:
  &lt;input id="x" name="x" type="number"&gt;
 &lt;/p&gt;
 &lt;script&gt;
  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;
  };
 &lt;/script&gt;
 &lt;noscript&gt;
  &lt;input type=submit value="Calculate Square"&gt;
 &lt;/noscript&gt;
&lt;/form&gt;</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><a href=#the-noscript-element>noscript</a></code> element is a blunt instrument. Sometimes, scripts might be enabled,
   but for some reason the page's script might fail. For this reason, it's generally better to avoid
   using <code><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>&lt;form action="calcSquare.php"&gt;
 &lt;p&gt;
  &lt;label for=x&gt;Number&lt;/label&gt;:
  &lt;input id="x" name="x" type="number"&gt;
 &lt;/p&gt;
 <strong>&lt;input id="submit" type=submit value="Calculate Square"&gt;</strong>
 &lt;script&gt;
  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>
 &lt;/script&gt;
&lt;/form&gt;</pre>

   <p>The above technique is also useful in XHTML, since <code><a href=#the-noscript-element>noscript</a></code> is not supported in
   <a href=#the-xhtml-syntax>the XHTML syntax</a>.</p>

  </div>


  <h4 id=the-template-element><span class=secno>4.3.3 </span>The <dfn><code>template</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#metadata-content>Metadata content</a>.</dd>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#script-supporting-elements title="script-supporting elements">Script-supporting element</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#metadata-content>metadata content</a> is expected.</dd>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dd>Where <a href=#script-supporting-elements>script-supporting elements</a> are expected.</dd>
   <dd>As a child of a <code><a href=#the-colgroup-element>colgroup</a></code> element that doesn't have a <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Either: <a href=#metadata-content>Metadata content</a>.</dd>
   <dd>Or: <a href=#flow-content>Flow content</a>.</dd>
   <dd>Or: The content model of <code><a href=#the-ol-element>ol</a></code> and <code><a href=#the-ul-element>ul</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-dl-element>dl</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-figure-element>figure</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-ruby-element>ruby</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-object-element>object</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-video-element>video</a></code> and <code><a href=#the-audio-element>audio</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-table-element>table</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-colgroup-element>colgroup</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-tr-element>tr</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-fieldset-element>fieldset</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-select-element>select</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-details-element>details</a></code> elements.</dd>
   <dd>Or: The content model of <code><a href=#the-menu-element>menu</a></code> elements whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state>popup menu state</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltemplateelement>HTMLTemplateElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  readonly attribute <a href=#documentfragment>DocumentFragment</a> <a href=#dom-template-content title=dom-template-content>content</a>;
};</pre>
</dd>
  </dl><!--TOPIC:HTML--><p>The <code><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><a href=#the-template-element>template</a></code> element <a href=#represents>represents</a> nothing.</p>

  <dl class=domintro><dt><var title="">template</var> . <code title=dom-template-content><a href=#dom-template-content>content</a></code></dt>

   <dd>

    <p>Returns the contents of the <code><a href=#the-template-element>template</a></code>, which are stored in a
    <code><a href=#documentfragment>DocumentFragment</a></code> associated with a different <code><a href=#document>Document</a></code> so as to avoid
    the <code><a href=#the-template-element>template</a></code> contents interfering with the main <code><a href=#document>Document</a></code>. (For
    example, this avoids form controls from being submitted, scripts from executing, and so
    forth.)</p>

   </dd>

  </dl><div class=impl>

  <p>Each <code><a href=#the-template-element>template</a></code> element has an associated <code><a href=#documentfragment>DocumentFragment</a></code> object that
  is its <dfn id=template-contents>template contents</dfn>. When a <code><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>template contents</a>:</p>

  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>.</li>

   <li>

    <p>If <var title="">doc</var> has an associated <a href=#browsing-context>browsing context</a>, run these substeps:</p>

    <ol><li><p>Let <var title="">new doc</var> be a new <code><a href=#document>Document</a></code> (that does not have a
     <a href=#browsing-context>browsing context</a>).</li>

     <li><p>If <var title="">doc</var> is an <a href=#html-documents title="HTML documents">HTML document</a>, mark
     <var title="">new doc</var> as an <a href=#html-documents title="HTML documents">HTML document</a>
     also.</li>

     <li><p>Set <var title="">doc</var> to <var title="">new doc</var>.</li>

    </ol></li>

   <li><p>Create a <code><a href=#documentfragment>DocumentFragment</a></code> object whose <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is <var title="">doc</var>.</li>

   <li><p>Set the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a> to the newly
   created <code><a href=#documentfragment>DocumentFragment</a></code> object.</li>

  </ol><p>The <dfn id=dom-template-content title=dom-template-content><code>content</code></dfn> IDL attribute must return the
  <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a>.</p>

  <hr><p>The <a href=#concept-node-clone-ext title=concept-node-clone-ext>cloning steps</a> for a <code><a href=#the-template-element>template</a></code>
  element <var title="">node</var> being cloned to a copy <var title="">copy</var> must run the
  following steps:</p>

  <ol><li><p>If the <var title="">clone children flag</var> is not set in the calling <a href=#concept-node-clone title=concept-node-clone>clone</a> algorithm, abort these steps.</li>

   <li><p>Let <var title="">copied contents</var> be the result of <a href=#concept-node-clone title=concept-node-clone>cloning</a> all the children of <var title="">node</var>'s
   <a href=#template-contents>template contents</a>, with <var title="">ownerDocument</var> set to <var title="">copy</var>'s <a href=#template-contents>template contents</a>'s <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, and with the <var title="">clone children
   flag</var> set.</li>

   <li><p>Append <var title="">copied contents</var> to <var title="">copy</var>'s <a href=#template-contents>template
   contents</a>.</li>

  </ol></div>

  <div class=example>

   <p>In this example, a script populates a table with data from a data structure, using a
   <code><a href=#the-template-element>template</a></code> to provide the element structure instead of manually generating the
   structure from markup.</p>

   <pre>&lt;!DOCTYPE html&gt;
&lt;title&gt;Cat data&lt;/title&gt;
&lt;script&gt;
 // 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 },
 ];
&lt;/script&gt;
&lt;table&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th&gt;Name &lt;th&gt;Color &lt;th&gt;Sex &lt;th&gt;Legs
 &lt;tbody&gt;
  &lt;template id="row"&gt;
   &lt;tr&gt;&lt;td&gt;&lt;td&gt;&lt;td&gt;&lt;td&gt;
  &lt;/template&gt;
&lt;/table&gt;
&lt;script&gt;
 var template = document.querySelector('#row');
 for (var i = 0; i &lt; data.length; i += 1) {
   var cat = data[i];
   var clone = template.content.cloneNode(true);
   var cells = clone.querySelectorAll('td');
   cells[0].textContent = cat.name;
   cells[1].textContent = cat.color;
   cells[2].textContent = cat.sex;
   cells[3].textContent = cat.legs;
   template.parentNode.appendChild(clone);
 }
&lt;/script&gt;</pre>

  </div>



  <div class=impl>

  <h5 id=template-XSLT-XPath><span class=secno>4.3.3.1 </span>Interaction of <code><a href=#the-template-element>template</a></code> elements with XSLT and XPath</h5>

  <p><i>This section is non-normative.</i></p>

  <p>This specification does not define how XSLT and XPath interact with the <code><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 title="xml parser">as described
   in this specification</a> needs to act as if <code><a href=#the-template-element>template</a></code> elements contain as
   descendants their <a href=#template-contents>template contents</a> for the purposes of the transform.</li>

   <li><p>An XSLT processor that outputs a DOM needs to ensure that nodes that would go into a
   <code><a href=#the-template-element>template</a></code> element are instead placed into the element's <a href=#template-contents>template
   contents</a>.</li>

   <li><p>XPath evaluation using the XPath DOM API when applied to a <code><a href=#document>Document</a></code> parsed
   using the <a href=#html-parser>HTML parser</a> or the <a href=#xml-parser>XML parser</a> described in this specification
   needs to ignore <a href=#template-contents>template contents</a>.</p>

  </ul></div>


  <h3 id=sections><span class=secno>4.4 </span>Sections</h3>

  <h4 id=the-body-element><span class=secno>4.4.1 </span>The <dfn><code>body</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the second element in an <code><a href=#the-html-element>html</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>A <code><a href=#the-body-element>body</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> can be omitted if
   the element is empty, or if the first thing inside the <code><a href=#the-body-element>body</a></code> element is not a
   <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>, except if the
   first thing inside the <code><a href=#the-body-element>body</a></code> element is a <code><a href=#the-script-element>script</a></code> or <code><a href=#the-style-element>style</a></code>
   element. <!-- Note that even if the </head> end tag is present, the parser makes <style> and
   <script> elements between </head> and <body> end up in the <head> instead of implying the <body>
   --></dd>
   <dd>A <code><a href=#the-body-element>body</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-body-element>body</a></code> element is not immediately followed by a <a href=#syntax-comments title=syntax-comments>comment</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code></dd>
   <dd><code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code></dd>
   <dd><code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code></dd>
   <dd><code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code></dd>
   <dd><code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code></dd>
   <dd><code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code></dd>
   <dd><code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code></dd>
   <dd><code title=handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code></dd>
   <dd><code title=handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code></dd>
   <dd><code title=handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code></dd>
   <dd><code title=handler-window-onresize><a href=#handler-window-onresize>onresize</a></code></dd>
   <dd><code title=handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code></dd>
   <dd><code title=handler-window-onunload><a href=#handler-window-onunload>onunload</a></code></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlbodyelement>HTMLBodyElement</dfn> : <a href=#htmlelement>HTMLElement</a> {

  // <a href="#HTMLBodyElement-partial">also has obsolete members</a>
};
<a href=#htmlbodyelement>HTMLBodyElement</a> implements <a href=#windoweventhandlers>WindowEventHandlers</a>;</pre>
</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-body-element>body</a></code> element <a href=#represents>represents</a> the main
  content of the document.</p>

  <p>In conforming documents, there is only one <code><a href=#the-body-element>body</a></code>
  element. The <code title=dom-document-body><a href=#dom-document-body>document.body</a></code>
  IDL attribute provides scripts with easy access to a document's
  <code><a href=#the-body-element>body</a></code> element.</p>

  <div class=impl>

  <p class=note>Some DOM operations (for example, parts of the
  <a href=#dnd>drag and drop</a> model) are defined in terms of "<a href=#the-body-element-0>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><a href=#the-body-element>body</a></code> element.</p>

  </div>

  <p>The <code><a href=#the-body-element>body</a></code> element exposes as <a href=#event-handler-content-attributes>event handler
  content attributes</a> a number of the <a href=#event-handlers>event
  handlers</a> of the <code><a href=#window>Window</a></code> object. It also mirrors
  their <a href=#event-handler-idl-attributes>event handler IDL attributes</a>.</p>

  <p>The <code title=handler-onblur><a href=#handler-onblur>onblur</a></code>, <code title=handler-onerror><a href=#handler-onerror>onerror</a></code>, <code title=handler-onfocus><a href=#handler-onfocus>onfocus</a></code>, <code title=handler-onload><a href=#handler-onload>onload</a></code>,
  and <code title=handler-onscroll><a href=#handler-onscroll>onscroll</a></code> <a href=#event-handlers>event handlers</a> of the
  <code><a href=#window>Window</a></code> object, exposed on the <code><a href=#the-body-element>body</a></code> element, replace the generic
  <a href=#event-handlers>event handlers</a> with the same names normally supported by <a href=#html-elements>HTML elements</a>.</p>

  <p class=example>Thus, for example, a bubbling <code title=event-error>error</code> event dispatched on a child of
  <a href=#the-body-element-0>the body element</a> of a <code><a href=#document>Document</a></code> would first
  trigger the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> <a href=#event-handler-content-attributes>event
  handler content attributes</a> of that element, then that of the
  root <code><a href=#the-html-element>html</a></code> element, and only <em>then</em> would it
  trigger the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code>
  <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
  attribute</a> on the <code><a href=#the-body-element>body</a></code> element. This is because
  the event would bubble from the target, to the <code><a href=#the-body-element>body</a></code>, to
  the <code><a href=#the-html-element>html</a></code>, to the <code><a href=#document>Document</a></code>, to the
  <code><a href=#window>Window</a></code>, and the <a href=#event-handlers title="event handlers">event
  handler</a> on the <code><a href=#the-body-element>body</a></code> is watching the
  <code><a href=#window>Window</a></code> not the <code><a href=#the-body-element>body</a></code>. A regular event
  listener attached to the <code><a href=#the-body-element>body</a></code> using <code title="">addEventListener()</code>, however, would be run when the
  event bubbled through the <code><a href=#the-body-element>body</a></code> and not when it reaches
  the <code><a href=#window>Window</a></code> object.</p>

  <div class=example>

   <p>This page updates an indicator to show whether or not the user
   is online:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Online or offline?&lt;/title&gt;
  &lt;script&gt;
   function update(online) {
     document.getElementById('status').textContent =
       online ? 'Online' : 'Offline';
   }
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body ononline="update(true)"
       onoffline="update(false)"
       onload="update(navigator.onLine)"&gt;
  &lt;p&gt;You are: &lt;span id="status"&gt;(Unknown)&lt;/span&gt;&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>



  <h4 id=the-article-element><span class=secno>4.4.2 </span>The <dfn><code>article</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-article-element>article</a></code> element <a href=#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>

  <!-- for context regarding "site", see http://krijnhoetmer.nl/irc-logs/whatwg/20130306#l-152 -->

  <p>When <code><a href=#the-article-element>article</a></code> elements are nested, the inner <code><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><a href=#the-article-element>article</a></code> elements nested within the <code><a href=#the-article-element>article</a></code> element for the blog
  entry.</p>

  <p>Author information associated with an <code><a href=#the-article-element>article</a></code> element (q.v. the
  <code><a href=#the-address-element>address</a></code> element) does not apply to nested <code><a href=#the-article-element>article</a></code> elements.</p>

  <p class=note>When used specifically with content to be redistributed in syndication, the
  <code><a href=#the-article-element>article</a></code> element is similar in purpose to the <code title="">entry</code> element in
  Atom. <a href=#refsATOM>[ATOM]</a>

  <p class=note>The schema.org microdata vocabulary can be used to provide the publication date
  for an <code><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><a href=#the-article-element>article</a></code>, but it is technically redundant in that case (since it's self-evident that
  the page is a single composition, as it is a single document).</p>

  <div id=article-example class=example>

   <p>This example shows a blog post using the <code><a href=#the-article-element>article</a></code> element, with some schema.org
   annotations:</p>

   <pre>&lt;article itemscope itemtype="http://schema.org/BlogPosting"&gt;
 &lt;header&gt;
  &lt;h1 itemprop="headline"&gt;The Very First Rule of Life&lt;/h1&gt;
  &lt;p&gt;&lt;time itemprop="datePublished" datetime="2009-10-09"&gt;3 days ago&lt;/time&gt;&lt;/p&gt;
  &lt;link itemprop="url" href="?comments=0"&gt;
 &lt;/header&gt;
 &lt;p&gt;If there's a microphone anywhere near you, assume it's hot and
 sending whatever you're saying to the world. Seriously.&lt;/p&gt;
 &lt;p&gt;<em>...</em>&lt;/p&gt;
 &lt;footer&gt;
  &lt;a itemprop="discussionUrl" href="?comments=1"&gt;Show comments...&lt;/a&gt;
 &lt;/footer&gt;
&lt;/article&gt;</pre>

   <p>Here is that same blog post, but showing some of the comments:</p>

   <pre>&lt;article itemscope itemtype="http://schema.org/BlogPosting"&gt;
 &lt;header&gt;
  &lt;h1 itemprop="headline"&gt;The Very First Rule of Life&lt;/h1&gt;
  &lt;p&gt;&lt;time itemprop="datePublished" datetime="2009-10-09"&gt;3 days ago&lt;/time&gt;&lt;/p&gt;
  &lt;link itemprop="url" href="?comments=0"&gt;
 &lt;/header&gt;
 &lt;p&gt;If there's a microphone anywhere near you, assume it's hot and
 sending whatever you're saying to the world. Seriously.&lt;/p&gt;
 &lt;p&gt;<em>...</em>&lt;/p&gt;
 &lt;section&gt;
  &lt;h1&gt;Comments&lt;/h1&gt;
  &lt;article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1"&gt;
   &lt;link itemprop="url" href="#c1"&gt;
   &lt;footer&gt;
    &lt;p&gt;Posted by: &lt;span itemprop="creator" itemscope itemtype="http://schema.org/Person"&gt;
     &lt;span itemprop="name"&gt;George Washington&lt;/span&gt;
    &lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;&lt;time itemprop="commentTime" datetime="2009-10-10"&gt;15 minutes ago&lt;/time&gt;&lt;/p&gt;
   &lt;/footer&gt;
   &lt;p&gt;Yeah! Especially when talking about your lobbyist friends!&lt;/p&gt;
  &lt;/article&gt;
  &lt;article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2"&gt;
   &lt;link itemprop="url" href="#c2"&gt;
   &lt;footer&gt;
    &lt;p&gt;Posted by: &lt;span itemprop="creator" itemscope itemtype="http://schema.org/Person"&gt;
     &lt;span itemprop="name"&gt;George Hammond&lt;/span&gt;
    &lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;&lt;time itemprop="commentTime" datetime="2009-10-10"&gt;5 minutes ago&lt;/time&gt;&lt;/p&gt;
   &lt;/footer&gt;
   &lt;p&gt;Hey, you have the same first name as me.&lt;/p&gt;
  &lt;/article&gt;
 &lt;/section&gt;
&lt;/article&gt;</pre>

   <p>Notice the use of <code><a href=#the-footer-element>footer</a></code> to give the information for each comment (such as who
   wrote it and when): the <code><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><a href=#the-header-element>header</a></code> in this case wouldn't
   be wrong either; it's mostly a matter of authoring preference.)</p>

  </div>



  <h4 id=the-section-element><span class=secno>4.4.3 </span>The <dfn><code>section</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-section-element>section</a></code> element <a href=#represents>represents</a> a generic section of a document or
  application. A section, in this context, is a thematic grouping of content, typically with a
  heading.</p>

  <p class=example>Examples of sections would be chapters, the various tabbed pages in a tabbed
  dialog box, or the numbered sections of a thesis. A Web site's home page could be split into
  sections for an introduction, news items, and contact information.</p>

  <p class=note>Authors are encouraged to use the <code><a href=#the-article-element>article</a></code> element instead of the
  <code><a href=#the-section-element>section</a></code> element when it would make sense to syndicate the contents of the
  element.</p>

  <p class=note id=use-div-for-wrappers>The <code><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><a href=#the-div-element>div</a></code> element instead. A general rule is
  that the <code><a href=#the-section-element>section</a></code> element is appropriate only if the element's contents would be
  listed explicitly in the document's <a href=#outline>outline</a>.</p>

  <div class=example>

   <p>In the following example, we see an article (part of a larger Web page) about apples,
   containing two short sections.</p>

   <pre>&lt;article&gt;
 &lt;hgroup&gt;
  &lt;h1&gt;Apples&lt;/h1&gt;
  &lt;h2&gt;Tasty, delicious fruit!&lt;/h2&gt;
 &lt;/hgroup&gt;
 &lt;p&gt;The apple is the pomaceous fruit of the apple tree.&lt;/p&gt;
 &lt;section&gt;
  &lt;h1&gt;Red Delicious&lt;/h1&gt;
  &lt;p&gt;These bright red apples are the most common found in many
  supermarkets.&lt;/p&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h1&gt;Granny Smith&lt;/h1&gt;
  &lt;p&gt;These juicy, green apples make a great filling for
  apple pies.&lt;/p&gt;
 &lt;/section&gt;
&lt;/article&gt;</pre>

   <p>Notice how the use of <code><a href=#the-section-element>section</a></code> means that the author can use <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
   elements throughout, without having to worry about whether a particular section is at the top
   level, the second level, the third level, and so on.</p>

  </div>

  <div class=example>

   <p>Here is a graduation programme with two sections, one for the list of people graduating, and
   one for the description of the ceremony. (The markup in this example features an uncommon style
   sometimes used to minimize the amount of <a href=#inter-element-whitespace>inter-element whitespace</a>.)</p>

   <pre>&lt;!DOCTYPE Html&gt;
&lt;Html
 &gt;&lt;Head
   &gt;&lt;Title
     &gt;Graduation Ceremony Summer 2022&lt;/Title
   &gt;&lt;/Head
 &gt;&lt;Body
   &gt;&lt;H1
     &gt;Graduation&lt;/H1
   &gt;&lt;Section
     &gt;&lt;H1
       &gt;Ceremony&lt;/H1
     &gt;&lt;P
       &gt;Opening Procession&lt;/P
     &gt;&lt;P
       &gt;Speech by Validactorian&lt;/P
     &gt;&lt;P
       &gt;Speech by Class President&lt;/P
     &gt;&lt;P
       &gt;Presentation of Diplomas&lt;/P
     &gt;&lt;P
       &gt;Closing Speech by Headmaster&lt;/P
   &gt;&lt;/Section
   &gt;&lt;Section
     &gt;&lt;H1
       &gt;Graduates&lt;/H1
     &gt;&lt;Ul
       &gt;&lt;Li
         &gt;Molly Carpenter&lt;/Li
       &gt;&lt;Li
         &gt;Anastasia Luccio&lt;/Li
       &gt;&lt;Li
         &gt;Ebenezar McCoy&lt;/Li
       &gt;&lt;Li
         &gt;Karrin Murphy&lt;/Li
       &gt;&lt;Li
         &gt;Thomas Raith&lt;/Li
       &gt;&lt;Li
         &gt;Susan Rodriguez&lt;/Li
     &gt;&lt;/Ul
   &gt;&lt;/Section
 &gt;&lt;/Body
&gt;&lt;/Html&gt;</pre>

  </div>

  <div class=example>

   <p>In this example, a book author has marked up some sections as chapters and some as appendices,
   and uses CSS to style the headers in these two classes of section differently. The whole book is
   wrapped in an <code><a href=#the-article-element>article</a></code> element as part of an even larger document containing other
   books.</p>

   <pre>&lt;article class="book"&gt;
 &lt;style&gt;
  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; }
 &lt;/style&gt;
 &lt;header&gt;
  &lt;hgroup&gt;
   &lt;h1&gt;My Book&lt;/h1&gt;
   &lt;h2&gt;A sample with not much content&lt;/h2&gt;
  &lt;/hgroup&gt;
  &lt;p&gt;&lt;small&gt;Published by Dummy Publicorp Ltd.&lt;/small&gt;&lt;/p&gt;
 &lt;/header&gt;
 &lt;section class="chapter"&gt;
  &lt;h1&gt;My First Chapter&lt;/h1&gt;
  &lt;p&gt;This is the first of my chapters. It doesn't say much.&lt;/p&gt;
  &lt;p&gt;But it has two paragraphs!&lt;/p&gt;
 &lt;/section&gt;
 &lt;section class="chapter"&gt;
  &lt;h1&gt;It Continutes: The Second Chapter&lt;/h1&gt;
  &lt;p&gt;Bla dee bla, dee bla dee bla. Boom.&lt;/p&gt;
 &lt;/section&gt;
 &lt;section class="chapter"&gt;
  &lt;h1&gt;Chapter Three: A Further Example&lt;/h1&gt;
  &lt;p&gt;It's not like a battle between brightness and earthtones would go
  unnoticed.&lt;/p&gt;
  &lt;p&gt;But it might ruin my story.&lt;/p&gt;
 &lt;/section&gt;
 &lt;section class="appendix"&gt;
  &lt;h1&gt;Appendix A: Overview of Examples&lt;/h1&gt;
  &lt;p&gt;These are demonstrations.&lt;/p&gt;
 &lt;/section&gt;
 &lt;section class="appendix"&gt;
  &lt;h1&gt;Appendix B: Some Closing Remarks&lt;/h1&gt;
  &lt;p&gt;Hopefully this long example shows that you &lt;em&gt;can&lt;/em&gt; style
  sections, so long as they are used to indicate actual sections.&lt;/p&gt;
 &lt;/section&gt;
&lt;/article&gt;</pre>

  </div>



  <h4 id=the-nav-element><span class=secno>4.4.4 </span>The <dfn><code>nav</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-main-element>main</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-nav-element>nav</a></code> element <a href=#represents>represents</a> a section of a page that links to other
  pages or to parts within the page: a section with navigation links.</p>

  <p class=note>Not all groups of links on a page need to be in a <code><a href=#the-nav-element>nav</a></code> element &mdash;
  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><a href=#the-footer-element>footer</a></code> element
  alone is sufficient for such cases; while a <code><a href=#the-nav-element>nav</a></code> element can be used in such cases, it
  is usually unnecessary.</p>

  <p class=note>User agents (such as screen readers) that are targeted at users who can benefit
  from navigation information being omitted in the initial rendering, or who can benefit from
  navigation information being immediately available, can use this element as a way to determine
  what content on the page to initially skip or provide on request (or both).</p>

  <div class=example>

   <p>In the following example, the page has several places where links are present, but only one of
   those places is considered a navigation section.</p>

   <pre>&lt;body itemscope itemtype="http://schema.org/Blog"&gt;
 &lt;header&gt;
  &lt;h1&gt;Wake up sheeple!&lt;/h1&gt;
  &lt;p&gt;&lt;a href="news.html"&gt;News&lt;/a&gt; -
     &lt;a href="blog.html"&gt;Blog&lt;/a&gt; -
     &lt;a href="forums.html"&gt;Forums&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;Last Modified: &lt;span itemprop="dateModified"&gt;2009-04-01&lt;/span&gt;&lt;/p&gt;
  &lt;nav&gt;
   &lt;h1&gt;Navigation&lt;/h1&gt;
   &lt;ul&gt;
    &lt;li&gt;&lt;a href="articles.html"&gt;Index of all articles&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="today.html"&gt;Things sheeple need to wake up for today&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="successes.html"&gt;Sheeple we have managed to wake&lt;/a&gt;&lt;/li&gt;
   &lt;/ul&gt;
  &lt;/nav&gt;
 &lt;/header&gt;
 &lt;main&gt;
  &lt;article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"&gt;
   &lt;header&gt;
    &lt;h1 itemprop="headline"&gt;My Day at the Beach&lt;/h1&gt;
   &lt;/header&gt;
   &lt;main itemprop="articleBody"&gt;
    &lt;p&gt;Today I went to the beach and had a lot of fun.&lt;/p&gt;
    <em>...more content...</em>
   &lt;/main&gt;
   &lt;footer&gt;
    &lt;p&gt;Posted &lt;time itemprop="datePublished" datetime="2009-10-10"&gt;Thursday&lt;/time&gt;.&lt;/p&gt;
   &lt;/footer&gt;
  &lt;/article&gt;
  <em>...more blog posts...</em>
 &lt;/main&gt;
 &lt;footer&gt;
  &lt;p&gt;Copyright &copy;
   &lt;span itemprop="copyrightYear"&gt;2010&lt;/span&gt;
   &lt;span itemprop="copyrightHolder"&gt;The Example Company&lt;/span&gt;
  &lt;/p&gt;
  &lt;p&gt;&lt;a href="about.html"&gt;About&lt;/a&gt; -
     &lt;a href="policy.html"&gt;Privacy Policy&lt;/a&gt; -
     &lt;a href="contact.html"&gt;Contact Us&lt;/a&gt;&lt;/p&gt;
 &lt;/footer&gt;
&lt;/body&gt;</pre>

   <p>Notice the <code><a href=#the-main-element>main</a></code> elements being used to wrap all the contents of the page other
   than the header and footer, and all the contents of the blog entry other than its header and
   footer.</p>

   <p>You can also see microdata annotations in the above example that use the schema.org vocabulary
   to provide the publication date and other metadata about the blog post.</p>

  </div>

  <div class=example>

   <p>In the following example, there are two <code><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>&lt;body&gt;
 &lt;h1&gt;The Wiki Center Of Exampland&lt;/h1&gt;
 &lt;nav&gt;
  &lt;ul&gt;
   &lt;li&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="/events"&gt;Current Events&lt;/a&gt;&lt;/li&gt;
   <em>...more...</em>
  &lt;/ul&gt;
 &lt;/nav&gt;
 &lt;article&gt;
  &lt;header&gt;
   &lt;h1&gt;Demos in Exampland&lt;/h1&gt;
   &lt;p&gt;Written by A. N. Other.&lt;/p&gt;
  &lt;/header&gt;
  &lt;nav&gt;
   &lt;ul&gt;
    &lt;li&gt;&lt;a href="#public"&gt;Public demonstrations&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#destroy"&gt;Demolitions&lt;/a&gt;&lt;/li&gt;
    <em>...more...</em>
   &lt;/ul&gt;
  &lt;/nav&gt;
  &lt;div&gt;
   &lt;section id="public"&gt;
    &lt;h1&gt;Public demonstrations&lt;/h1&gt;
    &lt;p&gt;<em>...more...</em>&lt;/p&gt;
   &lt;/section&gt;
   &lt;section id="destroy"&gt;
    &lt;h1&gt;Demolitions&lt;/h1&gt;
    &lt;p&gt;<em>...more...</em>&lt;/p&gt;
   &lt;/section&gt;
   <em>...more...</em>
  &lt;/div&gt;
  &lt;footer&gt;
   &lt;p&gt;&lt;a href="?edit"&gt;Edit&lt;/a&gt; | &lt;a href="?delete"&gt;Delete&lt;/a&gt; | &lt;a href="?Rename"&gt;Rename&lt;/a&gt;&lt;/p&gt;
  &lt;/footer&gt;
 &lt;/article&gt;
 &lt;footer&gt;
  &lt;p&gt;&lt;small&gt;&copy; copyright 1998 Exampland Emperor&lt;/small&gt;&lt;/p&gt;
 &lt;/footer&gt;
&lt;/body&gt;</pre>

  </div>

  <div class=example>

   <p>A <code><a href=#the-nav-element>nav</a></code> element doesn't have to contain a list, it can contain other kinds of
   content as well. In this navigation block, links are provided in prose:</p>

   <pre>&lt;nav&gt;
 &lt;h1&gt;Navigation&lt;/h1&gt;
 &lt;p&gt;You are on my home page. To the north lies &lt;a href="/blog"&gt;my
 blog&lt;/a&gt;, from whence the sounds of battle can be heard. To the east
 you can see a large mountain, upon which many &lt;a
 href="/school"&gt;school papers&lt;/a&gt; are littered. Far up thus mountain
 you can spy a little figure who appears to be me, desperately
 scribbling a &lt;a href="/school/thesis"&gt;thesis&lt;/a&gt;.&lt;/p&gt;
 &lt;p&gt;To the west are several exits. One fun-looking exit is labeled &lt;a
 href="http://games.example.com/"&gt;"games"&lt;/a&gt;. Another more
 boring-looking exit is labeled &lt;a
 href="http://isp.example.net/"&gt;ISP&trade;&lt;/a&gt;.&lt;/p&gt;
 &lt;p&gt;To the south lies a dark and dank &lt;a href="/about"&gt;contacts
 page&lt;/a&gt;. Cobwebs cover its disused entrance, and at one point you
 see a rat run quickly out of the page.&lt;/p&gt;
&lt;/nav&gt;</pre>

  </div>



  <h4 id=the-aside-element><span class=secno>4.4.5 </span>The <dfn><code>aside</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-content>Sectioning content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-main-element>main</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-aside-element>aside</a></code> element <a href=#represents>represents</a> a section of a page that consists of
  content that is tangentially related to the content around the <code><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><a href=#the-nav-element>nav</a></code> elements, and for other content that is considered
  separate from the main content of the page.</p>

  <p class=note>It's not appropriate to use the <code><a href=#the-aside-element>aside</a></code> element just for
  parentheticals, since those are part of the main flow of the document.</p>

  <div class=example>

   <p>The following example shows how an aside is used to mark up background material on Switzerland
   in a much longer news story on Europe.</p>

   <pre>&lt;aside&gt;
 &lt;h1&gt;Switzerland&lt;/h1&gt;
 &lt;p&gt;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.&lt;/p&gt;
&lt;/aside&gt;</pre>

  </div>

  <div class=example>

   <p>The following example shows how an aside is used to mark up a pull quote in a longer
   article.</p>

   <pre>...

&lt;p&gt;He later joined a large company, continuing on the same work.
&lt;q&gt;I love my job. People ask me what I do for fun when I'm not at
work. But I'm paid to do my hobby, so I never know what to
answer. Some people wonder what they would do if they didn't have to
work... but I know what I would do, because I was unemployed for a
year, and I filled that time doing exactly what I do now.&lt;/q&gt;&lt;/p&gt;

&lt;aside&gt;
 &lt;q&gt; People ask me what I do for fun when I'm not at work. But I'm
 paid to do my hobby, so I never know what to answer. &lt;/q&gt;
&lt;/aside&gt;

&lt;p&gt;Of course his work &mdash; or should that be hobby? &mdash;
isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;

...</pre>

  </div>

  <div class=example>

   <p>The following extract shows how <code><a href=#the-aside-element>aside</a></code> can be used for blogrolls and other side
   content on a blog:</p>

   <pre>&lt;body&gt;
 &lt;header&gt;
  &lt;h1&gt;My wonderful blog&lt;/h1&gt;
  &lt;p&gt;My tagline&lt;/p&gt;
 &lt;/header&gt;
 &lt;aside&gt;
  &lt;!-- <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> --&gt;
  &lt;nav&gt;
   &lt;h1&gt;My blogroll&lt;/h1&gt;
   &lt;ul&gt;
    &lt;li&gt;&lt;a href="http://blog.example.com/"&gt;Example Blog&lt;/a&gt;
   &lt;/ul&gt;
  &lt;/nav&gt;
  &lt;nav&gt;
   &lt;h1&gt;Archives&lt;/h1&gt;
   &lt;ol reversed&gt;
    &lt;li&gt;&lt;a href="/last-post"&gt;My last post&lt;/a&gt;
    &lt;li&gt;&lt;a href="/first-post"&gt;My first post&lt;/a&gt;
   &lt;/ol&gt;
  &lt;/nav&gt;
 &lt;/aside&gt;
 &lt;aside&gt;
  &lt;!-- <em>this aside is tangentially related to the page also, it
  contains twitter messages from the blog author</em> --&gt;
  &lt;h1&gt;Twitter Feed&lt;/h1&gt;
  &lt;blockquote cite="http://twitter.example.net/t31351234"&gt;
   I'm on vacation, writing my blog.
  &lt;/blockquote&gt;
  &lt;blockquote cite="http://twitter.example.net/t31219752"&gt;
   I'm going to go on vacation soon.
  &lt;/blockquote&gt;
 &lt;/aside&gt;
 &lt;article&gt;
  &lt;!-- <em>this is a blog post</em> --&gt;
  &lt;h1&gt;My last post&lt;/h1&gt;
  &lt;p&gt;This is my last post.&lt;/p&gt;
  &lt;footer&gt;
   &lt;p&gt;&lt;a href="/last-post" rel=bookmark&gt;Permalink&lt;/a&gt;
  &lt;/footer&gt;
 &lt;/article&gt;
 &lt;article&gt;
  &lt;!-- <em>this is also a blog post</em> --&gt;
  &lt;h1&gt;My first post&lt;/h1&gt;
  &lt;p&gt;This is my first post.&lt;/p&gt;
  &lt;aside&gt;
   &lt;!-- <em>this aside is about the blog post, since it's inside the
   &lt;article&gt; element; it would be wrong, for instance, to put the
   blogroll here, since the blogroll isn't really related to this post
   specifically, only to the page as a whole</em> --&gt;
   &lt;h1&gt;Posting&lt;/h1&gt;
   &lt;p&gt;While I'm thinking about it, I wanted to say something about
   posting. Posting is fun!&lt;/p&gt;
  &lt;/aside&gt;
  &lt;footer&gt;
   &lt;p&gt;&lt;a href="/first-post" rel=bookmark&gt;Permalink&lt;/a&gt;
  &lt;/footer&gt;
 &lt;/article&gt;
 &lt;footer&gt;
  &lt;nav&gt;
   &lt;a href="/archives"&gt;Archives&lt;/a&gt; &mdash;
   &lt;a href="/about"&gt;About me&lt;/a&gt; &mdash;
   &lt;a href="/copyright"&gt;Copyright&lt;/a&gt;
  &lt;/nav&gt;
 &lt;/footer&gt;
&lt;/body&gt;</pre>

  </div>



  <h4 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><span class=secno>4.4.6 </span>The <dfn id=the-h1-element><code>h1</code></dfn>, <dfn id=the-h2-element><code>h2</code></dfn>, <dfn id=the-h3-element><code>h3</code></dfn>, <dfn id=the-h4-element><code>h4</code></dfn>, <dfn id=the-h5-element><code>h5</code></dfn>, and <dfn id=the-h6-element><code>h6</code></dfn> elements</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#heading-content>Heading content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of an <code><a href=#the-hgroup-element>hgroup</a></code> element.</dd>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlheadingelement>HTMLHeadingElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLHeadingElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>These elements <a href=#represents title=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>headings and
  sections</a>.</p>

  <p>These elements have a <dfn id=rank>rank</dfn> given by the number in their name. The <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
  element is said to have the highest rank, the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element has the lowest rank, and two
  elements with the same name have equal rank.</p>

  <div class=example>

   <p>As far as their respective document outlines (their heading and section structures) are
   concerned, these two snippets are semantically equivalent:</p>

   <pre>&lt;body&gt;
&lt;h1&gt;Let's call it a draw(ing surface)&lt;/h1&gt;
&lt;h2&gt;Diving in&lt;/h2&gt;
&lt;h2&gt;Simple shapes&lt;/h2&gt;
&lt;h2&gt;Canvas coordinates&lt;/h2&gt;
&lt;h3&gt;Canvas coordinates diagram&lt;/h3&gt;
&lt;h2&gt;Paths&lt;/h2&gt;
&lt;/body&gt;</pre>

   <pre>&lt;body&gt;
 &lt;h1&gt;Let's call it a draw(ing surface)&lt;/h1&gt;
 &lt;section&gt;
  &lt;h1&gt;Diving in&lt;/h1&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h1&gt;Simple shapes&lt;/h1&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h1&gt;Canvas coordinates&lt;/h1&gt;
  &lt;section&gt;
   &lt;h1&gt;Canvas coordinates diagram&lt;/h1&gt;
  &lt;/section&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h1&gt;Paths&lt;/h1&gt;
 &lt;/section&gt;
&lt;/body&gt;</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>

  </div>




  <h4 id=the-hgroup-element><span class=secno>4.4.7 </span>The <dfn><code>hgroup</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#heading-content>Heading content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>One or more <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, and <span>script-supporting</span> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-hgroup-element>hgroup</a></code> element <a href=#represents>represents</a> the heading of a section, which
  consists of all the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element children of the
  <code><a href=#the-hgroup-element>hgroup</a></code> element. The element is used to group a set of
  <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><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>rank</a> of an <code><a href=#the-hgroup-element>hgroup</a></code> element is the rank of the highest-ranked
  <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element descendant of the <code><a href=#the-hgroup-element>hgroup</a></code> element, if
  there are any such elements, or otherwise the same as for an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element (the highest
  rank). Other elements of <a href=#heading-content>heading content</a> in the <code><a href=#the-hgroup-element>hgroup</a></code> element indicate
  subheadings or subtitles.</p>

  <p>The section on <a href=#headings-and-sections>headings and sections</a> defines how <code><a href=#the-hgroup-element>hgroup</a></code> elements are
  assigned to individual sections.</p>

  <div class=example>

   <p>Here are some examples of valid headings.</p>

    <pre>&lt;hgroup&gt;
 &lt;h1&gt;The reality dysfunction&lt;/h1&gt;
 &lt;h2&gt;Space is not the only void&lt;/h2&gt;
&lt;/hgroup&gt;</pre>

    <pre>&lt;hgroup&gt;
 &lt;h1&gt;Dr. Strangelove&lt;/h1&gt;
 &lt;h2&gt;Or: How I Learned to Stop Worrying and Love the Bomb&lt;/h2&gt;
&lt;/hgroup&gt;</pre>

   <p>The point of using <code><a href=#the-hgroup-element>hgroup</a></code> in these examples is to mask the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>
   element (which acts as a secondary title) from the <a href=#outline>outline</a> algorithm.</p>
   <!-- http://www.brucelawson.co.uk/2009/html-5-is-a-mess/#comment-618895 -->

   <p>How a user agent exposes such multi-level headings in user interfaces (e.g. in tables of
   contents or search results) is left open to implementors, as it is a user interface issue. The
   first example above could be rendered as:</p>

   <pre>The reality dysfunction: Space is not the only void</pre>

   <p>Alternatively, it could look like this:

   <pre>The reality dysfunction (Space is not the only void)</pre>

   <p>In interfaces where a title can be rendered on multiple lines, it could be rendered as
   follows, maybe with the first line in a bigger font size:</p>

   <pre>The reality dysfunction
Space is not the only void</pre>

  </div>


  <h4 id=the-header-element><span class=secno>4.4.8 </span>The <dfn><code>header</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, or <code><a href=#the-main-element>main</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-header-element>header</a></code> element <a href=#represents>represents</a> a group of introductory or navigational
  aids.</p>

  <p class=note>A <code><a href=#the-header-element>header</a></code> element is intended to usually contain the section's heading
  (an <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element or an <code><a href=#the-hgroup-element>hgroup</a></code> element), but this is
  not required. The <code><a href=#the-header-element>header</a></code> element can also be used to wrap a section's table of
  contents, a search form, or any relevant logos.</p>

  <div class=example>

  <p>Here are some sample headers. This first one is for a game:</p>

   <pre>&lt;header&gt;
 &lt;p&gt;Welcome to...&lt;/p&gt;
 &lt;h1&gt;Voidwars!&lt;/h1&gt;
&lt;/header&gt;</pre>

   <p>The following snippet shows how the element can be used to mark
   up a specification's header:</p>

   <pre>&lt;header&gt;
 &lt;hgroup&gt;
  &lt;h1&gt;Scalable Vector Graphics (SVG) 1.2&lt;/h1&gt;
  &lt;h2&gt;W3C Working Draft 27 October 2004&lt;/h2&gt;
 &lt;/hgroup&gt;
 &lt;dl&gt;
  &lt;dt&gt;This version:&lt;/dt&gt;
  &lt;dd&gt;&lt;a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/"&gt;http://www.w3.org/TR/2004/WD-SVG12-20041027/&lt;/a&gt;&lt;/dd&gt;
  &lt;dt&gt;Previous version:&lt;/dt&gt;
  &lt;dd&gt;&lt;a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/"&gt;http://www.w3.org/TR/2004/WD-SVG12-20040510/&lt;/a&gt;&lt;/dd&gt;
  &lt;dt&gt;Latest version of SVG 1.2:&lt;/dt&gt;
  &lt;dd&gt;&lt;a href="http://www.w3.org/TR/SVG12/"&gt;http://www.w3.org/TR/SVG12/&lt;/a&gt;&lt;/dd&gt;
  &lt;dt&gt;Latest SVG Recommendation:&lt;/dt&gt;
  &lt;dd&gt;&lt;a href="http://www.w3.org/TR/SVG/"&gt;http://www.w3.org/TR/SVG/&lt;/a&gt;&lt;/dd&gt;
  &lt;dt&gt;Editor:&lt;/dt&gt;
  &lt;dd&gt;Dean Jackson, W3C, &lt;a href="mailto:dean@w3.org"&gt;dean@w3.org&lt;/a&gt;&lt;/dd&gt;
  &lt;dt&gt;Authors:&lt;/dt&gt;
  &lt;dd&gt;See &lt;a href="#authors"&gt;Author List&lt;/a&gt;&lt;/dd&gt;
 &lt;/dl&gt;
 &lt;p class="copyright"&gt;&lt;a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
&lt;/header&gt;</pre>

  </div>

  <p class=note>The <code><a href=#the-header-element>header</a></code> element is not <a href=#sectioning-content>sectioning content</a>; it doesn't
  introduce a new section.</p>

  <div class=example>

  <p>In this example, the page has a page heading given by the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element, and two
  subsections whose headings are given by <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> elements. The content after the
  <code><a href=#the-header-element>header</a></code> element is still part of the last subsection started in the
  <code><a href=#the-header-element>header</a></code> element, because the <code><a href=#the-header-element>header</a></code> element doesn't take part in the
  <a href=#outline>outline</a> algorithm.</p>

   <pre>&lt;body&gt;
 &lt;header&gt;
  &lt;h1&gt;Little Green Guys With Guns&lt;/h1&gt;
  &lt;nav&gt;
   &lt;ul&gt;
    &lt;li&gt;&lt;a href="/games"&gt;Games&lt;/a&gt;
    &lt;li&gt;&lt;a href="/forum"&gt;Forum&lt;/a&gt;
    &lt;li&gt;&lt;a href="/download"&gt;Download&lt;/a&gt;
   &lt;/ul&gt;
  &lt;/nav&gt;
  &lt;h2&gt;Important News&lt;/h2&gt; &lt;!-- this starts a second subsection --&gt;
  &lt;!-- this is part of the subsection entitled "Important News" --&gt;
  &lt;p&gt;To play today's games you will need to update your client.&lt;/p&gt;
  &lt;h2&gt;Games&lt;/h2&gt; &lt;!-- this starts a third subsection --&gt;
 &lt;/header&gt;
 &lt;p&gt;You have three active games:&lt;/p&gt;
 &lt;!-- this is still part of the subsection entitled "Games" --&gt;
 ...</pre>

  </div>




  <h4 id=the-footer-element><span class=secno>4.4.9 </span>The <dfn><code>footer</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, or <code><a href=#the-main-element>main</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-footer-element>footer</a></code> element <a href=#represents>represents</a> a footer
  for its nearest ancestor <a href=#sectioning-content>sectioning content</a> or
  <a href=#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><a href=#the-footer-element>footer</a></code> element contains entire sections,
  they <a href=#represents title=represents>represent</a> appendices, indexes,
  long colophons, verbose license agreements, and other such
  content.</p>

  <p class=note>Contact information for the author or editor of a
  section belongs in an <code><a href=#the-address-element>address</a></code> element, possibly itself
  inside a <code><a href=#the-footer-element>footer</a></code>. Bylines and other information that
  could be suitable for both a <code><a href=#the-header-element>header</a></code> or a
  <code><a href=#the-footer-element>footer</a></code> can be placed in either (or neither). The
  primary purpose of these elements is merely to help the author write
  self-explanatory markup that is easy to maintain and style; they are
  not intended to impose specific structures on authors.</p>

  <p>Footers don't necessarily have to appear at the <em>end</em> of a
  section, though they usually do.</p>

  <p>When the nearest ancestor <a href=#sectioning-content>sectioning content</a> or
  <a href=#sectioning-root>sectioning root</a> element is <a href=#the-body-element-0>the body
  element</a>, then it applies to the whole page.</p>

  <p class=note>The <code><a href=#the-footer-element>footer</a></code> element is not
  <a href=#sectioning-content>sectioning content</a>; it doesn't introduce a new
  section.</p>

  <div class=example>

   <p>Here is a page with two footers, one at the top and one at the
   bottom, with the same content:</p>

   <pre>&lt;body&gt;
 &lt;footer&gt;&lt;a href="../"&gt;Back to index...&lt;/a&gt;&lt;/footer&gt;
 &lt;hgroup&gt;
  &lt;h1&gt;Lorem ipsum&lt;/h1&gt;
  &lt;h2&gt;The ipsum of all lorems&lt;/h2&gt;
 &lt;/hgroup&gt;
 &lt;p&gt;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.&lt;/p&gt;
 &lt;footer&gt;&lt;a href="../"&gt;Back to index...&lt;/a&gt;&lt;/footer&gt;
&lt;/body&gt;</pre>

  </div>

  <div class=example>

   <p>Here is an example which shows the <code><a href=#the-footer-element>footer</a></code> element
   being used both for a site-wide footer and for a section
   footer.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;HTML&gt;&lt;HEAD&gt;
&lt;TITLE&gt;The Ramblings of a Scientist&lt;/TITLE&gt;
&lt;BODY&gt;
&lt;H1&gt;The Ramblings of a Scientist&lt;/H1&gt;
&lt;ARTICLE&gt;
 &lt;H1&gt;Episode 15&lt;/H1&gt;
 &lt;VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD&gt;
  &lt;P&gt;&lt;A HREF="/fm/015.ogv"&gt;Download video&lt;/A&gt;.&lt;/P&gt;
 &lt;/VIDEO&gt;
 &lt;FOOTER&gt; &lt;!-- footer for article --&gt;
  &lt;P&gt;Published &lt;TIME DATETIME="2009-10-21T18:26-07:00"&gt;on 2009/10/21 at 6:26pm&lt;/TIME&gt;&lt;/P&gt;
 &lt;/FOOTER&gt;
&lt;/ARTICLE&gt;
&lt;ARTICLE&gt;
 &lt;H1&gt;My Favorite Trains&lt;/H1&gt;
 &lt;P&gt;I love my trains. My favorite train of all time is a K&ouml;f.&lt;/P&gt;
 &lt;P&gt;It is fun to see them pull some coal cars because they look so
 dwarfed in comparison.&lt;/P&gt;
 &lt;FOOTER&gt; &lt;!-- footer for article --&gt;
  &lt;P&gt;Published &lt;TIME DATETIME="2009-09-15T14:54-07:00"&gt;on 2009/09/15 at 2:54pm&lt;/TIME&gt;&lt;/P&gt;
 &lt;/FOOTER&gt;
&lt;/ARTICLE&gt;
&lt;FOOTER&gt; &lt;!-- site wide footer --&gt;
 &lt;NAV&gt;
  &lt;P&gt;&lt;A HREF="/credits.html"&gt;Credits&lt;/A&gt; &mdash;
     &lt;A HREF="/tos.html"&gt;Terms of Service&lt;/A&gt; &mdash;
     &lt;A HREF="/index.html"&gt;Blog Index&lt;/A&gt;&lt;/P&gt;
 &lt;/NAV&gt;
 &lt;P&gt;Copyright &copy; 2009 Gordon Freeman&lt;/P&gt;
&lt;/FOOTER&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;</pre>

  </div>

  <div class=example>

   <p>Some site designs have what is sometimes referred to as "fat
   footers" &mdash; 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>...
 &lt;footer&gt;
  &lt;nav&gt;
   &lt;section&gt;
    &lt;h1&gt;Articles&lt;/h1&gt;
    &lt;p&gt;&lt;img src="images/somersaults.jpeg" alt=""&gt; Go to the gym with
    our somersaults class! Our teacher Jim takes you through the paces
    in this two-part article. &lt;a href="articles/somersaults/1"&gt;Part
    1&lt;/a&gt; &middot; &lt;a href="articles/somersaults/2"&gt;Part 2&lt;/a&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src="images/kindplus.jpeg"&gt; Tired of walking on the edge of
    a clif&lt;!-- sic --&gt;? Our guest writer Lara shows you how to bumble
    your way through the bars. &lt;a href="articles/kindplus/1"&gt;Read
    more...&lt;/a&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src="images/crisps.jpeg"&gt; The chips are down, now all
    that's left is a potato. What can you do with it? &lt;a
    href="articles/crisps/1"&gt;Read more...&lt;/a&gt;&lt;/p&gt;
   &lt;/section&gt;
   &lt;ul&gt;
    &lt;li&gt; &lt;a href="/about"&gt;About us...&lt;/a&gt;
    &lt;li&gt; &lt;a href="/feedback"&gt;Send feedback!&lt;/a&gt;
    &lt;li&gt; &lt;a href="/sitemap"&gt;Sitemap&lt;/a&gt;
   &lt;/ul&gt;
  &lt;/nav&gt;
  &lt;p&gt;&lt;small&gt;Copyright &copy; 2015 The Snacker &mdash;
  &lt;a href="/tos"&gt;Terms of Service&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
 &lt;/footer&gt;
&lt;/body&gt;</pre>

  </div>


  <h4 id=the-address-element><span class=secno>4.4.10 </span>The <dfn><code>address</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <a href=#heading-content>heading
   content</a> descendants, no <a href=#sectioning-content>sectioning content</a>
   descendants, and no <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, or
   <code><a href=#the-address-element>address</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-address-element>address</a></code> element <a href=#represents>represents</a> the
  contact information for its nearest <code><a href=#the-article-element>article</a></code> or
  <code><a href=#the-body-element>body</a></code> element ancestor. If that is <a href=#the-body-element-0>the body
  element</a>, then the contact information applies to the document
  as a whole.</p>

  <div class=example>
   <p>For example, a page at the W3C Web site related to HTML might
   include the following contact information:</p>
   <pre>&lt;ADDRESS&gt;
 &lt;A href="../People/Raggett/"&gt;Dave Raggett&lt;/A&gt;,
 &lt;A href="../People/Arnaud/"&gt;Arnaud Le Hors&lt;/A&gt;,
 contact persons for the &lt;A href="Activity"&gt;W3C HTML Activity&lt;/A&gt;
&lt;/ADDRESS&gt;</pre>
  </div>

  <p>The <code><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><a href=#the-p-element>p</a></code>
  element is the appropriate element for marking up postal addresses
  in general.)</p>

  <p>The <code><a href=#the-address-element>address</a></code> element must not contain information
  other than contact information.</p>

  <div class=example>
   <p>For example, the following is non-conforming use of the
   <code><a href=#the-address-element>address</a></code> element:</p>
   <pre class=bad>&lt;ADDRESS&gt;Last Modified: 1999/12/24 23:37:50&lt;/ADDRESS&gt;</pre>
  </div>

  <p>Typically, the <code><a href=#the-address-element>address</a></code> element would be included
  along with other information in a <code><a href=#the-footer-element>footer</a></code> element.</p>

  <div class=impl>

  <p>The contact information for a node <var title="">node</var> is a
  collection of <code><a href=#the-address-element>address</a></code> elements defined by the first
  applicable entry from the following list:</p>

  <dl class=switch><dt>If <var title="">node</var> is an <code><a href=#the-article-element>article</a></code> element</dt>
   <dt>If <var title="">node</var> is a <code><a href=#the-body-element>body</a></code> element</dt>

   <dd>

    <p>The contact information consists of all the
    <code><a href=#the-address-element>address</a></code> elements that have <var title="">node</var>
    as an ancestor and do not have another <code><a href=#the-body-element>body</a></code> or
    <code><a href=#the-article-element>article</a></code> element ancestor that is a descendant of <var title="">node</var>.</p>

   </dd>

   <dt>If <var title="">node</var> has an ancestor element that is an <code><a href=#the-article-element>article</a></code> element</dt>
   <dt>If <var title="">node</var> has an ancestor element that is a <code><a href=#the-body-element>body</a></code> element</dt>

   <dd>

    <p>The contact information of <var title="">node</var> is the same
    as the contact information of the nearest <code><a href=#the-article-element>article</a></code> or
    <code><a href=#the-body-element>body</a></code> element ancestor, whichever is nearest.</p>

   </dd>

   <dt>If <var title="">node</var>'s <code><a href=#document>Document</a></code> has <a href=#the-body-element-0 title="the body element">a body element</a></dt>

   <dd>

    <p>The contact information of <var title="">node</var> is the same
    as the contact information of <a href=#the-body-element-0>the body element</a> of the
    <code><a href=#document>Document</a></code>.</p>

   </dd>

   <dt>Otherwise</dt>

   <dd>

    <p>There is no contact information for <var title="">node</var>.</p>

   </dd>

  </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>

  <div class=example>

   <p>In this example the footer contains contact information and a
   copyright notice.</p>

   <pre>&lt;footer&gt;
 &lt;address&gt;
  For more details, contact
  &lt;a href="mailto:js@example.com"&gt;John Smith&lt;/a&gt;.
 &lt;/address&gt;
 &lt;p&gt;&lt;small&gt;&copy; copyright 2038 Example Corp.&lt;/small&gt;&lt;/p&gt;
&lt;/footer&gt;</pre>

  </div>



  <h4 id=headings-and-sections><span class=secno>4.4.11 </span><dfn>Headings and sections</dfn></h4>

  <p>The <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements and the
  <code><a href=#the-hgroup-element>hgroup</a></code> element are headings.</p>

  <p>The first element of <a href=#heading-content>heading content</a> in an element
  of <a href=#sectioning-content>sectioning content</a> <a href=#represents>represents</a> the
  heading for that section. Subsequent headings of equal or higher
  <a href=#rank>rank</a> start new (implied) sections, headings of lower
  <a href=#rank>rank</a> start implied subsections that are part of the
  previous one. In both cases, the element <a href=#represents>represents</a> the
  heading of the implied section.</p>

  <p>Certain elements are said to be <dfn id=sectioning-root title="sectioning
  root">sectioning roots</dfn>, including <code><a href=#the-blockquote-element>blockquote</a></code> and
  <code><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>

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-blockquote-element>blockquote</a></code></li>
   <li><code><a href=#the-body-element>body</a></code></li>
   <li><code><a href=#the-details-element>details</a></code></li>
   <li><code><a href=#the-dialog-element>dialog</a></code></li>
   <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
   <li><code><a href=#the-figure-element>figure</a></code></li>
   <li><code><a href=#the-td-element>td</a></code></li>
  </ul><!-- a root element isn't a sectioning root. This means, for
  instance, that you don't get an outline if you just have a random
  XML file with <html:h1> elements in it. Other vocabs need to define
  what their sectioning root is. --><p><a href=#sectioning-content>Sectioning content</a> elements are always considered
  subsections of their nearest ancestor <a href=#sectioning-root>sectioning root</a>
  or their nearest ancestor element of <a href=#sectioning-content>sectioning
  content</a>, whichever is nearest, regardless of what implied
  sections other headings may have created.</p>

  <div class=example>
   <p>For the following fragment:</p>
   <pre>&lt;body&gt;
 &lt;h1&gt;Foo&lt;/h1&gt;
 &lt;h2&gt;Bar&lt;/h2&gt;
 &lt;blockquote&gt;
  &lt;h3&gt;Bla&lt;/h3&gt;
 &lt;/blockquote&gt;
 &lt;p&gt;Baz&lt;/p&gt;
 &lt;h2&gt;Quux&lt;/h2&gt;
 &lt;section&gt;
  &lt;h3&gt;Thud&lt;/h3&gt;
 &lt;/section&gt;
 &lt;p&gt;Grunt&lt;/p&gt;
&lt;/body&gt;</pre>
   <p>...the structure would be:</p>
   <ol><li>
     Foo (heading of explicit <code><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>
      <li>
       Quux (heading starting implied section with no content other than the heading itself)
      </li>
      <li>
       Thud (heading of explicit <code><a href=#the-section-element>section</a></code> section)
      </li>
     </ol></li>
   </ol><p>Notice how the <code><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>rank</a>, but
  authors are strongly encouraged to either use only <code><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>rank</a>
  for the section's nesting level.</p>

  <p>Authors are also encouraged to explicitly wrap sections in
  elements of <a href=#sectioning-content>sectioning content</a>, instead of relying on
  the implicit sections generated by having multiple headings in one
  element of <a href=#sectioning-content>sectioning content</a>.</p>

  <div class=example>
   <p>For example, the following is correct:</p>

   <pre>&lt;body&gt;
 &lt;h4&gt;Apples&lt;/h4&gt;
 &lt;p&gt;Apples are fruit.&lt;/p&gt;
 &lt;section&gt;
  &lt;h2&gt;Taste&lt;/h2&gt;
  &lt;p&gt;They taste lovely.&lt;/p&gt;
  &lt;h6&gt;Sweet&lt;/h6&gt;
  &lt;p&gt;Red apples are sweeter than green ones.&lt;/p&gt;
  &lt;h1&gt;Color&lt;/h1&gt;
  &lt;p&gt;Apples come in various colors.&lt;/p&gt;
 &lt;/section&gt;
&lt;/body&gt;</pre>

   <p>However, the same document would be more clearly expressed
   as:</p>

   <pre>&lt;body&gt;
 &lt;h1&gt;Apples&lt;/h1&gt;
 &lt;p&gt;Apples are fruit.&lt;/p&gt;
 &lt;section&gt;
  &lt;h2&gt;Taste&lt;/h2&gt;
  &lt;p&gt;They taste lovely.&lt;/p&gt;
  &lt;section&gt;
   &lt;h3&gt;Sweet&lt;/h3&gt;
   &lt;p&gt;Red apples are sweeter than green ones.&lt;/p&gt;
  &lt;/section&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h2&gt;Color&lt;/h2&gt;
  &lt;p&gt;Apples come in various colors.&lt;/p&gt;
 &lt;/section&gt;
&lt;/body&gt;</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>&lt;body&gt;
 &lt;h1&gt;Apples&lt;/h1&gt;
 &lt;p&gt;Apples are fruit.&lt;/p&gt;
 &lt;section&gt;
  &lt;h1&gt;Taste&lt;/h1&gt;
  &lt;p&gt;They taste lovely.&lt;/p&gt;
  &lt;section&gt;
   &lt;h1&gt;Sweet&lt;/h1&gt;
   &lt;p&gt;Red apples are sweeter than green ones.&lt;/p&gt;
  &lt;/section&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h1&gt;Color&lt;/h1&gt;
  &lt;p&gt;Apples come in various colors.&lt;/p&gt;
 &lt;/section&gt;
&lt;/body&gt;</pre>

   <p>This final example would need explicit style rules to be
   rendered well in legacy browsers. Legacy browsers without CSS
   support would render all the headings as top-level headings.</p>

  </div>


  <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>

  <div class=impl>

  <!-- v2 idea: It would be nice if there was a way to use this to
  autogenerate a table of contents or some such -->

  <p>This section defines an algorithm for creating an outline for a
  <a href=#sectioning-content>sectioning content</a> element or a <a href=#sectioning-root>sectioning
  root</a> element. It is defined in terms of a walk over the nodes
  of a DOM tree, in tree order, with each node being visited when it
  is <i>entered</i> and when it is <i>exited</i> during the walk.</p>

  </div>

  <p>The <dfn id=outline>outline</dfn> for a <a href=#sectioning-content>sectioning content</a>
  element or a <a href=#sectioning-root>sectioning root</a> element consists of a list
  of one or more potentially nested <a href=#concept-section title=concept-section>sections</a>. A <dfn id=concept-section title=concept-section>section</dfn> is a container that
  corresponds to some nodes in the original DOM tree. Each section can
  have one heading associated with it, and can contain any number of
  further nested sections. <span class=impl>The algorithm for the
  outline also associates each node in the DOM tree with a particular
  section and potentially a heading.</span> (The sections in the
  outline aren't <code><a href=#the-section-element>section</a></code> elements, though some may
  correspond to such elements &mdash; they are merely conceptual
  sections.)</p>

  <div class=example>

   <p>The following markup fragment:</p>

   <pre>&lt;body&gt;
 &lt;h1&gt;A&lt;/h1&gt;
 &lt;p&gt;B&lt;/p&gt;
 &lt;h2&gt;C&lt;/h2&gt;
 &lt;p&gt;D&lt;/p&gt;
 &lt;h2&gt;E&lt;/h2&gt;
 &lt;p&gt;F&lt;/p&gt;
&lt;/body&gt;</pre>

   <p>...results in the following outline being created for the
   <code><a href=#the-body-element>body</a></code> node (and thus the entire document):</p>

   <ol class=brief><li>
     <p>Section created for <code><a href=#the-body-element>body</a></code> node.</p>
     <p>Associated with heading "A".</p>
     <p>Also associated with paragraph "B".</p>
     <p>Nested sections:</p>
     <ol class=brief><li>
       <p>Section implied for first <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element.</p>
       <p>Associated with heading "C".</p>
       <p>Also associated with paragraph "D".</p>
       <p>No nested sections.</p>
      </li>
      <li>
       <p>Section implied for second <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element.</p>
       <p>Associated with heading "E".</p>
       <p>Also associated with paragraph "F".</p>
       <p>No nested sections.</p>
      </li>
     </ol></li>
   </ol></div>

  <div class=impl>

  <p>The algorithm that must be followed during a walk of a DOM
  subtree rooted at a <a href=#sectioning-content>sectioning content</a> element or a
  <a href=#sectioning-root>sectioning root</a> element to determine that element's
  <a href=#outline>outline</a> is as follows:</p>

  <ol><li><p>Let <var title="">current outline target</var> be null. (It holds
   the element whose <a href=#outline>outline</a> is being created.)</li>

   <li><p>Let <var title="">current section</var> be null. (It holds a
   pointer to a <a href=#concept-section title=concept-section>section</a>, so that
   elements in the DOM can all be associated with a section.)</li>

   <li><p>Create a stack to hold elements, which is used to handle
   nesting. Initialize this stack to empty.</li>

   <li>

    <p>Walk over the DOM in <a href=#tree-order>tree order</a>, starting with the
    <a href=#sectioning-content>sectioning content</a> element or <a href=#sectioning-root>sectioning
    root</a> element at the root of the subtree for which an
    outline is to be created, and trigger the first relevant step
    below for each element as the walk enters and exits it.</p>

    <dl class=switch><dt>When exiting an element, if that element is the element at
     the top of the stack</dt>

     <dd>

      <p class=note>The element being exited is a <a href=#heading-content>heading
      content</a> element or an element with a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute.</p>

      <p>Pop that element from the stack.</p>

     </dd>


     <dt>If the top of the stack is a <a href=#heading-content>heading content</a>
     element or an element with a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute</dt>

     <dd><p>Do nothing.</dd>


     <dt>When entering an element with a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute</dt>

     <dd>

      <p>Push the element being entered onto the stack. (This causes
      the algorithm to skip that element and any descendants of the
      element.)</p>

     </dd>


     <dt>When entering a <a href=#sectioning-content>sectioning content</a> element or a
     <a href=#sectioning-root>sectioning root</a> element</dt>

     <dd>

      <p>If <var title="">current outline target</var> is not null, and the
      <var title="">current section</var> has no heading, create an
      implied heading and let that be the heading for the <var title="">current section</var>.</p>

      <p>If <var title="">current outline target</var> is not null, push
      <var title="">current outline target</var> onto the stack.</p>

      <p>Let <var title="">current outline target</var> be the element
      that is being entered.</p>

      <p>Let <var title="">current section</var> be a newly created
      <a href=#concept-section title=concept-section>section</a> for the <var title="">current outline target</var> element.</p>

      <p>Associate <var title="">current outline target</var> with <var title="">current section</var>.</p>

      <p>Let there be a new <a href=#outline>outline</a> for the new <var title="">current outline target</var>, initialized with just the new
      <var title="">current section</var> as the only <a href=#concept-section title=concept-section>section</a> in the outline.</p>

     </dd>


     <dt>When exiting a <a href=#sectioning-content>sectioning content</a> element, if
     the stack is not empty</dt>

     <dd>

      <p>If the <var title="">current section</var> has no heading,
      create an implied heading and let that be the heading for the
      <var title="">current section</var>.</p>

      <p>Pop the top element from the stack, and let the <var title="">current outline target</var> be that element.</p>

      <p>Let <var title="">current section</var> be the last section
      in the <a href=#outline>outline</a> of the <var title="">current
      outline target</var> element.</p>

      <p>Append the <a href=#outline>outline</a> of the <a href=#sectioning-content>sectioning
      content</a> element being exited to the <var title="">current
      section</var>. (This does not change which section is the last
      section in the <a href=#outline>outline</a>.)</p>

     </dd>


     <dt>When exiting a <a href=#sectioning-root>sectioning root</a> element, if the
     stack is not empty</dt>

     <dd>

      <p>Run these steps:</p>

      <ol><li><p>If the <var title="">current section</var> has no
       heading, create an implied heading and let that be the heading
       for the <var title="">current section</var>.</li>

       <li><p>Pop the top element from the stack, and let the <var title="">current outline target</var> be that element.</li>

       <li><p>Let <var title="">current section</var> be the last
       section in the <a href=#outline>outline</a> of the <var title="">current
       outline target</var> element.</li>

       <li><p><i>Finding the deepest child</i>: If <var title="">current section</var> has no child sections, stop
       these steps.</li>

       <li><p>Let <var title="">current section</var> be the last
       child <a href=#concept-section title=concept-section>section</a> of the
       current <var title="">current section</var>.</li>

       <li><p>Go back to the substep labeled <i>finding the deepest
       child</i>.</li>

      </ol></dd>


     <dt>When exiting a <a href=#sectioning-content>sectioning content</a> element or a
     <a href=#sectioning-root>sectioning root</a> element</dt>

     <dd>

      <p class=note>The <var title="">current outline target</var> is the
      element being exited, and it is the <a href=#sectioning-content>sectioning
      content</a> element or a <a href=#sectioning-root>sectioning root</a> element
      at the root of the subtree for which an outline is being
      generated.</p>

      <p>If the <var title="">current section</var> has no heading,
      create an implied heading and let that be the heading for the
      <var title="">current section</var>.</p>

      <p>Skip to the next step in the overall set of steps. (The walk
      is over.)</p>

     </dd>


     <dt>When entering a <a href=#heading-content>heading content</a> element</dt>

     <dd>

      <p>If the <var title="">current section</var> has no heading,
      let the element being entered be the heading for the <var title="">current section</var>.</p>

      <p>Otherwise, if the element being entered has a
      <a href=#rank>rank</a> equal to or higher than the heading of the
      last section of the <a href=#outline>outline</a> of the <var title="">current outline target</var>, or if the heading of the last
      section of the <a href=#outline>outline</a> of the <var title="">current
      outline target</var> is an implied heading, then create a new <a href=#concept-section title=concept-section>section</a> and append it to the
      <a href=#outline>outline</a> of the <var title="">current outline target</var>
      element, so that this new section is the new last section of
      that outline. Let <var title="">current section</var> be that
      new section. Let the element being entered be the new heading
      for the <var title="">current section</var>.</p>

      <p>Otherwise, run these substeps:</p>

      <ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</li>

       <li><p><i>Heading loop</i>: If the element being entered has a
       <a href=#rank>rank</a> lower than the <a href=#rank>rank</a> of the
       heading of the <var title="">candidate section</var><!-- the
       first time through, it won't be, but maybe on a subsequent pass
       it is -->, then create a new <a href=#concept-section title=concept-section>section</a>, and append it to <var title="">candidate section</var>. (This does not change which
       section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
       element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>

       <li><p>Let <var title="">new candidate section</var> be the
       <a href=#concept-section title=concept-section>section</a> that contains <var title="">candidate section</var> in the <a href=#outline>outline</a> of
       <var title="">current outline target</var>.</li>

       <li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</li>

       <li><p>Return to the step labeled <i>heading loop</i>.</li>

      </ol><p>Push the element being entered onto the stack. (This causes
      the algorithm to skip any descendants of the element.)</p>

      <p class=note>Recall that <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> has the
      <em>highest</em> rank, and <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> has the lowest
      rank.</p>

     </dd>


     <dt>Otherwise</dt>

     <dd><p>Do nothing.</dd>

    </dl><p id=associatedSection>In addition, whenever the walk exits a
    node, after doing the steps above, if the node is not associated
    with a <a href=#concept-section title=concept-section>section</a> yet, associate
    the node with the <a href=#concept-section title=concept-section>section</a>
    <var title="">current section</var>.</p>

   </li>

   <li><p>Associate all nodes with the heading of the <a href=#concept-section title=concept-section>section</a> with which they are
   associated, if any.</li>

  </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-0>the body element</a> of a
  <code><a href=#document>Document</a></code> is the <a href=#outline>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>sectioning content</a>
  element, if the <a href=#concept-section title=concept-section>section</a> was
  created for a real element in the original document, or to the
  relevant <a href=#heading-content>heading content</a> element, if the <a href=#concept-section title=concept-section>section</a> in the tree was generated for
  a heading in the above process.</p>

  <p class=note>Selecting the first <a href=#concept-section title=concept-section>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><a href=#the-body-element>body</a></code> is to be found.</p>

  <p>The <dfn id=outline-depth>outline depth</dfn> of a <a href=#heading-content>heading content</a>
  element associated with a <a href=#concept-section title=concept-section>section</a> <var title="">section</var>
  is the number of <a href=#concept-section title=concept-section>sections</a> that
  are ancestors of <var title="">section</var> in the outermost
  <a href=#outline>outline</a> that <var title="">section</var> finds itself
  in when the <a href=#outline title=outline>outlines</a> of its
  <code><a href=#document>Document</a></code>'s elements are created, plus 1. The
  <a href=#outline-depth>outline depth</a> of a <a href=#heading-content>heading content</a> element
  not associated with a <a href=#concept-section title=concept-section>section</a>
  is 1.</p>

  <p>User agents should provide default headings for sections that do
  not have explicit section headings.</p>

  <div class=example>

   <p>Consider the following snippet:</p>

   <pre>&lt;body&gt;
 &lt;nav&gt;
  &lt;p&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/p&gt;
 &lt;/nav&gt;
 &lt;p&gt;Hello world.&lt;/p&gt;
 &lt;aside&gt;
  &lt;p&gt;My cat is cute.&lt;/p&gt;
 &lt;/aside&gt;
&lt;/body&gt;</pre>

   <p>Although it contains no headings, this snippet has three
   sections: a document (the <code><a href=#the-body-element>body</a></code>) with two subsections
   (a <code><a href=#the-nav-element>nav</a></code> and an <code><a href=#the-aside-element>aside</a></code>). A user agent could
   present the outline as follows:</p>

   <ol class=brief><li>Untitled document
     <ol><li>Navigation</li>
      <li>Sidebar</li>
     </ol></li>
   </ol><p>These default headings ("Untitled document", "Navigation",
   "Sidebar") are not specified by this specification, and might vary
   with the user's language, the page's language, the user's
   preferences, the user agent implementor's preferences, etc.</p>

  </div>

  <div class=note>

   <p>The following JavaScript function shows how the tree walk could
   be implemented. The <var title="">root</var> argument is the root
   of the tree to walk (either a <a href=#sectioning-content>sectioning content</a>
   element or a <a href=#sectioning-root>sectioning root</a> element), and the <var title="">enter</var> and <var title="">exit</var> arguments are
   callbacks that are called with the nodes as they are entered and
   exited. <a href=#refsECMA262>[ECMA262]</a></p>

   <pre>function (root, enter, exit) {
  var node = root;
  start: while (node) {
    enter(node);
    if (node.firstChild) {
      node = node.firstChild;
      continue start;
    }
    while (node) {
      exit(node);
      if (node == root) {
        node = null;
      } else if (node.nextSibling) {
        node = node.nextSibling;
        continue start;
      } else {
        node = node.parentNode;
      }
    }
  }
}</pre>

  </div>

  </div>


  <h5 id=sample-outlines><span class=secno>4.4.11.2 </span>Sample outlines</h5>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

   <p>The following document shows a straight-forward application of the <a href=#outline>outline</a>
   algorithm. First, here is the document, which is a book with very short chapters and
   subsections:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;The Tax Book (all in one page)&lt;/title&gt;
&lt;h1&gt;The Tax Book&lt;/h1&gt;
&lt;h2&gt;Earning money&lt;/h2&gt;
&lt;p&gt;Earning money is good.&lt;/p&gt;
&lt;h3&gt;Getting a job&lt;/h3&gt;
&lt;p&gt;To earn money you typically need a job.&lt;/p&gt;
&lt;h2&gt;Spending money&lt;/h2&gt;
&lt;p&gt;Spending is what money is mainly used for.&lt;/p&gt;
&lt;h3&gt;Cheap things&lt;/h3&gt;
&lt;p&gt;Buying cheap things often not cost-effective.&lt;/p&gt;
&lt;h3&gt;Expensive things&lt;/h3&gt;
&lt;p&gt;The most expensive thing is often not the most cost-effective either.&lt;/p&gt;
&lt;h2&gt;Investing money&lt;/h2&gt;
&lt;p&gt;You can lend your money to other people.&lt;/p&gt;
&lt;h2&gt;Losing money&lt;/h2&gt;
&lt;p&gt;If you spend money or invest money, sooner or later you will lose money.
&lt;h3&gt;Poor judgement&lt;/h3&gt;
&lt;p&gt;Usually if you lose money it's because you made a mistake.&lt;/p&gt;</pre>

   <p>This book would form the following outline:</p>

   <ol class=brief><li> The Tax Book    
     <ol class=brief><li> Earning money
       <ol class=brief><li> Getting a job
       </ol><li> Spending money
       <ol class=brief><li> Cheap things
        <li> Expensive things
       </ol><li> Investing money
      <li> Losing money
       <ol class=brief><li> Poor judgement
       </ol></ol></ol><p>Notice that the <code><a href=#the-title-element>title</a></code> element does not participate in the outline.</p>

  </div>

  <div class=example>

   <p>Here is a similar document, but this time using <code><a href=#the-section-element>section</a></code> elements to get the same
   effect:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;The Tax Book (all in one page)&lt;/title&gt;
&lt;h1&gt;The Tax Book&lt;/h1&gt;
&lt;section&gt;
 &lt;h1&gt;Earning money&lt;/h1&gt;
 &lt;p&gt;Earning money is good.&lt;/p&gt;
 &lt;section&gt;
  &lt;h1&gt;Getting a job&lt;/h1&gt;
  &lt;p&gt;To earn money you typically need a job.&lt;/p&gt;
 &lt;/section&gt;
&lt;/section&gt;
&lt;section&gt;
 &lt;h1&gt;Spending money&lt;/h1&gt;
 &lt;p&gt;Spending is what money is mainly used for.&lt;/p&gt;
 &lt;section&gt;
  &lt;h1&gt;Cheap things&lt;/h1&gt;
  &lt;p&gt;Buying cheap things often not cost-effective.&lt;/p&gt;
 &lt;/section&gt;
 &lt;section&gt;
  &lt;h1&gt;Expensive things&lt;/h1&gt;
  &lt;p&gt;The most expensive thing is often not the most cost-effective either.&lt;/p&gt;
 &lt;/section&gt;
&lt;/section&gt;
&lt;section&gt;
 &lt;h1&gt;Investing money&lt;/h1&gt;
 &lt;p&gt;You can lend your money to other people.&lt;/p&gt;
&lt;/section&gt;
&lt;section&gt;
 &lt;h1&gt;Losing money&lt;/h1&gt;
 &lt;p&gt;If you spend money or invest money, sooner or later you will lose money.
 &lt;section&gt;
  &lt;h1&gt;Poor judgement&lt;/h1&gt;
  &lt;p&gt;Usually if you lose money it's because you made a mistake.&lt;/p&gt;
 &lt;/section&gt;
&lt;/section&gt;</pre>

   <p>This book would form the same outline:</p>

   <ol class=brief><li> The Tax Book    
     <ol class=brief><li> Earning money
       <ol class=brief><li> Getting a job
       </ol><li> Spending money
       <ol class=brief><li> Cheap things
        <li> Expensive things
       </ol><li> Investing money
      <li> Losing money
       <ol class=brief><li> Poor judgement
       </ol></ol></ol></div>

  <div class=example>

   <p>A document can contain multiple top-level headings:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Alphabetic Fruit&lt;/title&gt;
&lt;h1&gt;Apples&lt;/h1&gt;
&lt;p&gt;Pomaceous.&lt;/p&gt;
&lt;h1&gt;Bananas&lt;/h1&gt;
&lt;p&gt;Edible.&lt;/p&gt;
&lt;h1&gt;Carambola&lt;/h1&gt;
&lt;p&gt;Star.&lt;/p&gt;</pre>

   <p>This would form the following simple outline consisting of three top-level sections:</p>

   <ol class=brief><li> Apples
    <li> Bananas
    <li> Carambola
   </ol><p>Effectively, the <code><a href=#the-body-element>body</a></code> element is split into three.</p>

  </div>

  <div class=example>

   <p>Mixing both the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> model and the
   <code><a href=#the-section-element>section</a></code>/<code><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><a href=#the-body-element>body</a></code> wrapped in a <code><a href=#the-section-element>section</a></code>:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Alphabetic Fruit&lt;/title&gt;
&lt;section&gt;
 &lt;h1&gt;Apples&lt;/h1&gt;
 &lt;p&gt;Pomaceous.&lt;/p&gt;
 &lt;h1&gt;Bananas&lt;/h1&gt;
 &lt;p&gt;Edible.&lt;/p&gt;
 &lt;h1&gt;Carambola&lt;/h1&gt;
 &lt;p&gt;Star.&lt;/p&gt;
&lt;/section&gt;</pre>

   <p>The resulting outline would be:</p>

   <ol class=brief><li> <i>(untitled page)</i>
     <ol class=brief><li> Apples
      <li> Bananas
      <li> Carambola
     </ol></ol><p>This result is described as <i>unintuitive</i> because it results in three subsections even
   though there's only one <code><a href=#the-section-element>section</a></code> element. Effectively, the <code><a href=#the-section-element>section</a></code> is
   split into three, just like the implied <code><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><a href=#the-body-element>body</a></code>
   element, since it has no explicit heading.)</p>

  </div>

  <div class=example>

   <p>Headings never rise above other sections. Thus, in the following example, the first
   <code><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>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Feathers on The Site of Encyclopedic Knowledge&lt;/title&gt;
&lt;section&gt;
 &lt;h1&gt;A plea from our caretakers&lt;/h1&gt;
 &lt;p&gt;Please, we beg of you, send help! We're stuck in the server room!&lt;/p&gt;
&lt;/section&gt;
&lt;h1&gt;Feathers&lt;/h1&gt;
&lt;p&gt;Epidermal growths.&lt;/p&gt;
</pre>

   <p>The resulting outline would be:</p>

   <ol class=brief><li> <i>(untitled page)</i>
     <ol class=brief><li> A plea from our caretakers
     </ol><li> Feathers
   </ol></div>

  <div class=example>

   <p>Thus, when an <code><a href=#the-article-element>article</a></code> element starts with a <code><a href=#the-nav-element>nav</a></code> block and only later
   has its heading, the result is that the <code><a href=#the-nav-element>nav</a></code> block is not part of the same section as
   the rest of the <code><a href=#the-article-element>article</a></code> in the outline. For instance, take this document:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;We're adopting a child! &mdash; Ray's blog&lt;/title&gt;
&lt;h1&gt;Ray's blog&lt;/h1&gt;
&lt;article&gt;
 &lt;header&gt;
  &lt;nav&gt;
   &lt;a href="?t=-1d"&gt;Yesterday&lt;/a&gt;;
   &lt;a href="?t=-7d"&gt;Last week&lt;/a&gt;;
   &lt;a href="?t=-1m"&gt;Last month&lt;/a&gt;
  &lt;/nav&gt;
  &lt;h1&gt;We're adopting a child!&lt;/h1&gt;
 &lt;/header&gt;
 &lt;main&gt;
  &lt;p&gt;As of today, Janine and I have signed the papers to become
  the proud parents of baby Diane! We've been looking forward to
  this day for weeks.&lt;/p&gt;
 &lt;/main&gt;
&lt;/article&gt;</pre>

   <p>The resulting outline would be:</p>

   <ol class=brief><li> Ray's blog
     <ol class=brief><li> <i>Untitled article</i>
       <ol class=brief><li> <i>Untitled navigation section</i>
       </ol><li> We're adopting a child!
     </ol></ol><p>Also worthy of note in this example is that the <code><a href=#the-header-element>header</a></code> and <code><a href=#the-main-element>main</a></code>
   elements have no effect whatsoever on the document outline.</p>

  </div>

  <div class=example>

   <p>The <code><a href=#the-hgroup-element>hgroup</a></code> element can be used for subheadings. For example:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Chronotype: CS Student&lt;/title&gt;
&lt;hgroup&gt;
 &lt;h1&gt; The morning &lt;/h1&gt;
 &lt;h2&gt; 06:00 to 12:00 &lt;/h2&gt;
&lt;/hgroup&gt;
&lt;p&gt;We sleep.&lt;/p&gt;
&lt;hgroup&gt;
 &lt;h1&gt; The afternoon &lt;/h1&gt;
 &lt;h2&gt; 12:00 to 18:00 &lt;/h2&gt;
&lt;/hgroup&gt;
&lt;p&gt;We study.&lt;/p&gt;
&lt;hgroup&gt;
 &lt;h2&gt;Additional Commentary&lt;/h2&gt;
 &lt;h3&gt;Because not all this is necessarily true&lt;/h3&gt;
 &lt;h6&gt;Ok it's almost certainly not true&lt;/h6&gt;
&lt;/hgroup&gt;
&lt;p&gt;Yeah we probably play, rather than study.&lt;/p&gt;
&lt;hgroup&gt;
 &lt;h1&gt; The evening &lt;/h1&gt;
 &lt;h2&gt; 18:00 to 00:00 &lt;/h2&gt;
&lt;/hgroup&gt;
&lt;p&gt;We play.&lt;/p&gt;
&lt;hgroup&gt;
 &lt;h1&gt; The night &lt;/h1&gt;
 &lt;h2&gt; 00:00 to 06:00 &lt;/h2&gt;
&lt;/hgroup&gt;
&lt;p&gt;We play some more.&lt;/p&gt;</pre>

   <p>The resulting outline would be:</p>

   <ol class=brief><li> The morning <small>06:00 to 12:00</small>
    <li> The afternoon <small>12:00 to 18:00</small>
     <ol class=brief><li> Additional Commentary <small>Because not all this is necessarily true <small>Ok it's almost certainly not true</small></small>
     </ol><li> The evening <small>18:00 to 00:00</small>
    <li> The night <small>00:00 to 06:00</small>
   </ol><p>Exactly how this is represented by user agents, as most interface issues, is left as a matter
   of implementation preference, but the key part is that the <code><a href=#the-hgroup-element>hgroup</a></code>'s descendant
   <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements are what form the element's heading. Thus, the
   following would be equally valid:</p>

   <ol class=brief><li> The morning &mdash; 06:00 to 12:00
    <li> The afternoon &mdash; 12:00 to 18:00
     <ol class=brief><li> Additional Commentary &mdash; Because not all this is necessarily true &mdash; Ok it's almost certainly not true
     </ol><li> The evening &mdash; 18:00 to 00:00
    <li> The night &mdash; 00:00 to 06:00
   </ol><p>But so would the following:</p>

   <ol class=brief><li> The morning
    <li> The afternoon
     <ol class=brief><li> Additional Commentary
     </ol><li> The evening
    <li> The night
   </ol><p>The following would also be valid, though maybe less practical in most contexts:</p>

   <ol class=brief><li> <p>The morning
         <p> 06:00 to 12:00
    <li> <p>The afternoon
         <p> 12:00 to 18:00
     <ol class=brief><li> <p> Additional Commentary
           <p> Because not all this is necessarily true
           <p> Ok it's almost certainly not true
     </ol><li> <p>The evening
         <p> 18:00 to 00:00
    <li> <p>The night
         <p> 00:00 to 06:00
   </ol></div>


  <h4 id=usage-summary-0><span class=secno>4.4.12 </span>Usage summary</h4>

  <p><i>This section is non-normative.</i></p>

  <table class=vertical-summary-table><thead><tr><th rowspan=2>Element
     <th>Purpose
    <tr><th>Example
   <tbody><tr><td rowspan=2><code><a href=#the-body-element>body</a></code>
     <td>The main content of the document.
    <tr><td><pre class=example>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt; &lt;title&gt;Steve Hill's Home Page&lt;/title&gt; &lt;/head&gt;
 <strong>&lt;body&gt;</strong> &lt;p&gt;Hard Trance is My Life.&lt;/p&gt; <strong>&lt;/body&gt;</strong>
&lt;/html&gt;</pre>

    <tr><td rowspan=2><code><a href=#the-article-element>article</a></code>
     <td>A complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
    <tr><td><pre class=example><strong>&lt;article&gt;</strong>
 &lt;img src="/tumblr_masqy2s5yn1rzfqbpo1_500.jpg" alt="Yellow smiley face with the caption 'masif'"&gt;
 &lt;p&gt;My fave Masif tee so far!&lt;/p&gt;
 &lt;footer&gt;Posted 2 days ago&lt;/footer&gt;
<strong>&lt;/article&gt;</strong>
<strong>&lt;article&gt;</strong>
 &lt;img src="/tumblr_m9tf6wSr6W1rzfqbpo1_500.jpg" alt=""&gt;
 &lt;p&gt;Happy 2nd birthday Masif Saturdays!!!&lt;/p&gt;
 &lt;footer&gt;Posted 3 weeks ago&lt;/footer&gt;
<strong>&lt;/article&gt;</strong></pre>

    <tr><td rowspan=2><code><a href=#the-section-element>section</a></code>
     <td>A generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
    <tr><td><pre class=example>&lt;h1&gt;Biography&lt;/h1&gt;
<strong>&lt;section&gt;</strong>
 &lt;h1&gt;The facts&lt;/h1&gt;
 &lt;p&gt;1500+ shows, 14+ countries&lt;/p&gt;
<strong>&lt;/section&gt;</strong>
<strong>&lt;section&gt;</strong>
 &lt;h1&gt;2010/2011 figures per year&lt;/h1&gt;
 &lt;p&gt;100+ shows, 8+ countries&lt;/p&gt;
<strong>&lt;/section&gt;</strong></pre>

    <tr><td rowspan=2><code><a href=#the-nav-element>nav</a></code>
     <td>A section of a page that links to other pages or to parts within the page: a section with navigation links.
    <tr><td><pre class=example><strong>&lt;nav&gt;</strong>
 &lt;p&gt;&lt;a href="/"&gt;Home&lt;/a&gt;
 &lt;p&gt;&lt;a href="/biog.html"&gt;Bio&lt;/a&gt;
 &lt;p&gt;&lt;a href="/discog.html"&gt;Discog&lt;/a&gt;
<strong>&lt;/nav&gt;</strong></pre>

    <tr><td rowspan=2><code><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><a href=#the-aside-element>aside</a></code> element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography.
    <tr><td><pre class=example>&lt;h1&gt;Music&lt;/h1&gt;
&lt;p&gt;As any burner can tell you, the event has a lot of trance.&lt;/p&gt;
<strong>&lt;aside&gt;</strong>You can buy the music we played at our &lt;a href="buy.html"&gt;playlist page&lt;/a&gt;.<strong>&lt;/aside&gt;</strong>
&lt;p&gt;This year we played a kind of trance that originated in Belgium, Germany, and the Netherlands in the mid 90s.&lt;/p&gt;</pre>

    <tr><td rowspan=2><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
     <td>A section heading
    <tr><td><pre class=example><strong>&lt;h1&gt;</strong>The Guide To Music On The Playa<strong>&lt;/h1&gt;</strong>
<strong>&lt;h2&gt;</strong>The Main Stage<strong>&lt;/h2&gt;</strong>
&lt;p&gt;If you want to play on a stage, you should bring one.&lt;/p&gt;
<strong>&lt;h2&gt;</strong>Amplified Music<strong>&lt;/h2&gt;</strong>
&lt;p&gt;Amplifiers up to 300W or 90dB are welcome.&lt;/p&gt;</pre>

    <tr><td rowspan=2><code><a href=#the-hgroup-element>hgroup</a></code>
     <td>The heading of a section, which consists of all the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element children of the <code><a href=#the-hgroup-element>hgroup</a></code> element. The element is used to group a set of <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines.
    <tr><td><pre class=example><strong>&lt;hgroup&gt;</strong>
 &lt;h1&gt;Burning Music&lt;/h1&gt;
 &lt;h2&gt;The Guide To Music On The Playa&lt;/h2&gt;
<strong>&lt;/hgroup&gt;</strong>
&lt;section&gt;
 <strong>&lt;hgroup&gt;</strong>
  &lt;h1&gt;Main Stage&lt;/h1&gt;
  &lt;h2&gt;The Fiction Of A Music Festival&lt;/h2&gt;
 <strong>&lt;/hgroup&gt;</strong>
 &lt;p&gt;If you want to play on a stage, you should bring one.&lt;/p&gt;
&lt;/section&gt;
&lt;section&gt;
 <strong>&lt;hgroup&gt;</strong>
  &lt;h1&gt;Loudness!&lt;/h1&gt;
  &lt;h2&gt;Questions About Amplified Music&lt;/h2&gt;
 <strong>&lt;/hgroup&gt;</strong>
 &lt;p&gt;Amplifiers up to 300W or 90dB are welcome.&lt;/p&gt;
&lt;/section&gt;</pre>

    <tr><td rowspan=2><code><a href=#the-header-element>header</a></code>
     <td>A group of introductory or navigational aids.
    <tr><td><pre class=example>&lt;article&gt;
 <strong>&lt;header&gt;</strong>
  &lt;h1&gt;Hard Trance is My Life&lt;/h1&gt;
  &lt;p&gt;By DJ Steve Hill and Technikal&lt;/p&gt;
 <strong>&lt;/header&gt;</strong>
 &lt;p&gt;The album with the amusing punctuation has red artwork.&lt;/p&gt;
&lt;/article&gt;</pre>

    <tr><td rowspan=2><code><a href=#the-footer-element>footer</a></code>
     <td>A footer for its nearest ancestor <a href=#sectioning-content>sectioning content</a> or <a href=#sectioning-root>sectioning root</a> element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.
    <tr><td><pre class=example>&lt;article&gt;
 &lt;h1&gt;Hard Trance is My Life&lt;/h1&gt;
 &lt;p&gt;The album with the amusing punctuation has red artwork.&lt;/p&gt;
 <strong>&lt;footer&gt;</strong>
  &lt;p&gt;Artists: DJ Steve Hill and Technikal&lt;/p&gt;
 <strong>&lt;/footer&gt;</strong>
&lt;/article&gt;</pre>

  </table><h5 id=article-or-section><span class=secno>4.4.12.1 </span>Article or section?</h5>

  <p><i>This section is non-normative.</i></p>

  <p>A <code><a href=#the-section-element>section</a></code> forms part of something else. An <code><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><a href=#the-section-element>section</a></code>
  because there'd be lots of other chapters on (maybe) other kinds of apples.</p>

  <p>On the other hand, one could imagine a tweet or reddit comment or tumblr post or newspaper
  classified ad that just said "Granny Smith. These juicy, green apples make a great filling for
  apple pies."; it would then be <code><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><a href=#the-article-element>article</a></code> on which it is commenting,
  therefore it is its own <code><a href=#the-article-element>article</a></code>.</p>



  <h3 id=grouping-content><span class=secno>4.5 </span>Grouping content</h3>

  <h4 id=the-p-element><span class=secno>4.5.1 </span>The <dfn><code>p</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>A <code><a href=#the-p-element>p</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-p-element>p</a></code> element is immediately followed by an <code><a href=#the-address-element>address</a></code>, <code><a href=#the-article-element>article</a></code>,
   <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#dir>dir</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-dl-element>dl</a></code>,
   <code><a href=#the-fieldset-element>fieldset</a></code>, <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>,
   <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code><a href=#the-header-element>header</a></code>,
   <code><a href=#the-hgroup-element>hgroup</a></code>, <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-main-element>main</a></code>, <code><a href=#the-menu-element>menu</a></code>, <code><a href=#the-nav-element>nav</a></code>,
   <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-p-element>p</a></code>, <code><a href=#the-pre-element>pre</a></code>, <code><a href=#the-section-element>section</a></code>, <code><a href=#the-table-element>table</a></code>, or
   <code><a href=#the-ul-element>ul</a></code>, element, or if there is no more content in the parent element and the parent
   element is not an <code><a href=#the-a-element>a</a></code> element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlparagraphelement>HTMLParagraphElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLParagraphElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-p-element>p</a></code> element <a href=#represents>represents</a> a <a href=#paragraph>paragraph</a>.</p>

  <p class=note>While paragraphs are usually represented in visual media by blocks of text that
  are physically separated from adjacent blocks through blank lines, a style sheet or user agent
  would be equally justified in presenting paragraph breaks in a different manner, for instance
  using inline pilcrows (&para;).</p>

  <div class=example>
   <p>The following examples are conforming HTML fragments:</p>
   <pre>&lt;p&gt;The little kitten gently seated himself on a piece of
carpet. Later in his life, this would be referred to as the time the
cat sat on the mat.&lt;/p&gt;</pre>
   <pre>&lt;fieldset&gt;
 &lt;legend&gt;Personal information&lt;/legend&gt;
 &lt;p&gt;
   &lt;label&gt;Name: &lt;input name="n"&gt;&lt;/label&gt;
   &lt;label&gt;&lt;input name="anon" type="checkbox"&gt; Hide from other users&lt;/label&gt;
 &lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Address: &lt;textarea name="a"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
&lt;/fieldset&gt;</pre>
   <pre>&lt;p&gt;There was once an example from Femley,&lt;br&gt;
Whose markup was of dubious quality.&lt;br&gt;
The validator complained,&lt;br&gt;
So the author was pained,&lt;br&gt;
To move the error from the markup to the rhyming.&lt;/p&gt;</pre>
  </div>

  <p>The <code><a href=#the-p-element>p</a></code> element should not be used when a more specific element is more
  appropriate.</p>

  <div class=example>

   <p>The following example is technically correct:</p>

<pre>&lt;section&gt;
 &lt;!-- ... --&gt;
 &lt;p&gt;Last modified: 2001-04-23&lt;/p&gt;
 &lt;p&gt;Author: fred@example.com&lt;/p&gt;
&lt;/section&gt;</pre>

   <p>However, it would be better marked-up as:</p>

<pre>&lt;section&gt;
 &lt;!-- ... --&gt;
 &lt;footer&gt;Last modified: 2001-04-23&lt;/footer&gt;
 &lt;address&gt;Author: fred@example.com&lt;/address&gt;
&lt;/section&gt;</pre>

   <p>Or:</p>

<pre>&lt;section&gt;
 &lt;!-- ... --&gt;
 &lt;footer&gt;
  &lt;p&gt;Last modified: 2001-04-23&lt;/p&gt;
  &lt;address&gt;Author: fred@example.com&lt;/address&gt;
 &lt;/footer&gt;
&lt;/section&gt;</pre>

  </div>

  <div class=note>

   <p>List elements (in particular, <code><a href=#the-ol-element>ol</a></code> and <code><a href=#the-ul-element>ul</a></code> elements) cannot be children
   of <code><a href=#the-p-element>p</a></code> elements. When a sentence contains a bulleted list, therefore, one might wonder
   how it should be marked up.</p>

   <div class=example>
    <p>For instance, this fantastic sentence has bullets relating to</p>
    <ul><li>wizards,
     <li>faster-than-light travel, and
     <li>telepathy,
    </ul><p>and is further discussed below.</p>
   </div>

   <p>The solution is to realise that a <i><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 title=paragraph>paragraphs</a> as defined by this specification: one before the list, one
   for each bullet, and one after the list.</p>

   <div class=example>

    <p>The markup for the above example could therefore be:</p>

    <pre>&lt;p&gt;For instance, this fantastic sentence has bullets relating to&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;wizards,
 &lt;li&gt;faster-than-light travel, and
 &lt;li&gt;telepathy,
&lt;/ul&gt;
&lt;p&gt;and is further discussed below.&lt;/p&gt;</pre>

   </div>

   <p>Authors wishing to conveniently style such "logical" paragraphs consisting of multiple
   "structural" paragraphs can use the <code><a href=#the-div-element>div</a></code> element instead of the <code><a href=#the-p-element>p</a></code>
   element.</p>

   <div class=example>

    <p>Thus for instance the above example could become the following:</p>

    <pre>&lt;div&gt;For instance, this fantastic sentence has bullets relating to
&lt;ul&gt;
 &lt;li&gt;wizards,
 &lt;li&gt;faster-than-light travel, and
 &lt;li&gt;telepathy,
&lt;/ul&gt;
and is further discussed below.&lt;/div&gt;</pre>

    <p>This example still has five structural paragraphs, but now the author can style just the
    <code><a href=#the-div-element>div</a></code> instead of having to consider each part of the example separately.</p>

   </div>

  </div>



  <h4 id=the-hr-element><span class=secno>4.5.2 </span>The <dfn><code>hr</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlhrelement>HTMLHRElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLHRElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-hr-element>hr</a></code> element <a href=#represents>represents</a> a
  <a href=#paragraph>paragraph</a>-level thematic break, e.g. a scene change in
  a story, or a transition to another topic within a section of a
  reference book.</p>

  <div class=example>

   <p>The following fictional extract from a project manual shows two
   sections that use the <code><a href=#the-hr-element>hr</a></code> element to separate topics
   within the section.</p>

   <pre>&lt;section&gt;
 &lt;h1&gt;Communication&lt;/h1&gt;
 &lt;p&gt;There are various methods of communication. This section
 covers a few of the important ones used by the project.&lt;/p&gt;
 <strong>&lt;hr&gt;</strong>
 &lt;p&gt;Communication stones seem to come in pairs and have mysterious
 properties:&lt;/p&gt;
 &lt;ul&gt;
  &lt;li&gt;They can transfer thoughts in two directions once activated
  if used alone.&lt;/li&gt;
  &lt;li&gt;If used with another device, they can transfer one's
  consciousness to another body.&lt;/li&gt;
  &lt;li&gt;If both stones are used with another device, the
  consciousnesses switch bodies.&lt;/li&gt;
 &lt;/ul&gt;
 <strong>&lt;hr&gt;</strong>
 &lt;p&gt;Radios use the electromagnetic spectrum in the meter range and
 longer.&lt;/p&gt;
 <strong>&lt;hr&gt;</strong>
 &lt;p&gt;Signal flares use the electromagnetic spectrum in the
 nanometer range.&lt;/p&gt;
&lt;/section&gt;
&lt;section&gt;
 &lt;h1&gt;Food&lt;/h1&gt;
 &lt;p&gt;All food at the project is rationed:&lt;/p&gt;
 &lt;dl&gt;
  &lt;dt&gt;Potatoes&lt;/dt&gt;
  &lt;dd&gt;Two per day&lt;/dd&gt;
  &lt;dt&gt;Soup&lt;/dt&gt;
  &lt;dd&gt;One bowl per day&lt;/dd&gt;
 &lt;/dl&gt;
 <strong>&lt;hr&gt;</strong>
 &lt;p&gt;Cooking is done by the chefs on a set rotation.&lt;/p&gt;
&lt;/section&gt;</pre>

   <p>There is no need for an <code><a href=#the-hr-element>hr</a></code> element between the
   sections themselves, since the <code><a href=#the-section-element>section</a></code> elements and
   the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements imply thematic changes themselves.</p>

  </div>

  <div class=example>

   <p>The following extract from <cite>Pandora's Star</cite> by Peter
   F. Hamilton shows two paragraphs that precede a scene change and
   the paragraph that follows it. The scene change, represented in the
   printed book by a gap containing a solitary centered star between
   the second and third paragraphs, is here represented using the
   <code><a href=#the-hr-element>hr</a></code> element.</p>

   <!-- ISBN 1-4050-0020-1; bottom of page 14 -->

   <pre lang=en-GB>&lt;p&gt;Dudley was ninety-two, in his second life, and fast approaching
time for another rejuvenation. Despite his body having the physical
age of a standard fifty-year-old, the prospect of a long degrading
campaign within academia was one he regarded with dread. For a
supposedly advanced civilization, the Intersolar Commonwealth could be
appallingly backward at times, not to mention cruel.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Maybe it won't be that bad&lt;/i&gt;, he told himself. The lie was
comforting enough to get him through the rest of the night's
shift.&lt;/p&gt;
<strong>&lt;hr&gt;</strong>
&lt;p&gt;The Carlton AllLander drove Dudley home just after dawn. Like the
astronomer, the vehicle was old and worn, but perfectly capable of
doing its job. It had a cheap diesel engine, common enough on a
semi-frontier world like Gralmond, although its drive array was a
thoroughly modern photoneural processor. With its high suspension and
deep-tread tyres it could plough along the dirt track to the
observatory in all weather and seasons, including the metre-deep snow
of Gralmond's winters.&lt;/p&gt;</pre>

  </div>

  <p class=note>The <code><a href=#the-hr-element>hr</a></code> element does not affect the
  document's <a href=#outline>outline</a>.</p>


  <h4 id=the-pre-element><span class=secno>4.5.3 </span>The <dfn><code>pre</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlpreelement>HTMLPreElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLPreElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-pre-element>pre</a></code> element <a href=#represents>represents</a> a block of
  preformatted text, in which structure is represented by typographic
  conventions rather than by elements.</p>

  <p class=note>In <a href=#syntax>the HTML syntax</a>, a leading
  newline character immediately following the <code><a href=#the-pre-element>pre</a></code> element
  start tag is stripped.</p>

  <p>Some examples of cases where the <code><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>

   <li>Including fragments of computer code, with structure indicated
   according to the conventions of that language.</li>

   <li>Displaying ASCII art.</li>

  </ul><p class=note>Authors are encouraged to consider how preformatted
  text will be experienced when the formatting is lost, as will be the
  case for users of speech synthesizers, braille displays, and the
  like. For cases like ASCII art, it is likely that an alternative
  presentation, such as a textual description, would be more
  universally accessible to the readers of the document.</p>

  <p>To represent a block of computer code, the <code><a href=#the-pre-element>pre</a></code>
  element can be used with a <code><a href=#the-code-element>code</a></code> element; to represent a
  block of computer output the <code><a href=#the-pre-element>pre</a></code> element can be used
  with a <code><a href=#the-samp-element>samp</a></code> element. Similarly, the <code><a href=#the-kbd-element>kbd</a></code>
  element can be used within a <code><a href=#the-pre-element>pre</a></code> element to indicate
  text that the user is to enter.</p>

  <div class=impl>

  <p>A newline in a <code><a href=#the-pre-element>pre</a></code> element should separate
  paragraphs for the purposes of the Unicode bidirectional algorithm.
  This requirement may be implemented indirectly through the style
  layer. For example, an HTML+CSS user agent could implement these
  requirements by implementing the CSS 'unicode-bidi' property. <a href=#refsBIDI>[BIDI]</a> <a href=#refsCSS>[CSS]</a></p>

  </div>

  <div class=example>

   <p>In the following snippet, a sample of computer code is
   presented.</p>

   <pre>&lt;p&gt;This is the &lt;code&gt;Panel&lt;/code&gt; constructor:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;function Panel(element, canClose, closeHandler) {
  this.element = element;
  this.canClose = canClose;
  this.closeHandler = function () { if (closeHandler) closeHandler() };
}&lt;/code&gt;&lt;/pre&gt;</pre>

  </div>

  <div class=example>

   <p>In the following snippet, <code><a href=#the-samp-element>samp</a></code> and <code><a href=#the-kbd-element>kbd</a></code>
   elements are mixed in the contents of a <code><a href=#the-pre-element>pre</a></code> element to
   show a session of Zork I.</p>

   <pre>&lt;pre&gt;&lt;samp&gt;You are in an open field west of a big white house with a boarded
front door.
There is a small mailbox here.

&gt;&lt;/samp&gt; &lt;kbd&gt;open mailbox&lt;/kbd&gt;

&lt;samp&gt;Opening the mailbox reveals:
A leaflet.

&gt;&lt;/samp&gt;&lt;/pre&gt;</pre>

  </div>

  <div class=example>

   <p>The following shows a contemporary poem that uses the
   <code><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>&lt;pre&gt;                maxling

it is with a          heart
               heavy

that i admit loss of a feline
        so           loved

a friend lost to the
        unknown
                                (night)

~cdr 11dec07&lt;/pre&gt;</pre>

  </div>



  <h4 id=the-blockquote-element><span class=secno>4.5.4 </span>The <dfn><code>blockquote</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code> &mdash; Link to the source of the quotation or more information about the edit</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlquoteelement>HTMLQuoteElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-quote-cite title=dom-quote-cite>cite</a>;
};</pre>
    <p class=note>The <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code> interface is
    also used by the <code><a href=#the-q-element>q</a></code> element.</p>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-blockquote-element>blockquote</a></code> element <a href=#represents>represents</a> a
  section that is quoted from another source.</p>

  <p>Content inside a <code><a href=#the-blockquote-element>blockquote</a></code> must be quoted from
  another source, whose address, if it has one, may be cited in the
  <dfn id=attr-blockquote-cite title=attr-blockquote-cite><code>cite</code></dfn>
  attribute.</p>

  <p>If the <code title=attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code> attribute is present, it must be a
  <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</a>. <span class=impl>To obtain the
  corresponding citation link, the value of the attribute must be <a href=#resolve-a-url title="resolve a
  url">resolved</a> relative to the element.</span> User agents may allow users to follow such
  citation links, but they are primarily intended for private use (e.g. by server-side scripts
  collecting statistics about a site's use of quotations), not for readers.</p>

  <p>The content of a <code><a href=#the-blockquote-element>blockquote</a></code> may be abbreviated or
  may have context added in the conventional manner for the text's
  language.</p>

  <div class=example>

   <p>For example, in English this is traditionally done using square
   brackets. Consider a page with the sentence "Fred ate the cracker.
   He then said he liked apples and fish."; it could be quoted as
   follows:</p>

   <pre>&lt;blockquote&gt;
 &lt;p&gt;[Fred] then said he liked [...] fish.&lt;/p&gt;
&lt;/blockquote&gt;</pre>

  </div>

  <p>Attribution for the quotation, if any, must be placed outside the
  <code><a href=#the-blockquote-element>blockquote</a></code> element.</p> <!-- Eventually someone is
  going to ask about quotes that are self-attributing, e.g. someone
  quoting an e-mail with full headers... -->

  <div class=example>

   <p>For example, here the attribution is given in a paragraph after
   the quote:</p>

   <pre>&lt;blockquote&gt;
 &lt;p&gt;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.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&mdash; Stephen Roberts&lt;/p&gt;</pre>

   <p>The other examples below show other ways of showing
   attribution.</p>

  </div>

  <div class=impl>

  <p>The <dfn id=dom-quote-cite title=dom-quote-cite><code>cite</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the element's <code title="">cite</code> content attribute.</p>

  </div>

  <div class=example>

   <p>Here a <code><a href=#the-blockquote-element>blockquote</a></code> element is used in conjunction
   with a <code><a href=#the-figure-element>figure</a></code> element and its <code><a href=#the-figcaption-element>figcaption</a></code>
   to clearly relate a quote to its attribution (which is not part of
   the quote and therefore doesn't belong inside the
   <code><a href=#the-blockquote-element>blockquote</a></code> itself):</p>

   <pre>&lt;figure&gt;
 &lt;blockquote&gt;
  &lt;p&gt;The truth may be puzzling. It may take some work to grapple with.
  It may be counterintuitive. It may contradict deeply held
  prejudices. It may not be consonant with what we desperately want to
  be true. But our preferences do not determine what's true. We have a
  method, and that method helps us to reach not absolute truth, only
  asymptotic approaches to the truth &mdash; never there, just closer
  and closer, always finding vast new oceans of undiscovered
  possibilities. Cleverly designed experiments are the key.&lt;/p&gt;
 &lt;/blockquote&gt;
 &lt;figcaption&gt;Carl Sagan, in "&lt;cite&gt;Wonder and Skepticism&lt;/cite&gt;", from
 the &lt;cite&gt;Skeptical Enquirer&lt;/cite&gt; Volume 19, Issue 1 (January-February
 1995)&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>This next example shows the use of <code><a href=#the-cite-element>cite</a></code> alongside
   <code><a href=#the-blockquote-element>blockquote</a></code>:</p>

   <pre>&lt;p&gt;His next piece was the aptly named &lt;cite&gt;Sonnet 130&lt;/cite&gt;:&lt;/p&gt;
&lt;blockquote cite="http://quotes.example.org/s/sonnet130.html"&gt;
  &lt;p&gt;My mistress' eyes are nothing like the sun,&lt;br&gt;
  Coral is far more red, than her lips red,&lt;br&gt;
  ...</pre>

  </div>

  <div class=example>

   <p>This example shows how a forum post could use
   <code><a href=#the-blockquote-element>blockquote</a></code> to show what post a user is replying
   to. The <code><a href=#the-article-element>article</a></code> element is used for each post, to mark
   up the threading.</p>

   <pre>&lt;article&gt;
 &lt;h1&gt;&lt;a href="http://bacon.example.com/?blog=109431"&gt;Bacon on a crowbar&lt;/a&gt;&lt;/h1&gt;
 &lt;article&gt;
  &lt;header&gt;&lt;strong&gt;t3yw&lt;/strong&gt; 12 points 1 hour ago&lt;/header&gt;
  &lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;
  &lt;footer&gt;&lt;a href="?pid=29578"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
  &lt;article&gt;
   &lt;header&gt;&lt;strong&gt;greg&lt;/strong&gt; 8 points 1 hour ago&lt;/header&gt;
   &lt;blockquote&gt;&lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;&lt;/blockquote&gt;
   &lt;p&gt;Dude narwhals don't eat bacon.&lt;/p&gt;
   &lt;footer&gt;&lt;a href="?pid=29579"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
   &lt;article&gt;
    &lt;header&gt;&lt;strong&gt;t3yw&lt;/strong&gt; 15 points 1 hour ago&lt;/header&gt;
    &lt;blockquote&gt;
     &lt;blockquote&gt;&lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;&lt;/blockquote&gt;
     &lt;p&gt;Dude narwhals don't eat bacon.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Next thing you'll be saying they don't get capes and wizard
    hats either!&lt;/p&gt;
    &lt;footer&gt;&lt;a href="?pid=29580"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
    &lt;article&gt;
     &lt;article&gt;
      &lt;header&gt;&lt;strong&gt;boing&lt;/strong&gt; -5 points 1 hour ago&lt;/header&gt;
      &lt;p&gt;narwhals are worse than ceiling cat&lt;/p&gt;
      &lt;footer&gt;&lt;a href="?pid=29581"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
     &lt;/article&gt;
    &lt;/article&gt;
   &lt;/article&gt;
  &lt;/article&gt;
  &lt;article&gt;
   &lt;header&gt;&lt;strong&gt;fred&lt;/strong&gt; 1 points 23 minutes ago&lt;/header&gt;
   &lt;blockquote&gt;&lt;p&gt;I bet a narwhal would love that.&lt;/p&gt;&lt;/blockquote&gt;
   &lt;p&gt;I bet they'd love to peel a banana too.&lt;/p&gt;
   &lt;footer&gt;&lt;a href="?pid=29582"&gt;permalink&lt;/a&gt;&lt;/footer&gt;
  &lt;/article&gt;
 &lt;/article&gt;
&lt;/article&gt;</pre>

  </div>

  <div class=example>

   <p>This example shows the use of a <code><a href=#the-blockquote-element>blockquote</a></code> for
   short snippets, demonstrating that one does not have to use
   <code><a href=#the-p-element>p</a></code> elements inside <code><a href=#the-blockquote-element>blockquote</a></code>
   elements:</p>

   <pre>&lt;p&gt;He began his list of "lessons" with the following:&lt;/p&gt;
&lt;blockquote&gt;One should never assume that his side of 
the issue will be recognized, let alone that it will 
be conceded to have merits.&lt;/blockquote&gt;
&lt;p&gt;He continued with a number of similar points, ending with:&lt;/p&gt;
&lt;blockquote&gt;Finally, one should be prepared for the threat 
of breakdown in negotiations at any given moment and not 
be cowed by the possibility.&lt;/blockquote&gt;
&lt;p&gt;We shall now discuss these points...</pre>

  </div>

  <p class=note><a href=#conversations>Examples of how to
  represent a conversation</a> are shown in a later section; it is not
  appropriate to use the <code><a href=#the-cite-element>cite</a></code> and <code><a href=#the-blockquote-element>blockquote</a></code>
  elements for this purpose.</p>



  <h4 id=the-ol-element><span class=secno>4.5.5 </span>The <dfn><code>ol</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd>If the element's children include at least one <code><a href=#the-li-element>li</a></code> element: <a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-li-element>li</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> &mdash; Number the list backwards</dd>
   <dd><code title=attr-ol-start><a href=#attr-ol-start>start</a></code> &mdash; <a href=#ordinal-value>Ordinal value</a> of the first item</dd>
   <dd><code title=attr-ol-type><a href=#attr-ol-type>type</a></code> &mdash; Kind of list marker</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlolistelement>HTMLOListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-ol-reversed title=dom-ol-reversed>reversed</a>;
           attribute long <a href=#dom-ol-start title=dom-ol-start>start</a>;
           attribute DOMString <a href=#dom-ol-type title=dom-ol-type>type</a>;

  // <a href="#HTMLOListElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-ol-element>ol</a></code> element <a href=#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><a href=#the-li-element>li</a></code> element child nodes
  of the <code><a href=#the-ol-element>ol</a></code> element, in <a href=#tree-order>tree order</a>.</p>

  <p>The <dfn id=attr-ol-reversed title=attr-ol-reversed><code>reversed</code></dfn>
  attribute is a <a href=#boolean-attribute>boolean attribute</a>. If present, it
  indicates that the list is a descending list (..., 3, 2, 1). If the
  attribute is omitted, the list is an ascending list (1, 2, 3,
  ...).</p>

  <p>The <dfn id=attr-ol-start title=attr-ol-start><code>start</code></dfn>
  attribute, if present, must be a <a href=#valid-integer>valid integer</a> giving
  the <a href=#ordinal-value>ordinal value</a> of the first list item.</p>

  <div class=impl>

  <p>If the <code title=attr-ol-start><a href=#attr-ol-start>start</a></code> attribute is
  present, user agents must <a href=#rules-for-parsing-integers title="rules for parsing
  integers">parse it as an integer</a>, in order to determine the
  attribute's value. The default value, used if the attribute is
  missing or if the value cannot be converted to a number according to
  the referenced algorithm, is 1 if the element has no <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> attribute, and is the
  number of child <code><a href=#the-li-element>li</a></code> elements otherwise.</p>

  <p>The first item in the list has the <a href=#ordinal-value>ordinal value</a>
  given by the <code><a href=#the-ol-element>ol</a></code> element's <code title=attr-ol-start><a href=#attr-ol-start>start</a></code> attribute, unless that
  <code><a href=#the-li-element>li</a></code> element has a <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute with a value that can
  be successfully parsed, in which case it has the <a href=#ordinal-value>ordinal
  value</a> given by that <code title=attr-li-value><a href=#attr-li-value>value</a></code>
  attribute.</p>

  <p>Each subsequent item in the list has the <a href=#ordinal-value>ordinal
  value</a> given by its <code title=attr-li-value><a href=#attr-li-value>value</a></code>
  attribute, if it has one, or, if it doesn't, the <a href=#ordinal-value>ordinal
  value</a> of the previous item, plus one if the <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> is absent, or minus one if
  it is present.</p>

  </div>

  <p>The <dfn id=attr-ol-type title=attr-ol-type><code>type</code></dfn> attribute
  can be used to specify the kind of marker to use in the list, in the
  cases where that matters (e.g. because items are to be referenced by
  their number/letter). The attribute, if specified, must have a value
  that is a <a href=#case-sensitive>case-sensitive</a> match for one of the
  characters given in the first cell of one of the rows of the
  following table. <span class=impl>The <code title=attr-ol-type><a href=#attr-ol-type>type</a></code> attribute represents the state
  given in the cell in the second column of the row whose first cell
  matches the attribute's value; if none of the cells match, or if the
  attribute is omitted, then the attribute represents the <a href=#attr-ol-type-state-decimal title=attr-ol-type-state-decimal>decimal</a> state.</span></p>

  <table><thead><tr><th>Keyword
     <th>State
     <th>Description
     <th colspan=8>Examples for values 1-3 and 3999-4001
   <tbody><tr><td><dfn id=attr-ol-type-keyword-decimal title=attr-ol-type-keyword-decimal><code>1</code></dfn> (U+0031)
     <td><dfn id=attr-ol-type-state-decimal title=attr-ol-type-state-decimal>decimal</dfn>
     <td>Decimal numbers
     <td class=eg><samp>1.</samp> <td class=eg><samp>2.</samp> <td class=eg><samp>3.</samp> <td class=eg>... <td class=eg><samp>3999.</samp> <td class=eg><samp>4000.</samp> <td class=eg><samp>4001.</samp> <td class=eg>...
    <tr><td><dfn id=attr-ol-type-keyword-lower-alpha title=attr-ol-type-keyword-lower-alpha><code>a</code></dfn> (U+0061)
     <td><dfn id=attr-ol-type-state-lower-alpha title=attr-ol-type-state-lower-alpha>lower-alpha</dfn>
     <td>Lowercase latin alphabet
     <td class=eg><samp>a.</samp> <td class=eg><samp>b.</samp> <td class=eg><samp>c.</samp> <td class=eg>... <td class=eg><samp>ewu.</samp> <td class=eg><samp>ewv.</samp> <td class=eg><samp>eww.</samp> <td class=eg>...
    <tr><td><dfn id=attr-ol-type-keyword-upper-alpha title=attr-ol-type-keyword-upper-alpha><code>A</code></dfn> (U+0041)
     <td><dfn id=attr-ol-type-state-upper-alpha title=attr-ol-type-state-upper-alpha>upper-alpha</dfn>
     <td>Uppercase latin alphabet
     <td class=eg><samp>A.</samp> <td class=eg><samp>B.</samp> <td class=eg><samp>C.</samp> <td class=eg>... <td class=eg><samp>EWU.</samp> <td class=eg><samp>EWV.</samp> <td class=eg><samp>EWW.</samp> <td class=eg>...
    <tr><td><dfn id=attr-ol-type-keyword-lower-roman title=attr-ol-type-keyword-lower-roman><code>i</code></dfn> (U+0069)
     <td><dfn id=attr-ol-type-state-lower-roman title=attr-ol-type-state-lower-roman>lower-roman</dfn>
     <td>Lowercase roman numerals
     <td class=eg><samp>i.</samp> <td class=eg><samp>ii.</samp> <td class=eg><samp>iii.</samp> <td class=eg>... <td class=eg><samp>mmmcmxcix.</samp> <td class=eg><samp>i&#x305;v&#x305;.</samp> <td class=eg><samp>i&#x305;v&#x305;i.</samp> <td class=eg>...
    <tr><td><dfn id=attr-ol-type-keyword-upper-roman title=attr-ol-type-keyword-upper-roman><code>I</code></dfn> (U+0049)
     <td><dfn id=attr-ol-type-state-upper-roman title=attr-ol-type-state-upper-roman>upper-roman</dfn>
     <td>Uppercase roman numerals
     <td class=eg><samp>I.</samp> <td class=eg><samp>II.</samp> <td class=eg><samp>III.</samp> <td class=eg>... <td class=eg><samp>MMMCMXCIX.</samp> <td class=eg><samp>I&#x305;V&#x305;.</samp> <td class=eg><samp>I&#x305;V&#x305;I.</samp> <td class=eg>...
  </table><div class=impl>

  <p>User agents should render the items of the list in a manner
  consistent with the state of the <code title=attr-ol-type><a href=#attr-ol-type>type</a></code> attribute of the <code><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 title=attr-ol-type><a href=#attr-ol-type>type</a></code> attribute.</p>

  <p class=note>For CSS user agents, a mapping for this attribute to
  the 'list-style-type' CSS property is given <a href=#decohints>in
  the rendering section</a> (the mapping is straightforward: the
  states above have the same names as their corresponding CSS
  values).</p>

  </div>

  <!-- v2: resuming numbering of lists from previous lists? -->

  <div class=impl>

  <p>The <dfn id=dom-ol-reversed title=dom-ol-reversed><code>reversed</code></dfn>,
  <dfn id=dom-ol-start title=dom-ol-start><code>start</code></dfn>, and <dfn id=dom-ol-type title=dom-ol-type><code>type</code></dfn> IDL attributes must
  <a href=#reflect>reflect</a> the respective content attributes of the same
  name. The <code title=dom-ol-start><a href=#dom-ol-start>start</a></code> IDL attribute has
  the same default as its content attribute.</p>

  </div>

  <div class=example>

   <p>The following markup shows a list where the order matters, and
   where the <code><a href=#the-ol-element>ol</a></code> element is therefore appropriate. Compare
   this list to the equivalent list in the <code><a href=#the-ul-element>ul</a></code> section to
   see an example of the same items using the <code><a href=#the-ul-element>ul</a></code>
   element.</p>

   <pre>&lt;p&gt;I have lived in the following countries (given in the order of when
I first lived there):&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;Switzerland
 &lt;li&gt;United Kingdom
 &lt;li&gt;United States
 &lt;li&gt;Norway
&lt;/ol&gt;</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>&lt;p&gt;I have lived in the following countries (given in the order of when
I first lived there):&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;United Kingdom
 &lt;li&gt;Switzerland
 &lt;li&gt;United States
 &lt;li&gt;Norway
&lt;/ol&gt;</pre>

  </div>


  <h4 id=the-ul-element><span class=secno>4.5.6 </span>The <dfn><code>ul</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd>If the element's children include at least one <code><a href=#the-li-element>li</a></code> element: <a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-li-element>li</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlulistelement>HTMLUListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLUListElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-ul-element>ul</a></code> element <a href=#represents>represents</a> a list of
  items, where the order of the items is not important &mdash; 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><a href=#the-li-element>li</a></code> element child nodes
  of the <code><a href=#the-ul-element>ul</a></code> element.</p>

  <div class=example>

   <p>The following markup shows a list where the order does not
   matter, and where the <code><a href=#the-ul-element>ul</a></code> element is therefore
   appropriate. Compare this list to the equivalent list in the
   <code><a href=#the-ol-element>ol</a></code> section to see an example of the same items using
   the <code><a href=#the-ol-element>ol</a></code> element.</p>

   <pre>&lt;p&gt;I have lived in the following countries:&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;Norway
 &lt;li&gt;Switzerland
 &lt;li&gt;United Kingdom
 &lt;li&gt;United States
&lt;/ul&gt;</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>&lt;p&gt;I have lived in the following countries:&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;Switzerland
 &lt;li&gt;Norway
 &lt;li&gt;United Kingdom
 &lt;li&gt;United States
&lt;/ul&gt;</pre>

  </div>


  <h4 id=the-li-element><span class=secno>4.5.7 </span>The <dfn><code>li</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Inside <code><a href=#the-ol-element>ol</a></code> elements.</dd>
   <dd>Inside <code><a href=#the-ul-element>ul</a></code> elements.</dd>
   <dd>Inside <code><a href=#the-menu-element>menu</a></code> elements whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>An <code><a href=#the-li-element>li</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-li-element>li</a></code> element is immediately followed by another <code><a href=#the-li-element>li</a></code> element or if there is
   no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd>If the element is a child of an <code><a href=#the-ol-element>ol</a></code> element: <code title=attr-li-value><a href=#attr-li-value>value</a></code> &mdash; <a href=#ordinal-value>Ordinal value</a> of the list item</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmllielement>HTMLLIElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute long <a href=#dom-li-value title=dom-li-value>value</a>;

  // <a href="#HTMLLIElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-li-element>li</a></code> element <a href=#represents>represents</a> a list
  item. If its parent element is an <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-ul-element>ul</a></code>,
  or <code><a href=#the-menu-element>menu</a></code> element, then the element is an item of the
  parent element's list, as defined for those elements. Otherwise, the
  list item has no defined list-related relationship to any other
  <code><a href=#the-li-element>li</a></code> element.</p>

  <p>If the parent element is an <code><a href=#the-ol-element>ol</a></code> element, then the
  <code><a href=#the-li-element>li</a></code> element has an <dfn id=ordinal-value>ordinal value</dfn>.</p>

  <p>The <dfn id=attr-li-value title=attr-li-value><code>value</code></dfn>
  attribute, if present, must be a <a href=#valid-integer>valid integer</a> giving
  the <a href=#ordinal-value>ordinal value</a> of the list item.</p>

  <div class=impl>

  <p>If the <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute is
  present, user agents must <a href=#rules-for-parsing-integers title="rules for parsing
  integers">parse it as an integer</a>, in order to determine the
  attribute's value. If the attribute's value cannot be converted to a
  number, the attribute must be treated as if it was absent. The
  attribute has no default value.</p>

  <p>The <code title=attr-li-value><a href=#attr-li-value>value</a></code> attribute is
  processed relative to the element's parent <code><a href=#the-ol-element>ol</a></code> element
  (q.v.), if there is one. If there is not, the attribute has no
  effect.</p>

  <p>The <dfn id=dom-li-value title=dom-li-value><code>value</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the value of the <code title=dom-li-value><a href=#dom-li-value>value</a></code> content attribute.</p>

  </div>

  <div class=example>
   <p>The following example, the top ten movies are listed (in reverse
   order). Note the way the list is given a title by using a
   <code><a href=#the-figure-element>figure</a></code> element and its <code><a href=#the-figcaption-element>figcaption</a></code>
   element.</p>
   <pre>&lt;figure&gt;
 &lt;figcaption&gt;The top 10 movies of all time&lt;/figcaption&gt;
 &lt;ol&gt;
  &lt;li value="10"&gt;&lt;cite&gt;Josie and the Pussycats&lt;/cite&gt;, 2001&lt;/li&gt;
  &lt;li value="9"&gt;&lt;cite lang="sh"&gt;&TScy;&rcy;&ncy;&acy; &mcy;&acy;&chcy;&kcy;&acy;, &bcy;&iecy;&lcy;&icy; &mcy;&acy;&chcy;&ocy;&rcy;&lt;/cite&gt;, 1998&lt;/li&gt;
  &lt;li value="8"&gt;&lt;cite&gt;A Bug's Life&lt;/cite&gt;, 1998&lt;/li&gt;
  &lt;li value="7"&gt;&lt;cite&gt;Toy Story&lt;/cite&gt;, 1995&lt;/li&gt;
  &lt;li value="6"&gt;&lt;cite&gt;Monsters, Inc&lt;/cite&gt;, 2001&lt;/li&gt;
  &lt;li value="5"&gt;&lt;cite&gt;Cars&lt;/cite&gt;, 2006&lt;/li&gt;
  &lt;li value="4"&gt;&lt;cite&gt;Toy Story 2&lt;/cite&gt;, 1999&lt;/li&gt;
  &lt;li value="3"&gt;&lt;cite&gt;Finding Nemo&lt;/cite&gt;, 2003&lt;/li&gt;
  &lt;li value="2"&gt;&lt;cite&gt;The Incredibles&lt;/cite&gt;, 2004&lt;/li&gt;
  &lt;li value="1"&gt;&lt;cite&gt;Ratatouille&lt;/cite&gt;, 2007&lt;/li&gt;
 &lt;/ol&gt;
&lt;/figure&gt;</pre>

   <p>The markup could also be written as follows, using the <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> attribute on the
   <code><a href=#the-ol-element>ol</a></code> element:</p>

   <pre>&lt;figure&gt;
 &lt;figcaption&gt;The top 10 movies of all time&lt;/figcaption&gt;
 &lt;ol reversed&gt;
  &lt;li&gt;&lt;cite&gt;Josie and the Pussycats&lt;/cite&gt;, 2001&lt;/li&gt;
  &lt;li&gt;&lt;cite lang="sh"&gt;&TScy;&rcy;&ncy;&acy; &mcy;&acy;&chcy;&kcy;&acy;, &bcy;&iecy;&lcy;&icy; &mcy;&acy;&chcy;&ocy;&rcy;&lt;/cite&gt;, 1998&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;A Bug's Life&lt;/cite&gt;, 1998&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;Toy Story&lt;/cite&gt;, 1995&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;Monsters, Inc&lt;/cite&gt;, 2001&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;Cars&lt;/cite&gt;, 2006&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;Toy Story 2&lt;/cite&gt;, 1999&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;Finding Nemo&lt;/cite&gt;, 2003&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;The Incredibles&lt;/cite&gt;, 2004&lt;/li&gt;
  &lt;li&gt;&lt;cite&gt;Ratatouille&lt;/cite&gt;, 2007&lt;/li&gt;
 &lt;/ol&gt;
&lt;/figure&gt;</pre>
  </div>

  <p class=note>While it is conforming to include heading elements
  (e.g. <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) inside <code><a href=#the-li-element>li</a></code> elements, it likely
  does not convey the semantics that the author intended. A heading
  starts a new section, so a heading in a list implicitly splits the
  list into spanning multiple sections.</p>



  <h4 id=the-dl-element><span class=secno>4.5.8 </span>The <dfn><code>dl</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd>If the element's children include at least one name-value group: <a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more groups each consisting of one or more <code><a href=#the-dt-element>dt</a></code> elements followed by one or more <code><a href=#the-dd-element>dd</a></code> elements, optionally intermixed with <a href=#script-supporting-elements>script-supporting elements</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmldlistelement>HTMLDListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLDListElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-dl-element>dl</a></code> element <a href=#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><a href=#the-dt-element>dt</a></code> elements) followed by one or more values
  (<code><a href=#the-dd-element>dd</a></code> elements), ignoring any nodes other than <code><a href=#the-dt-element>dt</a></code> and <code><a href=#the-dd-element>dd</a></code> elements. Within a single <code><a href=#the-dl-element>dl</a></code> element,
  there should not be more than one <code><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><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>

  <div class=impl>

  <p>If a <code><a href=#the-dl-element>dl</a></code> element is empty, it contains no groups.</p>

  <p>If a <code><a href=#the-dl-element>dl</a></code> element has one or more non-<a href=#inter-element-whitespace title="inter-element whitespace">whitespace</a> <code><a href=#text>Text</a></code>
  node children, or has child elements that are neither
  <code><a href=#the-dt-element>dt</a></code> nor <code><a href=#the-dd-element>dd</a></code> elements, all such
  <code><a href=#text>Text</a></code> nodes and elements, as well as their descendants
  (including any <code><a href=#the-dt-element>dt</a></code> or <code><a href=#the-dd-element>dd</a></code> elements), do not
  form part of any groups in that <code><a href=#the-dl-element>dl</a></code>.</p>

  <p>If a <code><a href=#the-dl-element>dl</a></code> element has one or more <code><a href=#the-dt-element>dt</a></code>
  element children but no <code><a href=#the-dd-element>dd</a></code> element children, then it
  consists of one group with names but no values.</p>

  <p>If a <code><a href=#the-dl-element>dl</a></code> element has one or more <code><a href=#the-dd-element>dd</a></code>
  element children but no <code><a href=#the-dt-element>dt</a></code> element children, then it
  consists of one group with values but no names.</p>

  <p>If a <code><a href=#the-dl-element>dl</a></code> element's first <code><a href=#the-dt-element>dt</a></code> or
  <code><a href=#the-dd-element>dd</a></code> element child is a <code><a href=#the-dd-element>dd</a></code> element, then the
  first group has no associated name.</p>

  <p>If a <code><a href=#the-dl-element>dl</a></code> element's last <code><a href=#the-dt-element>dt</a></code> or
  <code><a href=#the-dd-element>dd</a></code> element child is a <code><a href=#the-dt-element>dt</a></code> element, then the
  last group has no associated value.</p>

  <p class=note>When a <code><a href=#the-dl-element>dl</a></code> element doesn't match its
  content model, it is often due to accidentally using <code><a href=#the-dd-element>dd</a></code>
  elements in the place of <code><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>

  <div class=example>
   <p>In the following example, one entry ("Authors") is linked to two
   values ("John" and "Luke").</p>
   <pre>&lt;dl&gt;
 &lt;dt&gt; Authors
 &lt;dd&gt; John
 &lt;dd&gt; Luke
 &lt;dt&gt; Editor
 &lt;dd&gt; Frank
&lt;/dl&gt;</pre>
  </div>

  <div class=example>
   <p>In the following example, one definition is linked to two
   terms.</p>
   <pre>&lt;dl&gt;
 &lt;dt lang="en-US"&gt; &lt;dfn&gt;color&lt;/dfn&gt; &lt;/dt&gt;
 &lt;dt lang="en-GB"&gt; &lt;dfn&gt;colour&lt;/dfn&gt; &lt;/dt&gt;
 &lt;dd&gt; 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. &lt;/dd&gt;
&lt;/dl&gt;</pre>
  </div>

  <div class=example>
   <p>The following example illustrates the use of the <code><a href=#the-dl-element>dl</a></code>
   element to mark up metadata of sorts. At the end of the example,
   one group has two metadata labels ("Authors" and "Editors") and two
   values ("Robert Rothman" and "Daniel Jackson").</p>
   <pre>&lt;dl&gt;
 &lt;dt&gt; Last modified time &lt;/dt&gt;
 &lt;dd&gt; 2004-12-23T23:33Z &lt;/dd&gt;
 &lt;dt&gt; Recommended update interval &lt;/dt&gt;
 &lt;dd&gt; 60s &lt;/dd&gt;
 &lt;dt&gt; Authors &lt;/dt&gt;
 &lt;dt&gt; Editors &lt;/dt&gt;
 &lt;dd&gt; Robert Rothman &lt;/dd&gt;
 &lt;dd&gt; Daniel Jackson &lt;/dd&gt;
&lt;/dl&gt;</pre>
  </div>

  <div class=example>

   <p>The following example shows the <code><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>&lt;p&gt;Determine the victory points as follows (use the
first matching case):&lt;/p&gt;
&lt;dl&gt;
 &lt;dt&gt; If you have exactly five gold coins &lt;/dt&gt;
 &lt;dd&gt; You get five victory points &lt;/dd&gt;
 &lt;dt&gt; If you have one or more gold coins, and you have one or more silver coins &lt;/dt&gt;
 &lt;dd&gt; You get two victory points &lt;/dd&gt;
 &lt;dt&gt; If you have one or more silver coins &lt;/dt&gt;
 &lt;dd&gt; You get one victory point &lt;/dd&gt;
 &lt;dt&gt; Otherwise &lt;/dt&gt;
 &lt;dd&gt; You get no victory points &lt;/dd&gt;
&lt;/dl&gt;</pre>
  </div>

  <div class=example>
   <p>The following snippet shows a <code><a href=#the-dl-element>dl</a></code> element being used
   as a glossary. Note the use of <code><a href=#the-dfn-element>dfn</a></code> to indicate the
   word being defined.</p>
   <pre>&lt;dl&gt;
 &lt;dt&gt;&lt;dfn&gt;Apartment&lt;/dfn&gt;, n.&lt;/dt&gt;
 &lt;dd&gt;An execution context grouping one or more threads with one or
 more COM objects.&lt;/dd&gt;
 &lt;dt&gt;&lt;dfn&gt;Flat&lt;/dfn&gt;, n.&lt;/dt&gt;
 &lt;dd&gt;A deflated tire.&lt;/dd&gt;
 &lt;dt&gt;&lt;dfn&gt;Home&lt;/dfn&gt;, n.&lt;/dt&gt;
 &lt;dd&gt;The user's login directory.&lt;/dd&gt;
&lt;/dl&gt;</pre>
  </div>

  <p class=note>The <code><a href=#the-dl-element>dl</a></code> element is inappropriate for
  marking up dialogue. <a href=#conversations>Examples of how to
  mark up dialogue</a> are shown below.</p>



  <h4 id=the-dt-element><span class=secno>4.5.9 </span>The <dfn><code>dt</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Before <code><a href=#the-dd-element>dd</a></code> or <code><a href=#the-dt-element>dt</a></code> elements inside <code><a href=#the-dl-element>dl</a></code> elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, <a href=#sectioning-content>sectioning content</a>, or <a href=#heading-content>heading content</a> descendants.</dd>
   
   <dd>A <code><a href=#the-dt-element>dt</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-dt-element>dt</a></code> element is immediately followed by another <code><a href=#the-dt-element>dt</a></code> element or a
   <code><a href=#the-dd-element>dd</a></code> element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-dt-element>dt</a></code> element <a href=#represents>represents</a> the term, or
  name, part of a term-description group in a description list
  (<code><a href=#the-dl-element>dl</a></code> element).</p>

  <p class=note>The <code><a href=#the-dt-element>dt</a></code> element itself, when used in a
  <code><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><a href=#the-dfn-element>dfn</a></code> element.</p>

  <div class=example>

   <p>This example shows a list of frequently asked questions (a FAQ)
   marked up using the <code><a href=#the-dt-element>dt</a></code> element for questions and the
   <code><a href=#the-dd-element>dd</a></code> element for answers.</p>

   <pre>&lt;article&gt;
 &lt;h1&gt;FAQ&lt;/h1&gt;
 &lt;dl&gt;
  &lt;dt&gt;What do we want?&lt;/dt&gt;
  &lt;dd&gt;Our data.&lt;/dd&gt;
  &lt;dt&gt;When do we want it?&lt;/dt&gt;
  &lt;dd&gt;Now.&lt;/dd&gt;
  &lt;dt&gt;Where is it?&lt;/dt&gt;
  &lt;dd&gt;We are not sure.&lt;/dd&gt;
 &lt;/dl&gt;
&lt;/article&gt;</pre>

  </div>



  <h4 id=the-dd-element><span class=secno>4.5.10 </span>The <dfn><code>dd</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>After <code><a href=#the-dt-element>dt</a></code> or <code><a href=#the-dd-element>dd</a></code> elements inside <code><a href=#the-dl-element>dl</a></code> elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>A <code><a href=#the-dd-element>dd</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-dd-element>dd</a></code> element is immediately followed by another <code><a href=#the-dd-element>dd</a></code> element or a
   <code><a href=#the-dt-element>dt</a></code> element, or if there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-dd-element>dd</a></code> element <a href=#represents>represents</a> the
  description, definition, or value, part of a term-description group
  in a description list (<code><a href=#the-dl-element>dl</a></code> element).</p>

  <div class=example>

   <p>A <code><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><a href=#the-dt-element>dt</a></code> with a <code><a href=#the-dfn-element>dfn</a></code>, has several
   <code><a href=#the-dd-element>dd</a></code>s, showing the various parts of the definition.</p>

   <!-- the actual pronunciations below are nonsense. -->
   <pre>&lt;dl&gt;
 &lt;dt&gt;&lt;dfn&gt;happiness&lt;/dfn&gt;&lt;/dt&gt;
 &lt;dd class="pronunciation"&gt;/'h&aelig; p. nes/&lt;/dd&gt;
 &lt;dd class="part-of-speech"&gt;&lt;i&gt;&lt;abbr&gt;n.&lt;/abbr&gt;&lt;/i&gt;&lt;/dd&gt;
 &lt;dd&gt;The state of being happy.&lt;/dd&gt;
 &lt;dd&gt;Good fortune; success. &lt;q&gt;Oh &lt;b&gt;happiness&lt;/b&gt;! It worked!&lt;/q&gt;&lt;/dd&gt;
 &lt;dt&gt;&lt;dfn&gt;rejoice&lt;/dfn&gt;&lt;/dt&gt;
 &lt;dd class="pronunciation"&gt;/ri jois'/&lt;/dd&gt;
 &lt;dd&gt;&lt;i class="part-of-speech"&gt;&lt;abbr&gt;v.intr.&lt;/abbr&gt;&lt;/i&gt; To be delighted oneself.&lt;/dd&gt;
 &lt;dd&gt;&lt;i class="part-of-speech"&gt;&lt;abbr&gt;v.tr.&lt;/abbr&gt;&lt;/i&gt; To cause one to be delighted.&lt;/dd&gt;
&lt;/dl&gt;</pre>
  </div>


  <h4 id=the-figure-element><span class=secno>4.5.11 </span>The <dfn><code>figure</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Either: One <code><a href=#the-figcaption-element>figcaption</a></code> element followed by <a href=#flow-content>flow content</a>.</dd>
   <dd>Or: <a href=#flow-content>Flow content</a> followed by one <code><a href=#the-figcaption-element>figcaption</a></code> element.</dd>
   <dd>Or: <a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><!-- v2: Add a <credit> element for photo credits --><p>The <code><a href=#the-figure-element>figure</a></code> element <a href=#represents>represents</a> some <a href=#flow-content>flow content</a>,
  optionally with a caption, that is self-contained (like a complete sentence) and is typically
  referenced as a single unit from the main flow of the document.</p>

  <p class=note>Self-contained in this context does not necessarily mean independent. For example,
  each sentence in a paragraph is self-contained; an image that is part of a sentence would be
  inappropriate for <code><a href=#the-figure-element>figure</a></code>, but an entire sentence made of images would be fitting.</p>

  <p>The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc.</p>

  <div class=note>

   <p>When a <code><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><a href=#the-figure-element>figure</a></code> element is referenced by its relative position, e.g. "in the
   photograph above" or "as the next figure shows", then moving the figure would disrupt the page's
   meaning. Authors are encouraged to consider using labels to refer to figures, rather than using
   such relative references, so that the page can easily be restyled without affecting the page's
   meaning.</p>

  </div>

  <p>The <span class=impl>first</span> <code><a href=#the-figcaption-element>figcaption</a></code> element child of the element, if
  any, represents the caption of the <code><a href=#the-figure-element>figure</a></code> element's contents. If there is no child
  <code><a href=#the-figcaption-element>figcaption</a></code> element, then there is no caption.</p>

  <p>A <code><a href=#the-figure-element>figure</a></code> element's contents are part of the surrounding flow. If the purpose of
  the page is to display the figure, for example a photograph on an image sharing site, the
  <code><a href=#the-figure-element>figure</a></code> and <code><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><a href=#the-aside-element>aside</a></code> element should be used (and can itself
  wrap a <code><a href=#the-figure-element>figure</a></code>). For example, a pull quote that repeats content from an
  <code><a href=#the-article-element>article</a></code> would be more appropriate in an <code><a href=#the-aside-element>aside</a></code> than in a
  <code><a href=#the-figure-element>figure</a></code>, because it isn't part of the content, it's a repetition of the content for
  the purposes of enticing readers or highlighting key topics.</p>

  <div class=example>

   <p>This example shows the <code><a href=#the-figure-element>figure</a></code> element to mark up a code listing.</p>

   <pre>&lt;p&gt;In &lt;a href="#l4"&gt;listing 4&lt;/a&gt; we see the primary core interface
API declaration.&lt;/p&gt;
&lt;figure id="l4"&gt;
 &lt;figcaption&gt;Listing 4. The primary core interface API declaration.&lt;/figcaption&gt;
 &lt;pre&gt;&lt;code&gt;interface PrimaryCore {
 boolean verifyDataLine();
 void sendData(in sequence&amp;lt;byte&gt; data);
 void initSelfDestruct();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/figure&gt;
&lt;p&gt;The API is designed to use UTF-8.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>Here we see a <code><a href=#the-figure-element>figure</a></code> element to mark up a photo.</p>

   <pre>&lt;figure&gt;
 &lt;img src="bubbles-work.jpeg"
      alt="Bubbles, sitting in his office chair, works on his
           latest project intently."&gt;
 &lt;figcaption&gt;Bubbles at work&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>In this example, we see an image that is <em>not</em> a figure, as well as an image and a
   video that are. The first image is literally part of the example's second sentence, so it's not a
   self-contained unit, and thus <code><a href=#the-figure-element>figure</a></code> would be inappropriate.</p>

   <pre>&lt;h2&gt;Malinko's comics&lt;/h2&gt;

&lt;p&gt;This case centered on some sort of "intellectual property"
infringement related to a comic (see Exhibit A). The suit started
after a trailer ending with these words:

&lt;blockquote&gt;
 &lt;img src="promblem-packed-action.png" alt="ROUGH COPY! Promblem-Packed Action!"&gt;
&lt;/blockquote&gt;

&lt;p&gt;...was aired. A lawyer, armed with a Bigger Notebook, launched a
preemptive strike using snowballs. A complete copy of the trailer is
included with Exhibit B.

&lt;figure&gt;
 &lt;img src="ex-a.png" alt="Two squiggles on a dirty piece of paper."&gt;
 &lt;figcaption&gt;Exhibit A. The alleged &lt;cite&gt;rough copy&lt;/cite&gt; comic.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
 &lt;video src="ex-b.mov"&gt;&lt;/video&gt;
 &lt;figcaption&gt;Exhibit B. The &lt;cite&gt;Rough Copy&lt;/cite&gt; trailer.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The case was resolved out of court.</pre>

  </div>

  <div class=example>

   <p>Here, a part of a poem is marked up using <code><a href=#the-figure-element>figure</a></code>.</p>

   <pre>&lt;figure&gt;
 &lt;p&gt;'Twas brillig, and the slithy toves&lt;br&gt;
 Did gyre and gimble in the wabe;&lt;br&gt;
 All mimsy were the borogoves,&lt;br&gt;
 And the mome raths outgrabe.&lt;/p&gt;
 &lt;figcaption&gt;&lt;cite&gt;Jabberwocky&lt;/cite&gt; (first verse). Lewis Carroll, 1832-98&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>In this example, which could be part of a much larger work discussing a castle, nested
   <code><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>&lt;figure&gt;
 &lt;figcaption&gt;The castle through the ages: 1423, 1858, and 1999 respectively.&lt;/figcaption&gt;
 &lt;figure&gt;
  &lt;figcaption&gt;Etching. Anonymous, ca. 1423.&lt;/figcaption&gt;
  &lt;img src="castle1423.jpeg" alt="The castle has one tower, and a tall wall around it."&gt;
 &lt;/figure&gt;
 &lt;figure&gt;
  &lt;figcaption&gt;Oil-based paint on canvas. Maria Towle, 1858.&lt;/figcaption&gt;
  &lt;img src="castle1858.jpeg" alt="The castle now has two towers and two walls."&gt;
 &lt;/figure&gt;
 &lt;figure&gt;
  &lt;figcaption&gt;Film photograph. Peter Jankle, 1999.&lt;/figcaption&gt;
  &lt;img src="castle1999.jpeg" alt="The castle lies in ruins, the original tower all that remains in one piece."&gt;
 &lt;/figure&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>The previous example could also be more succintly written as follows (using <code title=attr-title><a href=#attr-title>title</a></code> attributes in place of the nested
   <code><a href=#the-figure-element>figure</a></code>/<code><a href=#the-figcaption-element>figcaption</a></code> pairs):</p>

   <pre>&lt;figure&gt;
 &lt;img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
      alt="The castle has one tower, and a tall wall around it."&gt;
 &lt;img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
      alt="The castle now has two towers and two walls."&gt;
 &lt;img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
      alt="The castle lies in ruins, the original tower all that remains in one piece."&gt;
 &lt;figcaption&gt;The castle through the ages: 1423, 1858, and 1999 respectively.&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>


  <h4 id=the-figcaption-element><span class=secno>4.5.12 </span>The <dfn><code>figcaption</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the first or last child of a <code><a href=#the-figure-element>figure</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-figcaption-element>figcaption</a></code> element <a href=#represents>represents</a> a caption or legend for the rest of
  the contents of the <code><a href=#the-figcaption-element>figcaption</a></code> element's parent <code><a href=#the-figure-element>figure</a></code> element<span class=impl>, if any</span>.</p>



  <h4 id=the-main-element><span class=secno>4.5.13 </span>The <dfn><code>main</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><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>represents</a> its children.</p>

  <p class=note>The <code><a href=#the-main-element>main</a></code> element is distinct from the <code><a href=#the-section-element>section</a></code> and
  <code><a href=#the-article-element>article</a></code> elements in that the <code><a href=#the-main-element>main</a></code> element does not contribute to the
  document <a href=#outline>outline</a>.</p>

  <div class=example>

   <p>In this example, the author has used a presentation where each component of the page is
   rendered in a box. To wrap the main content of the page (as opposed to the header, the footer,
   the navigation bar, and a sidebar), the <code><a href=#the-main-element>main</a></code> element is used.</p>

   <pre>&lt;!DOCTYPE html&gt;
&lt;title&gt;RPG System 17&lt;/title&gt;
&lt;style&gt;
 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; }
&lt;/style&gt;
&lt;header&gt;
 &lt;h1&gt;System Eighteen&lt;/h1&gt;
&lt;/header&gt;
&lt;nav&gt;
 &lt;a href="../16/"&gt;&slarr; System 17&lt;/a&gt;
 &lt;a href="../18/"&gt;RPXIX &srarr;&lt;/a&gt;
&lt;/nav&gt;
&lt;aside&gt;
 &lt;p&gt;This system has no HP mechanic, so there's no healing.
&lt;/aside&gt;
&lt;main&gt;
 &lt;h2&gt;Character creation&lt;/h2&gt;
 &lt;p&gt;Attributes (magic, strength, agility) are purchased at the cost of one point per level.&lt;/p&gt;
 &lt;h2&gt;Rolls&lt;/h2&gt;
 &lt;p&gt;Each encounter, roll the dice for all your skills. If you roll more than the opponent, you win.&lt;/p&gt;
&lt;/main&gt;
&lt;footer&gt;
 &lt;p&gt;Copyright &copy; 2013
&lt;/footer&gt;</pre>

  </div>



  <h4 id=the-div-element><span class=secno>4.5.14 </span>The <dfn><code>div</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmldivelement>HTMLDivElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLDivElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-div-element>div</a></code> element has no special meaning at all. It
  <a href=#represents>represents</a> its children. It can be used with the <code title=attr-class><a href=#classes>class</a></code>, <code title=attr-lang><a href=#attr-lang>lang</a></code>, and <code title=attr-title><a href=#attr-title>title</a></code> attributes to mark up semantics
  common to a group of consecutive elements.</p>

  <p class=note>Authors are strongly encouraged to view the
  <code><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><a href=#the-div-element>div</a></code> element leads to better accessibility for
  readers and easier maintainability for authors.</p>

  <div class=example>

   <p>For example, a blog post would be marked up using
   <code><a href=#the-article-element>article</a></code>, a chapter using <code><a href=#the-section-element>section</a></code>, a
   page's navigation aids using <code><a href=#the-nav-element>nav</a></code>, and a group of form
   controls using <code><a href=#the-fieldset-element>fieldset</a></code>.</p>

   <p>On the other hand, <code><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><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>&lt;article lang="en-US"&gt;
 &lt;h1&gt;My use of language and my cats&lt;/h1&gt;
 &lt;p&gt;My cat's behavior hasn't changed much since her absence, except
 that she plays her new physique to the neighbors regularly, in an
 attempt to get pets.&lt;/p&gt;
 &lt;div lang="en-GB"&gt;
  &lt;p&gt;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.&lt;/p&gt;
  &lt;p&gt;Hm, I just noticed that in the last paragraph I used British
  English. But I'm supposed to write in American English. So I
  shouldn't say "pavement" or "flat" or "colour"...&lt;/p&gt;
 &lt;/div&gt;
 &lt;p&gt;I should say "sidewalk" and "apartment" and "color"!&lt;/p&gt;
&lt;/article&gt;</pre>

  </div>


  <h3 id=text-level-semantics><span class=secno>4.6 </span>Text-level semantics</h3>

  <h4 id=the-a-element><span class=secno>4.6.1 </span>The <dfn><code>a</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#transparent>Transparent</a>, but there must be no <a href=#interactive-content>interactive content</a> descendant.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> &mdash; Address of the <a href=#hyperlink>hyperlink</a></dd>
   <dd><code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> &mdash; <a href=#browsing-context>Browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a></dd>
   <dd><code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> &mdash; Whether to download the resource instead of navigating to it, and its file name if so</dd>
   <dd><code title=attr-hyperlink-ping><a href=#ping>ping</a></code> &mdash; <a href=#url title=URL>URLs</a> to ping</dd>
   <dd><code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> &mdash; Relationship between the document containing the hyperlink and the destination resource</dd>
   <dd><code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code> &mdash; Language of the linked resource</dd>
   <dd><code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> &mdash; Hint for the type of the referenced resource</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlanchorelement>HTMLAnchorElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-a-target title=dom-a-target>target</a>;
           attribute DOMString <a href=#dom-a-download title=dom-a-download>download</a>;
           attribute DOMString <a href=#dom-a-ping title=dom-a-ping>ping</a>;
           attribute DOMString <a href=#dom-a-rel title=dom-a-rel>rel</a>;
  readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-a-rellist title=dom-a-relList>relList</a>;
           attribute DOMString <a href=#dom-a-hreflang title=dom-a-hreflang>hreflang</a>;
           attribute DOMString <a href=#dom-a-type title=dom-a-type>type</a>;

           attribute DOMString <a href=#dom-a-text title=dom-a-text>text</a>;

  // <a href="#HTMLAnchorElement-partial">also has obsolete members</a>
};
<a href=#htmlanchorelement>HTMLAnchorElement</a> implements <a href=#urlutils>URLUtils</a>;</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>If the <code><a href=#the-a-element>a</a></code> element has an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute,
  then it <a href=#represents>represents</a> a <a href=#hyperlink>hyperlink</a> (a hypertext anchor) labeled by its
  contents.</p>

  <!-- v2: Eric Meyer requests the ability to nest links so that a big hyperlink, e.g. representing
  a calendar event, can be clickable, while within it there are subareas that represent links to
  distinct areas, e.g. a link to see photos of the event, or to edit the event, or some such. -->

  <p>If the <code><a href=#the-a-element>a</a></code> element has no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute,
  then the element <a href=#represents>represents</a> a placeholder for where a link might otherwise have been
  placed, if it had been relevant, consisting of just the element's contents.</p>

  <p>The <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>, <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>, <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>,
  <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
  attributes must be omitted if the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute is not
  present.</p>

  <p>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an <code><a href=#the-a-element>a</a></code> element,
  then the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute must also be specified.</p>

  <div class=example>

   <p>If a site uses a consistent navigation toolbar on every page, then the link that would
   normally link to the page itself could be marked up using an <code><a href=#the-a-element>a</a></code> element:</p>

   <pre>&lt;nav&gt;
 &lt;ul&gt;
  &lt;li&gt; &lt;a href="/"&gt;Home&lt;/a&gt; &lt;/li&gt;
  &lt;li&gt; &lt;a href="/news"&gt;News&lt;/a&gt; &lt;/li&gt;
  &lt;li&gt; &lt;a&gt;Examples&lt;/a&gt; &lt;/li&gt;
  &lt;li&gt; &lt;a href="/legal"&gt;Legal&lt;/a&gt; &lt;/li&gt;
 &lt;/ul&gt;
&lt;/nav&gt;</pre>

  </div>

  <div class=impl>

  <p>The <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>, <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>, <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>, and <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>
  attributes affect what happens when users <a href=#following-hyperlinks title="following hyperlinks">follow
  hyperlinks</a> or <a href=#downloading-hyperlinks title="downloading hyperlinks">download hyperlinks</a> created using
  the <code><a href=#the-a-element>a</a></code> element. The <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
  attributes may be used to indicate to the user the likely nature of the target resource before the
  user follows the link.</p>

  <p>The <a href=#activation-behavior>activation behavior</a> of <code><a href=#the-a-element>a</a></code> elements that create <a href=#hyperlink title=hyperlink>hyperlinks</a> is to run the following steps:</p>

  <ol><!-- c.f. <area>'s similar section --><li><p>If the <code><a href=#the-a-element>a</a></code> element's <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully active</a>, then abort these steps.</li>
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2033 -->
   <!-- http://www.hixie.ch/tests/adhoc/html/navigation/iframe/002.html -->

   <li>

    <p>If either the <code><a href=#the-a-element>a</a></code> element has a <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute and the algorithm is not <a href=#allowed-to-show-a-popup>allowed
    to show a popup</a>, or the element's <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>
    attribute is present and applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
    browsing context name</a>, using the value of the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name, would result
    in there not being a chosen browsing context, then run these substeps:</p>

    <ol><li><p>If there is an <a href=#entry-script>entry script</a>, throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.</li>

     <li><p>Abort these steps without following the hyperlink.</li>

    </ol></li>

   <li><p>If the target of the <code title=event-click><a href=#event-click>click</a></code> event is an <code><a href=#the-img-element>img</a></code>
   element with an <code title=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><!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A...%3Ca%20href%3D%22%23%22%3E%3Cimg%20ismap%20usemap%3D%22%23a%22%20src%3D/resources/images/smallcats%3E%3C/a%3E%0A%3Cmap%20name%3Da%3E%3Carea%20shape%3Drect%20coords%3D0%2C0%2C50%2C50%20href%3Db%3E%3C/map%3E --><li>If the <code title=event-click><a href=#event-click>click</a></code> event was a real pointing-device-triggered
     <code title=event-click><a href=#event-click>click</a></code> event on the <code><a href=#the-img-element>img</a></code> element, then let <var title="">x</var> be the distance in CSS pixels from the left edge of the image's left border,
     if it has one, or the left edge of the image otherwise, to the location of the click, and let
     <var title="">y</var> be the distance in CSS pixels from the top edge of the image's top
     border, if it has one, or the top edge of the image otherwise, to the location of the click.
     Otherwise, let <var title="">x</var> and <var title="">y</var> be zero.</li>

     <li>Let the <dfn id=hyperlink-suffix><var>hyperlink suffix</var></dfn> be a U+003F QUESTION MARK character, the
     value of <var title="">x</var> expressed as a base-ten integer using <a href=#ascii-digits>ASCII digits</a>,
     a U+002C COMMA character (,), and the value of <var title="">y</var> expressed as a base-ten
     integer using <a href=#ascii-digits>ASCII digits</a>.</li>

    </ol></li>

   <li><p>Finally, the user agent must <a href=#following-hyperlinks title="following hyperlinks">follow the
   hyperlink</a> or <a href=#downloading-hyperlinks title="downloading hyperlinks">download the hyperlink</a> created by
   the <code><a href=#the-a-element>a</a></code> element, as determined by the <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute and any expressed user preference. If
   the steps above defined a <var><a href=#hyperlink-suffix>hyperlink suffix</a></var>, then take that into account when following
   or downloading the hyperlink.</li>

  </ol></div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">a</var> . <code title=dom-a-text><a href=#dom-a-text>text</a></code></dt>

   <dd>

    <p>Same as <code><a href=#textcontent>textContent</a></code>.</p>

   </dd>

  </dl><div class=impl>

  <p>The IDL attributes <dfn id=dom-a-download title=dom-a-download><code>download</code></dfn>, <dfn id=dom-a-ping title=dom-a-ping><code>ping</code></dfn>, <dfn id=dom-a-target title=dom-a-target><code>target</code></dfn>,
  <dfn id=dom-a-rel title=dom-a-rel><code>rel</code></dfn>, <dfn id=dom-a-hreflang title=dom-a-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-a-type title=dom-a-type><code>type</code></dfn>, must <a href=#reflect>reflect</a> the respective content
  attributes of the same name.</p>

  <p>The IDL attribute <dfn id=dom-a-rellist title=dom-a-rellist><code>relList</code></dfn> must
  <a href=#reflect>reflect</a> the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> content attribute.</p>

  <p>The <dfn id=dom-a-text title=dom-a-text><code>text</code></dfn> IDL attribute, on getting, must return the
  same value as the <code><a href=#textcontent>textContent</a></code> IDL attribute on the element, and on setting, must act
  as if the <code><a href=#textcontent>textContent</a></code> IDL attribute on the element had been set to the new value.</p>

  <hr><!-- concept-uu --><p>The <code><a href=#the-a-element>a</a></code> element also supports the <code><a href=#urlutils>URLUtils</a></code> interface. <a href=#refsURL>[URL]</a></p>

  <p>When the element is created, and whenever the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute is set, changed, or removed, the user
  agent must invoke the element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-set-the-input title=concept-uu-set-the-input>set the input</a> algorithm with the value of the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute, if any, or the empty string otherwise,
  as the given value.</p>

  <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base title=concept-uu-get-the-base>get the
  base</a> algorithm must simply return <a href="#the-element's-base-url">the element's base URL</a>.</p>

  <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding title=concept-uu-query-encoding>query
  encoding</a> is the <a href="#document's-character-encoding">document's character encoding</a>.</p>

  <p>When the element's <code><a href=#urlutils>URLUtils</a></code> interface invokes its <a href=#concept-uu-update title=concept-uu-update>update steps</a> with a string <var title="">value</var>, the user
  agent must set the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute to
  the string <var title="">value</var>.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>The <code><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>&lt;aside class="advertising"&gt;
 &lt;h1&gt;Advertising&lt;/h1&gt;
 &lt;a href="http://ad.example.com/?adid=1929&amp;amp;pubid=1422"&gt;
  &lt;section&gt;
   &lt;h1&gt;Mellblomatic 9000!&lt;/h1&gt;
   &lt;p&gt;Turn all your widgets into mellbloms!&lt;/p&gt;
   &lt;p&gt;Only $9.99 plus shipping and handling.&lt;/p&gt;
  &lt;/section&gt;
 &lt;/a&gt;
 &lt;a href="http://ad.example.com/?adid=375&amp;amp;pubid=1422"&gt;
  &lt;section&gt;
   &lt;h1&gt;The Mellblom Browser&lt;/h1&gt;
   &lt;p&gt;Web browsing at the speed of light.&lt;/p&gt;
   &lt;p&gt;No other browser goes faster!&lt;/p&gt;
  &lt;/section&gt;
 &lt;/a&gt;
&lt;/aside&gt;</pre>

  </div>


  <h4 id=the-em-element><span class=secno>4.6.2 </span>The <dfn><code>em</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-em-element>em</a></code> element <a href=#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><a href=#the-em-element>em</a></code> elements.</p>

  <p>The placement of stress emphasis changes the meaning of the sentence. The element thus forms an
  integral part of the content. The precise way in which stress is used in this way depends on the
  language.</p>

  <div class=example>

   <p>These examples show how changing the stress emphasis changes the meaning. First, a general
   statement of fact, with no stress:</p>

   <pre>&lt;p&gt;Cats are cute animals.&lt;/p&gt;</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>&lt;p&gt;&lt;em&gt;Cats&lt;/em&gt; are cute animals.&lt;/p&gt;</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>&lt;p&gt;Cats &lt;em&gt;are&lt;/em&gt; cute animals.&lt;/p&gt;</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>&lt;p&gt;Cats are &lt;em&gt;cute&lt;/em&gt; animals.&lt;/p&gt;</pre>

   <p>Similarly, if someone asserted that cats were vegetables, someone correcting this might
   emphasize the last word:</p>

   <pre>&lt;p&gt;Cats are cute &lt;em&gt;animals&lt;/em&gt;.&lt;/p&gt;</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>&lt;p&gt;&lt;em&gt;Cats are cute animals!&lt;/em&gt;&lt;/p&gt;</pre>

   <p>Anger mixed with emphasizing the cuteness could lead to markup such as:</p>

   <pre>&lt;p&gt;&lt;em&gt;Cats are &lt;em&gt;cute&lt;/em&gt; animals!&lt;/em&gt;&lt;/p&gt;</pre>

  </div>

  <div class=note>

   <p>The <code><a href=#the-em-element>em</a></code> element isn't a generic "italics" element. Sometimes, text is intended to
   stand out from the rest of the paragraph, as if it was in a different mood or voice. For this,
   the <code><a href=#the-i-element>i</a></code> element is more appropriate.</p>

   <p>The <code><a href=#the-em-element>em</a></code> element also isn't intended to convey importance; for that purpose, the
   <code><a href=#the-strong-element>strong</a></code> element is more appropriate.</p>

   <!--

    Thus the following is a bad use of <em>:

      <p><em>Note</em>: ...</p>

    You should use <strong> or <i> for this instead (depending on
    exactly what you're doing).

   -->

  </div>



  <h4 id=the-strong-element><span class=secno>4.6.3 </span>The <dfn><code>strong</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-strong-element>strong</a></code> element <a href=#represents>represents</a> strong
  importance for its contents.</p>

  <p>The relative level of importance of a piece of content is given
  by its number of ancestor <code><a href=#the-strong-element>strong</a></code> elements; each
  <code><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><a href=#the-strong-element>strong</a></code> element does not change the meaning of the
  sentence.</p>

  <div class=example>
   <p>Here is an example of a warning notice in a game, with the
   various parts marked up according to how important they are:</p>
   <!-- DO NOT REFLOW THIS EXAMPLE it has been carefully balanced -->
   <pre>&lt;p&gt;&lt;strong&gt;Warning.&lt;/strong&gt; This dungeon is dangerous.
&lt;strong&gt;Avoid the ducks.&lt;/strong&gt; Take any gold you find.
&lt;strong&gt;&lt;strong&gt;Do not take any of the diamonds&lt;/strong&gt;,
they are explosive and &lt;strong&gt;will destroy anything within
ten meters.&lt;/strong&gt;&lt;/strong&gt; You have been warned.&lt;/p&gt;</pre>
  </div>


  <h4 id=the-small-element><span class=secno>4.6.4 </span>The <dfn><code>small</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-small-element>small</a></code> element <a href=#represents>represents</a> side
  comments such as small print.</p>

  <p class=note>Small print typically features disclaimers, caveats,
  legal restrictions, or copyrights. Small print is also sometimes
  used for attribution, or for satisfying licensing requirements.</p>

  <p class=note>The <code><a href=#the-small-element>small</a></code> element does not
  "de-emphasize" or lower the importance of text emphasized by the
  <code><a href=#the-em-element>em</a></code> element or marked as important with the
  <code><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><a href=#the-em-element>em</a></code> or
  <code><a href=#the-strong-element>strong</a></code> elements respectively.</p>

  <p>The <code><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><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><a href=#the-small-element>small</a></code> element must not be used for subheadings; for that purpose, use the
  <code><a href=#the-hgroup-element>hgroup</a></code> element.</p>

  <div class=example>

   <p>In this example, the <code><a href=#the-small-element>small</a></code> element is used to
   indicate that value-added tax is not included in a price of a hotel
   room:</p>

   <pre class=example>&lt;dl&gt;
 &lt;dt&gt;Single room
 &lt;dd&gt;199 &euro; &lt;small&gt;breakfast included, VAT not included&lt;/small&gt;
 &lt;dt&gt;Double room
 &lt;dd&gt;239 &euro; &lt;small&gt;breakfast included, VAT not included&lt;/small&gt;
&lt;/dl&gt;</pre>

  </div>

  <div class=example>

   <p>In this second example, the <code><a href=#the-small-element>small</a></code> element is used
   for a side comment in an article.</p>

   <pre>&lt;p&gt;Example Corp today announced record profits for the
second quarter &lt;small&gt;(Full Disclosure: Foo News is a subsidiary of
Example Corp)&lt;/small&gt;, leading to speculation about a third quarter
merger with Demo Group.&lt;/p&gt;</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>&lt;aside&gt;
 &lt;h1&gt;Example Corp&lt;/h1&gt;
 &lt;p&gt;This company mostly creates small software and Web
 sites.&lt;/p&gt;
 &lt;p&gt;The Example Corp company mission is "To provide entertainment
 and news on a sample basis".&lt;/p&gt;
 &lt;p&gt;&lt;small&gt;Information obtained from &lt;a
 href="http://example.com/about.html"&gt;example.com&lt;/a&gt; home
 page.&lt;/small&gt;&lt;/p&gt;
&lt;/aside&gt;</pre>

  </div>

  <div class=example>

   <p>In this last example, the <code><a href=#the-small-element>small</a></code> element is marked
   as being <em>important</em> small print.</p>

   <pre>&lt;p&gt;&lt;strong&gt;&lt;small&gt;Continued use of this service will result in a kiss.&lt;/small&gt;&lt;/strong&gt;&lt;/p&gt;</pre>

  </div>


  <h4 id=the-s-element><span class=secno>4.6.5 </span>The <dfn><code>s</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-s-element>s</a></code> element <a href=#represents>represents</a> contents that
  are no longer accurate or no longer relevant.</p>

  <p class=note>The <code><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><a href=#the-del-element>del</a></code> element.</p>

  <div class=example>

   <p>In this example a recommended retail price has been marked as no
   longer relevant as the product in question has a new sale
   price.</p>

   <pre>&lt;p&gt;Buy our Iced Tea and Lemonade!&lt;/p&gt;
&lt;p&gt;&lt;s&gt;Recommended retail price: $3.99 per bottle&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Now selling for just $2.99 a bottle!&lt;/strong&gt;&lt;/p&gt;</pre>

  </div>


  <h4 id=the-cite-element><span class=secno>4.6.6 </span>The <dfn><code>cite</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-cite-element>cite</a></code> element <a href=#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,
  etc). This can be a work that is being quoted or
  referenced in detail (i.e. a citation), or it can just be a work
  that is mentioned in passing.</p>

  <p>A person's name is not the title of a work &mdash; even if people
  call that person a piece of work &mdash; and the element must
  therefore not be used to mark up people's names. (In some cases, the
  <code><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><a href=#the-span-element>span</a></code> element can be used.)</p>

<!--(some people argue a ship is a work)
  <p>A ship is similarly not a work, and the element must not be used
  to mark up ship names (the <code>i</code> element can be used for
  that purpose).</p>
-->

  <div class=example>

   <p>This next example shows a typical use of the <code><a href=#the-cite-element>cite</a></code>
   element:</p>

   <pre>&lt;p&gt;My favorite book is &lt;cite&gt;The Reality Dysfunction&lt;/cite&gt; by
Peter F. Hamilton. My favorite comic is &lt;cite&gt;Pearls Before
Swine&lt;/cite&gt; by Stephan Pastis. My favorite track is &lt;cite&gt;Jive
Samba&lt;/cite&gt; by the Cannonball Adderley Sextet.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>This is correct usage:</p>

   <pre>&lt;p&gt;According to the Wikipedia article &lt;cite&gt;HTML&lt;/cite&gt;, as it
stood in mid-February 2008, leaving attribute values unquoted is
unsafe. This is obviously an over-simplification.&lt;/p&gt;</pre>

   <p>The following, however, is incorrect usage, as the
   <code><a href=#the-cite-element>cite</a></code> element here is containing far more than the
   title of the work:</p>

   <pre class=bad>&lt;!-- do not copy this example, it is an example of bad usage! --&gt;
&lt;p&gt;According to &lt;cite&gt;the Wikipedia article on HTML&lt;/cite&gt;, as it
stood in mid-February 2008, leaving attribute values unquoted is
unsafe. This is obviously an over-simplification.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>The <code><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>&lt;p&gt;&lt;cite&gt;Universal Declaration of Human Rights&lt;/cite&gt;, United Nations,
December 1948. Adopted by General Assembly resolution 217 A (III).&lt;/p&gt;</pre>

  </div>

  <p class=note>A <em>citation</em> is not a <em>quote</em> (for
  which the <code><a href=#the-q-element>q</a></code> element is appropriate).</p>

  <div class=example>

   <p>This is incorrect usage, because <code><a href=#the-cite-element>cite</a></code> is not for
   quotes:</p>

   <pre class=bad>&lt;p&gt;&lt;cite&gt;This is wrong!&lt;/cite&gt;, said Ian.&lt;/p&gt;</pre>

   <p>This is also incorrect usage, because a person is not a
   work:</p>

   <pre class=bad>&lt;p&gt;&lt;q&gt;This is still wrong!&lt;/q&gt;, said &lt;cite&gt;Ian&lt;/cite&gt;.&lt;/p&gt;</pre>

   <p>The correct usage does not use a <code><a href=#the-cite-element>cite</a></code> element:</p>

   <pre>&lt;p&gt;&lt;q&gt;This is correct&lt;/q&gt;, said Ian.&lt;/p&gt;</pre>

   <p>As mentioned above, the <code><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>&lt;p&gt;And then &lt;b&gt;Ian&lt;/b&gt; said &lt;q&gt;this might be right, in a
gossip column, maybe!&lt;/q&gt;.&lt;/p&gt;</pre>

  </div>



  <h4 id=the-q-element><span class=secno>4.6.7 </span>The <dfn><code>q</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-q-cite><a href=#attr-q-cite>cite</a></code> &mdash; Link to the source of the quotation or more information about the edit</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-q-element>q</a></code> element <a href=#represents>represents</a> some <a href=#phrasing-content title="phrasing content">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><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><a href=#the-q-element>q</a></code> element must be quoted from
  another source, whose address, if it has one, may be cited in the
  <dfn id=attr-q-cite title=attr-q-cite><code>cite</code></dfn> attribute. The
  source may be fictional, as when quoting characters in a novel or
  screenplay.</p>

  <p>If the <code title=attr-q-cite><a href=#attr-q-cite>cite</a></code> attribute is present, it must be a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL
  potentially surrounded by spaces</a>. <span class=impl>To obtain the corresponding citation
  link, the value of the attribute must be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to
  the element.</span> User agents may allow users to follow such citation links, but they are
  primarily intended for private use (e.g. by server-side scripts collecting statistics about a
  site's use of quotations), not for readers.</p>

  <p>The <code><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><a href=#the-q-element>q</a></code> element for marking up sarcastic
  statements.</p>

  <p>The use of <code><a href=#the-q-element>q</a></code> elements to mark up quotations is
  entirely optional; using explicit quotation punctuation without
  <code><a href=#the-q-element>q</a></code> elements is just as correct.</p>

  <div class=example>

   <p>Here is a simple example of the use of the <code><a href=#the-q-element>q</a></code>
   element:</p>

   <pre>&lt;p&gt;The man said &lt;q&gt;Things that are impossible just take
longer&lt;/q&gt;. I disagreed with him.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>Here is an example with both an explicit citation link in the
   <code><a href=#the-q-element>q</a></code> element, and an explicit citation outside:</p>

   <pre>&lt;p&gt;The W3C page &lt;cite&gt;About W3C&lt;/cite&gt; says the W3C's
mission is &lt;q cite="http://www.w3.org/Consortium/"&gt;To lead the
World Wide Web to its full potential by developing protocols and
guidelines that ensure long-term growth for the Web&lt;/q&gt;. I
disagree with this mission.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, the quotation itself contains a
   quotation:</p>

   <pre>&lt;p&gt;In &lt;cite&gt;Example One&lt;/cite&gt;, he writes &lt;q&gt;The man
said &lt;q&gt;Things that are impossible just take longer&lt;/q&gt;. I
disagreed with him&lt;/q&gt;. Well, I disagree even more!&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, quotation marks are used instead of
   the <code><a href=#the-q-element>q</a></code> element:</p>

   <pre>&lt;p&gt;His best argument was &#x275d;I disagree&#x275e;, which
I thought was laughable.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, there is no quote &mdash; the
   quotation marks are used to name a word. Use of the <code><a href=#the-q-element>q</a></code>
   element in this case would be inappropriate.</p>

   <pre>&lt;p&gt;The word "ineffable" could have been used to describe the disaster
resulting from the campaign's mismanagement.&lt;/p&gt;</pre>

  </div>


  <h4 id=the-dfn-element><span class=secno>4.6.8 </span>The <dfn><code>dfn</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-dfn-element>dfn</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd>Also, the <code title=attr-dfn-title><a href=#attr-dfn-title>title</a></code> attribute has special semantics on this element. &mdash; Full term or expansion of abbreviation</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-dfn-element>dfn</a></code> element <a href=#represents>represents</a> the defining
  instance of a term. The <a href=#paragraph title=paragraph>paragraph</a>,
  <a href=#the-dl-element title=dl>description list group</a>, or <a href=#sectioning-content title="sectioning content">section</a> that is the nearest
  ancestor of the <code><a href=#the-dfn-element>dfn</a></code> element must also contain the
  definition(s) for the <a href=#defining-term title="defining term">term</a> given
  by the <code><a href=#the-dfn-element>dfn</a></code> element.</p>

  <p><dfn id=defining-term>Defining term</dfn>: If the <code><a href=#the-dfn-element>dfn</a></code> element has a
  <dfn id=attr-dfn-title title=attr-dfn-title><code>title</code></dfn> attribute, then
  the exact value of that attribute is the term being defined.
  Otherwise, if it contains exactly one element child node and no
  child <code><a href=#text>Text</a></code> nodes, and that child
  element is an <code><a href=#the-abbr-element>abbr</a></code> element with a <code title=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><a href=#textcontent>textContent</a></code> of the <code><a href=#the-dfn-element>dfn</a></code>
  element that gives the term being defined.</p>

  <!-- note that this means <dfn>x \n x</dfn> won't match <span>x x</span> -->

  <p>If the <code title=attr-dfn-title><a href=#attr-dfn-title>title</a></code> attribute of the
  <code><a href=#the-dfn-element>dfn</a></code> element is present, then it must contain only the
  term being defined.</p>

  <p class=note>The <code title=attr-title><a href=#attr-title>title</a></code> attribute
  of ancestor elements does not affect <code><a href=#the-dfn-element>dfn</a></code> elements.</p>

  <p>An <code><a href=#the-a-element>a</a></code> element that links to a <code><a href=#the-dfn-element>dfn</a></code>
  element represents an instance of the term defined by the
  <code><a href=#the-dfn-element>dfn</a></code> element.</p>

  <div class=example>

   <p>In the following fragment, the term "Garage Door Opener" is
   first defined in the first paragraph, then used in the second. In
   both cases, its abbreviation is what is actually displayed.</p>

   <pre>&lt;p&gt;The <strong>&lt;dfn&gt;&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;&lt;/dfn&gt;</strong>
is a device that allows off-world teams to open the iris.&lt;/p&gt;
&lt;!-- ... later in the document: --&gt;
&lt;p&gt;Teal'c activated his <strong>&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;</strong>
and so Hammond ordered the iris to be opened.&lt;/p&gt;</pre>

   <p>With the addition of an <code><a href=#the-a-element>a</a></code> element, the reference
   can be made explicit:</p>

   <pre>&lt;p&gt;The &lt;dfn <strong>id=gdo</strong>&gt;&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;&lt;/dfn&gt;
is a device that allows off-world teams to open the iris.&lt;/p&gt;
&lt;!-- ... later in the document: --&gt;
&lt;p&gt;Teal'c activated his <strong>&lt;a href=#gdo&gt;</strong>&lt;abbr title="Garage Door Opener"&gt;GDO&lt;/abbr&gt;<strong>&lt;/a&gt;</strong>
and so Hammond ordered the iris to be opened.&lt;/p&gt;</pre>

  </div>



  <h4 id=the-abbr-element><span class=secno>4.6.9 </span>The <dfn><code>abbr</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd>Also, the <code title=attr-abbr-title><a href=#attr-abbr-title>title</a></code> attribute has special semantics on this element. &mdash; Full term or expansion of abbreviation</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-abbr-element>abbr</a></code> element <a href=#represents>represents</a> an
  abbreviation or acronym, optionally with its expansion. The <dfn id=attr-abbr-title title=attr-abbr-title><code>title</code></dfn> attribute may be
  used to provide an expansion of the abbreviation. The attribute, if
  specified, must contain an expansion of the abbreviation, and
  nothing else.</p>

  <div class=example>
   <p>The paragraph below contains an abbreviation marked up with the
   <code><a href=#the-abbr-element>abbr</a></code> element. This paragraph <a href=#defining-term title="defining
   term">defines the term</a> "Web Hypertext Application Technology
   Working Group".</p>
   <pre>&lt;p&gt;The &lt;dfn id=whatwg&gt;&lt;abbr
title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;&lt;/dfn&gt;
is a loose unofficial collaboration of Web browser manufacturers and
interested parties who wish to develop new technologies designed to
allow authors to write and deploy Applications over the World Wide
Web.&lt;/p&gt;</pre>
   <p>An alternative way to write this would be:</p>
   <pre>&lt;p&gt;The &lt;dfn id=whatwg&gt;Web Hypertext Application Technology
Working Group&lt;/dfn&gt; (&lt;abbr
title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;)
is a loose unofficial collaboration of Web browser manufacturers and
interested parties who wish to develop new technologies designed to
allow authors to write and deploy Applications over the World Wide
Web.&lt;/p&gt;</pre>
  </div>

  <div class=example>
   <p>This paragraph has two abbreviations. Notice how only one is
   defined; the other, with no expansion associated with it, does not
   use the <code><a href=#the-abbr-element>abbr</a></code> element.</p>
   <pre>&lt;p&gt;The
&lt;abbr title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;
started working on HTML5 in 2004.&lt;/p&gt;</pre>
  </div>

  <div class=example>
   <p>This paragraph links an abbreviation to its definition.</p>
   <pre>&lt;p&gt;The &lt;a href="#whatwg"&gt;&lt;abbr
title="Web Hypertext Application Technology Working Group"&gt;WHATWG&lt;/abbr&gt;&lt;/a&gt;
community does not have much representation from Asia.&lt;/p&gt;</pre>
  </div>

  <div class=example>
   <p>This paragraph marks up an abbreviation without giving an
   expansion, possibly as a hook to apply styles for abbreviations
   (e.g. smallcaps).</p>
   <pre>&lt;p&gt;Philip` and Dashiva both denied that they were going to
get the issue counts from past revisions of the specification to
backfill the &lt;abbr&gt;WHATWG&lt;/abbr&gt; issue graph.&lt;/p&gt;</pre>
  </div>

  <p>If an abbreviation is pluralized, the expansion's grammatical
  number (plural vs singular) must match the grammatical number of the
  contents of the element.</p>

  <div class=example>

   <p>Here the plural is outside the element, so the expansion is in
   the singular:</p>

   <pre>&lt;p&gt;Two &lt;abbr title="Working Group"&gt;WG&lt;/abbr&gt;s worked on
this specification: the &lt;abbr&gt;WHATWG&lt;/abbr&gt; and the
&lt;abbr&gt;HTMLWG&lt;/abbr&gt;.&lt;/p&gt;</pre>

   <p>Here the plural is inside the element, so the expansion is in
   the plural:</p>

   <pre>&lt;p&gt;Two &lt;abbr title="Working Groups"&gt;WGs&lt;/abbr&gt; worked on
this specification: the &lt;abbr&gt;WHATWG&lt;/abbr&gt; and the
&lt;abbr&gt;HTMLWG&lt;/abbr&gt;.&lt;/p&gt;</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><a href=#the-abbr-element>abbr</a></code> element with a <code title=attr-title><a href=#attr-title>title</a></code> attribute is an alternative to
   including the expansion inline (e.g. in parentheses).</li>

   <li>Abbreviations that are likely to be unfamiliar to the
   document's readers, for which authors are encouraged to either mark
   up the abbreviation using an <code><a href=#the-abbr-element>abbr</a></code> element with a <code title=attr-title><a href=#attr-title>title</a></code> attribute or include the expansion
   inline in the text the first time the abbreviation is used.</li>

   <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><a href=#the-abbr-element>abbr</a></code> element
   can be used without a <code title=attr-title><a href=#attr-title>title</a></code>
   attribute.</li>

  </ul><p title=note>Providing an expansion in a <code title=attr-title><a href=#attr-title>title</a></code> attribute once will not necessarily
  cause other <code><a href=#the-abbr-element>abbr</a></code> elements in the same document with the
  same contents but without a <code title=attr-title><a href=#attr-title>title</a></code>
  attribute to behave as if they had the same expansion. Every
  <code><a href=#the-abbr-element>abbr</a></code> element is independent.</p>



  <h4 id=the-data-element><span class=secno>4.6.10 </span>The <dfn><code>data</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-data-value><a href=#attr-data-value>value</a></code> &mdash; Machine-readable value</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmldataelement>HTMLDataElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-data-value title=dom-data-value>value</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-data-element>data</a></code> element <a href=#represents>represents</a> its
  contents, along with a machine-readable form of those contents in
  the <code title=attr-data-value><a href=#attr-data-value>value</a></code> attribute.</p>

  <p>The <dfn id=attr-data-value title=attr-data-value><code>value</code></dfn>
  attribute must be present. Its value must be a representation of the
  element's contents in a machine-readable format.</p>

  <p class=note>When the value is date- or time-related, the more
  specific <code><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 title=attr-data-value><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 title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes can also be useful in
  such situations.)</p>

  <div class=impl>

  <p>The <dfn id=dom-data-value title=dom-data-value><code>value</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name.</p>

  </div>

  <div class=example>

   <p>Here, a short table has its numeric values encoded using <code><a href=#the-data-element>data</a></code> so that the
   <a href=#table-sorting-model>table sorting model</a> can provide a sorting mechanism on each column, despite the
   numbers being presented in textual form in one column and in a decomposed form in another.</p>

   <pre>&lt;table sortable&gt;
 &lt;thead&gt; &lt;tr&gt; &lt;th&gt; Game &lt;th&gt; Corporations &lt;th&gt; Map Size
 &lt;tbody&gt;
  &lt;tr&gt; &lt;td&gt; 1830 &lt;td&gt; &lt;data value="8"&gt;Eight&lt;/data&gt; &lt;td&gt; &lt;data value="93"&gt;19+74 hexes (93 total)&lt;/data&gt;
  &lt;tr&gt; &lt;td&gt; 1856 &lt;td&gt; &lt;data value="11"&gt;Eleven&lt;/data&gt; &lt;td&gt; &lt;data value="99"&gt;12+87 hexes (99 total)&lt;/data&gt;
  &lt;tr&gt; &lt;td&gt; 1870 &lt;td&gt; &lt;data value="10"&gt;Ten&lt;/data&gt; &lt;td&gt; &lt;data value="149"&gt;4+145 hexes (149 total)&lt;/data&gt;
&lt;/table&gt;</pre>

  </div>




  <h4 id=the-time-element><span class=secno>4.6.11 </span>The <dfn><code>time</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> &mdash; Machine-readable value</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltimeelement>HTMLTimeElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-time-datetime title=dom-time-dateTime>dateTime</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-time-element>time</a></code> element <a href=#represents>represents</a> its contents, along with a
  machine-readable form of those contents in the <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code>
  attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and
  durations, as described below.</p>

  <p>The <dfn id=attr-time-datetime title=attr-time-datetime><code>datetime</code></dfn> attribute may be present. If
  present, its value must be a representation of the element's contents in a machine-readable
  format.</p>

  <p>A <code><a href=#the-time-element>time</a></code> element that does not have a <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content attribute must not have any element
  descendants.</p>

  <p>The <dfn id=datetime-value>datetime value</dfn> of a <code><a href=#the-time-element>time</a></code> element is the value of the element's
  <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content attribute, if it has one, or the
  element's <code><a href=#textcontent>textContent</a></code>, if it does not.</p>

  <p>The <a href=#datetime-value>datetime value</a> of a <code><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>valid month string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;2011-11&lt;/time&gt;</pre>

   </dd>


   <dt>A <a href=#valid-date-string>valid date string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;2011-11-12&lt;/time&gt;</pre>

   </dd>


   <dt>A <a href=#valid-yearless-date-string>valid yearless date string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;11-12&lt;/time&gt;</pre>

   </dd>


   <dt>A <a href=#valid-time-string>valid time string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;14:54&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;14:54:39&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;14:54:39.929&lt;/time&gt;</pre>

   </dd>


   <dt>A <a href=#valid-local-date-and-time-string>valid local date and time string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;2011-11-12T14:54&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39.929&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39.929&lt;/time&gt;</pre>

    <p class=note>Times with dates but without a time zone offset are useful for specifying events
    that are observed at the same specific time in each time zone, throughout a day. For example,
    the 2020 new year is celebrated at 2020-01-01 00:00 in each time zone, not at the same precise
    moment across all time zones. For events that occur at the same time across all time zones, for
    example a videoconference meeting, a <a href=#valid-global-date-and-time-string>valid global date and time string</a> is likely
    more useful.</p>

   </dd>


   <dt>A <a href=#valid-time-zone-offset-string>valid time-zone offset string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;Z&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;+0000&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;+00:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;-0800&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;-08:00&lt;/time&gt;</pre>

    <p class=note>For times without dates (or times referring to events that recur on multiple
    dates), specifying the geographic location that controls the time is usually more useful than
    specifying a time zone offset, because geographic locations change time zone offsets with
    daylight savings time. In some cases, geographic locations even change time zone, e.g. when the
    boundaries of those time zones are redrawn, as happened with Samoa at the end of 2011. There
    exists a time zone database that describes the boundaries of time zones and what rules apply
    within each such zone, known as the <i>time zone database</i>. <a href=#refsTZDATABASE>[TZDATABASE]</a></p>

   </dd>


   <dt>A <a href=#valid-global-date-and-time-string>valid global date and time string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;2011-11-12T14:54Z&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39Z&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39.929Z&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12T14:54+0000&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39+0000&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39.929+0000&lt;/time&gt;</pre> 

    <pre class=example>&lt;time&gt;2011-11-12T14:54+00:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39+00:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T14:54:39.929+00:00&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12T06:54-0800&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T06:54:39-0800&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T06:54:39.929-0800&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12T06:54-08:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T06:54:39-08:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12T06:54:39.929-08:00&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12 14:54Z&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39Z&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39.929Z&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12 14:54+0000&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39+0000&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39.929+0000&lt;/time&gt;</pre> 

    <pre class=example>&lt;time&gt;2011-11-12 14:54+00:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39+00:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 14:54:39.929+00:00&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12 06:54-0800&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 06:54:39-0800&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 06:54:39.929-0800&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;2011-11-12 06:54-08:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 06:54:39-08:00&lt;/time&gt;</pre>
    <pre class=example>&lt;time&gt;2011-11-12 06:54:39.929-08:00&lt;/time&gt;</pre>

    <p class=note>Times with dates and a time zone offset are useful for specifying specific
    events, or recurring virtual events where the time is not anchored to a specific geographic
    location. For example, the precise time of an asteroid impact, or a particular meeting in a
    series of meetings held at 1400 UTC every day, regardless of whether any particular part of the
    world is observing daylight savings time or not. For events where the precise time varies by the
    local time zone offset of a specific geographic location, a <a href=#valid-local-date-and-time-string>valid local date and time
    string</a> combined with that geographic location is likely more useful.</p>

   </dd>


   <dt>A <a href=#valid-week-string>valid week string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;2011-W46&lt;/time&gt;</pre>

   </dd>


   <dt>Four or more <a href=#ascii-digits>ASCII digits</a>, at least one of which is not U+0030 DIGIT ZERO (0)</dt>

   <dd>

    <pre class=example>&lt;time&gt;2011&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;0001&lt;/time&gt;</pre>

   </dd>


   <dt>A <a href=#valid-duration-string>valid duration string</a></dt>

   <dd>

    <pre class=example>&lt;time&gt;PT4H18M3S&lt;/time&gt;</pre>

    <pre class=example>&lt;time&gt;4h 18m 3s&lt;/time&gt;</pre>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id="machine-readable-equivalent-of-the-element's-contents">machine-readable equivalent of the element's contents</dfn> must be obtained from the
  element's <a href=#datetime-value>datetime value</a> by using the following algorithm:</p>

  <ol><li><p>If <a href=#parse-a-month-string title="parse a month string">parsing a month string</a> from the element's
   <a href=#datetime-value>datetime value</a> returns a <a href=#concept-month title=concept-month>month</a>, that is the
   machine-readable equivalent; abort these steps.</li>

   <li><p>If <a href=#parse-a-date-string title="parse a date string">parsing a date string</a> from the element's
   <a href=#datetime-value>datetime value</a> returns a <a href=#concept-date title=concept-date>date</a>, that is the
   machine-readable equivalent; abort these steps.</li>

   <li><p>If <a href=#parse-a-yearless-date-string title="parse a yearless date string">parsing a yearless date string</a> from
   the element's <a href=#datetime-value>datetime value</a> returns a <a href=#concept-yearless-date title=concept-yearless-date>yearless
   date</a>, that is the machine-readable equivalent; abort these steps.</li>

   <li><p>If <a href=#parse-a-time-string title="parse a time string">parsing a time string</a> from the element's
   <a href=#datetime-value>datetime value</a> returns a <a href=#concept-time title=concept-time>time</a>, that is the
   machine-readable equivalent; abort these steps.</li>

   <li><p>If <a href=#parse-a-local-date-and-time-string title="parse a local date and time string">parsing a local date and time
   string</a> from the element's <a href=#datetime-value>datetime value</a> returns a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>, that is the machine-readable
   equivalent; abort these steps.</li>

   <li><p>If <a href=#parse-a-time-zone-offset-string title="parse a time-zone offset string">parsing a time-zone offset string</a>
   from the element's <a href=#datetime-value>datetime value</a> returns a <a href=#concept-timezone title=concept-timezone>time-zone
   offset</a>, that is the machine-readable equivalent; abort these steps.</li>

   <li><p>If <a href=#parse-a-global-date-and-time-string title="parse a global date and time string">parsing a global date and time
   string</a> from the element's <a href=#datetime-value>datetime value</a> returns a <a href=#concept-datetime title=concept-datetime>global date and time</a>, that is the machine-readable equivalent;
   abort these steps.</li>

   <li><p>If <a href=#parse-a-week-string title="parse a week string">parsing a week string</a> from the element's
   <a href=#datetime-value>datetime value</a> returns a <a href=#concept-week title=concept-week>week</a>, that is the
   machine-readable equivalent; abort these steps.</li>

   <li><p>If the element's <a href=#datetime-value>datetime value</a> consists of only <a href=#ascii-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>

   <li><p>If <a href=#parse-a-duration-string title="parse a duration string">parsing a duration string</a> from the
   element's <a href=#datetime-value>datetime value</a> returns a <a href=#concept-duration title=concept-duration>duration</a>,
   that is the machine-readable equivalent; abort these steps.</li>

   <li><p>There is no machine-readable equivalent.</li>

  </ol><p class=note>The algorithms referenced above are intended to be designed such that for any
  arbitrary string <var title="">s</var>, only one of the algorithms returns a value. A more
  efficient approach might be to create a single algorithm that parses all these data types in one
  pass; developing such an algorithm is left as an exercise to the reader.</p>

  <p>The <dfn id=dom-time-datetime title=dom-time-dateTime><code>dateTime</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the element's <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content
  attribute.</p>

  </div>

  <div class=example>

   <p>The <code><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><a href=#the-time-element>time</a></code> element:</p>

   <pre>&lt;div class="vevent"&gt;
 &lt;a class="url" href="http://www.web2con.com/"&gt;http://www.web2con.com/&lt;/a&gt;
  &lt;span class="summary"&gt;Web 2.0 Conference&lt;/span&gt;:
  &lt;time class="dtstart" datetime="2005-10-05"&gt;October 5&lt;/time&gt; -
  &lt;time class="dtend" datetime="2005-10-07"&gt;7&lt;/time&gt;,
  at the &lt;span class="location"&gt;Argent Hotel, San Francisco, CA&lt;/span&gt;
 &lt;/div&gt;</pre>

  </div>

  <div class=example>

   <p>Here, a fictional microdata vocabulary based on the Atom vocabulary is used with the
   <code><a href=#the-time-element>time</a></code> element to mark up a blog post's publication date.</p>

   <pre>&lt;article itemscope itemtype="http://n.example.org/rfc4287"&gt;
 &lt;h1 itemprop="title"&gt;Big tasks&lt;/h1&gt;
 &lt;footer&gt;Published &lt;time itemprop="published" datetime="2009-08-29"&gt;two days ago&lt;/time&gt;.&lt;/footer&gt;
 &lt;p itemprop="content"&gt;Today, I went out and bought a bike for my kid.&lt;/p&gt;
&lt;/article&gt;</pre>

  </div>

  <div class=example>

   <p>In this example, another article's publication date is marked up using <code><a href=#the-time-element>time</a></code>, this
   time using the schema.org microdata vocabulary:</p>

   <pre>&lt;article itemscope itemtype="http://schema.org/BlogPosting"&gt;
 &lt;h1 itemprop="headline"&gt;Small tasks&lt;/h1&gt;
 &lt;footer&gt;Published &lt;time itemprop="datePublished" datetime="2009-08-30"&gt;yesterday&lt;/time&gt;.&lt;/footer&gt;
 &lt;p itemprop="articleBody"&gt;I put a bike bell on his bike.&lt;/p&gt;
&lt;/article&gt;</pre>

  </div>

  <div class=example>

   <p>In the following snippet, the <code><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>&lt;p&gt;Our first date was &lt;time datetime="2006-09-23"&gt;a Saturday&lt;/time&gt;.&lt;/p&gt;</pre>

   <p>In this second snippet, the value includes a time:</p>

   <pre>&lt;p&gt;We stopped talking at &lt;time datetime="2006-09-24T05:00-07:00"&gt;5am the next morning&lt;/time&gt;.&lt;/p&gt;</pre>

   <p>A script loaded by the page (and thus privy to the page's internal convention of marking up
   dates and times using the <code><a href=#the-time-element>time</a></code> element) could scan through the page and look at all
   the <code><a href=#the-time-element>time</a></code> elements therein to create an index of dates and times.</p>

  </div>

  <div class=example>

   <p>For example, this element conveys the string "Tuesday" with the additional semantic that the
   12th of November 2011 is the meaning that corresponds to "Tuesday":</p>

   <pre>Today is &lt;time datetime="2011-11-12"&gt;Tuesday&lt;/time&gt;.</pre>

  </div>

  <div class=example>

   <p>In this example, a specific time in the Pacific Standard Time timezone is specified:</p>

   <pre>Your next meeting is at &lt;time datetime="2011-11-12T15:00-08:00"&gt;3pm&lt;/time&gt;.</pre>

  </div>




  <h4 id=the-code-element><span class=secno>4.6.12 </span>The <dfn><code>code</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-code-element>code</a></code> element <a href=#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><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 title=attr-class><a href=#classes>class</a></code> attribute, e.g.
  by adding a class prefixed with "<code title="">language-</code>" to the element.</p>

  <div class=example>

   <p>The following example shows how the element can be used in a
   paragraph to mark up element names and computer code, including
   punctuation.</p>

   <pre>&lt;p&gt;The &lt;code&gt;code&lt;/code&gt; element represents a fragment of computer
code.&lt;/p&gt;

&lt;p&gt;When you call the &lt;code&gt;activate()&lt;/code&gt; method on the
&lt;code&gt;robotSnowman&lt;/code&gt; object, the eyes glow.&lt;/p&gt;

&lt;p&gt;The example below uses the &lt;code&gt;begin&lt;/code&gt; keyword to indicate
the start of a statement block. It is paired with an &lt;code&gt;end&lt;/code&gt;
keyword, which is followed by the &lt;code&gt;.&lt;/code&gt; punctuation character
(full stop) to indicate the end of the program.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>The following example shows how a block of code could be marked
   up using the <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-code-element>code</a></code> elements.</p>

   <pre>&lt;pre&gt;&lt;code class="language-pascal"&gt;var i: Integer;
begin
   i := 1;
end.&lt;/code&gt;&lt;/pre&gt;</pre>

   <p>A class is used in that example to indicate the language
   used.</p>

  </div>

  <p class=note>See the <code><a href=#the-pre-element>pre</a></code> element for more details.</p>


  <h4 id=the-var-element><span class=secno>4.6.13 </span>The <dfn><code>var</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-var-element>var</a></code> element <a href=#represents>represents</a> a variable.
  This could be an actual variable in a mathematical expression or
  programming context, an identifier representing a constant, a symbol
  identifying a physical quantity, a function parameter, or just be a
  term used as a placeholder in prose.</p>

  <div class=example>
   <p>In the paragraph below, the letter "n" is being used as a
   variable in prose:</p>
   <pre>&lt;p&gt;If there are &lt;var&gt;n&lt;/var&gt; pipes leading to the ice
cream factory then I expect at &lt;em&gt;least&lt;/em&gt; &lt;var&gt;n&lt;/var&gt;
flavors of ice cream to be available for purchase!&lt;/p&gt;</pre>
  </div>

  <p>For mathematics, in particular for anything beyond the simplest
  of expressions, MathML is more appropriate. However, the
  <code><a href=#the-var-element>var</a></code> element can still be used to refer to specific
  variables that are then mentioned in MathML expressions.</p>

  <div class=example>

   <p>In this example, an equation is shown, with a legend that
   references the variables in the equation. The expression itself is
   marked up with MathML, but the variables are mentioned in the
   figure's legend using <code><a href=#the-var-element>var</a></code>.</p>

   <pre>&lt;figure&gt;
 &lt;math&gt;
  &lt;mi&gt;a&lt;/mi&gt;
  &lt;mo&gt;=&lt;/mo&gt;
  &lt;msqrt&gt;
   &lt;msup&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;
   &lt;mi&gt;+&lt;/mi&gt;
   &lt;msup&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;
  &lt;/msqrt&gt;
 &lt;/math&gt;
 &lt;figcaption&gt;
  Using Pythagoras' theorem to solve for the hypotenuse &lt;var&gt;a&lt;/var&gt; of
  a triangle with sides &lt;var&gt;b&lt;/var&gt; and &lt;var&gt;c&lt;/var&gt;
 &lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>Here, the equation describing mass-energy equivalence is used in
   a sentence, and the <code><a href=#the-var-element>var</a></code> element is used to mark the
   variables and constants in that equation:</p>

   <pre>&lt;p&gt;Then he turned to the blackboard and picked up the chalk. After a few moment's
thought, he wrote &lt;var&gt;E&lt;/var&gt; = &lt;var&gt;m&lt;/var&gt; &lt;var&gt;c&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;. The teacher
looked pleased.&lt;/p&gt;</pre>

  </div>


  <h4 id=the-samp-element><span class=secno>4.6.14 </span>The <dfn><code>samp</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-samp-element>samp</a></code> element <a href=#represents>represents</a> (sample)
  output from a program or computing system.</p>

  <p class=note>See the <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-kbd-element>kbd</a></code>
  elements for more details.</p>

  <div class=example>
   <p>This example shows the <code><a href=#the-samp-element>samp</a></code> element being used
   inline:</p>
   <pre>&lt;p&gt;The computer said &lt;samp&gt;Too much cheese in tray
two&lt;/samp&gt; but I didn't know what that meant.&lt;/p&gt;</pre>
  </div>

  <div class=example>
   <p>This second example shows a block of sample output. Nested
   <code><a href=#the-samp-element>samp</a></code> and <code><a href=#the-kbd-element>kbd</a></code> elements allow for the
   styling of specific elements of the sample output using a
   style sheet. There's also a few parts of the <code><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><a href=#the-span-element>span</a></code> elements
   are used.</p>

   <pre>&lt;pre&gt;&lt;samp&gt;&lt;span class="prompt"&gt;jdoe@mowmow:~$&lt;/span&gt; &lt;kbd&gt;ssh demo.example.com&lt;/kbd&gt;
Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1
Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:22:36 PST 2005 i686 unknown

&lt;span class="prompt"&gt;jdoe@demo:~$&lt;/span&gt; &lt;span class="cursor"&gt;_&lt;/span&gt;&lt;/samp&gt;&lt;/pre&gt;</pre>
  </div>


  <h4 id=the-kbd-element><span class=secno>4.6.15 </span>The <dfn><code>kbd</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-kbd-element>kbd</a></code> element <a href=#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><a href=#the-kbd-element>kbd</a></code> element is nested inside a
  <code><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><a href=#the-kbd-element>kbd</a></code> element <em>contains</em> a
  <code><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><a href=#the-kbd-element>kbd</a></code> element is nested inside another
  <code><a href=#the-kbd-element>kbd</a></code> element, it represents an actual key or other
  single unit of input as appropriate for the input mechanism.</p>

  <div class=example>
   <p>Here the <code><a href=#the-kbd-element>kbd</a></code> element is used to indicate keys to press:</p>
   <pre>&lt;p&gt;To make George eat an apple, press &lt;kbd&gt;&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;F3&lt;/kbd&gt;&lt;/kbd&gt;&lt;/p&gt;</pre>

   <p>In this second example, the user is told to pick a particular
   menu item. The outer <code><a href=#the-kbd-element>kbd</a></code> element marks up a block of
   input, with the inner <code><a href=#the-kbd-element>kbd</a></code> elements representing each
   individual step of the input, and the <code><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>&lt;p&gt;To make George eat an apple, select
    &lt;kbd&gt;&lt;kbd&gt;&lt;samp&gt;File&lt;/samp&gt;&lt;/kbd&gt;|&lt;kbd&gt;&lt;samp&gt;Eat Apple...&lt;/samp&gt;&lt;/kbd&gt;&lt;/kbd&gt;
&lt;/p&gt;</pre>

   <p>Such precision isn't necessary; the following is equally fine:</p>

   <pre>&lt;p&gt;To make George eat an apple, select &lt;kbd&gt;File | Eat Apple...&lt;/kbd&gt;&lt;/p&gt;</pre>

  </div>


  <h4 id=the-sub-and-sup-elements><span class=secno>4.6.16 </span>The <dfn id=the-sub-element><code>sub</code></dfn> and <dfn id=the-sup-element><code>sup</code></dfn> elements</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Use <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-sub-and-sup-elements>sup</a></code> element <a href=#represents>represents</a> a
  superscript and the <code><a href=#the-sub-and-sup-elements>sub</a></code> element <a href=#represents>represents</a>
  a subscript.</p>

  <p>These elements must be used only to mark up typographical
  conventions with specific meanings, not for typographical
  presentation for presentation's sake. For example, it would be
  inappropriate for the <code><a href=#the-sub-and-sup-elements>sub</a></code> and <code><a href=#the-sub-and-sup-elements>sup</a></code> elements
  to be used in the name of the LaTeX document preparation system. In
  general, authors should use these elements only if the
  <em>absence</em> of those elements would change the meaning of the
  content.</p>

  <p>In certain languages, superscripts are part of the typographical
  conventions for some abbreviations.</p>

  <div class=example>
   <pre>&lt;p&gt;The most beautiful women are
&lt;span lang="fr"&gt;&lt;abbr&gt;M&lt;sup&gt;lle&lt;/sup&gt;&lt;/abbr&gt; Gwendoline&lt;/span&gt; and
&lt;span lang="fr"&gt;&lt;abbr&gt;M&lt;sup&gt;me&lt;/sup&gt;&lt;/abbr&gt; Denise&lt;/span&gt;.&lt;/p&gt;</pre>
  </div>

  <p>The <code><a href=#the-sub-and-sup-elements>sub</a></code> element can be used inside a
  <code><a href=#the-var-element>var</a></code> element, for variables that have subscripts.</p>

  <div class=example>

   <p>Here, the <code><a href=#the-sub-and-sup-elements>sub</a></code> element is used to represents the
   subscript that identifies the variable in a family of
   variables:</p>

   <pre>&lt;p&gt;The coordinate of the &lt;var&gt;i&lt;/var&gt;th point is
(&lt;var&gt;x&lt;sub&gt;&lt;var&gt;i&lt;/var&gt;&lt;/sub&gt;&lt;/var&gt;, &lt;var&gt;y&lt;sub&gt;&lt;var&gt;i&lt;/var&gt;&lt;/sub&gt;&lt;/var&gt;).
For example, the 10th point has coordinate
(&lt;var&gt;x&lt;sub&gt;10&lt;/sub&gt;&lt;/var&gt;, &lt;var&gt;y&lt;sub&gt;10&lt;/sub&gt;&lt;/var&gt;).&lt;/p&gt;</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><a href=#the-sub-and-sup-elements>sub</a></code> and <code><a href=#the-sub-and-sup-elements>sup</a></code> if
  detailed mathematical markup is not desired. <a href=#refsMATHML>[MATHML]</a></p>

  <div class=example>
   <pre>&lt;var&gt;E&lt;/var&gt;=&lt;var&gt;m&lt;/var&gt;&lt;var&gt;c&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;</pre>
   <pre>f(&lt;var&gt;x&lt;/var&gt;, &lt;var&gt;n&lt;/var&gt;) = log&lt;sub&gt;4&lt;/sub&gt;&lt;var&gt;x&lt;/var&gt;&lt;sup&gt;&lt;var&gt;n&lt;/var&gt;&lt;/sup&gt;</pre>
  </div>



  <h4 id=the-i-element><span class=secno>4.6.17 </span>The <dfn><code>i</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-i-element>i</a></code> element <a href=#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 title=attr-lang><a href=#attr-lang>lang</a></code> attributes (or,
  in XML, <a href=#attr-xml-lang title=attr-xml-lang><code title="">lang</code>
  attributes in the <span>XML namespace</span></a>).</p>

  <div class=example>
   <p>The examples below show uses of the <code><a href=#the-i-element>i</a></code> element:</p>
   <pre>&lt;p&gt;The &lt;i class="taxonomy"&gt;Felis silvestris catus&lt;/i&gt; is cute.&lt;/p&gt;
&lt;p&gt;The term &lt;i&gt;prose content&lt;/i&gt; is defined above.&lt;/p&gt;
&lt;p&gt;There is a certain &lt;i lang="fr"&gt;je ne sais quoi&lt;/i&gt; in the air.&lt;/p&gt;</pre>
   <p>In the following example, a dream sequence is marked up using
   <code><a href=#the-i-element>i</a></code> elements.</p>
   <pre>&lt;p&gt;Raymond tried to sleep.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;The ship sailed away on Thursday&lt;/i&gt;, he
dreamt. &lt;i&gt;The ship had many people aboard, including a beautiful
princess called Carey. He watched her, day-in, day-out, hoping she
would notice him, but she never did.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Finally one night he picked up the courage to speak with
her&mdash;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Raymond woke with a start as the fire alarm rang out.&lt;/p&gt;</pre>
  </div>

  <p>Authors can use the <code title=attr-class><a href=#classes>class</a></code>
  attribute on the <code><a href=#the-i-element>i</a></code> element to identify why the element
  is being used, so that if the style of a particular use (e.g. dream
  sequences as opposed to taxonomic terms) is to be changed at a later
  date, the author doesn't have to go through the entire document (or
  series of related documents) annotating each use.</p>

  <p>Authors are encouraged to consider whether other elements might
  be more applicable than the <code><a href=#the-i-element>i</a></code> element, for instance the
  <code><a href=#the-em-element>em</a></code> element for marking up stress emphasis, or the
  <code><a href=#the-dfn-element>dfn</a></code> element to mark up the defining instance of a
  term.</p>

  <p class=note>Style sheets can be used to format <code><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><a href=#the-i-element>i</a></code> elements will
  necessarily be italicized.</p>


  <h4 id=the-b-element><span class=secno>4.6.18 </span>The <dfn><code>b</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-b-element>b</a></code> element <a href=#represents>represents</a> a span of text
  to which attention is being drawn for utilitarian purposes without
  conveying any extra importance and with no implication of an
  alternate voice or mood, such as key words in a document abstract,
  product names in a review, actionable words in interactive
  text-driven software, or an article lede.</p>

  <div class=example>
   <p>The following example shows a use of the <code><a href=#the-b-element>b</a></code> element
   to highlight key words without marking them up as important:</p>
   <pre>&lt;p&gt;The &lt;b&gt;frobonitor&lt;/b&gt; and &lt;b&gt;barbinator&lt;/b&gt; components are fried.&lt;/p&gt;</pre>
  </div>

  <div class=example>
   <p>In the following example, objects in a text adventure are
   highlighted as being special by use of the <code><a href=#the-b-element>b</a></code>
   element.</p>
   <pre>&lt;p&gt;You enter a small room. Your &lt;b&gt;sword&lt;/b&gt; glows
brighter. A &lt;b&gt;rat&lt;/b&gt; scurries past the corner wall.&lt;/p&gt;</pre>
  </div>

  <div class=example>
   <p>Another case where the <code><a href=#the-b-element>b</a></code> element is appropriate is
   in marking up the lede (or lead) sentence or paragraph. The
   following example shows how a <a href=http://news.bbc.co.uk/2/hi/uk_news/scotland/north_east/7101506.stm>BBC
   article about kittens adopting a rabbit as their own</a> could be
   marked up:</p>
   <pre>&lt;article&gt;
 &lt;h2&gt;Kittens 'adopted' by pet rabbit&lt;/h2&gt;
 &lt;p&gt;&lt;b class="lede"&gt;Six abandoned kittens have found an
 unexpected new mother figure &mdash; a pet rabbit.&lt;/b&gt;&lt;/p&gt;
 &lt;p&gt;Veterinary nurse Melanie Humble took the three-week-old
 kittens to her Aberdeen home.&lt;/p&gt;
<i>[...]</i></pre>
  </div>

  <p>As with the <code><a href=#the-i-element>i</a></code> element, authors can use the <code title=attr-class><a href=#classes>class</a></code> attribute on the <code><a href=#the-b-element>b</a></code>
  element to identify why the element is being used, so that if the
  style of a particular use is to be changed at a later date, the
  author doesn't have to go through annotating each use.</p>

  <p>The <code><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><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> to <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements, stress emphasis
  should use the <code><a href=#the-em-element>em</a></code> element, importance should be denoted
  with the <code><a href=#the-strong-element>strong</a></code> element, and text marked or highlighted
  should use the <code><a href=#the-mark-element>mark</a></code> element.</p>

  <div class=example>
   <p>The following would be <em>incorrect</em> usage:</p>
   <pre class=bad>&lt;p&gt;&lt;b&gt;WARNING!&lt;/b&gt; Do not frob the barbinator!&lt;/p&gt;</pre>
   <p>In the previous example, the correct element to use would have
   been <code><a href=#the-strong-element>strong</a></code>, not <code><a href=#the-b-element>b</a></code>.</p>
  </div>

  <p class=note>Style sheets can be used to format <code><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><a href=#the-b-element>b</a></code> elements will
  necessarily be boldened.</p>



  <h4 id=the-u-element><span class=secno>4.6.19 </span>The <dfn><code>u</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-u-element>u</a></code> element <a href=#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><a href=#the-em-element>em</a></code> element should be
  used; for marking key words or phrases either the <code><a href=#the-b-element>b</a></code>
  element or the <code><a href=#the-mark-element>mark</a></code> element should be used, depending
  on the context; for marking book titles, the <code><a href=#the-cite-element>cite</a></code>
  element should be used<!-- even for the Chinese wavy underline 'book
  title mark' -->; for labeling text with explicit textual
  annotations, the <code><a href=#the-ruby-element>ruby</a></code> element should be used; for
  labeling ship names in Western texts, the <code><a href=#the-i-element>i</a></code> element
  should be used.</p>

  <p class=note>The default rendering of the <code><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><a href=#the-u-element>u</a></code> element where it could be confused for a
  hyperlink.</p>




  <h4 id=the-mark-element><span class=secno>4.6.20 </span>The <dfn><code>mark</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><!-- v2: attribute that means "highlight this on the scrollbar" --><p>The <code><a href=#the-mark-element>mark</a></code> element <a href=#represents>represents</a> a run of text in one document marked or
  highlighted for reference purposes, due to its relevance in another context. When used in a
  quotation or other block of text referred to from the prose, it indicates a highlight that was not
  originally present but which has been added to bring the reader's attention to a part of the text
  that might not have been considered important by the original author when the block was originally
  written, but which is now under previously unexpected scrutiny. When used in the main prose of a
  document, it indicates a part of the document that has been highlighted due to its likely
  relevance to the user's current activity.</p>

  <div class=example>
   <p>This example shows how the <code><a href=#the-mark-element>mark</a></code> element can be used
   to bring attention to a particular part of a quotation:</p>
   <pre>&lt;p lang="en-US"&gt;Consider the following quote:&lt;/p&gt;
&lt;blockquote lang="en-GB"&gt;
 &lt;p&gt;Look around and you will find, no-one's really
 &lt;mark&gt;colour&lt;/mark&gt; blind.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p lang="en-US"&gt;As we can tell from the &lt;em&gt;spelling&lt;/em&gt; of the word,
the person writing this quote is clearly not American.&lt;/p&gt;</pre>
   <p>(If the goal was to mark the element as misspelt, however, the
   <code><a href=#the-u-element>u</a></code> element, possibly with a class, would be more
   appropriate.)</p>
  </div>

  <div class=example>

   <p>Another example of the <code><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>&lt;p&gt;I also have some &lt;mark&gt;kitten&lt;/mark&gt;s who are visiting me
these days. They're really cute. I think they like my garden! Maybe I
should adopt a &lt;mark&gt;kitten&lt;/mark&gt;.&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>In the following snippet, a paragraph of text refers to a specific part of a code
   fragment.</p>

   <pre>&lt;p&gt;The highlighted part below is where the error lies:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var i: Integer;
begin
   i := &lt;mark&gt;1.1&lt;/mark&gt;;
end.&lt;/code&gt;&lt;/pre&gt;</pre>

   <p>This is separate from <em>syntax highlighting</em>, for which <code><a href=#the-span-element>span</a></code> is more
   appropriate. Combining both, one would get:</p>

   <pre>&lt;p&gt;The highlighted part below is where the error lies:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span class=keyword&gt;var&lt;/span&gt; &lt;span class=ident&gt;i&lt;/span&gt;: &lt;span class=type&gt;Integer&lt;/span&gt;;
&lt;span class=keyword&gt;begin&lt;/span&gt;
   &lt;span class=ident&gt;i&lt;/span&gt; := &lt;span class=literal&gt;&lt;mark&gt;1.1&lt;/mark&gt;&lt;/span&gt;;
&lt;span class=keyword&gt;end&lt;/span&gt;.&lt;/code&gt;&lt;/pre&gt;</pre>

  </div>

  <div class=example>

   <p>This is another example showing the use of <code><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><a href=#the-mark-element>mark</a></code> elements in quotes to render in italics.</p>

   <pre>&lt;article&gt;
 &lt;style scoped&gt;
  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;
  }
 &lt;/style&gt;
 &lt;h1&gt;She knew&lt;/h1&gt;
 &lt;p&gt;Did you notice the subtle joke in the joke on panel 4?&lt;/p&gt;
 &lt;blockquote&gt;
  &lt;p class="bubble"&gt;I didn't &lt;em&gt;want&lt;/em&gt; to believe. &lt;mark&gt;Of course
  on some level I realized it was a known-plaintext attack.&lt;/mark&gt; But I
  couldn't admit it until I saw for myself.&lt;/p&gt;
 &lt;/blockquote&gt;
 &lt;p&gt;(Emphasis mine.) I thought that was great. It's so pedantic, yet it
 explains everything neatly.&lt;/p&gt;
&lt;/article&gt;</pre>

   <p>Note, incidentally, the distinction between the <code><a href=#the-em-element>em</a></code> element in this example, which
   is part of the original text being quoted, and the <code><a href=#the-mark-element>mark</a></code> element, which is
   highlighting a part for comment.</p>

  </div>

  <div class=example>

   <p>The following example shows the difference between denoting the <em>importance</em> of a span
   of text (<code><a href=#the-strong-element>strong</a></code>) as opposed to denoting the <em>relevance</em> of a span of text
   (<code><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>&lt;h3&gt;Wormhole Physics Introduction&lt;/h3&gt;

&lt;p&gt;&lt;mark&gt;A wormhole in normal conditions can be held open for a
maximum of just under 39 minutes.&lt;/mark&gt; Conditions that can increase
the time include a powerful energy source coupled to one or both of
the gates connecting the wormhole, and a large gravity well (such as a
black hole).&lt;/p&gt;

&lt;p&gt;&lt;mark&gt;Momentum is preserved across the wormhole. Electromagnetic
radiation can travel in both directions through a wormhole,
but matter cannot.&lt;/mark&gt;&lt;/p&gt;

&lt;p&gt;When a wormhole is created, a vortex normally forms.
&lt;strong&gt;Warning: The vortex caused by the wormhole opening will
annihilate anything in its path.&lt;/strong&gt; Vortexes can be avoided when
using sufficiently advanced dialing technology.&lt;/p&gt;

&lt;p&gt;&lt;mark&gt;An obstruction in a gate will prevent it from accepting a
wormhole connection.&lt;/mark&gt;&lt;/p&gt;</pre>

  </div>


  <h4 id=the-ruby-element><span class=secno>4.6.21 </span>The <dfn><code>ruby</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>See prose.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><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><a href=#the-ruby-element>ruby</a></code> elements consists of one or more of the following
  sequences:</p>

  <ol class=brief><li>One or the other of the following:
    <ul class=brief><li><a href=#phrasing-content>Phrasing content</a>, but with no <code><a href=#the-ruby-element>ruby</a></code> elements and with no <code><a href=#the-ruby-element>ruby</a></code> element descendants
     <li>A single <code><a href=#the-ruby-element>ruby</a></code> element that itself has no <code><a href=#the-ruby-element>ruby</a></code> element descendants
    </ul><li>One or the other of the following:
    <ul class=brief><li>One or more <code><a href=#the-rt-element>rt</a></code> elements
     <li>An <code><a href=#the-rp-element>rp</a></code> element followed by one or more <code><a href=#the-rt-element>rt</a></code> elements, each of which is itself followed by an <code><a href=#the-rp-element>rp</a></code> element
    </ul></ol><!-- ( ( phrasing-content | <ruby> ) ( <rt>+ | <rp> ( <rt> <rp> )+ ) )+ // with further ruby descendant restrictions --><p>The <code><a href=#the-ruby-element>ruby</a></code> and <code><a href=#the-rt-element>rt</a></code> elements can be used for a variety of kinds of
  annotations, including in particular (though by no means limited to) those described below. For
  more details on Japanese Ruby in particular, and how to render Ruby for Japanese, see
  <cite>Requirements for Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>

  <p class=note>At the time of writing, CSS does not yet provide a way to fully control the
  rendering of the HTML <code><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>

  <!-- examples in the following list are mostly based on those in http://www.w3.org/International/datespace/2010/02/jlreq-examples/ -->

  <dl><dt>Mono-ruby for individual base characters in Japanese

   <dd>

    <p>One or more hiragana or katakana characters (the ruby
    annotation) are placed with each ideographic character (the base
    text). This is used to provide readings of kanji characters.

    <div class=example> <!-- B as in BASE -->
     <pre>&lt;ruby&gt;B&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
    </div>

    <div class=example>
     <p>In this example, notice how each annotation corresponds to a single base character.
     <pre>&lt;ruby&gt;&#x541b;&lt;rt&gt;&#x304f;&#x3093;&lt;/ruby&gt;&lt;ruby&gt;&#x5b50;&lt;rt&gt;&#x3057;&lt;/ruby&gt;&#x306f;&lt;ruby&gt;&#x548c;&lt;rt&gt;&#x308f;&lt;/ruby&gt;&#x3057;&#x3066;&lt;ruby&gt;&#x540c;&lt;rt&gt;&#x3069;&#x3046;&lt;/ruby&gt;&#x305c;&#x305a;&#x3002;</pre>
     <p lang=ja><ruby>&#x541b;<rt>&#x304f;&#x3093;</ruby><ruby>&#x5b50;<rt>&#x3057;</ruby>&#x306f;<ruby>&#x548c;<rt>&#x308f;</ruby>&#x3057;&#x3066;<ruby>&#x540c;<rt>&#x3069;&#x3046;</ruby>&#x305c;&#x305a;&#x3002;
     <p>This example can also be written as follows, using one <code><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><a href=#the-ruby-element>ruby</a></code> elements each with one base text segment and annotation (as in the markup
     above):
     <pre>&lt;ruby&gt;&#x541b;&lt;rt&gt;&#x304f;&#x3093;&lt;/rt&gt;&#x5b50;&lt;rt&gt;&#x3057;&lt;/ruby&gt;&#x306f;&lt;ruby&gt;&#x548c;&lt;rt&gt;&#x308f;&lt;/ruby&gt;&#x3057;&#x3066;&lt;ruby&gt;&#x540c;&lt;rt&gt;&#x3069;&#x3046;&lt;/ruby&gt;&#x305c;&#x305a;&#x3002;</pre>
    </div>

   </dd>


   <dt>Mono-ruby for compound words (jukugo)

   <dd>

    <p>This is similar to the previous case: each ideographic character in the compound word (the
    base text) has its reading given in hiragana or katakana characters (the ruby annotation). The
    difference is that the base text segments form a compound word rather than being separate from
    each other.

    <div class=example> <!-- B as in BASE -->
     <pre>&lt;ruby&gt;B&lt;rt&gt;annotation&lt;/rt&gt;B&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
    </div>

    <div class=example>
     <p>In this example, notice again how each annotation corresponds to a single base character. In this example, each compound word (jukugo) corresponds to a single <code><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>&lt;ruby&gt;&#x9b3c;&lt;rt&gt;&#x304d;&lt;/rt&gt;&#x9580;&lt;rt&gt;&#x3082;&#x3093;&lt;/rt&gt;&lt;/ruby&gt;&#x306e;&lt;ruby&gt;&#x65b9;&lt;rt&gt;&#x307b;&#x3046;&lt;/rt&gt;&#x89d2;&lt;rt&gt;&#x304c;&#x304f;&lt;/rt&gt;&lt;/ruby&gt;&#x3092;&lt;ruby&gt;&#x51dd;&lt;rt&gt;&#x304e;&#x3087;&#x3046;&lt;/rt&gt;&#x8996;&lt;rt&gt;&#x3057;&lt;/rt&gt;&lt;/ruby&gt;&#x3059;&#x308b;</pre>
     <p lang=ja><ruby>&#x9b3c;<rt>&#x304d;</rt>&#x9580;<rt>&#x3082;&#x3093;</ruby>&#x306e;<ruby>&#x65b9;<rt>&#x307b;&#x3046;</rt>&#x89d2;<rt>&#x304c;&#x304f;</ruby>&#x3092;<ruby>&#x51dd;<rt>&#x304e;&#x3087;&#x3046;</rt>&#x8996;<rt>&#x3057;</ruby>&#x3059;&#x308b;

    </div>

   </dd>


   <dt>Jukugo-ruby

   <dd>

    <p>This is semantically identical to the previous case (each individual ideographic character in
    the base compound word has its reading given in an annotation in hiragana or katakana
    characters), but the rendering is the more complicated Jukugo Ruby rendering.

    <div class=example>
     <p>This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.</p>
     <pre>&lt;ruby&gt;&#x9b3c;&lt;rt&gt;&#x304d;&lt;/rt&gt;&#x9580;&lt;rt&gt;&#x3082;&#x3093;&lt;/rt&gt;&lt;/ruby&gt;&#x306e;&lt;ruby&gt;&#x65b9;&lt;rt&gt;&#x307b;&#x3046;&lt;/rt&gt;&#x89d2;&lt;rt&gt;&#x304c;&#x304f;&lt;/rt&gt;&lt;/ruby&gt;&#x3092;&lt;ruby&gt;&#x51dd;&lt;rt&gt;&#x304e;&#x3087;&#x3046;&lt;/rt&gt;&#x8996;&lt;rt&gt;&#x3057;&lt;/rt&gt;&lt;/ruby&gt;&#x3059;&#x308b;</pre>
     <!-- Once CSS is updated to describe this, invoke the CSS and unhide this -->
     <!--
     <p lang=ja><ruby>&#39740;<rt>&#12365;</rt>&#38272;<rt>&#12418;&#12435;</rt></ruby>&#12398;<ruby>&#26041;<rt>&#12411;&#12358;</rt>&#35282;<rt>&#12364;&#12367;</rt></ruby>&#12434;<ruby>&#20957;<rt>&#12366;&#12423;&#12358;</rt>&#35222;<rt>&#12375;</rt></ruby>&#12377;&#12427;
     -->
    </div>

    <p class=note>For more details on <a href=http://www.w3.org/TR/jlreq/#positioning_of_jukugoruby>Jukugo Ruby rendering</a>, see
    Appendix F in the <cite>Requirements for Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>

   </dd>


   <dt>Group ruby for describing meanings

   <dd>

    <p>The annotation describes the meaning of the base text, rather than (or in addition to) the
    pronunciation. As such, both the base text and the annotation can be multiple characters long.

    <div class=example>
     <pre>&lt;ruby&gt;BASE&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
    </div>

    <div class=example>
     <p>Here a compound ideographic word has its corresponding katakana given as an annotation.
     <pre>&lt;ruby&gt;&#x5883;&#x754c;&#x9762;&lt;rt&gt;&#x30a4;&#x30f3;&#x30bf;&#x30fc;&#x30d5;&#x30a7;&#x30fc;&#x30b9;&lt;/ruby&gt;</pre>
     <p lang=ja><ruby>&#x5883;&#x754c;&#x9762;<rt>&#x30a4;&#x30f3;&#x30bf;&#x30fc;&#x30d5;&#x30a7;&#x30fc;&#x30b9;</ruby></div>

    <div class=example>
     <p>Here a compound ideographic word has its translation in English provided as an annotation.
     <pre>&lt;ruby lang="ja"&gt;&#x7de8;&#x96c6;&#x8005;&lt;rt lang="en"&gt;editor&lt;/ruby&gt;</pre>
     <p><ruby lang=ja>&#x7de8;&#x96c6;&#x8005;<rt lang=en>editor</ruby></div>

   </dd>


   <dt>Group ruby for Jukuji readings

   <dd>

    <p>A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping
    would be difficult. (In English, the words "Colonel" and "Lieutenant" are examples of words
    where a direct mapping of pronunciation to individual letters is, in some dialects, rather
    unclear.)

    <div class=example>
     <p>In this example, the name of a species of flowers has a phonetic reading provided using group ruby:
     <pre>&lt;ruby&gt;&#x7d2b;&#x967d;&#x82b1;&lt;rt&gt;&#x3042;&#x3058;&#x3055;&#x3044;&lt;/ruby&gt;</pre>
     <p lang=ja><ruby>&#x7d2b;&#x967d;&#x82b1;<rt>&#x3042;&#x3058;&#x3055;&#x3044;</ruby></div>

   </dd>


   <dt>Text with both phonetic and semantic annotations (double-sided ruby)

   <dd>

    <p>Sometimes, ruby styles described above are combined.

    <p>If this results in two annotations covering the same single base segment, then the
    annotations can just be placed back to back.

    <div class=example>
     <pre>&lt;ruby&gt;BASE&lt;rt&gt;annotation 1&lt;rt&gt;annotation 2&lt;/ruby&gt;</pre>
    </div>

    <div class=example>
     <pre>&lt;ruby&gt;B&lt;rt&gt;a&lt;rt&gt;a&lt;/ruby&gt;&lt;ruby&gt;A&lt;rt&gt;a&lt;rt&gt;a&lt;/ruby&gt;&lt;ruby&gt;S&lt;rt&gt;a&lt;rt&gt;a&lt;/ruby&gt;&lt;ruby&gt;E&lt;rt&gt;a&lt;rt&gt;a&lt;/ruby&gt;</pre>
    </div>

    <div class=example>

     <p>In this contrived example, some symbols are given names in English and French.

     <pre>&lt;ruby&gt;
 &hearts; &lt;rt&gt; Heart &lt;rt lang=fr&gt; C&oelig;ur
 &#x2618; &lt;rt&gt; Shamrock &lt;rt lang=fr&gt; Tr&egrave;fle
 &sext; &lt;rt&gt; Star &lt;rt lang=fr&gt; &Eacute;toile
&lt;/ruby&gt;</pre>

    </div>

    <p>In more complication situations such as following examples, a nested <code><a href=#the-ruby-element>ruby</a></code>
    element is used to give the inner annotations, and then that whole <code><a href=#the-ruby-element>ruby</a></code> is then
    given an annotation at the "outer" level.

    <div class=example>
     <pre>&lt;ruby&gt;&lt;ruby&gt;B&lt;rt&gt;a&lt;/rt&gt;A&lt;rt&gt;n&lt;/rt&gt;S&lt;rt&gt;t&lt;/rt&gt;E&lt;rt&gt;n&lt;/rt&gt;&lt;/ruby&gt;&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
    </div>

    <div class=example>
     <p>Here both a phonetic reading and the meaning are given in ruby annotations. The annotation on the nested <code><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><a href=#the-rt-element>rt</a></code> element that is a child of the outer <code><a href=#the-ruby-element>ruby</a></code> element gives the meaning using hiragana.
     <pre>&lt;ruby&gt;&lt;ruby&gt;&#x6771;&lt;rt&gt;&#x3068;&#x3046;&lt;/rt&gt;&#x5357;&lt;rt&gt;&#x306a;&#x3093;&lt;/rt&gt;&lt;/ruby&gt;&lt;rt&gt;&#x305f;&#x3064;&#x307f;&lt;/rt&gt;&lt;/ruby&gt;&#x306e;&#x65b9;&#x89d2;</pre>
     <p lang=ja><ruby><ruby>&#x6771;<rt>&#x3068;&#x3046;</rt>&#x5357;<rt>&#x306a;&#x3093;</ruby><rt>&#x305f;&#x3064;&#x307f;</ruby>&#x306e;&#x65b9;&#x89d2;
    </div>

    <div class=example>
     <p>This is the same example, but the meaning is given in English instead of Japanese:
     <pre>&lt;ruby&gt;&lt;ruby&gt;&#x6771;&lt;rt&gt;&#x3068;&#x3046;&lt;/rt&gt;&#x5357;&lt;rt&gt;&#x306a;&#x3093;&lt;/rt&gt;&lt;/ruby&gt;&lt;rt lang=en&gt;Southeast&lt;/rt&gt;&lt;/ruby&gt;&#x306e;&#x65b9;&#x89d2;</pre>
     <p lang=ja><ruby><ruby>&#x6771;<rt>&#x3068;&#x3046;</rt>&#x5357;<rt>&#x306a;&#x3093;</ruby><rt lang=en>Southeast</ruby>&#x306e;&#x65b9;&#x89d2;
    </div>

   </dd>

  </dl><hr><p>Within a <code><a href=#the-ruby-element>ruby</a></code> element that does not have a <code><a href=#the-ruby-element>ruby</a></code> element ancestor,
  content is segmented and segments are placed into three categories: base text segments, annotation
  segments, and ignored segments. Ignored segments do not form part of the document's semantics
  (they consist of some <a href=#inter-element-whitespace>inter-element whitespace</a> and <code><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<!-- if anyone can find a better way of phrasing this parenthetical,
  do let me know! -->). Annotation segments correspond to <code><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><a href=#the-ruby-element>ruby</a></code> element <a href=#represents>represents</a> the union of the segments of base
  text it contains, along with the mapping from those base text segments to annotation segments.
  Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly
  one element. <a href=#refsDOM>[DOM]</a></p>

  <p>At any particular time, the segmentation and categorisation of content of a <code><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 title="">base text segments</var> be an empty list of base text segments, each
   potentially with a list of base text subsegments.</li>

   <li><p>Let <var title="">annotation segments</var> be an empty list of annotation segments, each
   potentially being associated with a base text segment or subsegment.</li>

   <li><p>Let <var title="">root</var> be the <code><a href=#the-ruby-element>ruby</a></code> element for which the algorithm is
   being run.</li>

   <li><p>If <var title="">root</var> has a <code><a href=#the-ruby-element>ruby</a></code> element ancestor, then jump to the
   step labeled <i>end</i>.</li>

   <li><p>Let <var title="">current parent</var> be <var title="">root</var>.</li>

   <li><p>Let <var title="">index</var> be 0.</li>

   <li><p>Let <var title="">start index</var> be null.</li>

   <li><p>Let <var title="">parent start index</var> be null.</li>

   <li><p>Let <var title="">current base text</var> be null.</li>


   <!-- This is spaghetti code. If someone can work out a way to phrase this that is as unambiguous
   but maps more cleanly to structured code, please let me know. -->


   <li><p><i>Start mode</i>: If <var title="">index</var> is equal to or greater than the number of
   child nodes in <var title="">current parent</var>, then jump to the step labeled <i>end
   mode</i>.</p>

   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an
   <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code> element, jump to the step labeled <i>annotation
   mode</i>.</li>

   <!-- if we get here then the first node in a ruby element or after an <rt> or <rp> is something
   we want in a base text -->
   
   <li><p>Set <var title="">start index</var> to the value of <var title="">index</var>.</li>

   <li><p><i>Base mode</i>: If the <var title="">index</var>th node in <var title="">current
   parent</var> is a <code><a href=#the-ruby-element>ruby</a></code> element, and if <var title="">current parent</var> is the
   same element as <var title="">root</var>, then <a href=#push-a-ruby-level>push a ruby level</a> and then jump to
   the step labeled <i>start mode</i>.</li>

   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an
   <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code> element, then <a href=#set-the-current-base-text>set the current base text</a> and then
   jump to the step labeled <i>annotation mode</i>.</li>

   <li><p>Increment <var title="">index</var> by one.</li>

   <li><p><i>Base mode post-increment</i>: If <var title="">index</var> is equal to or greater than
   the number of child nodes in <var title="">current parent</var>, then jump to the step labeled
   <i>end mode</i>.</li>

   <li><p>Jump back to the step labeled <i>base mode</i>.</li>


   <li><p><i>Annotation mode</i>: If the <var title="">index</var>th node in <var title="">current
   parent</var> is an <code><a href=#the-rt-element>rt</a></code> element, then <a href=#push-a-ruby-annotation>push a ruby annotation</a> and jump to
   the step labeled <i>annotation mode increment</i>.</li>

   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an
   <code><a href=#the-rp-element>rp</a></code> element, jump to the step labeled <i>annotation mode increment</i>.</li>

   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is not a
   <code><a href=#text>Text</a></code> node, or is a <code><a href=#text>Text</a></code> node that is not <a href=#inter-element-whitespace>inter-element
   whitespace</a>, then jump to the step labeled <i>base mode</i>.</li>

   <!-- index points at whitespace -->

   <li><p><i>Annotation mode increment</i>: Let <var title="">lookahead index</var> be <var title="">index</var> plus one.</li>

   <li><p><i>Annotation mode white-space skipper</i>: If <var title="">lookahead index</var> is
   equal to the number of child nodes in <var title="">current parent</var> then jump to the step
   labeled <i>end mode</i>.</li>

   <li><p>If the <var title="">lookahead index</var>th node in <var title="">current parent</var> is
   an <code><a href=#the-rt-element>rt</a></code> element or an <code><a href=#the-rp-element>rp</a></code> element, then set <var title="">index</var> to
   <var title="">lookahead index</var> and jump to the step labeled <i>annotation mode</i>.</li>

   <li><p>If the <var title="">lookahead index</var>th node in <var title="">current parent</var> is
   not a <code><a href=#text>Text</a></code> node, or is a <code><a href=#text>Text</a></code> node that is not <a href=#inter-element-whitespace>inter-element
   whitespace</a>, then jump to the step labeled <i>base mode</i> (without further incrementing
   <var title="">index</var>, so the <a href=#inter-element-whitespace>inter-element whitespace</a> seen so far becomes part
   of the next base text segment).</li>

   <li><p>Increment <var title="">lookahead index</var> by one.</li>

   <li><p>Jump to the step labeled <i>annotation mode white-space skipper</i>.</li>


   <li><p><i>End mode</i>: If <var title="">current parent</var> is not the same element as <var title="">root</var>, then <a href=#pop-a-ruby-level>pop a ruby level</a> and jump to the step labeled <i>base mode
   post-increment</i>.</li>

   <li><p><i>End</i>: Return <var title="">base text segments</var> and <var title="">annotation
   segments</var>. Any content of the <code><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>.</li>

  </ol><p>When the steps above say to <dfn id=set-the-current-base-text>set the current base text</dfn>, it means to run the following
  steps at that point in the algorithm:</p>

  <ol><li><p>Let <var title="">text range</var> be a DOM range whose <a href=#concept-range-start title=concept-range-start>start</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary
   point</a> (<var title="">current parent</var>, <var title="">start index</var>) and whose
   <a href=#concept-range-end title=concept-range-end>end</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary
   point</a> (<var title="">current parent</var>, <var title="">index</var>).</li>

   <li><p>Let <var title="">new text segment</var> be a base text segment described by the range
   <var title="">annotation range</var>.</p>

   <li><p>Add <var title="">new text segment</var> to <var title="">base text
   segments</var>.</li>

   <li><p>Let <var title="">current base text</var> be <var title="">new text
   segment</var>.</li>

   <li><p>Let <var title="">start index</var> be null.</li>

  </ol><p>When the steps above say to <dfn id=push-a-ruby-level>push a ruby level</dfn>, it means to run the following steps
  at that point in the algorithm:</p>

  <ol><li><p>Let <var title="">current parent</var> be the <var title="">index</var>th node in <var title="">current parent</var>.</li>

   <li><p>Let <var title="">index</var> be 0.</li>

   <li><p>Set <var title="">saved start index</var> to the value of <var title="">start
   index</var>.</li>

   <li><p>Let <var title="">start index</var> be null.</li>

  </ol><p>When the steps above say to <dfn id=pop-a-ruby-level>pop a ruby level</dfn>, it means to run the following steps at
  that point in the algorithm:</p>

  <ol><li><p>Let <var title="">index</var> be the position of <var title="">current parent</var> in
   <var title="">root</var>.</li>

   <li><p>Let <var title="">current parent</var> be <var title="">root</var>.</li>

   <li><p>Increment <var title="">index</var> by one.</li>

   <li><p>Set <var title="">start index</var> to the value of <var title="">saved start
   index</var>.</li>

   <li><p>Let <var title="">saved start index</var> be null.</li>

  </ol><p>When the steps above say to <dfn id=push-a-ruby-annotation>push a ruby annotation</dfn>, it means to run the following
  steps at that point in the algorithm:</p>

  <ol><li><p>Let <var title="">rt</var> be the <code><a href=#the-rt-element>rt</a></code> element that is the <var title="">index</var>th node of <var title="">current parent</var>.</li>

   <li><p>Let <var title="">annotation range</var> be a DOM range whose <a href=#concept-range-start title=concept-range-start>start</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary
   point</a> (<var title="">current parent</var>, <var title="">index</var>) and whose <a href=#concept-range-end title=concept-range-end>end</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary point</a>
   (<var title="">current parent</var>, <var title="">index</var> plus one) (i.e. that contains only
   <var title="">rt</var>).</li>

   <li><p>Let <var title="">new annotation segment</var> be an annotation segment described by the
   range <var title="">annotation range</var>.</li>

   <li><p>If <var title="">current base text</var> is not null, associate <var title="">new
   annotation segment</var> with <var title="">current base text</var>.</li>

   <li><p>Add <var title="">new annotation segment</var> to <var title="">annotation
   segments</var>.</li>

  </ol><div class=example>

   <!-- this is the hiragana for the word "kanji" ("chinese character") in japanese -->
   <!-- in japanese, ruby-like typography is called "furigana" -->

   <p>In this example, each ideograph in the Japanese text <span lang=ja title="">&#x6f22;&#x5b57;</span> is annotated with its reading in hiragana.</p>

   <pre lang=ja>...
&lt;ruby&gt;&#x6f22;&lt;rt&gt;&#x304b;&#x3093;&lt;/rt&gt;&#x5b57;&lt;rt&gt;&#x3058;&lt;/rt&gt;&lt;/ruby&gt;
...</pre>

   <p>This might be rendered as:</p>

   <p><img src=http://images.whatwg.org/sample-ruby-ja.png width=171 alt="The two main ideographs, each with its annotation in hiragana rendered in a smaller font above it." height=78></p>

  </div>

  <div class=example>

   <!-- this is the zhuyin fuhao (aka bopomofo) for the word "hanzi" ("chinese character") in traditional chinese, as used in taiwan -->

   <p>In this example, each ideograph in the traditional Chinese text <span lang=zh-TW title="">&#x6f22;&#x5b57;</span> is annotated with its bopomofo reading.</p>

   <pre lang=zh-TW>&lt;ruby&gt;&#x6f22;&lt;rt&gt;&#x310f;&#x3122;&#x2cb;&lt;/rt&gt;&#x5b57;&lt;rt&gt;&#x3117;&#x2cb;&lt;/rt&gt;&lt;/ruby&gt;</pre>

   <p>This might be rendered as:</p>

   <p><img src=http://images.whatwg.org/sample-ruby-bopomofo.png width=78 alt="The two main ideographs, each with its bopomofo annotation rendered in a smaller font next to it." height=100></p>

  </div>

  <div class=example>

   <!-- this is the pinyin for the word "hanzi" ("chinese character") in simplified chinese, as used in mainland china -->

   <p>In this example, each ideograph in the simplified Chinese text <span lang=zh-CN title="">&#x6c49;&#x5b57;</span> is annotated with its pinyin reading.</p>

   <pre lang=zh-CN>...&lt;ruby&gt;&#x6c49;&lt;rt&gt;h&agrave;n&lt;/rt&gt;&#x5b57;&lt;rt&gt;z&igrave;&lt;/rt&gt;&lt;/ruby&gt;...</pre>

   <p>This might be rendered as:</p>

   <p><img src=http://images.whatwg.org/sample-ruby-pinyin.png width=173 alt="The two main ideographs, each with its pinyin annotation rendered in a smaller font above it." height=79></p>

  </div>

  <!-- Note: Examples are 32px/16px Stone Sans Sem ITC TT -->

  <div class=example>

   <p>In this more contrived example, the acronym "HTML" has four annotations: one for the whole
   acronym, briefly describing what it is, one for the letters "HT" expanding them to "Hypertext",
   one for the letter "M" expanding it to "Markup", and one for the letter "L" expanding it to
   "Language".</p>

   <pre>&lt;ruby&gt;
 &lt;ruby&gt;HT&lt;rt&gt;Hypertext&lt;/rt&gt;M&lt;rt&gt;Markup&lt;/rt&gt;L&lt;rt&gt;Language&lt;/rt&gt;&lt;/ruby&gt;
 &lt;rt&gt;An abstract language for describing documents and applications
&lt;/ruby&gt;</pre>

  </div>


  <h4 id=the-rt-element><span class=secno>4.6.22 </span>The <dfn><code>rt</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-ruby-element>ruby</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>An <code><a href=#the-rt-element>rt</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-rt-element>rt</a></code> element is immediately followed by an <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code> element,
   or if there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><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><a href=#the-ruby-element>ruby</a></code> element, it doesn't <a href=#represents title=represents>represent</a>
  anything itself, but the <code><a href=#the-ruby-element>ruby</a></code> element uses it as part of determining what <em>it</em>
  <a href=#represents>represents</a>.</p>

  <div class=impl>

  <p>An <code><a href=#the-rt-element>rt</a></code> element that is not a child of a <code><a href=#the-ruby-element>ruby</a></code> element
  <a href=#represents>represents</a> the same thing as its children.</p>

  </div>


  <h4 id=the-rp-element><span class=secno>4.6.23 </span>The <dfn><code>rp</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-ruby-element>ruby</a></code> element, either immediately before or immediately after an <code><a href=#the-rt-element>rt</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>An <code><a href=#the-rp-element>rp</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-rp-element>rp</a></code> element is immediately followed by an <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code> element,
   or if there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-rp-element>rp</a></code> element can be used to provide parentheses around a ruby text component of
  a ruby annotation, to be shown by user agents that don't support ruby annotations.</p>

  <p>An <code><a href=#the-rp-element>rp</a></code> element <span class=impl>that is a child of a <code><a href=#the-ruby-element>ruby</a></code>
  element</span> <a href=#represents>represents</a> nothing. <span class=impl>An <code><a href=#the-rp-element>rp</a></code> element
  whose parent element is not a <code><a href=#the-ruby-element>ruby</a></code> element <a href=#represents>represents</a> its
  children.</span></p>

  <div class=example>

   <p>The example above, in which each ideograph in the text <span lang=ja title="">&#x6f22;&#x5b57;</span> is annotated with its
   phonetic reading, could be expanded to use <code><a href=#the-rp-element>rp</a></code> so that in
   legacy user agents the readings are in parentheses:</p>

   <pre lang=ja>...
&lt;ruby&gt;&#x6f22;&lt;rp&gt; (&lt;/rp&gt;&lt;rt&gt;&#x304b;&#x3093;&lt;/rt&gt;&lt;rp&gt;) &lt;/rp&gt;&#x5b57;&lt;rp&gt; (&lt;/rp&gt;&lt;rt&gt;&#x3058;&lt;/rt&gt;&lt;rp&gt;) &lt;/rp&gt;&lt;/ruby&gt;
...</pre>

   <p>In conforming user agents the rendering would be as above, but
   in user agents that do not support ruby, the rendering would
   be:</p>

   <pre lang=ja>... &#x6f22; (&#x304b;&#x3093;) &#x5b57; (&#x3058;) ...</pre>

  </div>

  <div class=example>

   <p>When there are multiple annotations for a segment, <code><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><a href=#the-rp-element>rp</a></code> elements as
   well:

   <pre>&lt;ruby&gt;
&hearts;&lt;rp&gt;: &lt;/rp&gt;&lt;rt&gt;Heart&lt;/rt&gt;&lt;rp&gt;, &lt;/rp&gt;&lt;rt lang=fr&gt;C&oelig;ur&lt;/rt&gt;&lt;rp&gt;.&lt;/rp&gt;
&#x2618;&lt;rp&gt;: &lt;/rp&gt;&lt;rt&gt;Shamrock&lt;/rt&gt;&lt;rp&gt;, &lt;/rp&gt;&lt;rt lang=fr&gt;Tr&egrave;fle&lt;/rt&gt;&lt;rp&gt;.&lt;/rp&gt;
&sext;&lt;rp&gt;: &lt;/rp&gt;&lt;rt&gt;Star&lt;/rt&gt;&lt;rp&gt;, &lt;/rp&gt;&lt;rt lang=fr&gt;&Eacute;toile&lt;/rt&gt;&lt;rp&gt;.&lt;/rp&gt;
&lt;/ruby&gt;</pre>

   <p>This would make the example render as follows in non-ruby-capable user agents:

   <pre>&hearts;: Heart, <span lang=fr>C&oelig;ur</span>. &#x2618;: Shamrock, <span lang=fr>Tr&egrave;fle</span>. &sext;: Star, <span lang=fr>&Eacute;toile</span>.</pre>

  </div>


  <h4 id=the-bdi-element><span class=secno>4.6.24 </span>The <dfn><code>bdi</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd>Also, the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-bdi-element>bdi</a></code> element <a href=#represents>represents</a> a span of text that is to be isolated from
  its surroundings for the purposes of bidirectional text formatting. <a href=#refsBIDI>[BIDI]</a></p>

  <p class=note>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global attribute defaults to <code title=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>

  <div class=impl>

  <p>For the purposes of applying the bidirectional algorithm to the contents of a <code><a href=#the-bdi-element>bdi</a></code>
  element, user agents must treat the element as an independent and isolated segment.</p>

  <p>For the purposes of applying the bidirectional algorithm to the paragraph-level container that
  a <code><a href=#the-bdi-element>bdi</a></code> element finds itself within, the <code><a href=#the-bdi-element>bdi</a></code> element must be treated like
  a U+FFFC OBJECT REPLACEMENT CHARACTER (in the same manner that an image or other inline object is
  handled).</p>

  <p>The requirements on handling the <code><a href=#the-bdi-element>bdi</a></code> element for the bidirectional algorithm may
  be implemented indirectly through the style layer. For example, an HTML+CSS user agent could
  implement these requirements by implementing the CSS 'unicode-bidi' property. <a href=#refsCSS>[CSS]</a></p>

  </div>

  <div class=example>

   <p>This element is especially useful when embedding user-generated content with an unknown
   directionality.</p>

   <p>In this example, usernames are shown along with the number of posts that the user has
   submitted. If the <code><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>&lt;ul&gt;
 &lt;li&gt;User &lt;bdi&gt;jcranmer&lt;/bdi&gt;: 12 posts.
 &lt;li&gt;User &lt;bdi&gt;hober&lt;/bdi&gt;: 5 posts.
 &lt;li&gt;User &lt;bdi&gt;<bdo dir=rtl>&#x625;&#x64a;&#x627;&#x646;</bdo>&lt;/bdi&gt;: 3 posts.
&lt;/ul&gt;</pre>

  </div>


  <h4 id=the-bdo-element><span class=secno>4.6.25 </span>The <dfn><code>bdo</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd>Also, the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-bdo-element>bdo</a></code> element <a href=#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 title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute on this element, with the
  value <code>ltr</code> to specify a left-to-right override and with the value <code>rtl</code> to
  specify a right-to-left override.</p>

  <div class=impl>

  <p>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <i title=attr-dir-rtl-state><a href=#attr-dir-rtl-state>rtl</a></i> state, then for the purposes of the bidirectional algorithm,
  the user agent must act as if there was a U+202D LEFT-TO-RIGHT OVERRIDE character at the start of
  the element, and a U+202C POP DIRECTIONAL FORMATTING at the end of the element.</p>

  <p>If the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute is in the <i title=attr-dir-ltr-state><a href=#attr-dir-ltr-state>ltr</a></i>, then for the purposes of the bidirectional algorithm, the user
  agent must act as if there was a U+202E RIGHT-TO-LEFT OVERRIDE character at the start of the
  element, and a U+202C POP DIRECTIONAL FORMATTING at the end of the element.</p>

  <p>The requirements on handling the <code><a href=#the-bdo-element>bdo</a></code> element for the bidirectional algorithm may
  be implemented indirectly through the style layer. For example, an HTML+CSS user agent could
  implement these requirements by implementing the CSS 'unicode-bidi' property. <a href=#refsCSS>[CSS]</a></p>

  </div>



  <h4 id=the-span-element><span class=secno>4.6.26 </span>The <dfn><code>span</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlspanelement>HTMLSpanElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-span-element>span</a></code> element doesn't mean anything on its own,
  but can be useful when used together with the <a href=#global-attributes>global
  attributes</a>, e.g. <code title=attr-class><a href=#classes>class</a></code>, <code title=attr-lang><a href=#attr-lang>lang</a></code>, or <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>.
  It <a href=#represents>represents</a> its children.</p>

  <div class=example>

   <p>In this example, a code fragment is marked up using
   <code><a href=#the-span-element>span</a></code> elements and <code title=attr-class><a href=#classes>class</a></code> attributes so that its keywords and
   identifiers can be color-coded from CSS:</p>

   <!-- extract from http://www.cs.cmu.edu/~dst/DeCSS/Gallery/vlc-dvd_css-c.txt -->

   <pre>&lt;pre&gt;&lt;code class="lang-c"&gt;&lt;span class="keyword"&gt;for&lt;/span&gt; (&lt;span class="ident"&gt;j&lt;/span&gt; = 0; &lt;span class="ident"&gt;j&lt;/span&gt; &amp;lt; 256; &lt;span class="ident"&gt;j&lt;/span&gt;++) {
  &lt;span class="ident"&gt;i_t3&lt;/span&gt; = (&lt;span class="ident"&gt;i_t3&lt;/span&gt; &amp; 0x1ffff) | (&lt;span class="ident"&gt;j&lt;/span&gt; &amp;lt;&amp;lt; 17);
  &lt;span class="ident"&gt;i_t6&lt;/span&gt; = (((((((&lt;span class="ident"&gt;i_t3&lt;/span&gt; &gt;&gt; 3) ^ &lt;span class="ident"&gt;i_t3&lt;/span&gt;) &gt;&gt; 1) ^ &lt;span class="ident"&gt;i_t3&lt;/span&gt;) &gt;&gt; 8) ^ &lt;span class="ident"&gt;i_t3&lt;/span&gt;) &gt;&gt; 5) &amp; 0xff;
  &lt;span class="keyword"&gt;if&lt;/span&gt; (&lt;span class="ident"&gt;i_t6&lt;/span&gt; == &lt;span class="ident"&gt;i_t1&lt;/span&gt;)
    &lt;span class="keyword"&gt;break&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;</pre>

  </div>



  <h4 id=the-br-element><span class=secno>4.6.27 </span>The <dfn><code>br</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlbrelement>HTMLBRElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLBRElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-br-element>br</a></code> element <a href=#represents>represents</a> a line
  break.</p>

  <p class=note>While line breaks are usually represented in visual
  media by physically moving subsequent text to a new line, a style
  sheet or user agent would be equally justified in causing line
  breaks to be rendered in a different manner, for instance as green
  dots, or as extra spacing.</p>

  <p><code><a href=#the-br-element>br</a></code> elements must be used only for line breaks that
  are actually part of the content, as in poems or addresses.</p>

  <div class=example>

  <p>The following example is correct usage of the <code><a href=#the-br-element>br</a></code>
  element:</p>

   <pre>&lt;p&gt;P. Sherman&lt;br&gt;
42 Wallaby Way&lt;br&gt;
Sydney&lt;/p&gt;</pre>

  </div>

  <p><code><a href=#the-br-element>br</a></code> elements must not be used for separating thematic
  groups in a paragraph.</p>

  <div class=example>

   <p>The following examples are non-conforming, as they abuse the
   <code><a href=#the-br-element>br</a></code> element:</p>

   <pre>&lt;p&gt;&lt;a ...&gt;34 comments.&lt;/a&gt;&lt;br&gt;
&lt;a ...&gt;Add a comment.&lt;/a&gt;&lt;/p&gt;</pre>

   <pre>&lt;p&gt;&lt;label&gt;Name: &lt;input name="name"&gt;&lt;/label&gt;&lt;br&gt;
&lt;label&gt;Address: &lt;input name="address"&gt;&lt;/label&gt;&lt;/p&gt;</pre>

   <p>Here are alternatives to the above, which are correct:</p>

   <pre>&lt;p&gt;&lt;a ...&gt;34 comments.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a ...&gt;Add a comment.&lt;/a&gt;&lt;/p&gt;</pre>

   <pre>&lt;p&gt;&lt;label&gt;Name: &lt;input name="name"&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;label&gt;Address: &lt;input name="address"&gt;&lt;/label&gt;&lt;/p&gt;</pre>

  </div>

  <p>If a <a href=#paragraph>paragraph</a> consists of nothing but a single
  <code><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>

  <div class=impl>

  <p>Any content inside <code><a href=#the-br-element>br</a></code> elements must not be
  considered part of the surrounding text.</p>

  <p>A <code><a href=#the-br-element>br</a></code> element should separate paragraphs for the
  purposes of the Unicode bidirectional algorithm. This requirement
  may be implemented indirectly through the style layer. For example,
  an HTML+CSS user agent could implement these requirements by
  implementing the CSS 'unicode-bidi' property. <a href=#refsBIDI>[BIDI]</a> <a href=#refsCSS>[CSS]</a></p>

  </div>


  <h4 id=the-wbr-element><span class=secno>4.6.28 </span>The <dfn><code>wbr</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-wbr-element>wbr</a></code> element <a href=#represents>represents</a> a line break
  opportunity.</p>

  <div class=impl>

  <p>For the purposes of applying the bidirectional algorithm to the paragraph-level container that
  a <code><a href=#the-wbr-element>wbr</a></code> element finds itself within, the <code><a href=#the-wbr-element>wbr</a></code> element must be treated like
  a U+200B ZERO WIDTH SPACE (i.e. it has no effect).</p>

  <p>The requirements on handling the <code><a href=#the-wbr-element>wbr</a></code> element for the bidirectional algorithm may
  be implemented indirectly through the style layer, e.g. by implementing the suggestions in the <a href=#rendering>rendering</a> section.</p>

  </div>

  <div class=example>

   <p>In the following example, someone is quoted as saying something
   which, for effect, is written as one long word. However, to ensure
   that the text can be wrapped in a readable fashion, the individual
   words in the quote are separated using a <code><a href=#the-wbr-element>wbr</a></code>
   element.</p>

   <pre>&lt;p&gt;So then he pointed at the tiger and screamed
"there&lt;wbr&gt;is&lt;wbr&gt;no&lt;wbr&gt;way&lt;wbr&gt;you&lt;wbr&gt;are&lt;wbr&gt;ever&lt;wbr&gt;going&lt;wbr&gt;to&lt;wbr&gt;catch&lt;wbr&gt;me"!&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>Here, especially long lines of code in a program listing have
   suggested wrapping points given using <code><a href=#the-wbr-element>wbr</a></code>
   elements.</p>

   <pre>&lt;pre&gt;...
Heading heading = Helm.HeadingFactory(HeadingCoordinates[1], &lt;wbr&gt;HeadingCoordinates[2], &lt;wbr&gt;HeadingCoordinates[3], &lt;wbr&gt;HeadingCoordinates[4]);
Course course = Helm.CourseFactory(Heading, &lt;wbr&gt;Maps.MapFactoryFromHeading(heading), &lt;wbr&gt;Speeds.GetMaximumSpeed().ConvertToWarp());
...&lt;/pre&gt;</pre>

  </div>

  <div class=impl>

  <p>Any content inside <code><a href=#the-wbr-element>wbr</a></code> elements must not be
  considered part of the surrounding text.</p>

  </div>



  <h4 id=usage-summary><span class=secno>4.6.29 </span>Usage summary</h4>

  <p><i>This section is non-normative.</i></p>

  <table><thead><tr><th>Element
     <th>Purpose
     <th>Example
   <tbody><tr><td><code><a href=#the-a-element>a</a></code>
     <td>Hyperlinks
     <td><pre class=example>Visit my <strong>&lt;a href="drinks.html"&gt;drinks&lt;/a&gt;</strong> page.</pre>

    <tr><td><code><a href=#the-em-element>em</a></code>
     <td>Stress emphasis
     <td><pre class=example>I must say I <strong>&lt;em&gt;adore&lt;/em&gt;</strong> lemonade.</pre>

    <tr><td><code><a href=#the-strong-element>strong</a></code>
     <td>Importance
     <td><pre class=example>This tea is <strong>&lt;strong&gt;very hot&lt;/strong&gt;</strong>.</pre>

    <tr><td><code><a href=#the-small-element>small</a></code>
     <td>Side comments
     <td><pre class=example>These grapes are made into wine. <strong>&lt;small&gt;Alcohol is addictive.&lt;/small&gt;</strong></pre>

    <tr><td><code><a href=#the-s-element>s</a></code>
     <td>Inaccurate text
     <td><pre class=example>Price: <strong>&lt;s&gt;&pound;4.50&lt;/s&gt;</strong> &pound;2.00!</pre>

    <tr><td><code><a href=#the-cite-element>cite</a></code>
     <td>Titles of works
     <td><pre class=example>The case <strong>&lt;cite&gt;Hugo v. Danielle&lt;/cite&gt;</strong> is relevant here.</pre>

    <tr><td><code><a href=#the-q-element>q</a></code>
     <td>Quotations
     <td><pre class=example>The judge said <strong>&lt;q&gt;You can drink water from the fish tank&lt;/q&gt;</strong> but advised against it.</pre>

    <tr><td><code><a href=#the-dfn-element>dfn</a></code>
     <td>Defining instance
     <td><pre class=example>The term <strong>&lt;dfn&gt;organic food&lt;/dfn&gt;</strong> refers to food produced without synthetic chemicals.</pre>

    <tr><td><code><a href=#the-abbr-element>abbr</a></code>
     <td>Abbreviations
     <td><pre class=example>Organic food in Ireland is certified by the <strong>&lt;abbr title="Irish Organic Farmers and Growers Association"&gt;IOFGA&lt;/abbr&gt;</strong>.</pre>

    <tr><td><code><a href=#the-data-element>data</a></code>
     <td>Machine-readable equivalent
     <td><pre class=example>Available starting today! <strong>&lt;data value="UPC:022014640201"&gt;North Coast Organic Apple Cider&lt;/data&gt;</strong></pre>

    <tr><td><code><a href=#the-time-element>time</a></code>
     <td>Machine-readable equivalent of date- or time-related data
     <td><pre class=example>Available starting on <strong>&lt;time datetime="2011-11-12"&gt;November 12th&lt;/time&gt;</strong>!</pre>

    <tr><td><code><a href=#the-code-element>code</a></code>
     <td>Computer code
     <td><pre class=example>The <strong>&lt;code&gt;fruitdb&lt;/code&gt;</strong> program can be used for tracking fruit production.</pre>

    <tr><td><code><a href=#the-var-element>var</a></code>
     <td>Variables
     <td><pre class=example>If there are <strong>&lt;var&gt;n&lt;/var&gt;</strong> fruit in the bowl, at least <strong>&lt;var&gt;n&lt;/var&gt;</strong>&divide;2 will be ripe.</pre>

    <tr><td><code><a href=#the-samp-element>samp</a></code>
     <td>Computer output
     <td><pre class=example>The computer said <strong>&lt;samp&gt;Unknown error -3&lt;/samp&gt;</strong>.</pre>

    <tr><td><code><a href=#the-kbd-element>kbd</a></code>
     <td>User input
     <td><pre class=example>Hit <strong>&lt;kbd&gt;F1&lt;/kbd&gt;</strong> to continue.</pre>

    <tr><td><code><a href=#the-sub-and-sup-elements>sub</a></code>
     <td>Subscripts
     <td><pre class=example>Water is H<strong>&lt;sub&gt;2&lt;/sub&gt;</strong>O.</pre>

    <tr><td><code><a href=#the-sub-and-sup-elements>sup</a></code>
     <td>Superscripts
     <td><pre class=example>The Hydrogen in heavy water is usually <strong>&lt;sup&gt;2&lt;/sup&gt;</strong>H.</pre>

    <tr><td><code><a href=#the-i-element>i</a></code>
     <td>Alternative voice
     <td><pre class=example>Lemonade consists primarily of <strong>&lt;i&gt;Citrus limon&lt;/i&gt;</strong>.</pre>

    <tr><td><code><a href=#the-b-element>b</a></code>
     <td>Keywords
     <td><pre class=example>Take a <strong>&lt;b&gt;lemon&lt;/b&gt;</strong> and squeeze it with a <strong>&lt;b&gt;juicer&lt;/b&gt;</strong>.</pre>

    <tr><td><code><a href=#the-u-element>u</a></code>
     <td>Annotations
     <td><pre class=example>The mixture of apple juice and <strong>&lt;u class="spelling"&gt;eldeflower&lt;/u&gt;</strong> juice is very pleasant.</pre>

    <tr><td><code><a href=#the-mark-element>mark</a></code>
     <td>Highlight
     <td><pre class=example>Elderflower cordial, with one <strong>&lt;mark&gt;part&lt;/mark&gt;</strong> cordial to ten <strong>&lt;mark&gt;part&lt;/mark&gt;</strong>s water, stands a<strong>&lt;mark&gt;part&lt;/mark&gt;</strong> from the rest.</pre>

    <tr><td><code><a href=#the-ruby-element>ruby</a></code>, <code><a href=#the-rt-element>rt</a></code>, <code><a href=#the-rp-element>rp</a></code>
     <td>Ruby annotations
     <td><pre class=example><strong>&lt;ruby&gt; OJ &lt;rp&gt;(&lt;rt&gt;Orange Juice&lt;rp&gt;)&lt;/ruby&gt;</strong></pre>

    <tr><td><code><a href=#the-bdi-element>bdi</a></code>
     <td>Text directionality isolation
     <td><pre class=example>The recommended restaurant is <strong>&lt;bdi lang=""&gt;My Juice Caf&eacute; (At The Beach)&lt;/bdi&gt;</strong>.</pre>

    <tr><td><code><a href=#the-bdo-element>bdo</a></code>
     <td>Text directionality formatting
     <td><pre class=example>The proposal is to write English, but in reverse order. "Juice" would become "<strong>&lt;bdo dir=rtl&gt;Juice&lt;/bdo&gt;</strong>"</pre>

    <tr><td><code><a href=#the-span-element>span</a></code>
     <td>Other
     <td><pre class=example>In French we call it <strong>&lt;span lang="fr"&gt;sirop de sureau&lt;/span&gt;</strong>.</pre>

    <tr><td><code><a href=#the-br-element>br</a></code>
     <td>Line break
     <td><pre class=example>Simply Orange Juice Company<strong>&lt;br&gt;</strong>Apopka, FL 32703<strong>&lt;br&gt;</strong>U.S.A.</pre>

    <tr><td><code><a href=#the-wbr-element>wbr</a></code>
     <td>Line breaking opportunity
     <td><pre class=example>www.simply<strong>&lt;wbr&gt;</strong>orange<strong>&lt;wbr&gt;</strong>juice.com</pre>

  </table><h3 id=edits><span class=secno>4.7 </span>Edits</h3>

  <p>The <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements represent
  edits to the document.</p>


  <h4 id=the-ins-element><span class=secno>4.7.1 </span>The <dfn><code>ins</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#transparent>Transparent</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code> &mdash; Link to the source of the quotation or more information about the edit</dd>
   <dd><code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> &mdash; Date and (optionally) time of the change</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses the <code><a href=#htmlmodelement>HTMLModElement</a></code> interface.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-ins-element>ins</a></code> element <a href=#represents>represents</a> an addition
  to the document.</p>

  <div class=example>

   <p>The following represents the addition of a single paragraph:</p>

   <pre>&lt;aside&gt;
 &lt;ins&gt;
  &lt;p&gt; I like fruit. &lt;/p&gt;
 &lt;/ins&gt;
&lt;/aside&gt;</pre>

   <p>As does the following, because everything in the
   <code><a href=#the-aside-element>aside</a></code> element here counts as <a href=#phrasing-content>phrasing
   content</a> and therefore there is just one
   <a href=#paragraph>paragraph</a>:</p>

   <pre>&lt;aside&gt;
 &lt;ins&gt;
  Apples are &lt;em&gt;tasty&lt;/em&gt;.
 &lt;/ins&gt;
 &lt;ins&gt;
  So are pears.
 &lt;/ins&gt;
&lt;/aside&gt;</pre>

  </div>

  <p><code><a href=#the-ins-element>ins</a></code> elements should not cross <a href=#paragraph title=paragraph>implied paragraph</a> boundaries.</p>

  <div class=example>

   <p>The following example represents the addition of two paragraphs,
   the second of which was inserted in two parts. The first
   <code><a href=#the-ins-element>ins</a></code> element in this example thus crosses a paragraph
   boundary, which is considered poor form.</p>

   <pre class=bad>&lt;aside&gt;
 &lt;!-- don't do this --&gt;
 &lt;ins datetime="2005-03-16 00:00Z"&gt;
  &lt;p&gt; I like fruit. &lt;/p&gt;
  Apples are &lt;em&gt;tasty&lt;/em&gt;.
 &lt;/ins&gt;
 &lt;ins datetime="2007-12-19 00:00Z"&gt;
  So are pears.
 &lt;/ins&gt;
&lt;/aside&gt;</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>&lt;aside&gt;
 &lt;ins datetime="2005-03-16 00:00Z"&gt;
  &lt;p&gt; I like fruit. &lt;/p&gt;
 &lt;/ins&gt;
 &lt;ins datetime="2005-03-16 00:00Z"&gt;
  Apples are &lt;em&gt;tasty&lt;/em&gt;.
 &lt;/ins&gt;
 &lt;ins datetime="2007-12-19 00:00Z"&gt;
  So are pears.
 &lt;/ins&gt;
&lt;/aside&gt;</pre>

   <!-- Those dates aren't random. They're the start and end of
   something. Can you guess what? -->

  </div>


  <h4 id=the-del-element><span class=secno>4.7.2 </span>The <dfn><code>del</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#transparent>Transparent</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code> &mdash; Link to the source of the quotation or more information about the edit</dd>
   <dd><code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> &mdash; Date and (optionally) time of the change</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses the <code><a href=#htmlmodelement>HTMLModElement</a></code> interface.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-del-element>del</a></code> element <a href=#represents>represents</a> a removal from the document.</p>

  <p><code><a href=#the-del-element>del</a></code> elements should not cross <a href=#paragraph title=paragraph>implied paragraph</a>
  boundaries.</p>

  <div class=example>

   <p>The following shows a "to do" list where items that have been done are crossed-off with the
   date and time of their completion.</p>

   <pre>&lt;h1&gt;To Do&lt;/h1&gt;
&lt;ul&gt;
 &lt;li&gt;Empty the dishwasher&lt;/li&gt;
 &lt;li&gt;&lt;del datetime="2009-10-11T01:25-07:00"&gt;Watch Walter Lewin's lectures&lt;/del&gt;&lt;/li&gt;
 &lt;li&gt;&lt;del datetime="2009-10-10T23:38-07:00"&gt;Download more tracks&lt;/del&gt;&lt;/li&gt;
 &lt;li&gt;Buy a printer&lt;/li&gt;
&lt;/ul&gt;</pre>

  </div>



  <h4 id=attributes-common-to-ins-and-del-elements><span class=secno>4.7.3 </span>Attributes common to <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements</h4>

  <p>The <dfn id=attr-mod-cite title=attr-mod-cite><code>cite</code></dfn> attribute may be used to specify the
  address of a document that explains the change. When that document is long, for instance the
  minutes of a meeting, authors are encouraged to include a fragment identifier pointing to the
  specific part of that document that discusses the change.</p>

  <p>If the <code title=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>valid
  URL potentially surrounded by spaces</a> that explains the change. <span class=impl>To obtain
  the corresponding citation link, the value of the attribute must be <a href=#resolve-a-url title="resolve a
  url">resolved</a> relative to the element.</span> User agents may allow users to follow such
  citation links, but they are primarily intended for private use (e.g. by server-side scripts
  collecting statistics about a site's edits), not for readers.</p>


  <p>The <dfn id=attr-mod-datetime title=attr-mod-datetime><code>datetime</code></dfn> attribute may be used to specify
  the time and date of the change.</p>

  <p>If present, the <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> attribute's value must be a
  <a href=#valid-date-string-with-optional-time>valid date string with optional time</a>.</p>

  <div class=impl>

  <p>User agents must parse the <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> attribute according
  to the <a href=#parse-a-date-or-time-string>parse a date or time string</a> algorithm. If that doesn't return a <a href=#concept-date title=concept-date>date</a> or a <a href=#concept-datetime title=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>valid date string with optional time</a>). Otherwise, the modification is marked as
  having been made at the given <a href=#concept-date title=concept-date>date</a> or <a href=#concept-datetime title=concept-datetime>global date and time</a>. If the given value is a <a href=#concept-datetime title=concept-datetime>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>

  </div>

  <p>This value <span class=impl>may be shown to the user, but it</span> is primarily intended for
  private use.</p>

  <p>The <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements <span class=impl>must</span> implement the
  <code><a href=#htmlmodelement>HTMLModElement</a></code> interface:</p>

  <pre class=idl>interface <dfn id=htmlmodelement>HTMLModElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-mod-cite title=dom-mod-cite>cite</a>;
           attribute DOMString <a href=#dom-mod-datetime title=dom-mod-dateTime>dateTime</a>;
};</pre>

  <div class=impl>

  <p>The <dfn id=dom-mod-cite title=dom-mod-cite><code>cite</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the element's <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code> content attribute. The <dfn id=dom-mod-datetime title=dom-mod-dateTime><code>dateTime</code></dfn> IDL attribute must <a href=#reflect>reflect</a> the
  element's <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> content attribute.</p>

  </div>



  <h4 id=edits-and-paragraphs><span class=secno>4.7.4 </span>Edits and paragraphs</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Since the <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements do not
  affect <a href=#paragraph title=paragraph>paragraphing</a>, it is possible,
  in some cases where paragraphs are <a href=#paragraph title=paragraph>implied</a> (without explicit <code><a href=#the-p-element>p</a></code>
  elements), for an <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element to
  span both an entire paragraph or other non-<a href=#phrasing-content>phrasing
  content</a> elements and part of another paragraph. For
  example:</p>

  <pre>&lt;section&gt;
 &lt;ins&gt;
  &lt;p&gt;
   This is a paragraph that was inserted.
  &lt;/p&gt;
  This is another paragraph whose first sentence was inserted
  at the same time as the paragraph above.
 &lt;/ins&gt;
 This is a second sentence, which was there all along.
&lt;/section&gt;</pre>

  <p>By only wrapping some paragraphs in <code><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><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element (though this is very
  confusing, and not considered good practice):</p>

  <pre class=bad>&lt;section&gt;
 This is the first paragraph. &lt;ins&gt;This sentence was
 inserted.
 &lt;p&gt;This second paragraph was inserted.&lt;/p&gt;
 This sentence was inserted too.&lt;/ins&gt; This is the
 third paragraph in this example.
 &lt;!-- (don't do this) --&gt;
&lt;/section&gt;</pre>

  <p>However, due to the way <a href=#paragraph title=paragraph>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><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element. You instead have
  to use one (or two) <code><a href=#the-p-element>p</a></code> element(s) and two
  <code><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> elements, as for example:</p>

  <pre>&lt;section&gt;
 &lt;p&gt;This is the first paragraph. &lt;del&gt;This sentence was
 deleted.&lt;/del&gt;&lt;/p&gt;
 &lt;p&gt;&lt;del&gt;This sentence was deleted too.&lt;/del&gt; That
 sentence needed a separate &amp;lt;del&amp;gt; element.&lt;/p&gt;
&lt;/section&gt;</pre>

  <p>Partly because of the confusion described above, authors are
  strongly encouraged to always mark up all paragraphs with the
  <code><a href=#the-p-element>p</a></code> element, instead of having <code><a href=#the-ins-element>ins</a></code> or
  <code><a href=#the-del-element>del</a></code> elements that cross <a href=#paragraph title=paragraph>implied
  paragraphs</a> boundaries.</p>


  <h4 id=edits-and-lists><span class=secno>4.7.5 </span>Edits and lists</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The content models of the <code><a href=#the-ol-element>ol</a></code> and <code><a href=#the-ul-element>ul</a></code>
  elements do not allow <code><a href=#the-ins-element>ins</a></code> and <code><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><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> element can be wrapped around
  the contents of the <code><a href=#the-li-element>li</a></code> element. To indicate that an
  item has been replaced by another, a single <code><a href=#the-li-element>li</a></code> element
  can have one or more <code><a href=#the-del-element>del</a></code> elements followed by one or
  more <code><a href=#the-ins-element>ins</a></code> elements.</p>

  <div class=example>

   <p>In the following example, a list that started empty had items
   added and removed from it over time. The bits in the example that
   have been emphasized show the parts that are the "current" state of
   the list. The list item numbers don't take into account the edits,
   though.</p>

   <pre>&lt;h1&gt;Stop-ship bugs&lt;/h1&gt;
&lt;ol&gt;
 &lt;li&gt;&lt;ins datetime="2008-02-12T15:20Z"&gt;<em>Bug 225:
 Rain detector doesn't work in snow</em>&lt;/ins&gt;&lt;/li&gt;
 &lt;li&gt;&lt;del datetime="2008-03-01T20:22Z"&gt;&lt;ins datetime="2008-02-14T12:02Z"&gt;Bug 228:
 Water buffer overflows in April&lt;/ins&gt;&lt;/del&gt;&lt;/li&gt;
 &lt;li&gt;&lt;ins datetime="2008-02-16T13:50Z"&gt;<em>Bug 230:
 Water heater doesn't use renewable fuels</em>&lt;/ins&gt;&lt;/li&gt;
 &lt;li&gt;&lt;del datetime="2008-02-20T21:15Z"&gt;&lt;ins datetime="2008-02-16T14:25Z"&gt;Bug 232:
 Carbon dioxide emissions detected after startup&lt;/ins&gt;&lt;/del&gt;&lt;/li&gt;
&lt;/ol&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, a list that started with just fruit
   was replaced by a list with just colors.</p>

   <pre>&lt;h1&gt;List of &lt;del&gt;fruits&lt;/del&gt;&lt;ins&gt;colors&lt;/ins&gt;&lt;/h1&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;del&gt;Lime&lt;/del&gt;&lt;ins&gt;Green&lt;/ins&gt;&lt;/li&gt;
 &lt;li&gt;&lt;del&gt;Apple&lt;/del&gt;&lt;/li&gt;
 &lt;li&gt;Orange&lt;/li&gt;
 &lt;li&gt;&lt;del&gt;Pear&lt;/del&gt;&lt;/li&gt;
 &lt;li&gt;&lt;ins&gt;Teal&lt;/ins&gt;&lt;/li&gt;
 &lt;li&gt;&lt;del&gt;Lemon&lt;/del&gt;&lt;ins&gt;Yellow&lt;/ins&gt;&lt;/li&gt;
 &lt;li&gt;Olive&lt;/li&gt;
 &lt;li&gt;&lt;ins&gt;Purple&lt;/ins&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>

  </div>


  <h4 id=edits-and-tables><span class=secno>4.7.6 </span>Edits and tables</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The elements that form part of the table model have complicated
  content model requirements that do not allow for the
  <code><a href=#the-ins-element>ins</a></code> and <code><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><a href=#the-ins-element>ins</a></code> or <code><a href=#the-del-element>del</a></code> elements
  (respectively).</p>

  <div class=example>

   <p>Here, a table's row has been added:</p>

   <pre>&lt;table&gt;
 &lt;thead&gt;
  &lt;tr&gt; &lt;th&gt; Game name           &lt;th&gt; Game publisher   &lt;th&gt; Verdict
 &lt;tbody&gt;
  &lt;tr&gt; &lt;td&gt; Diablo 2            &lt;td&gt; Blizzard         &lt;td&gt; 8/10
  &lt;tr&gt; &lt;td&gt; Portal              &lt;td&gt; Valve            &lt;td&gt; 10/10
<strong>  &lt;tr&gt; &lt;td&gt; &lt;ins&gt;Portal 2&lt;/ins&gt; &lt;td&gt; &lt;ins&gt;Valve&lt;/ins&gt; &lt;td&gt; &lt;ins&gt;10/10&lt;/ins&gt;</strong>
&lt;/table&gt;</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>&lt;table&gt;
 &lt;thead&gt;
  &lt;tr&gt; &lt;th&gt; Game name           &lt;th&gt; Game publisher   &lt;th&gt; <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z"&gt;Verdict&lt;/del&gt;</strong>
 &lt;tbody&gt;
  &lt;tr&gt; &lt;td&gt; Diablo 2            &lt;td&gt; Blizzard         &lt;td&gt; <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z"&gt;8/10&lt;/del&gt;</strong>
  &lt;tr&gt; &lt;td&gt; Portal              &lt;td&gt; Valve            &lt;td&gt; <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z"&gt;10/10&lt;/del&gt;</strong>
  &lt;tr&gt; &lt;td&gt; Portal 2            &lt;td&gt; Valve            &lt;td&gt; <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z"&gt;10/10&lt;/del&gt;</strong>
&lt;/table&gt;</pre>

  </div>

  <p>Generally speaking, there is no good way to indicate more
  complicated edits (e.g. that a cell was removed, moving all
  subsequent cells up or to the left).</p>




  <h3 id=embedded-content-1><span class=secno>4.8 </span>Embedded content</h3>


  <h4 id=the-img-element><span class=secno>4.8.1 </span>The <dfn><code>img</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd><a href=#form-associated-element>Form-associated element</a>.</dd>
   <dd>If the element has a <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> &mdash; Replacement text for use when images are not available</dd>
   <dd><code title=attr-img-src><a href=#attr-img-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> &mdash; Images to use in different situations (e.g. high-resolution displays, small monitors, etc)</dd>
   <dd><code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> &mdash; How the element handles crossorigin requests</dd>
   <dd><code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> &mdash; Name of <a href=#image-map>image map</a> to use</dd>
   <dd><code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> &mdash; Whether the image is a server-side image map</dd>
   <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code> &mdash; Vertical dimension</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>[NamedConstructor=<a href=#dom-image title=dom-image>Image</a>(optional unsigned long width, optional unsigned long height)]
interface <dfn id=htmlimageelement>HTMLImageElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-img-alt title=dom-img-alt>alt</a>;
           attribute DOMString <a href=#dom-img-src title=dom-img-src>src</a>;
           attribute DOMString <a href=#dom-img-srcset title=dom-img-srcset>srcset</a>;
           attribute DOMString <a href=#dom-img-crossorigin title=dom-img-crossOrigin>crossOrigin</a>;
           attribute DOMString <a href=#dom-img-usemap title=dom-img-useMap>useMap</a>;
           attribute boolean <a href=#dom-img-ismap title=dom-img-isMap>isMap</a>;
           attribute unsigned long <a href=#dom-img-width title=dom-img-width>width</a>;
           attribute unsigned long <a href=#dom-img-height title=dom-img-height>height</a>;
  readonly attribute unsigned long <a href=#dom-img-naturalwidth title=dom-img-naturalWidth>naturalWidth</a>;
  readonly attribute unsigned long <a href=#dom-img-naturalheight title=dom-img-naturalHeight>naturalHeight</a>;
  readonly attribute boolean <a href=#dom-img-complete title=dom-img-complete>complete</a>;

  // <a href="#HTMLImageElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>An <code><a href=#the-img-element>img</a></code> element represents an image.</p>

  <!-- v2 ideas for <img>:

     * Maps sites would like to know which images are already cached,
       so that they can use images that are vaguely suitable while
       they wait for the most appropriate image to download.

       Almost like lowsrc="", except that many images might be
       appropriate.

       Slight hitch: their images are at a different origin, and we
       don't want to allow arbitrary cross-origin inspection (privacy
       leak risk). So it will require them to do CORS opt-in.

     * See note at rel=noreferrer.

  -->

  <p>The image given by the <dfn id=attr-img-src title=attr-img-src><code>src</code></dfn> and <dfn id=attr-img-srcset title=attr-img-srcset><code>srcset</code></dfn> attributes is the embedded content; the value of
  the <dfn id=attr-img-alt title=attr-img-alt><code>alt</code></dfn> attribute provides equivalent content for
  those who cannot process images or who have image loading disabled (i.e. it is the
  <code><a href=#the-img-element>img</a></code> element's <a href=#fallback-content>fallback content</a>).</p>

  <p>The requirements on the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value are described
  <a href=#alt>in the next section</a>.</p>

  <p>The <code title=attr-img-src><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>valid non-empty URL potentially surrounded by spaces</a> referencing a non-interactive,
  optionally animated, image resource that is neither paged nor scripted.</p>

  <p>The <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute may also be present. If present, its
  value must consist of one or more <a href=#image-candidate-string title="image candidate string">image candidate
  strings</a>, each separated from the next by a U+002C COMMA character (,). This attribute
  allows authors to provide alternative images for environments with smaller screens or screens with
  higher pixel densities.</p>

  <div class=note>

   <p>The <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute allows authors to provide a set of
   images to handle graphical displays of varying dimensions and pixel densities.</p>

   <p>The attribute essentially takes a comma-separated list of URLs each with one or more
   descriptors giving the maximum viewport dimensions and pixel density allowed to use the image.
   From the available options, the user agent then picks the most appropriate image. If the viewport
   dimensions or pixel density changes, the user agent can replace the image data with a new image
   on the fly.</p>

   <p>To specify an image, give first a URL, then one or more descriptors of the form 100w, 100h, or
   2x, where "100w" means "maximum viewport width of 100 CSS pixels", "100h" is the same but for
   height, and "2x" means "maximum pixel density of 2 device pixels per CSS pixel".</p>

  </div>

  <p>An <dfn id=image-candidate-string>image candidate string</dfn> consists of the following components, in order, with the
  further restrictions described below this list:</p>

  <ol><li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

   <li>A <a href=#valid-non-empty-url>valid non-empty URL</a> referencing a non-interactive, optionally animated, image
   resource that is neither paged nor scripted.</li>

   <li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

   <li>Optionally a <i>width descriptor</i>, consisting of: a <a href=#space-character>space character</a>, a
   <a href=#valid-non-negative-integer>valid non-negative integer</a> representing the <i>width descriptor value</i>, and a
   U+0077 LATIN SMALL LETTER W character.</li>

   <li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

   <li>Optionally a <i>height descriptor</i>, consisting of: a <a href=#space-character>space character</a>, a
   <a href=#valid-non-negative-integer>valid non-negative integer</a> representing the <i>height descriptor value</i>, and a
   U+0068 LATIN SMALL LETTER H character.</li>

   <li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

   <li>Optionally a <i>pixel density descriptor</i>, consisting of: a <a href=#space-character>space character</a>,
   a <a href=#valid-floating-point-number>valid floating-point number</a> giving a number greater than zero representing the
   <i>pixel density descriptor value</i>, and a U+0078 LATIN SMALL LETTER X character.</li>

   <li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>

  </ol><p>Each <a href=#image-candidate-string>image candidate string</a> must have at least one of the three optional
  descriptors. There must not be two <a href=#image-candidate-string title="image candidate string">image candidate
  strings</a> in a <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute whose <i>width
  descriptor value</i>, <i>height descriptor value</i>, and <i>pixel density descriptor value</i>
  are each identical to their counterpart in the other <a href=#image-candidate-string>image candidate string</a>; for the
  purposes of this requirement, omitted <i>width descriptors</i> and <i>height descriptors</i> are
  considered to have the value "Infinity", and omitted <i>pixel density descriptors</i> are
  considered to have the value 1.</p>

  <div class=example>

   <p>In this example, a banner that takes half the viewport is provided in two versions, one for
   wide screen and one for narrow screens.</p>

   <pre>&lt;h1&gt;&lt;img alt="The Breakfast Combo"
         src="banner.jpeg"
         srcset="banner-HD.jpeg 2x, banner-phone.jpeg 100w, banner-phone-HD.jpeg 100w 2x"&gt;&lt;/h1&gt;</pre>

  </div>

  <p class=note>The requirements above imply that images can be static bitmaps (e.g. PNGs, GIFs,
  JPEGs), single-page vector documents (single-page PDFs, XML files with an SVG root element),
  animated bitmaps (APNGs, animated GIFs), animated vector graphics (XML files with an SVG root
  element that use declarative SMIL animation), and so forth. However, these definitions preclude
  SVG files with script, multipage PDF files, interactive MNG files, HTML documents, plain text
  documents, and so forth. <a href=#refsPNG>[PNG]</a> <a href=#refsGIF>[GIF]</a> <a href=#refsJPEG>[JPEG]</a> <a href=#refsPDF>[PDF]</a> <a href=#refsXML>[XML]</a> <a href=#refsAPNG>[APNG]</a> <!-- <a href="#refsAGIF">[AGIF]</a> --> <a href=#refsSVG>[SVG]</a>
  <a href=#refsMNG>[MNG]</a> </p>

  <p>The <code><a href=#the-img-element>img</a></code> element must not be used as a layout tool. In particular, <code><a href=#the-img-element>img</a></code>
  elements should not be used to display transparent images, as they rarely convey meaning and
  rarely add anything useful to the document.</p>

  <hr><p>The <dfn id=attr-img-crossorigin title=attr-img-crossorigin><code>crossorigin</code></dfn> attribute is a <a href=#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><a href=#the-canvas-element>canvas</a></code>.</p>

  <div class=impl>

  <hr><p>An <code><a href=#the-img-element>img</a></code> is always in one of the following states:</p>

  <dl><dt><dfn id=img-none title=img-none>Unavailable</dfn></dt>
   <dd>The user agent hasn't obtained any image data.</dd>

   <dt><dfn id=img-inc title=img-inc>Partially available</dfn></dt>
   <dd>The user agent has obtained some of the image data.</dd>

   <dt><dfn id=img-all title=img-all>Completely available</dfn></dt>
   <dd>The user agent has obtained all of the image data and at least
   the image dimensions are available.</dd>

   <dt><dfn id=img-error title=img-error>Broken</dfn></dt>
   <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).</dd>

  </dl><p>When an <code><a href=#the-img-element>img</a></code> element is either in the <a href=#img-inc title=img-inc>partially
  available</a> state or in the <a href=#img-all title=img-all>completely available</a> state, it is
  said to be <dfn id=img-available title=img-available>available</dfn>.</p>

  <p>An <code><a href=#the-img-element>img</a></code> element is initially <a href=#img-none title=img-none>unavailable</a>.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element is <a href=#img-available title=img-available>available</a>, it
  <a href=#provides-a-paint-source>provides a paint source</a> whose width is the image's intrinsic width, whose height is
  the image's intrinsic height, and whose appearance is the intrinsic appearance of the image.</p>

  <p>In a <a href=#browsing-context>browsing context</a> where <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is
  disabled</a>, user agents may obtain images immediately or on demand. In a <a href=#browsing-context>browsing
  context</a> where <a href=#concept-bc-noscript title=concept-bc-noscript>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>update the image
  data</a> of an <code><a href=#the-img-element>img</a></code> element whenever that element is created with a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, a <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>
  attribute, or both. A user agent that obtains images immediately must also synchronously
  <a href=#update-the-image-data>update the image data</a> of an <code><a href=#the-img-element>img</a></code> element whenever that element has its
  <code title=attr-img-src><a href=#attr-img-src>src</a></code>, <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>, or <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> attribute set, changed, or removed.</p> <!-- Note
  how this does NOT happen when the base URL changes. -->

  <p>A user agent that obtains images on demand must <a href=#update-the-image-data>update the image data</a> of an
  <code><a href=#the-img-element>img</a></code> element whenever it needs the image data (i.e. on demand), but only if the
  <code><a href=#the-img-element>img</a></code> element has a <code title=attr-img-src><a href=#attr-img-src>src</a></code> or <code title=attr-img-src><a href=#attr-img-src>srcset</a></code> attribute, and only if the <code><a href=#the-img-element>img</a></code> element is in the
  <a href=#img-none title=img-none>unavailable</a> state. When an <code><a href=#the-img-element>img</a></code> element's <code title=attr-img-src><a href=#attr-img-src>src</a></code>, <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>, or <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> attribute set, changed, or removed, if the user
  agent only obtains images on demand, the <code><a href=#the-img-element>img</a></code> element must return to the <a href=#img-none title=img-none>unavailable</a> state.</p> <!-- Note how this does NOT happen when the base
  URL changes. -->

  <p>Each <code><a href=#the-img-element>img</a></code> element has a <dfn id=last-selected-source>last selected source</dfn>, which must initially be
  null, and a <dfn id=current-pixel-density>current pixel density</dfn>, which must initially be undefined.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element has a <a href=#current-pixel-density>current pixel density</a> that is not 1.0, the
  element's image data must be treated as if its resolution, in device pixels per CSS pixels, was
  the <a href=#current-pixel-density>current pixel density</a>.</p>

  <p class=example>For example, if the <a href=#current-pixel-density>current pixel density</a> is 3.125, that means
  that there are 300 device pixels per CSS inch, and thus if the image data is 300x600, it has an
  intrinsic dimension of 96 CSS pixels by 192 CSS pixels.</p>

  <p>Each <code><a href=#document>Document</a></code> object must have a <dfn id=list-of-available-images>list of available images</dfn>. Each image
  in this list is identified by a tuple consisting of an <a href=#absolute-url>absolute URL</a>, a <a href=#cors-settings-attribute>CORS
  settings attribute</a> mode, and, if the mode is not <a href=#attr-crossorigin-none title=attr-crossorigin-none>No
  CORS</a>, an <a href=#origin>origin</a>. User agents may copy entries from one <code><a href=#document>Document</a></code>
  object's <a href=#list-of-available-images>list of available images</a> to another at any time (e.g. when the
  <code><a href=#document>Document</a></code> is created, user agents can add to it all the images that are loaded in
  other <code><a href=#document>Document</a></code>s), but must not change the keys of entries copied in this way when
  doing so. User agents may also remove images from such lists at any time (e.g. to save
  memory).</p>

  <p>When the user agent is to <dfn id=update-the-image-data>update the image data</dfn> of an <code><a href=#the-img-element>img</a></code> element, it
  must run the following steps:</p>

  <ol><li><p>Return the <code><a href=#the-img-element>img</a></code> element to the <a href=#img-none title=img-none>unavailable</a>
   state.</p>

   <li><p>If an instance of the <a href=#fetch title=fetch>fetching</a> algorithm is still running for
   this element, then abort that algorithm, discarding any pending <a href=#concept-task title=concept-task>tasks</a> generated by that algorithm.</li>

   <li><p>Forget the <code><a href=#the-img-element>img</a></code> element's current image data, if any.</li>

   <li><p>If the user agent cannot support images, or its support for images has been disabled, then
   abort these steps.</li>

   <li>

    <p>If the element has a <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute specified, then
    let <var title="">selected source</var> and <var title="">selected pixel density</var> be the
    URL and pixel density that results from <a href=#processing-the-image-candidates>processing the image candidates</a>,
    respectively.

    Otherwise, if the element has a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute specified and
    its value is not the empty string, let <var title="">selected source</var> be the value of the
    element's <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, and <var title="">selected pixel
    density</var> be 1.0. Otherwise, let <var title="">selected source</var> be null and <var title="">selected pixel density</var> be undefined.</p>

   </li>

   <li><p>Let the <code><a href=#the-img-element>img</a></code> element's <a href=#last-selected-source>last selected source</a> be <var title="">selected source</var> and the <code><a href=#the-img-element>img</a></code> element's <a href=#current-pixel-density>current pixel
   density</a> be <var title="">selected pixel density</var>.</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">selected source</var>, relative
   to the element. If that is not successful, abort these steps.</li>

   <li><p>Let <var title="">key</var> be a tuple consisting of the resulting <a href=#absolute-url>absolute
   URL</a>, the <code><a href=#the-img-element>img</a></code> element's <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code>
   attribute's mode, and, if that mode is not <a href=#attr-crossorigin-none title=attr-crossorigin-none>No CORS</a>,
   the <code><a href=#document>Document</a></code> object's <a href=#origin>origin</a>.</li>

   <li><p>If the <a href=#list-of-available-images>list of available images</a> contains an entry for <var title="">key</var>, then set the <code><a href=#the-img-element>img</a></code> element to the <a href=#img-all title=img-all>completely
   available</a> state, update the presentation of the image appropriately, <a href=#queue-a-task>queue a
   task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the
   <code><a href=#the-img-element>img</a></code> element, and abort these steps.</li>

   <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to continue. The <a href=#synchronous-section>synchronous
   section</a> consists of all the remaining steps of this algorithm until the algorithm says the
   <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous
   section">synchronous sections</a> are marked with &#x231b;.)</li>

   <li>

    <p>&#x231b; If another instance of this algorithm for this <code><a href=#the-img-element>img</a></code> element was started
    after this instance (even if it aborted and is no longer running), then abort these steps.</p>

    <p class=note>Only the last instance takes effect, to avoid multiple requests when, for
    example, the <code title=attr-img-src><a href=#attr-img-src>src</a></code>, <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>,
    and <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> attributes are all set in
    succession.</p>

   </li>

   <li>

    <p>&#x231b; If <var title="">selected source</var> is null, then set the element to the <a href=#img-error title=img-error>broken</a> state, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
    event</a> named <code title=event-error>error</code> at the <code><a href=#the-img-element>img</a></code> element, and
    abort these steps.</p>

   </li>

   <li>

    <p><a href=#fire-a-progress-event>Fire a progress event</a> named <code title=event-loadstart>loadstart</code> at
    the <code><a href=#the-img-element>img</a></code> element.</p>

   </li>

   <li>

    <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the <a href=#absolute-url>absolute URL</a>
    that resulted from the earlier step, with the <i>mode</i> being the state of the element's <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute, the <i title="">origin</i>
    being the <a href=#origin>origin</a> of the <code><a href=#the-img-element>img</a></code> element's <code><a href=#document>Document</a></code>, and the
    <i>default origin behaviour</i> set to <i>taint</i>.</p>

    <p>The resource obtained in this fashion, if any, is the <code><a href=#the-img-element>img</a></code> element's image data.
    It can be either <a href=#cors-same-origin>CORS-same-origin</a> or <a href=#cors-cross-origin>CORS-cross-origin</a>; this affects
    the <a href=#origin>origin</a> of the image itself (e.g. when used on a <code><a href=#the-canvas-element>canvas</a></code>).</p>

    <!-- same text in <input type=image> section and similar text elsewhere -->
    <p>Fetching the image must <a href=#delay-the-load-event>delay the load event</a> of the element's document until the
    <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the
    <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> (<a href=#img-load>defined below</a>) has been run.</p>

    <p class=warning>This, unfortunately, can be used to perform a rudimentary port scan of the
    user's local network (especially in conjunction with scripting, though scripting isn't actually
    necessary to carry out such an attack). User agents may implement <a href=#origin title=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>The first <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
    task">queued</a> by the <a href=#networking-task-source>networking task source</a> while the image is being <a href=#fetch title=fetch>fetched</a> must set the <code><a href=#the-img-element>img</a></code> element's state to <a href=#img-inc title=img-inc>partially available</a>.</p>

    <p id=img-load>If the resource is in a supported image format, then each <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the
    <a href=#networking-task-source>networking task source</a> while the image is being <a href=#fetch title=fetch>fetched</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). In addition, if the resource is
    <a href=#cors-same-origin>CORS-same-origin</a>, each such <a href=#concept-task title=concept-task>task</a> must <a href=#fire-a-progress-event>fire
    a progress event</a> named <code title=event-progress>progress</code> at the
    <code><a href=#the-img-element>img</a></code> element.</p>

    <p>Furthermore, the last <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
    task">queued</a> by the <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> must additionally run the steps for the matching entry in the
    following list:</p>

    <dl class=switch><dt>If the download was successful and the user agent was able to determine the image's width and height</dt>

     <dd>

      <ol><li><p>Set the <code><a href=#the-img-element>img</a></code> element to the <a href=#img-all title=img-all>completely
       available</a> state.</p>

       <li><p>Add the image to the <a href=#list-of-available-images>list of available images</a> using the key <var title="">key</var>.</li>

       <li>

        <p>If the resource is <a href=#cors-same-origin>CORS-same-origin</a>: <a href=#fire-a-progress-event>fire a progress event</a>
        named <code title=event-load>load</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

        <p>If the resource is <a href=#cors-cross-origin>CORS-cross-origin</a>: <a href=#fire-a-simple-event>fire a simple event</a> named
        <code title=event-load>load</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

       </li>

       <li>

        <p>If the resource is <a href=#cors-same-origin>CORS-same-origin</a>: <a href=#fire-a-progress-event>fire a progress event</a>
        named <code title=event-load>loadend</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

        <p>If the resource is <a href=#cors-cross-origin>CORS-cross-origin</a>: <a href=#fire-a-simple-event>fire a simple event</a> named
        <code title=event-load>loadend</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

       </li>

      </ol></dd>

     <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1222 -->

     <dt>Otherwise</dt>

     <dd>

      <ol><li><p>Set the <code><a href=#the-img-element>img</a></code> element to the <a href=#img-error title=img-error>broken</a>
       state.</li>

       <li>

        <p>If the resource is <a href=#cors-same-origin>CORS-same-origin</a>: <a href=#fire-a-progress-event>fire a progress event</a>
        named <code title=event-load>load</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

        <p>If the resource is <a href=#cors-cross-origin>CORS-cross-origin</a>: <a href=#fire-a-simple-event>fire a simple event</a> named
        <code title=event-load>load</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

       </li>

       <li>

        <p>If the resource is <a href=#cors-same-origin>CORS-same-origin</a>: <a href=#fire-a-progress-event>fire a progress event</a>
        named <code title=event-load>loadend</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

        <p>If the resource is <a href=#cors-cross-origin>CORS-cross-origin</a>: <a href=#fire-a-simple-event>fire a simple event</a> named
        <code title=event-load>loadend</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

       </li>

      </ol></dd>

    </dl><p>On the other hand, if the resource type is <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>, then each
    <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the
    <a href=#networking-task-source>networking task source</a> while the image is being <a href=#fetch title=fetch>fetched</a>
    must also 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><a href=#the-img-element>img</a></code> element to the <a href=#img-all title=img-all>completely available</a> state
    and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#the-img-element>img</a></code> element.</p>

    <p class=note>The <code title=event-progress>progress</code> and <code title=event-loadend>loadend</code> events are not fired for
    <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> image streams.</p>

    <p>Otherwise, either the image data is corrupted in some fatal way such that the image
    dimensions cannot be obtained, or the image data is not in a supported file format; the user
    agent must set the <code><a href=#the-img-element>img</a></code> element to the <a href=#img-error title=img-error>broken</a> state,
    abort the <a href=#fetch title=fetch>fetching</a> algorithm, discarding any pending <a href=#concept-task title=concept-task>tasks</a> generated by that algorithm, and then <a href=#queue-a-task>queue a
    task</a> to first <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-img-element>img</a></code> element and then <a href=#fire-a-simple-event>fire a simple
    event</a> named <code title=event-loadend>loadend</code> at the <code><a href=#the-img-element>img</a></code>
    element.</p>

   </li>

  </ol><p>While a user agent is running the above algorithm for an element <var title="">x</var>, there
  must be a strong reference from the element's <code><a href=#document>Document</a></code> to the element <var title="">x</var>, even if that element is not <a href=#in-a-document title="in a Document">in</a> its
  <code><a href=#document>Document</a></code>.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element is in the <a href=#img-all title=img-all>completely available</a>
  state <em>and</em> the user agent can decode the media data without errors, then the
  <code><a href=#the-img-element>img</a></code> element is said to be <dfn id=img-good title=img-good>fully decodable</dfn>.</p>

  <p>Whether the image is fetched successfully or not (e.g. whether the response code was a 2xx code
  <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>) must be ignored when determining
  the image's type and whether it is a valid image.</p>

  <p class=note>This allows servers to return images with error responses, and have them
  displayed.</p>

  <p>The user agent should apply the <a href=#content-type-sniffing:-image title="Content-Type sniffing: image">image sniffing
  rules</a> to determine the type of the image, with the image's <a href=#content-type title=Content-Type>associated Content-Type headers</a> giving the <var title="">official
  type</var>. If these rules are not applied, then the type of the image must be the type given by
  the image's <a href=#content-type title=Content-Type>associated Content-Type headers</a>.</p>

  <p>User agents must not support non-image resources with the <code><a href=#the-img-element>img</a></code> element (e.g. XML
  files whose root element is an HTML element). User agents must not run executable code (e.g.
  scripts) embedded in the image resource. User agents must only display the first page of a
  multipage resource (e.g. a PDF file). User agents must not allow the resource to act in an
  interactive fashion, but should honor any animation in the resource.</p>

  <p>This specification does not specify which image types are to be supported.</p>

  <hr><p>When the user agent is required to <dfn id=processing-the-image-candidates title="processing the image candidates">process the
  image candidates</dfn> of an <code><a href=#the-img-element>img</a></code> element's <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute, the user agent must run the following steps,
  which return a URL and pixel density (null and undefined respectively if no selection can be
  made):</p>

  <ol><li><p>Let <var title="">input</var> be the value of the <code><a href=#the-img-element>img</a></code> element's <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">raw candidates</var> be an initially empty ordered list of <a href=#url title=URL>URLs</a> with associated unparsed descriptors. The order of entries in the list is
   the order in which entries are added to the list.</li>

   <li><p><i>Splitting loop</i>: <a href=#skip-whitespace>Skip whitespace</a>.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not <a href=#space-character title="space
   character">space characters</a>, and let that be <var title="">url</var>.</li> <!-- if
   /url/ is empty, we're at the end of the string -->

   <li><p>If <var title="">url</var> is empty, then jump to the step labeled <i>descriptor
   parser</i>.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not U+002C COMMA characters (,),
   and let that be <var title="">descriptors</var>.</li>

   <li><p>Add <var title="">url</var> to <var title="">raw candidates</var>, associated with <var title="">descriptors</var>.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then jump to
   the step labeled <i>descriptor parser</i>.</li>

   <li><p>Advance <var title="">position</var> to the next character in <var title="">input</var>
   (skipping past the U+002C COMMA character (,) separating this candidate from the next).</li>

   <li><p>Return to the step labeled <i>splitting loop</i>.</li>

   <li><p><i>Descriptor parser</i>: Let <var title="">candidates</var> be an initially empty ordered
   list of <a href=#url title=URL>URLs</a> each with an associated pixel density, and optionally an
   associated width, height, or both. The order of entries in the list is the order in which entries
   are added to the list.</p>

   <li>

    <p>For each entry in <var title="">raw candidates</var> with <a href=#url>URL</a> <var title="">url</var> associated with the unparsed descriptors <var title="">unparsed
    descriptors</var>, in the order they were originally added to the list, run these substeps:</p>

    <ol><li><p>Let <var title="">descriptor list</var> be the result of <a href=#split-a-string-on-spaces title="split a string on
     spaces">splitting <var title="">unparsed descriptors</var> on spaces</a>.</li>

     <li><p>Let <var title="">error</var> be <i>no</i>.</li>

     <li><p>Let <var title="">width</var> be <i>absent</i>.</li>

     <li><p>Let <var title="">height</var> be <i>absent</i>.</li>

     <li><p>Let <var title="">density</var> be <i>absent</i>.</li>

     <li>

      <p>For each token in <var title="">descriptor list</var>, run the appropriate set of steps
      from the following list:</p>

      <dl class=switch><dt>If the token consists of a <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a U+0077 LATIN SMALL LETTER W character</dt>

       <dd>

        <ol><li><p>If <var title="">width</var> is not <i>absent</i>, then let <var title="">error</var> be <i>yes</i>.</li>

         <li><p>Apply the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the token. Let
         <var title="">width</var> be the result.</li>

        </ol></dd>


       <dt>If the token consists of a <a href=#valid-non-negative-integer>valid non-negative integer</a> followed by a U+0068 LATIN SMALL LETTER H character</dt>

       <dd>

        <ol><li><p>If <var title="">height</var> is not <i>absent</i>,
         then let <var title="">error</var> be <i>yes</i>.</li>

         <li><p>Apply the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
         integers</a> to the token. Let <var title="">height</var>
         be the result.</li>

        </ol></dd>


       <dt>If the token consists of a <a href=#valid-floating-point-number>valid floating-point number</a> followed by a U+0078 LATIN SMALL LETTER X character</dt>

       <dd>

        <ol><li><p>If <var title="">density</var> is not <i>absent</i>, then let <var title="">error</var> be <i>yes</i>.</li>

         <li><p>Apply the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> to the token.
         Let <var title="">density</var> be the result.</li>

        </ol></dd>
       

      </dl></li>

     <li><p>If <var title="">width</var> is still <i>absent</i>, set it to Infinity.</li>

     <li><p>If <var title="">height</var> is still <i>absent</i>, set it to Infinity.</li>

     <li><p>If <var title="">density</var> is still <i>absent</i>, set it to 1.0.</li>

     <li><p>If <var title="">error</var> is still <i>no</i>, then add an entry to <var title="">candidates</var> whose <a href=#url>URL</a> is <var title="">url</var>, associated with a
     width <var title="">width</var>, a height <var title="">height</var>, and a pixel density <var title="">density</var>.</li>

    </ol></li>

   <li>

    <p>If the <code><a href=#the-img-element>img</a></code> element has a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute whose
    value is not the empty string, then run the following substeps:</p>

    <ol><li><p>Let <var title="">url</var> be the value of the element's <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute.</li>

     <li><p>Add an entry to <var title="">candidates</var> whose <a href=#url>URL</a> is <var title="">url</var>, associated with a width Infinity, a height Infinity, and a pixel density
     1.0.</li>

    </ol></li>

   <li><p>If <var title="">candidates</var> is empty, return null as the URL and undefined as the
   pixel density and abort these steps.</li>

   <li><p>If an entry <var title="">b</var> in <var title="">candidates</var> has the same
   associated width, height, and pixel density as an earlier entry <var title="">a</var> in <var title="">candidates</var>, then remove entry <var title="">b</var>. Repeat this step until none
   of the entries in <var title="">candidates</var> have the same associated width, height, and
   pixel density as an earlier entry.</li>

   <li>

    <p>Optionally, return the <a href=#url>URL</a> of an entry in <var title="">candidates</var> chosen
    by the user agent, and that entry's associated pixel density, and then abort these steps. The
    user agent may apply any algorithm or heuristic in its selection of an entry for the purposes of
    this step.</p>

    <p class=note>This allows a user agent to override the default algorithm (as described in
    subsequent steps) in case the user agent has a reason to do so. For example, it would allow the
    user agent in highly bandwidth-constrained conditions to intentionally opt to use an image
    intended for a smaller screen size, on the assumption that it'll probably be good enough.
    Implementors are urged to avoid doing this if at all possible, to let authors have predictable
    results. The results of using an image intended for a different viewport size can be, at a
    minimum, aesthetically displeasing.</p>

    <p class=note>This clause is not necessary to select images that are of lower pixel density
    than the display can handle, because the definition of pixel density below is also left up to
    the user agent. This step is only needed to allow user agents to pick images intended for
    viewports with other dimensions.</p>

   </li>

   <li><p>Let <var title="">max width</var> be the width of the viewport, and let <var title="">max
   height</var> be the height of the viewport. <a href=#refsCSS>[CSS]</a></li>

   <li><p>If there are any entries in <var title="">candidates</var> that have an associated width
   that is less than <var title="">max width</var>, then remove them, unless that would remove all
   the entries, in which case remove only the entries whose associated width is less than the
   greatest such width.</li>

   <li><p>If there are any entries in <var title="">candidates</var> that have an associated height
   that is less than <var title="">max height</var>, then remove them, unless that would remove all
   the entries, in which case remove only the entries whose associated height is less than the
   greatest such height.</li>

   <li><p>If there are any entries in <var title="">candidates</var> that have an associated pixel
   density that is less than a user-agent-defined value giving the nominal pixel density of the
   display, then remove them, unless that would remove all the entries, in which case remove only
   the entries whose associated pixel density is less than the greatest such pixel density.</li>

   <li><p>Remove all the entries in <var title="">candidates</var> that have an associated width
   that is greater than the smallest such width.</li>

   <li><p>Remove all the entries in <var title="">candidates</var> that have an associated height
   that is greater than the smallest such height.</li>

   <li><p>Remove all the entries in <var title="">candidates</var> that have an associated pixel
   density that is greater than the smallest such pixel density.</li>

   <li><p>Return the <a href=#url>URL</a> of the sole remaining entry in <var title="">candidates</var>,
   and that entry's associated pixel density.</li>

  </ol><p>The user agent may at any time run the following algorithm to update an <code><a href=#the-img-element>img</a></code>
  element's image in order to react to changes in the environment. (User agents are <em>not
  required</em> to ever run this algorithm.)</p>

  <ol><li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The <a href=#synchronous-section>synchronous section</a>
   consists of all the remaining steps of this algorithm until the algorithm says the
   <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous
   section">synchronous sections</a> are marked with &#x231b;.)</li>

   <li><p>&#x231b; If the <code><a href=#the-img-element>img</a></code> element does not have a <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute specified, is not in the <a href=#img-all title=img-all>completely available</a> state, has image data whose resource type is
   <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>, or if its <a href=#update-the-image-data>update the image data</a> algorithm is
   running, then abort this algorithm.</li> <!-- we don't support replacing push-JPEG images
   because defining what happens with the tasks and events and so on in that case would become
   implausibly complicated. -->

   <li><p>&#x231b; Let <var title="">selected source</var> and <var title="">selected pixel
   density</var> be the URL and pixel density that results from <a href=#processing-the-image-candidates>processing the image
   candidates</a>, respectively.</li>

   <li><p>&#x231b; If <var title="">selected source</var> is null, then abort these steps.</li>
   <!-- not sure this can ever actually happen -->

   <li><p>&#x231b; If <var title="">selected source</var> and <var title="">selected pixel
   density</var> are the same as the element's <a href=#last-selected-source>last selected source</a> and <a href=#current-pixel-density>current
   pixel density</a>, then abort these steps.</li> <!-- note that this check happens before
   base URL resolution, so changing the base URL doesn't trigger an update if nothing else changed
   -->

   <li><p>&#x231b; <a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">selected source</var>,
   relative to the element.</li>

   <li><p>&#x231b; Let <var title="">CORS mode</var> be the state of the element's <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute.</li>

   <li><p>&#x231b; If the <a href=#resolve-a-url>resolve a URL</a> algorithm is not successful, abort these
   steps.</p>

   <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the remaining steps
   asynchronously.</li>

   <li>

    <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the resulting <a href=#absolute-url>absolute
    URL</a>, with the <i>mode</i> being <var title="">CORS mode</var>, the <i title="">origin</i>
    being the <a href=#origin>origin</a> of the <code><a href=#the-img-element>img</a></code> element's <code><a href=#document>Document</a></code>, and the
    <i>default origin behaviour</i> set to <i>taint</i>.</p>

    <p>If this download fails in any way (other than the response code not being a 2xx code, as
    mentioned earlier), or if the image format is unsupported (as determined by applying the <a href=#content-type-sniffing:-image title="Content-Type sniffing: image">image sniffing rules</a>, again as mentioned earlier),
    or if the resource type is <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>, then abort these steps.</p>

    <p>Otherwise, wait for the <a href=#fetch>fetch</a> algorithm to queue its last task, and then
    continue with these steps. The data obtained in this way is used in the steps below.</p>

   </li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> to run the following substeps:</p>

    <ol><li><p>If the <code><a href=#the-img-element>img</a></code> element's <code title=attr-img-src><a href=#attr-img-src>src</a></code>, <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>, or <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code>
     attributes have been set, changed, or removed since this algorithm started, then abort these
     steps.</p>

     <li><p>Let the <code><a href=#the-img-element>img</a></code> element's <a href=#last-selected-source>last selected source</a> be <var title="">selected source</var> and the <code><a href=#the-img-element>img</a></code> element's <a href=#current-pixel-density>current pixel
     density</a> be <var title="">selected pixel density</var>.</li>

     <li><p>Replace the <code><a href=#the-img-element>img</a></code> element's image data with the resource obtained by the
     earlier step of this algorithm. It can be either <a href=#cors-same-origin>CORS-same-origin</a> or
     <a href=#cors-cross-origin>CORS-cross-origin</a>; this affects the <a href=#origin>origin</a> of the image itself (e.g.
     when used on a <code><a href=#the-canvas-element>canvas</a></code>).</li>

     <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title="">load</code> at the
     <code><a href=#the-img-element>img</a></code> element.</li>

    </ol></li>

  </ol><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue
  a task">queued</a> by algorithms in this section is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>

  <hr><p>What an <code><a href=#the-img-element>img</a></code> element represents depends on the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
  attribute.</p>

  <dl class=switch><dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is set to the empty string</dt>

   <dd>

    <p>The image is either decorative or supplemental to the rest of the content, redundant with
    some other information in the document.</p>

    <p>If the image is <a href=#img-available title=img-available>available</a> and the user agent is configured
    to display that image, then the element <a href=#represents>represents</a> the element's image data.</p>

    <p>Otherwise, the element <a href=#represents>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>

   </dd>

   <dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is set to a value that isn't empty</dt>

   <dd>

    <p>The image is a key part of the content; the <code title=attr-img-alt><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 title=img-available>available</a> and the user agent is configured
    to display that image, then the element <a href=#represents>represents</a> the element's image data.</p>

    <p>Otherwise, the element <a href=#represents>represents</a> the text given by the <code title=attr-img-alt><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>

   </dd>

   <dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is not</dt>

   <dd>

    <p>The image might be a key part of the content, and there is no textual equivalent of the image
    available.</p>

    <p class=note>In a conforming document, the absence of the <code title=attr-img-alt><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 title=img-available>available</a> and the user agent is configured
    to display that image, then the element <a href=#represents>represents</a> the element's image data.</p>

    <p>Otherwise, the user agent should display some sort of indicator that there is an image that
    is not being rendered, and may, if requested by the user, or if so configured, or when required
    to provide contextual information in response to navigation, provide caption information for the
    image, derived as follows:</p>

    <ol><!-- when editing this list, search for the two other occurrences of 'critical-no-alt' --><!-- NOTE: the order of these steps is important; it's intended to make the innermost caption
     override the outer ones --><li><p>If the image has a <code title=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>

     <li><p>If the image is a descendant of a <code><a href=#the-figure-element>figure</a></code> element that has a child
     <code><a href=#the-figcaption-element>figcaption</a></code> element, and, ignoring the <code><a href=#the-figcaption-element>figcaption</a></code> element and its
     descendants, the <code><a href=#the-figure-element>figure</a></code> element has no <code><a href=#text>Text</a></code> node descendants other
     than <a href=#inter-element-whitespace>inter-element whitespace</a>, and no <a href=#embedded-content>embedded content</a> descendant
     other than the <code><a href=#the-img-element>img</a></code> element, then the contents of the first such
     <code><a href=#the-figcaption-element>figcaption</a></code> element are the caption information; abort these steps.</li>

     <li><p>There is no caption information.</li>

    </ol></dd>

   <dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is not set and either the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is set to the empty string or the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute is not set at all</dt>

   <dd>

    <p>The element <a href=#represents>represents</a> nothing.</p>

   </dd>

   <dt>Otherwise</dt>

   <dd>

    <p>The element <a href=#represents>represents</a> the text given by the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>

   </dd>

  </dl><p>The <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute does not represent advisory information.
  User agents must not present the contents of the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute
  in the same way as content of the <code title=attr-title><a href=#attr-title>title</a></code> attribute.</p>

  <p>User agents may always provide the user with the option to display any image, or to prevent any
  image from being displayed. User agents may also apply heuristics to help the user make use of the
  image when the user is unable to see it, e.g. due to a visual disability or because they are using
  a text terminal with no graphics capabilities. Such heuristics could include, for instance,
  optical character recognition (OCR) of text found within the image.</p>

  <p class=warning>While user agents are encouraged to repair cases of missing <code title=attr-img-alt><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><a href=#the-img-element>img</a></code> elements, if any, are ignored for the purposes of
  rendering.</p>

  </div>

  <hr><p>The <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute,
  if present, can indicate that the image has an associated
  <a href=#image-map>image map</a>.</p>

  <p>The <dfn id=attr-img-ismap title=attr-img-ismap><code>ismap</code></dfn>
  attribute, when used on an element that is a descendant of an
  <code><a href=#the-a-element>a</a></code> element with an <code title=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><a href=#the-a-element>a</a></code> element.</p>

  <p>The <code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> attribute is a
  <a href=#boolean-attribute>boolean attribute</a>. The attribute must not be specified
  on an element that does not have an ancestor <code><a href=#the-a-element>a</a></code> element
  with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute.</p>

  <p>The <code><a href=#the-img-element>img</a></code> element supports <a href=#dimension-attributes>dimension
  attributes</a>.</p>

  <div class=impl>

  <p>The <dfn id=dom-img-alt title=dom-img-alt><code>alt</code></dfn>, <dfn id=dom-img-src title=dom-img-src><code>src</code></dfn>, and <dfn id=dom-img-srcset title=dom-img-srcset><code>srcset</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p>The <dfn id=dom-img-crossorigin title=dom-img-crossOrigin><code>crossOrigin</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute,
  <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <dfn id=dom-img-usemap title=dom-img-useMap><code>useMap</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> content attribute.</p>

  <p>The <dfn id=dom-img-ismap title=dom-img-isMap><code>isMap</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the <code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> content attribute.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">image</var> . <code title=dom-img-width><a href=#dom-img-width>width</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">image</var> . <code title=dom-img-height><a href=#dom-img-height>height</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">image</var> . <code title=dom-img-naturalWidth><a href=#dom-img-naturalwidth>naturalWidth</a></code></dt>
   <dt><var title="">image</var> . <code title=dom-img-naturalHeight><a href=#dom-img-naturalheight>naturalHeight</a></code></dt>

   <dd>

    <p>These attributes return the intrinsic dimensions of the image,
    or zero if the dimensions are not known.</p>

   </dd>

   <dt><var title="">image</var> . <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code></dt>

   <dd>

    <p>Returns true if the image has been completely downloaded or if
    no image is specified; otherwise, returns false.</p>

   </dd>

   <dt><var title="">image</var> = new <code title=dom-image><a href=#dom-image>Image</a></code>( [ <var title="">width</var> [, <var title="">height</var> ] ] )</dt>

   <dd>

    <p>Returns a new <code><a href=#the-img-element>img</a></code> element, with the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes set to the values
    passed in the relevant arguments, if applicable.</p>

   </dd>

  </dl><div class=impl>

  <p>The IDL attributes <dfn id=dom-img-width title=dom-img-width><code>width</code></dfn> and <dfn id=dom-img-height title=dom-img-height><code>height</code></dfn> must return the
  rendered width and height of the image, in CSS pixels, if the image
  is <a href=#being-rendered>being rendered</a>, and is being rendered to a visual
  medium; or else the intrinsic width and height of the image, in CSS
  pixels, if the image is <i title=img-available><a href=#img-available>available</a></i> but
  not being rendered to a visual medium; or else 0, if the image is
  not <i title=img-available><a href=#img-available>available</a></i>. <a href=#refsCSS>[CSS]</a></p>

  <p>On setting, they must act as if they <a href=#reflect title=reflect>reflected</a> the respective content attributes
  of the same name.</p>

  <p>The IDL attributes <dfn id=dom-img-naturalwidth title=dom-img-naturalWidth><code>naturalWidth</code></dfn> and
  <dfn id=dom-img-naturalheight title=dom-img-naturalHeight><code>naturalHeight</code></dfn>
  must return the intrinsic width and height of the image, in CSS
  pixels, if the image is <i title=img-available><a href=#img-available>available</a></i>, or
  else 0. <a href=#refsCSS>[CSS]</a></p>

  <p>The IDL attribute <dfn id=dom-img-complete title=dom-img-complete><code>complete</code></dfn> must return
  true if any of the following conditions is true:</p>
  <ul class=brief><li>Both the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute and the <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute are omitted.
   <li>The <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute is omitted and the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute's value is the empty string. <!-- we only have this hack for src="", not srcset=""; present but empty or bogus srcset="" still means complete=false if it's not in the img-error state -->
   <li>The final <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> has been <a href=#queue-a-task title="queue a task">queued</a>, but has not yet been run, and the <code><a href=#the-img-element>img</a></code> element is not in the <a href=#img-error title=img-error>broken</a> state.
   <li>The <code><a href=#the-img-element>img</a></code> element is <a href=#img-all title=img-all>completely available</a>.
  </ul><p>Otherwise, the attribute must return false.</p>

  <p class=note>The value of <code title=dom-img-complete><a href=#dom-img-complete>complete</a></code> can thus change while
  a <a href=#concept-script title=concept-script>script</a> is executing.</p>

  <p>A constructor is provided for creating <code><a href=#htmlimageelement>HTMLImageElement</a></code> objects (in addition to
  the factory methods from DOM such as <code title="">createElement()</code>): <dfn id=dom-image title=dom-image><code>Image(<var title="">width</var>, <var title="">height</var>)</code></dfn>.
  When invoked as a constructor, this must return a new <code><a href=#htmlimageelement>HTMLImageElement</a></code> object (a new
  <code><a href=#the-img-element>img</a></code> element). If the <var title="">width</var> argument is present, the new object's
  <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> content attribute must be set to <var title="">width</var>. If the <var title="">height</var> argument is also present, the new object's
  <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> content attribute must be set to <var title="">height</var>. The element's document must be the <a href=#active-document>active document</a> of the
  <a href=#browsing-context>browsing context</a> of the <code><a href=#window>Window</a></code> object on which the interface object of
  the invoked constructor is found.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>A single image can have different appropriate alternative text
   depending on the context.</p>

   <p>In each of the following cases, the same image is used, yet the
   <code title=attr-img-alt><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>&lt;p&gt;I lived in &lt;img src="carouge.svg" alt=""&gt; Carouge.&lt;/p&gt;</pre>

   <p>Here it is used as an icon representing the town:</p>
   <pre>&lt;p&gt;Home town: &lt;img src="carouge.svg" alt="Carouge"&gt;&lt;/p&gt;</pre>

   <p>Here it is used as part of a text on the town:</p>

   <pre>&lt;p&gt;Carouge has a coat of arms.&lt;/p&gt;
&lt;p&gt;&lt;img src="carouge.svg" alt="The coat of arms depicts a lion, sitting in front of a tree."&gt;&lt;/p&gt;
&lt;p&gt;It is used as decoration all over the town.&lt;/p&gt;</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>&lt;p&gt;Carouge has a coat of arms.&lt;/p&gt;
&lt;p&gt;&lt;img src="carouge.svg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;The coat of arms depicts a lion, sitting in front of a tree.
It is used as decoration all over the town.&lt;/p&gt;</pre>

   <p>Here it is used as part of a story:</p>

   <pre>&lt;p&gt;He picked up the folder and a piece of paper fell out.&lt;/p&gt;
&lt;p&gt;&lt;img src="carouge.svg" alt="Shaped like a shield, the paper had a
red background, a green tree, and a yellow lion with its tongue
hanging out and whose tail was shaped like an S."&gt;&lt;/p&gt;
&lt;p&gt;He stared at the folder. S! The answer he had been looking for all
this time was simply the letter S! How had he not seen that before? It all
came together now. The phone call where Hector had referred to a lion's tail,
the time Marco had stuck his tongue out...&lt;/p&gt;</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 title=attr-title><a href=#attr-title>title</a></code> attribute:</p>

   <pre>&lt;p&gt;The last user to have uploaded a coat of arms uploaded this one:&lt;/p&gt;
&lt;p&gt;&lt;img src="last-uploaded-coat-of-arms.cgi" title="User-uploaded coat of arms."&gt;&lt;/p&gt;</pre>

   <p>Ideally, the author would find a way to provide real replacement
   text even in this case, e.g. by asking the previous user. Not
   providing replacement text makes the document more difficult to use
   for people who are unable to view images, e.g. blind users, or
   users or very low-bandwidth connections or who pay by the byte, or
   users who are forced to use a text-only Web browser.</p>

  </div>

  <div class=example>

   <p>Here are some more examples showing the same picture used in
   different contexts, with different appropriate alternate texts each
   time.</p>

   <pre>&lt;article&gt;
 &lt;h1&gt;My cats&lt;/h1&gt;
 &lt;h2&gt;Fluffy&lt;/h2&gt;
 &lt;p&gt;Fluffy is my favorite.&lt;/p&gt;
 &lt;img src="fluffy.jpg" alt="She likes playing with a ball of yarn."&gt;
 &lt;p&gt;She's just too cute.&lt;/p&gt;
 &lt;h2&gt;Miles&lt;/h2&gt;
 &lt;p&gt;My other cat, Miles just eats and sleeps.&lt;/p&gt;
&lt;/article&gt;</pre>

   <pre>&lt;article&gt;
 &lt;h1&gt;Photography&lt;/h1&gt;
 &lt;h2&gt;Shooting moving targets indoors&lt;/h2&gt;
 &lt;p&gt;The trick here is to know how to anticipate; to know at what speed and
 what distance the subject will pass by.&lt;/p&gt;
 &lt;img src="fluffy.jpg" alt="A cat flying by, chasing a ball of yarn, can be
 photographed quite nicely using this technique."&gt;
 &lt;h2&gt;Nature by night&lt;/h2&gt;
 &lt;p&gt;To achieve this, you'll need either an extremely sensitive film, or
 immense flash lights.&lt;/p&gt;
&lt;/article&gt;</pre>

   <pre>&lt;article&gt;
 &lt;h1&gt;About me&lt;/h1&gt;
 &lt;h2&gt;My pets&lt;/h2&gt;
 &lt;p&gt;I've got a cat named Fluffy and a dog named Miles.&lt;/p&gt;
 &lt;img src="fluffy.jpg" alt="Fluffy, my cat, tends to keep itself busy."&gt;
 &lt;p&gt;My dog Miles and I like go on long walks together.&lt;/p&gt;
 &lt;h2&gt;music&lt;/h2&gt;
 &lt;p&gt;After our walks, having emptied my mind, I like listening to Bach.&lt;/p&gt;
&lt;/article&gt;</pre>

   <pre>&lt;article&gt;
 &lt;h1&gt;Fluffy and the Yarn&lt;/h1&gt;
 &lt;p&gt;Fluffy was a cat who liked to play with yarn. He also liked to jump.&lt;/p&gt;
 &lt;aside&gt;&lt;img src="fluffy.jpg" alt="" title="Fluffy"&gt;&lt;/aside&gt;
 &lt;p&gt;He would play in the morning, he would play in the evening.&lt;/p&gt;
&lt;/article&gt;</pre>

  </div>



  <h5 id=alt><span class=secno>4.8.1.1 </span>Requirements for providing text to act as an alternative for images</h5>


  <h6 id=general-guidelines><span class=secno>4.8.1.1.1 </span>General guidelines</h6>

  <p>Except where otherwise specified, the <code title=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 title=attr-img-alt><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 title=attr-img-alt><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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value should never
  contain text that could be considered the image's <em><a href=#the-caption-element>caption</a></em>,
  <em><a href=#the-title-element>title</a></em>, or <em><a href=#the-legend-element>legend</a></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 title=attr-title><a href=#attr-title>title</a></code> attribute can be used for
  supplemental information.</p>

  <p>Another corollary is that the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value should not repeat
  information that is already provided in the prose next to the
  image.</p>

  <p class=note>One way to think of alternative text is to think
  about how you would read the page containing the image to someone
  over the phone, without mentioning that there is an image
  present. Whatever you say instead of the image is typically a good
  start for writing the alternative text.</p>


  <h6 id=a-link-or-button-containing-nothing-but-the-image><span class=secno>4.8.1.1.2 </span>A link or button containing nothing but the image</h6>

  <p>When an <a href=#the-a-element>a</a> element that creates a
  <a href=#hyperlink>hyperlink</a>, or a <code><a href=#the-button-element>button</a></code> element, has no
  textual content but contains one or more images, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attributes must contain text that
  together convey the purpose of the link or button.</p>

  <div class=example>

   <p>In this example, a user is asked to pick his preferred 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>&lt;h1&gt;Pick your color&lt;/h1&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="green.html"&gt;<strong>&lt;img src="green.jpeg" alt="Green"&gt;</strong>&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="blue.html"&gt;<strong>&lt;img src="blue.jpeg" alt="Blue"&gt;</strong>&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="red.html"&gt;<strong>&lt;img src="red.jpeg" alt="Red"&gt;</strong>&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>

  </div>

  <div class=example>

   <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>&lt;button name="rgb"&gt;<strong>&lt;img src="red" alt="RGB"&gt;&lt;img src="green" alt=""&gt;&lt;img src="blue" alt=""&gt;</strong>&lt;/button&gt;
&lt;button name="cmyk"&gt;<strong>&lt;img src="cyan" alt="CMYK"&gt;&lt;img src="magenta" alt=""&gt;&lt;img src="yellow" alt=""&gt;&lt;img src="black" alt=""&gt;</strong>&lt;/button&gt;</pre>

   <p>Since each image represents one part of the text, it could also
   be written like this:</p>

   <pre>&lt;button name="rgb"&gt;<strong>&lt;img src="red" alt="R"&gt;&lt;img src="green" alt="G"&gt;&lt;img src="blue" alt="B"&gt;</strong>&lt;/button&gt;
&lt;button name="cmyk"&gt;<strong>&lt;img src="cyan" alt="C"&gt;&lt;img src="magenta" alt="M"&gt;&lt;img src="yellow" alt="Y"&gt;&lt;img src="black" alt="K"&gt;</strong>&lt;/button&gt;</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>&lt;button name="rgb"&gt;<strong>&lt;img src="red" alt="sRGB profile"&gt;&lt;img src="green" alt=""&gt;&lt;img src="blue" alt=""&gt;</strong>&lt;/button&gt;
&lt;button name="cmyk"&gt;<strong>&lt;img src="cyan" alt="CMYK profile"&gt;&lt;img src="magenta" alt=""&gt;&lt;img src="yellow" alt=""&gt;&lt;img src="black" alt=""&gt;</strong>&lt;/button&gt;</pre>

  </div>



  <h6 id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations><span class=secno>4.8.1.1.3 </span>A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrations</h6>

  <p>Sometimes something can be more clearly stated in graphical
  form, for example as a flowchart, a diagram, a graph, or a simple
  map showing directions. In such cases, an image can be given using
  the <code><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 title=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 title=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 class=example>

   <p>In the following example we have <a href=images/parsing-model-overview.png>a flowchart</a> in image
   form, with text in the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
   attribute rephrasing the flowchart in prose form:</p>

   <pre>&lt;p&gt;In the common case, the data handled by the tokenization stage
comes from the network, but it can also come from script.&lt;/p&gt;
&lt;p&gt;<strong>&lt;img src="images/parsing-model-overview.png" alt="The Network
passes data to the Input Stream Preprocessor, which passes it to the
Tokenizer, which passes it to the Tree Construction stage. From there,
data goes to both the DOM and to Script Execution. Script Execution is
linked to the DOM, and, using document.write(), passes data to the
Tokenizer."&gt;</strong>&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>Here's another example, showing a good solution and a bad
   solution to the problem of including an image in a
   description.</p>

   <p>First, here's the good solution. This sample shows how the
   alternative text should just be what you would have put in the
   prose if the image had never existed.</p>

   <pre>&lt;!-- This is the correct way to do things. --&gt;
&lt;p&gt;
 You are standing in an open field west of a house.
 <strong>&lt;img src="house.jpeg" alt="The house is white, with a boarded front door."&gt;</strong>
 There is a small mailbox here.
&lt;/p&gt;</pre>

   <p>Second, here's the bad solution. In this incorrect way of
   doing things, the alternative text is simply a description of the
   image, instead of a textual replacement for the image. It's bad
   because when the image isn't shown, the text doesn't flow as well
   as in the first example.</p>

   <pre class=bad>&lt;!-- <em>This is the wrong way to do things.</em> --&gt;
&lt;p&gt;
 You are standing in an open field west of a house.
 &lt;img src="house.jpeg" alt="A white house, with a boarded front door."&gt;
 There is a small mailbox here.
&lt;/p&gt;</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 title=attr-title><a href=#attr-title>title</a></code> attribute or in the
   <code><a href=#the-figcaption-element>figcaption</a></code> element of a <code><a href=#the-figure-element>figure</a></code> with this
   image).</p>

  </div>


  <h6 id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos><span class=secno>4.8.1.1.4 </span>A short phrase or label with an alternative graphical representation: icons, logos</h6>

  <p>A document can contain information in iconic form. The icon is
  intended to help users of visual browsers to 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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be present but must
  be empty.</p>

  <div class=example>

   <p>Here the icons are next to text that conveys the same meaning,
   so they have an empty <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
   attribute:</p>

   <pre>&lt;nav&gt;
 &lt;p&gt;&lt;a href="/help/"&gt;<strong>&lt;img src="/icons/help.png" alt=""&gt;</strong> Help&lt;/a&gt;&lt;/p&gt;
 &lt;p&gt;&lt;a href="/configure/"&gt;<strong>&lt;img src="/icons/configuration.png" alt=""&gt;</strong>
 Configuration Tools&lt;/a&gt;&lt;/p&gt;
&lt;/nav&gt;</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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>

  <div class=example>

   <p>Here, posts on a news site are labeled with an icon
   indicating their topic.</p>

   <pre>&lt;body&gt;
 &lt;article&gt;
  &lt;header&gt;
   &lt;h1&gt;Ratatouille wins &lt;i&gt;Best Movie of the Year&lt;/i&gt; award&lt;/h1&gt;
   &lt;p&gt;<strong>&lt;img src="movies.png" alt="Movies"&gt;</strong>&lt;/p&gt;
  &lt;/header&gt;
  &lt;p&gt;Pixar has won yet another &lt;i&gt;Best Movie of the Year&lt;/i&gt; award,
  making this its 8th win in the last 12 years.&lt;/p&gt;
 &lt;/article&gt;
 &lt;article&gt;
  &lt;header&gt;
   &lt;h1&gt;Latest TWiT episode is online&lt;/h1&gt;
   &lt;p&gt;<strong>&lt;img src="podcasts.png" alt="Podcasts"&gt;</strong>&lt;/p&gt;
  &lt;/header&gt;
  &lt;p&gt;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.&lt;/p&gt;
 &lt;/article&gt;
&lt;/body&gt;</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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must
  contain the name of the entity being represented by the logo. The
  <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must <em>not</em>
  contain text like the word "logo", as it is not the fact that it is
  a logo that is being conveyed, it's the entity itself.</p>

  <p>If the logo is being used next to the name of the entity that
  it represents, then the logo is supplemental, and its <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must instead be
  empty.</p>

  <p>If the logo is merely used as decorative material (as branding,
  or, for example, as a side image in an article that mentions the
  entity to which the logo belongs), then the entry below on purely
  decorative images applies. If the logo is actually being
  discussed, then it is being used as a phrase or paragraph (the
  description of the logo) with an alternative graphical
  representation (the logo itself), and the first entry above
  applies.</p>

  <div class=example>

   <p>In the following snippets, all four of the above cases are
   present. First, we see a logo used to represent a company:</p>

   <pre>&lt;h1&gt;<strong>&lt;img src="XYZ.gif" alt="The XYZ company"&gt;</strong>&lt;/h1&gt;</pre>

   <p>Next, we see a paragraph which uses a logo right next to the
   company name, and so doesn't have any alternative text:

   <pre>&lt;article&gt;
 &lt;h2&gt;News&lt;/h2&gt;
 &lt;p&gt;We have recently been looking at buying the <strong>&lt;img src="alpha.gif"
 alt=""&gt; &Alpha;&Beta;&Gamma; company</strong>, a small Greek company
 specializing in our type of product.&lt;/p&gt;</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>&lt;aside&gt;&lt;p&gt;&lt;img src="alpha-large.gif" alt=""&gt;&lt;/p&gt;&lt;/aside&gt;</strong>
 &lt;p&gt;The &Alpha;&Beta;&Gamma; 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.&lt;/p&gt;
&lt;/article&gt;</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>&lt;p&gt;Consider for a moment their logo:&lt;/p&gt;

<strong>&lt;p&gt;&lt;img src="/images/logo" alt="It consists of a green circle with a
green question mark centered inside it."&gt;&lt;/p&gt;</strong>

&lt;p&gt;How unoriginal can you get? I mean, oooooh, a question mark, how
&lt;em&gt;revolutionary&lt;/em&gt;, how utterly &lt;em&gt;ground-breaking&lt;/em&gt;, I'm
sure everyone will rush to adopt those specifications now! They could
at least have tried for some sort of, I don't know, sequence of
rounded squares with varying shades of green and bold white outlines,
at least that would look good on the cover of a blue book.&lt;/p&gt;</pre>

   <p>This example shows how the alternative text should be written
   such that if the image isn't <i title=img-available><a href=#img-available>available</a></i>, and the text is used instead,
   the text flows seamlessly into the surrounding text, as if the
   image had never been there in the first place.</p>

  </div>


  <h6 id=text-that-has-been-rendered-to-a-graphic-for-typographical-effect><span class=secno>4.8.1.1.5 </span>Text that has been rendered to a graphic for typographical effect</h6>

  <p>Sometimes, an image just consists of text, and the purpose of the
  image is not to highlight the actual typographic effects used to
  render the text, but just to convey the text itself.</p>

  <p>In such cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
  attribute must be present but must consist of the same text as
  written in the image itself.</p>

  <div class=example>

   <p>Consider a graphic containing the text "Earth Day", but with the
   letters all decorated with flowers and plants. If the text is
   merely being used as a heading, to spice up the page for graphical
   users, then the correct alternative text is just the same text
   "Earth Day", and no mention need be made of the decorations:</p>

   <pre>&lt;h1&gt;<strong>&lt;img src="earthdayheading.png" alt="Earth Day"&gt;</strong>&lt;/h1&gt;</pre>

  </div>



  <h6 id=a-graphical-representation-of-some-of-the-surrounding-text><span class=secno>4.8.1.1.6 </span>A graphical representation of some of the surrounding text</h6>

  <p>In many cases, the image is actually just supplementary, and its presence merely reinforces the
  surrounding text. In these cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be
  present but its value must be the empty string.</p>

  <p>In general, an image falls into this category if removing the image doesn't make the page any
  less useful, but including the image makes it a lot easier for users of visual browsers to
  understand the concept.</p>

  <div class=example>

   <p>A flowchart that repeats the previous paragraph in graphical form:</p>

   <pre>&lt;p&gt;The Network passes data to the Input Stream Preprocessor, which
passes it to the Tokenizer, which passes it to the Tree Construction
stage. From there, data goes to both the DOM and to Script Execution.
Script Execution is linked to the DOM, and, using document.write(),
passes data to the Tokenizer.&lt;/p&gt;
<strong>&lt;p&gt;&lt;img src="images/parsing-model-overview.png" alt=""&gt;&lt;/p&gt;</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 title=attr-title><a href=#attr-title>title</a></code> attribute
   can be used, or the <code><a href=#the-figure-element>figure</a></code> and <code><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>&lt;!-- Using the title="" attribute --&gt;
&lt;p&gt;The Network passes data to the Input Stream Preprocessor, which
passes it to the Tokenizer, which passes it to the Tree Construction
stage. From there, data goes to both the DOM and to Script Execution.
Script Execution is linked to the DOM, and, using document.write(),
passes data to the Tokenizer.&lt;/p&gt;
&lt;p&gt;<strong>&lt;img src="images/parsing-model-overview.png" alt=""
        title="Flowchart representation of the parsing model."&gt;</strong>&lt;/p&gt;</pre>

   <pre>&lt;!-- Using &lt;figure&gt; and &lt;figcaption&gt; --&gt;
&lt;p&gt;The Network passes data to the Input Stream Preprocessor, which
passes it to the Tokenizer, which passes it to the Tree Construction
stage. From there, data goes to both the DOM and to Script Execution.
Script Execution is linked to the DOM, and, using document.write(),
passes data to the Tokenizer.&lt;/p&gt;
&lt;figure&gt;
 <strong>&lt;img src="images/parsing-model-overview.png" alt="The Network leads to
 the Input Stream Preprocessor, which leads to the Tokenizer, which
 leads to the Tree Construction stage. The Tree Construction stage
 leads to two items. The first is Script Execution, which leads via
 document.write() back to the Tokenizer. The second item from which
 Tree Construction leads is the DOM. The DOM is related to the Script
 Execution."&gt;</strong>
 &lt;figcaption&gt;Flowchart representation of the parsing model.&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

   <pre class=bad>&lt;!-- This is WRONG. Do not do this. Instead, do what the above examples do. --&gt;
&lt;p&gt;The Network passes data to the Input Stream Preprocessor, which
passes it to the Tokenizer, which passes it to the Tree Construction
stage. From there, data goes to both the DOM and to Script Execution.
Script Execution is linked to the DOM, and, using document.write(),
passes data to the Tokenizer.&lt;/p&gt;
&lt;p&gt;&lt;img src="images/parsing-model-overview.png"
        alt="Flowchart representation of the parsing model."&gt;&lt;/p&gt;
&lt;!-- Never put the image's caption in the alt="" attribute! --&gt;</pre>

  </div>

  <div class=example>

   <p>A graph that repeats the previous paragraph in graphical form:</p>

   <pre>&lt;p&gt;According to a study covering several billion pages,
about 62% of documents on the Web in 2007 triggered the Quirks
rendering mode of Web browsers, about 30% triggered the Almost
Standards mode, and about 9% triggered the Standards mode.&lt;/p&gt;
<strong>&lt;p&gt;&lt;img src="rendering-mode-pie-chart.png" alt=""&gt;&lt;/p&gt;</strong></pre>

  </div>



  <h6 id="a-purely-decorative-image-that-doesn't-add-any-information"><span class=secno>4.8.1.1.7 </span>A purely decorative image that doesn't add any information</h6>

  <p>If an image is decorative but isn't especially page-specific
  &mdash; for example an image that forms part of a site-wide design
  scheme &mdash; the image should be specified in the site's CSS, not
  in the markup of the document.</p>

  <p>However, a decorative image that isn't discussed by the
  surrounding text but still has some relevance can be included in a page
  using the <code><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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be present but its
  value must be the empty string.</p>

  <div class=example>

   <p>Examples where the image is purely decorative despite being
   relevant would include things like a photo of the Black Rock City
   landscape in a blog post about an event at Burning Man, or an
   image of a painting inspired by a poem, on a page reciting that
   poem. The following snippet shows an example of the latter
   case (only the first verse is included in this snippet):</p>

   <pre>&lt;h1&gt;The Lady of Shalott&lt;/h1&gt;
<strong>&lt;p&gt;&lt;img src="shalott.jpeg" alt=""&gt;&lt;/p&gt;</strong>
&lt;p&gt;On either side the river lie&lt;br&gt;
Long fields of barley and of rye,&lt;br&gt;
That clothe the wold and meet the sky;&lt;br&gt;
And through the field the road run by&lt;br&gt;
To many-tower'd Camelot;&lt;br&gt;
And up and down the people go,&lt;br&gt;
Gazing where the lilies blow&lt;br&gt;
Round an island there below,&lt;br&gt;
The island of Shalott.&lt;/p&gt;</pre>

  </div>


  <h6 id=a-group-of-images-that-form-a-single-larger-picture-with-no-links><span class=secno>4.8.1.1.8 </span>A group of images that form a single larger picture with no links</h6>

  <p>When a picture has been sliced into smaller image files that are
  then displayed together to form the complete picture again, one of
  the images must have its <code title=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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute set to
  the empty string.</p>

  <div class=example>

   <p>In the following example, a picture representing a company logo
   for <span title="">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>&lt;h1&gt;<strong>&lt;img src="logo1.png" alt="XYZ Corp"&gt;&lt;img src="logo2.png" alt=""&gt;</strong>&lt;/h1&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, a rating is shown as three filled
   stars and two empty stars. While the alternative text could have
   been "&bigstar;&bigstar;&bigstar;&star;&star;", 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>&lt;p&gt;Rating: &lt;meter max=5 value=3&gt;<strong>&lt;img src="1" alt="3 out of 5"
  &gt;&lt;img src="1" alt=""&gt;&lt;img src="1" alt=""&gt;&lt;img src="0" alt=""
  &gt;&lt;img src="0" alt=""&gt;</strong>&lt;/meter&gt;&lt;/p&gt;</pre>

  </div>



  <h6 id=a-group-of-images-that-form-a-single-larger-picture-with-links><span class=secno>4.8.1.1.9 </span>A group of images that form a single larger picture with links</h6>

  <p>Generally, <a href=#image-map title="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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute representing the purpose
  of the link.</p>

  <div class=example>

   <p>In the following example, a picture representing the flying
   spaghetti monster emblem, with each of the left noodly appendages
   and the right noodly appendages in different images, so that the
   user can pick the left side or the right side in an adventure.</p>

   <pre>&lt;h1&gt;The Church&lt;/h1&gt;
&lt;p&gt;You come across a flying spaghetti monster. Which side of His
Noodliness do you wish to reach out for?&lt;/p&gt;
<strong>&lt;p&gt;&lt;a href="?go=left" &gt;&lt;img src="fsm-left.png"  alt="Left side. "&gt;&lt;/a
  &gt;&lt;img src="fsm-middle.png" alt=""
  &gt;&lt;a href="?go=right"&gt;&lt;img src="fsm-right.png" alt="Right side."&gt;&lt;/a&gt;&lt;/p&gt;</strong></pre>

  </div>



  <h6 id=a-key-part-of-the-content><span class=secno>4.8.1.1.10 </span>A key part of the content</h6>

  <p>In some cases, the image is a critical part of the
  content. This could be the case, for instance, on a page that is
  part of a photo gallery. The image is the whole <em>point</em> of
  the page containing it.</p>

  <p>How to provide alternative text for an image that is a key part
  of the content depends on the image's provenance.</p>

  <dl><dt>The general case</dt>

   <dd>

    <p>When it is possible for detailed alternative text to be
    provided, for example if the image is part of a series of
    screenshots in a magazine review, or part of a comic strip, or is
    a photograph in a blog entry about that photograph, text that can
    serve as a substitute for the image must be given as the contents
    of the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>

    <div class=example>

     <p>A screenshot in a gallery of screenshots for a new OS, with
     some alternative text:</p>

     <pre>&lt;figure&gt;
 <strong>&lt;img src="KDE%20Light%20desktop.png"
      alt="The desktop is blue, with icons along the left hand side in
           two columns, reading System, Home, K-Mail, etc. A window is
           open showing that menus wrap to a second line if they
           cannot fit in the window. The window has a list of icons
           along the top, with an address bar below it, a list of
           icons for tabs along the left edge, a status bar on the
           bottom, and two panes in the middle. The desktop has a bar
           at the bottom of the screen with a few buttons, a pager, a
           list of open applications, and a clock."&gt;</strong>
 &lt;figcaption&gt;Screenshot of a KDE desktop.&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

    </div>

    <div class=example>

     <p>A graph in a financial report:</p>

     <pre><strong>&lt;img src="sales.gif"
     title="Sales graph"
     alt="From 1998 to 2005, sales increased by the following percentages
     with each year: 624%, 75%, 138%, 40%, 35%, 9%, 21%"&gt;</strong></pre>

     <p>Note that "sales graph" would be inadequate alternative text
     for a sales graph. Text that would be a good <em><a href=#the-caption-element>caption</a></em> is
     not generally suitable as replacement text.</p>

    </div>

   </dd>


   <dt>Images that defy a complete description</dt>

   <dd>

    <p>In certain cases, the nature of the image might be such that
    providing thorough alternative text is impractical. For example,
    the image could be indistinct, or could be a complex fractal, or
    could be a detailed topographical map.</p>

    <p>In these cases, the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
    attribute must contain some suitable alternative text, but it may
    be somewhat brief.</p>

    <div class=example>

     <p>Sometimes there simply is no text that can do justice to an
     image. For example, there is little that can be said to usefully
     describe a Rorschach inkblot test. However, a description, even
     if brief, is still better than nothing:</p>

     <pre>&lt;figure&gt;
 <strong>&lt;img src="/commons/a/a7/Rorschach1.jpg" alt="A shape with left-right
 symmetry with indistinct edges, with a small gap in the center, two
 larger gaps offset slightly from the center, with two similar gaps
 under them. The outline is wider in the top half than the bottom
 half, with the sides extending upwards higher than the center, and
 the center extending below the sides."&gt;</strong>
 &lt;figcaption&gt;A black outline of the first of the ten cards
 in the Rorschach inkblot test.&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

     <p>Note that the following would be a very bad use of alternative
     text:</p>

     <pre class=bad>&lt;!-- This example is wrong. Do not copy it. --&gt;
&lt;figure&gt;
 &lt;img src="/commons/a/a7/Rorschach1.jpg" alt="A black outline
 of the first of the ten cards in the Rorschach inkblot test."&gt;
 &lt;figcaption&gt;A black outline of the first of the ten cards
 in the Rorschach inkblot test.&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

     <p>Including the caption in the alternative text like this isn't
     useful because it effectively duplicates the caption for users
     who don't have images, taunting them twice yet not helping them
     any more than if they had only read or heard the caption
     once.</p>

    </div>

    <div class=example>

     <p>Another example of an image that defies full description is a
     fractal, which, by definition, is infinite in detail.</p>

     <p>The following example shows one possible way of providing
     alternative text for the full view of an image of the Mandelbrot
     set.</p>

     <pre><strong>&lt;img src="ms1.jpeg" alt="The Mandelbrot set appears as a cardioid with
its cusp on the real axis in the positive direction, with a smaller
bulb aligned along the same center line, touching it in the negative
direction, and with these two shapes being surrounded by smaller bulbs
of various sizes."&gt;</strong></pre>

    </div>

   </dd>


   <dt id=unknown-images>Images whose contents are not known</dt>

   <dd>

    <p>In some unfortunate cases, there might be no alternative text
    available at all, either because the image is obtained in some
    automated fashion without any associated alternative text (e.g. a
    Webcam), or because the page is being generated by a script using
    user-provided images where the user did not provide suitable or
    usable alternative text (e.g. photograph sharing sites), or
    because the author does not himself know what the images represent
    (e.g. a blind photographer sharing an image on his blog).</p>

    <p>In such cases, the <code title=attr-img-alt><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><!-- when editing this list, search for the two other occurrences
     of 'critical-no-alt' --><!-- NOTE: the order of these steps is important; it's intended
     to encourage using <figcaption> rather than title="" --><li id=figcaption-as-alt-condition><p>The <code><a href=#the-img-element>img</a></code>
     element is in a <code><a href=#the-figure-element>figure</a></code> element that contains a
     <code><a href=#the-figcaption-element>figcaption</a></code> element that contains content other than
     <a href=#inter-element-whitespace>inter-element whitespace</a>, and, ignoring the
     <code><a href=#the-figcaption-element>figcaption</a></code> element and its descendants, the
     <code><a href=#the-figure-element>figure</a></code> element has no <code><a href=#text>Text</a></code> node
     descendants other than <a href=#inter-element-whitespace>inter-element whitespace</a>, and
     no <a href=#embedded-content>embedded content</a> descendant other than the
     <code><a href=#the-img-element>img</a></code> element.</li>

     <li>

      <p>The <code title=attr-title><a href=#attr-title>title</a></code> attribute is
      present and has a non-empty value.</p>

      <!-- search for title-warning if modifying this paragraph -->
      <p class=note>Relying on the <code title=attr-title><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>

     </li>

    </ul><p class=note>Such cases are to be kept to an absolute
    minimum. If there is even the slightest possibility of the author
    having the ability to provide real alternative text, then it would
    not be acceptable to omit the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>
    attribute.</p>

    <div class=example>

     <p>A photo on a photo-sharing site, if the site received the
     image with no metadata other than the caption, could be marked up
     as follows:</p>

     <pre>&lt;figure&gt;
 <strong>&lt;img src="1100670787_6a7c664aef.jpg"&gt;</strong>
 &lt;figcaption&gt;Bubbles traveled everywhere with us.&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

     <p>It would be better, however, if a detailed description of the
     important parts of the image obtained from the user and included
     on the page.</p>

    </div>

    <div class=example>

     <p>A blind user's blog in which a photo taken by the user is
     shown. Initially, the user might not have any idea what the photo
     he took shows:</p>

     <pre>&lt;article&gt;
 &lt;h1&gt;I took a photo&lt;/h1&gt;
 &lt;p&gt;I went out today and took a photo!&lt;/p&gt;
 &lt;figure&gt;
  <strong>&lt;img src="photo2.jpeg"&gt;</strong>
  &lt;figcaption&gt;A photograph taken blindly from my front porch.&lt;/figcaption&gt;
 &lt;/figure&gt;
&lt;/article&gt;</pre>

     <p>Eventually though, the user might obtain a description of the
     image from his friends and could then include alternative text:</p>

     <pre>&lt;article&gt;
 &lt;h1&gt;I took a photo&lt;/h1&gt;
 &lt;p&gt;I went out today and took a photo!&lt;/p&gt;
 &lt;figure&gt;
  <strong>&lt;img src="photo2.jpeg" alt="The photograph shows my squirrel
  feeder hanging from the edge of my roof. It is half full, but there
  are no squirrels around. In the background, out-of-focus trees fill the
  shot. The feeder is made of wood with a metal grate, and it contains
  peanuts. The edge of the roof is wooden too, and is painted white
  with light blue streaks."&gt;</strong>
  &lt;figcaption&gt;A photograph taken blindly from my front porch.&lt;/figcaption&gt;
 &lt;/figure&gt;
&lt;/article&gt;</pre>

    </div>

    <div class=example>

     <p>Sometimes the entire point of the image is that a textual
     description is not available, and the user is to provide the
     description. For instance, the point of a CAPTCHA image is to see
     if the user can literally read the graphic. Here is one way to
     mark up a CAPTCHA (note the <code title=attr-title><a href=#attr-title>title</a></code>
     attribute):</p>

     <pre>&lt;p&gt;&lt;label&gt;What does this image say?
<strong>&lt;img src="captcha.cgi?id=8934" title="CAPTCHA"&gt;</strong>
&lt;input type=text name=captcha&gt;&lt;/label&gt;
(If you cannot see the image, you can use an &lt;a
href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</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>&lt;table&gt;
 &lt;thead&gt;
  &lt;tr&gt; &lt;th&gt; Image &lt;th&gt; Description
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;td&gt; <strong>&lt;img src="2421.png" title="Image 640 by 100, filename 'banner.gif'"&gt;</strong>
   &lt;td&gt; &lt;input name="alt2421"&gt;
  &lt;tr&gt;
   &lt;td&gt; <strong>&lt;img src="2422.png" title="Image 200 by 480, filename 'ad3.gif'"&gt;</strong>
   &lt;td&gt; &lt;input name="alt2422"&gt;
&lt;/table&gt;</pre>

     <p>Notice that even in this example, as much useful information
     as possible is still included in the <code title=attr-title><a href=#attr-title>title</a></code> attribute.</p>

    </div>

    <p class=note>Since some users cannot use images at all
    (e.g. because they have a very slow connection, or because they
    are using a text-only browser, or because they are listening to
    the page being read out by a hands-free automobile voice Web
    browser, or simply because they are blind), the <code title=attr-img-alt><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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>

   </dd>

  </dl><h6 id=an-image-not-intended-for-the-user><span class=secno>4.8.1.1.11 </span>An image not intended for the user</h6>

  <p>Generally authors should avoid using <code><a href=#the-img-element>img</a></code> elements
  for purposes other than showing images.</p>

  <p>If an <code><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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must
  be the empty string.</p>

  <p>In such cases, the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and
  <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes should both
  be set to zero.</p>


  <h6 id=an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images><span class=secno>4.8.1.1.12 </span>An image in an e-mail or private document intended for a specific person who is known to be able to view images</h6>

  <p><i>This section does not apply to documents that are publicly
  accessible, or whose target audience is not necessarily personally
  known to the author, such as documents on a Web site, e-mails sent
  to public mailing lists, or software documentation.</i></p>

  <p>When an image is included in a private communication (such as an HTML e-mail) aimed at a
  specific person who is known to be able to view images, the <code title=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>




  <div class=impl>

  <h6 id=guidance-for-markup-generators><span class=secno>4.8.1.1.13 </span>Guidance for markup generators</h6>

  <p>Markup generators (such as WYSIWYG authoring tools) should,
  wherever possible, obtain alternative text from their
  users. However, it is 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><a href=#the-figure-element>figure</a></code> and <code><a href=#the-figcaption-element>figcaption</a></code> elements, or the
  <code title=attr-title><a href=#attr-title>title</a></code> attribute, to provide the
  image's caption.</p>

  <p>As a last resort, implementors should either set the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute to the empty string, under
  the assumption that the image is a purely decorative image that
  doesn't add any information but is still specific to the surrounding
  content, or omit the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute
  altogether, under the assumption that the image is a key part of the
  content.</p>

  <p>Markup generators may specify a <dfn id=attr-img-generator-unable-to-provide-required-alt title=attr-img-generator-unable-to-provide-required-alt><code>generator-unable-to-provide-required-alt</code></dfn>
  attribute on <code><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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute. The
  value of this attribute must be the empty string. Documents
  containing such attributes are not conforming, but conformance
  checkers will <a href=#guidance-for-conformance-checkers>silently
  ignore</a> this error.</p>

  <p class=note>This is intended to avoid markup generators from
  being pressured into replacing the error of omitting the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute with the even more
  egregious error of providing phony alternative text, because
  state-of-the-art automated conformance checkers cannot distinguish
  phony alternative text from correct alternative text.</p>

  <p>Markup generators should generally avoid using the image's own
  file name as the alternative text. Similarly, markup generators
  should avoid generating alternative text from any content that will
  be equally available to presentation user agents (e.g. Web
  browsers).</p>

  <p class=note>This is because once a page is generated, it will
  typically not be updated, whereas the browsers that later read the
  page can be updated by the user, therefore the browser is likely to
  have more up-to-date and finely-tuned heuristics than the markup
  generator did when generating the page.</p>

  </div>

  <div class=impl>

  <h6 id=guidance-for-conformance-checkers><span class=secno>4.8.1.1.14 </span>Guidance for conformance checkers</h6>

  <p>A conformance checker must report the lack of an <code title=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><!-- when editing this list, search for the two other occurrences
   of 'critical-no-alt' --><li><p>The <code><a href=#the-img-element>img</a></code> element is in a <code><a href=#the-figure-element>figure</a></code>
   element that satisfies <a href=#figcaption-as-alt-condition>the
   conditions described above</a>.</li>

   <li><p>The <code><a href=#the-img-element>img</a></code> element has a <code title=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>

   <!-- the following are additional entries not included in the
   aforementioned list, as they apply only to conformance checkers -->

   <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>

   <li><p>The <code><a href=#the-img-element>img</a></code> element has a (non-conforming) <code title=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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute as an error must also not
   report the presence of the empty <code title=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 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 &mdash; 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 title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute as an error even in the
   presence of the <code title=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; 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.)</li>

  </ul></div>


  <h5 id=adaptive-images><span class=secno>4.8.1.2 </span>Adaptive images</h5>

  <p><i>This section is non-normative.</i></p>

  <p>CSS and media queries can be used to construct graphical page
  layouts that adapt dynamically to the user's environment, in
  particular to different viewport dimensions and pixel densities. For
  content, however, CSS does not help; instead, we have the
  <code><a href=#the-img-element>img</a></code> element's <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute. This section walks
  through a sample case showing how to use this attribute.</p>

  <p>Consider a situation where on wide screens (wider than 600 CSS
  pixels) a 300&times;150 image named <code title="">a-rectangle.png</code> is to be used, but on smaller
  screens (600 CSS pixels and less), a smaller 100&times;100 image
  called <code title="">a-square.png</code> is to be used. The markup
  for this would look like this:</p>

  <pre>&lt;figure&gt;
 &lt;img src="a-rectangle.png" srcset="a-square.png 600w"
      alt="Barney Frank wears a suit and glasses."&gt;
 &lt;figcaption&gt;Barney Frank, 2011&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  <p class=note>For details on what to put in the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute,
  see the earlier sections.</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>&lt;figure&gt;
 &lt;style scoped&gt;
  #a { width: 300px; height: 150px; }
  @media all and (max-width: 600px) { #a { width: 100px; height: 100px; } }
 &lt;/style&gt;
 &lt;img src="a-rectangle.png" srcset="a-square.png 600w" id="a"
      alt="Barney Frank wears a suit and glasses."&gt;
 &lt;figcaption&gt;Barney Frank, 2011&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  <p>Alternatively, the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=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 title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>:</p>

  <pre>&lt;figure&gt;
 &lt;style scoped media="all and (max-width: 600px)"&gt;
  #a { width: 100px; height: 100px; }
 &lt;/style&gt;
 &lt;img src="a-rectangle.png" width="300" height="100"
      srcset="a-square.png 600w" id=a
      alt="Barney Frank wears a suit and glasses."&gt;
 &lt;figcaption&gt;Barney Frank, 2011&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  <hr><p>The <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute is used with the <code title=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 title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute. This leads
  to a question of which image to provide in the <code title=attr-img-src><a href=#attr-img-src>src</a></code>
  attribute.</p>

  <p>The answer that results in the least duplication is to provide the image suitable for an
  infinite width and infinite height viewport with a pixel density of 1 CSS pixel per device
  pixel:</p>

  <pre>&lt;img src="pear-desktop.jpeg" srcset="pear-mobile.jpeg 720w, pear-tablet.jpeg 1280w"
     alt="The pear is juicy."&gt;</pre>

  <p>However, if legacy mobile user agents are more important, one can list all three images in the
  <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute, overriding the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute entirely. To do this, the widest image has to have the
  pixel density descriptor instead of the width, since there is no way to specify an infinite width
  explicitly:</p>

  <pre>&lt;img src="pear-mobile.jpeg"
     srcset="pear-mobile.jpeg 720w, pear-tablet.jpeg 1280w, pear-desktop.jpeg 1x"
     alt="The pear is juicy."&gt;</pre>

  <p>Since at this point the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is actually being
  ignored entirely by <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>-supporting user agents, the <code title=attr-img-src><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>&lt;img src="pear-tablet.jpeg"
     srcset="pear-mobile.jpeg 720w, pear-tablet.jpeg 1280w, pear-desktop.jpeg 1x"
     alt="The pear is juicy."&gt;</pre>

  <hr><p>The dimensions in the <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute are the maximum
  (viewport) dimensions that an image is intended for. It is possible to think of the numbers as
  minimums, though... if the images are listed in order, then the minimum for an image is the
  dimension given for the previous image. This example attempts to demonstrate this by using the
  file names to show the minimum values for each image:</p>

  <pre>&lt;img src="pear-tablet.jpeg"
     srcset="pear-min0.jpeg 720w, pear-min721.jpeg 1280w, pear-min1281.jpeg 1x"
     alt="The pear is juicy."&gt;</pre>



  <h4 id=the-iframe-element><span class=secno>4.8.2 </span>The <dfn><code>iframe</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Text that conforms to <a href=#iframe-content-model>the requirements given in the prose</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> &mdash; A document to render in the <code><a href=#the-iframe-element>iframe</a></code></dd>
   <dd><code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code> &mdash; Name of <a href=#nested-browsing-context>nested browsing context</a></dd>
   <dd><code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> &mdash; Security rules for nested content</dd>
   <dd><code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> &mdash; Whether to apply the document's styles to the nested content</dd>
   <dd><code title=attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code> &mdash; Whether to allow the <code><a href=#the-iframe-element>iframe</a></code>'s contents to use <code title=dom-element-requestFullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code></dd>
   <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code> &mdash; Vertical dimension</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmliframeelement>HTMLIFrameElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-iframe-src title=dom-iframe-src>src</a>;
           attribute DOMString <a href=#dom-iframe-srcdoc title=dom-iframe-srcdoc>srcdoc</a>;
           attribute DOMString <a href=#dom-iframe-name title=dom-iframe-name>name</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-iframe-sandbox title=dom-iframe-sandbox>sandbox</a>;
           attribute boolean <a href=#dom-iframe-seamless title=dom-iframe-seamless>seamless</a>;
           attribute boolean <a href=#dom-iframe-allowfullscreen title=dom-iframe-allowFullscreen>allowFullscreen</a>;
           attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
           attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
  readonly attribute Document? <a href=#dom-iframe-contentdocument title=dom-iframe-contentDocument>contentDocument</a>;
  readonly attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-iframe-contentwindow title=dom-iframe-contentWindow>contentWindow</a>;

  // <a href="#HTMLIFrameElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><!-- INTRO --><p>The <code><a href=#the-iframe-element>iframe</a></code> element <a href=#represents>represents</a> a <a href=#nested-browsing-context>nested browsing
  context</a>.</p>


  <!-- SRC/SRCDOC -->

  <p>The <dfn id=attr-iframe-src title=attr-iframe-src><code>src</code></dfn> attribute gives the address of a page
  that the <a href=#nested-browsing-context>nested browsing context</a> is to contain. The attribute, if present, must be a
  <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>. If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> is specified on an <code><a href=#the-iframe-element>iframe</a></code> element, then the
  <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute must also be specified.</p>

  <p>The <dfn id=attr-iframe-srcdoc title=attr-iframe-srcdoc><code>srcdoc</code></dfn> attribute gives the content of
  the page that the <a href=#nested-browsing-context>nested browsing context</a> is to contain. The value of the attribute
  is the source of <dfn id=an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code>
  document</dfn>.</p>

  <p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#html-documents>HTML documents</a>, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute, if present, must have a value using <a href=#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 title=syntax-comments>comments</a> and <a href=#space-character title="space
   character">space characters</a>.</li>

   <li>Optionally, a <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>.

   <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and <a href=#space-character title="space
   character">space characters</a>.</li>

   <li>The root element, in the form of an <code><a href=#the-html-element>html</a></code> <a href=#syntax-elements title=syntax-elements>element</a>.</li>

   <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and <a href=#space-character title="space
   character">space characters</a>.</li>

  </ol><p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#xml-documents>XML documents</a>, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute, if present, must have a value that matches the
  production labeled <code title="">document</code> in the XML specification. <a href=#refsXML>[XML]</a></p>

  <div class=example>

   <p>Here a blog uses the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute in conjunction
   with the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> and <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attributes described below to provide users of user
   agents that support this feature with an extra layer of protection from script injection in the
   blog post comments:</p>

   <pre>&lt;article&gt;
 &lt;h1&gt;I got my own magazine!&lt;/h1&gt;
 &lt;p&gt;After much effort, I've finally found a publisher, and so now I
 have my own magazine! Isn't that awesome?! The first issue will come
 out in September, and we have articles about getting food, and about
 getting in boxes, it's going to be great!&lt;/p&gt;
 &lt;footer&gt;
  &lt;p&gt;Written by &lt;a href="/users/cap"&gt;cap&lt;/a&gt;, 1 hour ago.
 &lt;/footer&gt;
 &lt;article&gt;
  &lt;footer&gt; Thirteen minutes ago, &lt;a href="/users/ch"&gt;ch&lt;/a&gt; wrote: &lt;/footer&gt;
  &lt;iframe seamless sandbox srcdoc="&lt;p&gt;did you get a cover picture yet?"&gt;&lt;/iframe&gt;
 &lt;/article&gt;
 &lt;article&gt;
  &lt;footer&gt; Nine minutes ago, &lt;a href="/users/cap"&gt;cap&lt;/a&gt; wrote: &lt;/footer&gt;
  &lt;iframe seamless sandbox srcdoc="&lt;p&gt;Yeah, you can see it &lt;a href=&amp;quot;/gallery?mode=cover&amp;amp;amp;page=1&amp;quot;&gt;in my gallery&lt;/a&gt;."&gt;&lt;/iframe&gt;
 &lt;/article&gt;
 &lt;article&gt;
  &lt;footer&gt; Five minutes ago, &lt;a href="/users/ch"&gt;ch&lt;/a&gt; wrote: &lt;/footer&gt;
  &lt;iframe seamless sandbox srcdoc="&lt;p&gt;hey that's earl's table.
&lt;p&gt;you should get earl&amp;amp;amp;me on the next cover."&gt;&lt;/iframe&gt;
 &lt;/article&gt;</pre>

   <p>Notice the way that quotes have to be escaped (otherwise the <code title=attr-iframe-srcdoc><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 &mdash; once so that the ampersand is preserved when originally parsing
   the <code title=attr-iframe-srcdoc><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 title=syntax-doctype>DOCTYPE</a> is optional in
   <a href=#an-iframe-srcdoc-document title="an iframe srcdoc document"><code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> documents</a>, and the <code><a href=#the-html-element>html</a></code>,
   <code><a href=#the-head-element>head</a></code>, and <code><a href=#the-body-element>body</a></code> elements have <a href=#syntax-tag-omission>optional
   start and tags</a>, and the <code><a href=#the-title-element>title</a></code> element is also optional in <a href=#an-iframe-srcdoc-document title="an iframe
   srcdoc document"><code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code>
   documents</a>, the markup in a <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute can be
   relatively succint despite representing an entire document, since only the contents of the
   <code><a href=#the-body-element>body</a></code> element need appear literally in the syntax. The other elements are still
   present, but only by implication.</p>

  </div>

  <p class=note>In <a href=#syntax>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 (&amp;) characters, and to specify the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, to ensure safe embedding of content.</p>

  <p class=note>Due to restrictions of <a href=#the-xhtml-syntax>the XHTML syntax</a>, in XML the U+003C LESS-THAN
  SIGN character (&lt;) needs to be escaped as well. In order to prevent <a href=http://www.w3.org/TR/xml/#AVNormalize>attribute-value normalization</a>, some of XML's
  whitespace characters &mdash; specifically U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
  (LF), and U+000D CARRIAGE RETURN (CR) &mdash; also need to be escaped. <a href=#refsXML>[XML]</a></p>

  <p class=note>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute and the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute are both specified together, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute takes priority. This allows authors to provide
  a fallback <a href=#url>URL</a> for legacy user agents that do not support the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute.</p>


  <div class=impl>

  <hr><!-- SRC/SRCDOC PROCESSING MODEL --><p>When an <code><a href=#the-iframe-element>iframe</a></code> element is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted
  into a document</a>, the user agent must create a <a href=#nested-browsing-context>nested browsing context</a>, and
  then <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a> for the first time.</p>

  <p>When an <code><a href=#the-iframe-element>iframe</a></code> element is <a href=#remove-an-element-from-a-document title="remove an element from a document">removed
  from a document</a>, the user agent must <a href=#a-browsing-context-is-discarded title="a browsing context is
  discarded">discard</a> the <a href=#nested-browsing-context>nested browsing context</a>.</p>

  <p class=note>This happens without any <code title=event-unload>unload</code> events firing
  (the <a href=#nested-browsing-context>nested browsing context</a> and its <code><a href=#document>Document</a></code> are <em title="a browsing
  context is discarded"><a href=#a-browsing-context-is-discarded>discarded</a></em>, not <em title="unload a document"><a href=#unload-a-document>unloaded</a></em>).</p>

  <!-- START of section that's very similar to <frame> -->

  <p>Whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context>nested browsing context</a> has its
  <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute set, changed, or removed, the user agent
  must <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>.</p>

  <p>Similarly, whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context>nested browsing context</a>
  but with no <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute specified has its <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute set, changed, or removed, the user agent must
  <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>.</p> <!-- It doesn't happen when the base
  URL is changed, though. -->

  <p>When the user agent is to <dfn id=process-the-iframe-attributes>process the <code>iframe</code> attributes</dfn>, it must run
  the first appropriate steps from the following list:</p>

  <dl class=switch><dt>If the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is specified</dt>

   <dd><p><a href=#navigate>Navigate</a><!--DONAV iframe--> the element's <a href=#child-browsing-context>child browsing context</a>
   to a resource whose <a href=#content-type>Content-Type</a> is <code><a href=#text/html>text/html</a></code>, whose <a href=#url>URL</a>
   is <code><a href=#about:srcdoc>about:srcdoc</a></code>, and whose data consists of the value of the attribute. The
   resulting <code><a href=#document>Document</a></code> must be considered <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>.</dd>

   <dt>Otherwise, if the element has no <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute
   specified, and the user agent is processing the <code><a href=#the-iframe-element>iframe</a></code>'s attributes for the first
   time</dt>

   <dd>

    <p><a href=#queue-a-task>Queue a task</a> to run the <a href=#iframe-load-event-steps>iframe load event steps</a>.</p>

   </dd>

   <dt>Otherwise</dt>

   <dd>

    <ol><li>

      <p>If the value of the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is the empty string,
      let <var title="">url</var> be the string "<code><a href=#about:blank>about:blank</a></code>".</p>

      <p>Otherwise, <a href=#resolve-a-url title="resolve a url">resolve</a> the value of the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute, relative to the <code><a href=#the-iframe-element>iframe</a></code> element.</p>

      <p>If that is not successful, then let <var title="">url</var> be the string
      "<code><a href=#about:blank>about:blank</a></code>". Otherwise, let <var title="">url</var> be the resulting
      <a href=#absolute-url>absolute URL</a>.</p>

     </li>

     <li>

      <p>If there exists an <a href=#ancestor-browsing-context>ancestor browsing context</a> whose <a href=#active-document>active
      document</a>'s <a href="#the-document's-address" title="the document's address">address</a>, ignoring fragment
      identifiers, is equal to <var title="">url</var>, then abort these steps.</p>
      <!-- http://www.hixie.ch/tests/adhoc/html/frames/iframes/ 008.html and 009.html -->
      <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1969 -->
      <!-- I'm assuming that "resolve" will normalise things like scheme and hostname case -->

     </li>

     <li>

      <p><a href=#navigate>Navigate</a><!--DONAV iframe--> the element's <a href=#child-browsing-context>child browsing context</a>
      to <var title="">url</var>.</p>
      
     </li>

    </ol></dd>

  </dl><p>Any <a href=#navigate title=navigate>navigation</a> required of the user agent in the <a href=#process-the-iframe-attributes>process
  the <code>iframe</code> attributes</a> algorithm must be completed as an <a href=#explicit-self-navigation-override>explicit
  self-navigation override</a> and with the <code><a href=#the-iframe-element>iframe</a></code> element's document's
  <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source browsing context</a>.</p>

  <p>Furthermore, if the <a href=#active-document>active document</a> of the element's <a href=#child-browsing-context>child browsing
  context</a> before such a <a href=#navigate title=navigate>navigation</a> was not <a href=#completely-loaded>completely
  loaded</a> at the time of the new <a href=#navigate title=navigate>navigation</a>, then the <a href=#navigate title=navigate>navigation</a> must be completed with <a href=#replacement-enabled>replacement enabled</a>.</p>

  <p>Similarly, if the <a href=#child-browsing-context>child browsing context</a>'s <a href=#session-history>session history</a> contained
  only one <code><a href=#document>Document</a></code> when the <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>
  algorithm was invoked, and that was the <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> created
  when the <a href=#child-browsing-context>child browsing context</a> was created, then any <a href=#navigate title=navigate>navigation</a> required of the user agent in that algorithm must be completed
  with <a href=#replacement-enabled>replacement enabled</a>.</p> <!-- see also the note near similar text for the
  location.assign() method -->

  <p>When a <code><a href=#document>Document</a></code> in an <code><a href=#the-iframe-element>iframe</a></code> is marked as <a href=#completely-loaded>completely
  loaded</a>, the user agent must synchronously run the <a href=#iframe-load-event-steps>iframe load event steps</a>.</p>

  <p>When content whose <a href=#url>URL</a> has the <a href=#same-origin>same origin</a> as the <code><a href=#the-iframe-element>iframe</a></code>
  element's <code><a href=#document>Document</a></code> fails to load (e.g. due to a DNS error, network error, or if the
  server returned a 4xx or 5xx status code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
  equivalent</a>), then the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-error>error</code> at the element instead. (This event does
  not fire for <a href=#parse-error title="parse error">parse errors</a>, script errors, or any errors for
  cross-origin resources.)</p>

  <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#dom-manipulation-task-source>DOM
  manipulation task source</a>.</p>

  <p class=note>A <code title=event-load>load</code> event is also fired at the
  <code><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><a href=#document>Document</a></code> has an <dfn id=iframe-load-in-progress>iframe load in progress</dfn> flag and a <dfn id=mute-iframe-load>mute
  iframe load</dfn> flag. When a <code><a href=#document>Document</a></code> is created, these flags must be unset for
  that <code><a href=#document>Document</a></code>.</p>

  <p>The <dfn id=iframe-load-event-steps>iframe load event steps</dfn> are as follows:</p>

  <ol><li><p>Let <var title="">child document</var> be the <a href=#active-document>active document</a> of the
   <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>.</li>

   <li><p>If <var title="">child document</var> has its <a href=#mute-iframe-load>mute iframe load</a> flag set,
   abort these steps.</li>

   <li><p>Set <var title="">child document</var>'s <a href=#iframe-load-in-progress>iframe load in progress</a>
   flag.</li>

   <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-load>load</code> at the
   <code><a href=#the-iframe-element>iframe</a></code> element.</li>

   <li><p>Unset <var title="">child document</var>'s <a href=#iframe-load-in-progress>iframe load in progress</a>
   flag.</li>

  </ol><p class=warning>This, in conjunction with scripting, can be used to probe the URL space of the
  local network's HTTP servers. User agents may implement <a href=#origin title=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><a href=#the-iframe-element>iframe</a></code>'s <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> is
  not <a href=#ready-for-post-load-tasks>ready for post-load tasks</a>, and when anything in the <code><a href=#the-iframe-element>iframe</a></code> is <a href=#delay-the-load-event title="delay the load event">delaying the load event</a> of the <code><a href=#the-iframe-element>iframe</a></code>'s
  <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>, and when the <code><a href=#the-iframe-element>iframe</a></code>'s
  <a href=#browsing-context>browsing context</a> is in the <a href=#delaying-load-events-mode>delaying <code title=event-load>load</code> events
  mode</a>, the <code><a href=#the-iframe-element>iframe</a></code> must <a href=#delay-the-load-event>delay the load event</a> of its document.</p>

  <p class=note>If, during the handling of the <code title=event-load>load</code> event, the
  <a href=#browsing-context>browsing context</a> in the <code><a href=#the-iframe-element>iframe</a></code> is again <a href=#navigate title=navigate>navigated</a>, that will further <a href=#delay-the-load-event>delay the load event</a>.</p>

  </div>

  <!-- END of section that's very similar to <frame> -->

  <p class=note>If, when the element is created, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not set, and the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is either also not set or set but its value cannot be
  <a href=#resolve-a-url title="resolve a url">resolved</a>, the browsing context will remain at the initial
  <code><a href=#about:blank>about:blank</a></code> page.</p>

  <p class=note>If the user <a href=#navigate title=navigate>navigates</a> away from this page, the
  <code><a href=#the-iframe-element>iframe</a></code>'s corresponding <code><a href=#windowproxy>WindowProxy</a></code> object will proxy new
  <code><a href=#window>Window</a></code> objects for new <code><a href=#document>Document</a></code> objects, but the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute will not change.</p>


  <hr><!-- NAME --><p>The <dfn id=attr-iframe-name title=attr-iframe-name><code>name</code></dfn> attribute, if present, must be a
  <a href=#valid-browsing-context-name>valid browsing context name</a>. The given value is used to name the <a href=#nested-browsing-context>nested
  browsing context</a>. <span class=impl>When the browsing context is created, if the attribute
  is present, the <a href=#browsing-context-name>browsing context name</a> must be set to the value of this attribute;
  otherwise, the <a href=#browsing-context-name>browsing context name</a> must be set to the empty string.</span></p>

  <div class=impl>

  <p>Whenever the <code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code> attribute is set, the nested
  <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-name title="browsing context name">name</a> must be changed to
  the new value. If the attribute is removed, the <a href=#browsing-context-name>browsing context name</a> must be set to
  the empty string.</p>

  </div>


  <hr><!-- SANDBOX --><p>The <dfn id=attr-iframe-sandbox title=attr-iframe-sandbox><code>sandbox</code></dfn> attribute, when specified,
  enables a set of extra restrictions on any content hosted by the <code><a href=#the-iframe-element>iframe</a></code>. Its value
  must be an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a>. The allowed values are <code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>, <code title=attr-iframe-sandbox-allow-pointer-lock><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>, <code title=attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>, <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>, <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>, and <code title=attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>.</p>

  <p>When the attribute is set, the content is treated as being from a unique <a href=#origin>origin</a>,
  forms, scripts, and various potentially annoying APIs are disabled, links are prevented from
  targeting other <a href=#browsing-context title="browsing context">browsing contexts</a>, and plugins are secured.
  The <code title=attr-iframe-sandbox-allow-same-origin><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 title=attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>
  keyword allows the content to <a href=#navigate>navigate</a> its <a href=#top-level-browsing-context>top-level browsing context</a>;
  and the <code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>, <code title=attr-iframe-sandbox-allow-pointer-lock><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>, <code title=attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code> and <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> keywords re-enable forms, the
  pointer lock API, popups, and scripts respectively. <a href=#refsPOINTERLOCK>[POINTERLOCK]</a></p>

  <p class=warning>Setting both the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> and <code title=attr-iframe-sandbox-allow-same-origin><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>same origin</a> as the page containing the <code><a href=#the-iframe-element>iframe</a></code>
  allows the embedded page to simply remove the <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>
  attribute and then reload itself, effectively breaking out of the sandbox altogether.</p>

  <p class=warning>These flags only take effect when the <a href=#nested-browsing-context>nested browsing context</a> of
  the <code><a href=#the-iframe-element>iframe</a></code> is <a href=#navigate title=navigate>navigated</a>. Removing them, or removing the
  entire <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, has no effect on an
  already-loaded page.</p>

  <p class=warning>Potentially hostile files should not be served from the same server as the file
  containing the <code><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><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 title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>
  attribute.</p>

  <div class=impl>

  <!-- v2: Add a new attribute that enables new restrictions, e.g.:
       - disallow cross-origin loads of any kind (networking
         override that only allows same-origin URLs or about:,
         javascript:, data:)
       - block access to 'parent.frames' from sandbox
  -->

  <p>When an <code><a href=#the-iframe-element>iframe</a></code> element with a <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>
  attribute has its <a href=#nested-browsing-context>nested browsing context</a> created (before the initial
  <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> is created), and when an <code><a href=#the-iframe-element>iframe</a></code>
  element's <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute is set or changed while it
  has a <a href=#nested-browsing-context>nested browsing context</a>, the user agent must <a href=#parse-a-sandboxing-directive title="parse a sandboxing
  directive">parse the sandboxing directive</a> using the attribute's value as the <var title="">input</var>, the <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>'s
  <a href=#iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag set</a> as the output, and, if the
  <code><a href=#the-iframe-element>iframe</a></code> has an <code title=attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>
  attribute, the <var title="">allow fullscreen flag</var>.</p>

  <p>When an <code><a href=#the-iframe-element>iframe</a></code> element's <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>
  attribute is removed while it has a <a href=#nested-browsing-context>nested browsing context</a>, the user agent must
  empty the <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>'s
  <a href=#iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag set</a> as the output.</p>

  </div>

  <div class=example>

   <p>In this example, some completely-unknown, potentially hostile, user-provided HTML content is
   embedded in a page. Because it is served from a separate domain, it is affected by all the normal
   cross-site restrictions. In addition, the embedded page has scripting disabled, plugins disabled,
   forms disabled, and it cannot navigate any frames or windows other than itself (or any frames or
   windows it itself embeds).</p>

   <pre>&lt;p&gt;We're not scared of you! Here is your content, unedited:&lt;/p&gt;
&lt;iframe sandbox src="http://usercontent.example.net/getusercontent.cgi?id=12193"&gt;&lt;/iframe&gt;</pre>

   <p class=warning>It is important to use a separate domain so that if the attacker convinces the
   user to visit that page directly, the page doesn't run in the context of the site's origin, which
   would make the user vulnerable to any attack found in the page.</p>

  </div>

  <div class=example>

   <p>In this example, a gadget from another site is embedded. The gadget has scripting and forms
   enabled, and the origin sandbox restrictions are lifted, allowing the gadget to communicate with
   its originating server. The sandbox is still useful, however, as it disables plugins and popups,
   thus reducing the risk of the user being exposed to malware and other annoyances.</p>

   <pre>&lt;iframe sandbox="allow-same-origin allow-forms allow-scripts"
        src="http://maps.example.com/embedded.html"&gt;&lt;/iframe&gt;</pre>

  </div>

  <div class=example>

   <p>Suppose a file A contained the following fragment:</p>

   <pre>&lt;iframe sandbox="allow-same-origin allow-forms" src=B&gt;&lt;/iframe&gt;</pre>

   <p>Suppose that file B contained an iframe also:</p>

   <pre>&lt;iframe sandbox="allow-scripts" src=C&gt;&lt;/iframe&gt;</pre>

   <p>Further, suppose that file C contained a link:</p>

   <pre>&lt;a href=D&gt;Link&lt;/a&gt;</pre>

   <p>For this example, suppose all the files were served as <code><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><a href=#the-iframe-element>iframe</a></code> in A has scripts disabled, and this overrides the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> keyword set on the
   <code><a href=#the-iframe-element>iframe</a></code> in B. Forms are also disabled, because the inner <code><a href=#the-iframe-element>iframe</a></code> (in B)
   does not have the <code title=attr-iframe-sandbox-allow-forms><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 title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attributes in A <!--grammar-check-override--> and B.
   This would change nothing immediately. If the user clicked the link in C, loading page D into the
   <code><a href=#the-iframe-element>iframe</a></code> in B, page D would now act as if the <code><a href=#the-iframe-element>iframe</a></code> in B had the <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> and <code title=attr-iframe-sandbox-allow-forms><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>nested browsing context</a> in the <code><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 title=attr-iframe-sandbox><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><!-- SEAMLESS --><p>The <dfn id=attr-iframe-seamless title=attr-iframe-seamless><code>seamless</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. When specified, it indicates that the <code><a href=#the-iframe-element>iframe</a></code> element's
  <a href=#browsing-context>browsing context</a> is to be rendered in a manner that makes it appear to be part of the
  containing document (seamlessly included in the parent document).</p>

  <div class=example>

   <p id=inclusion>An HTML inclusion is effected using this attribute as in the following example.
   In this case, the inclusion is of a site-wide navigation bar.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Mirror Mirror &mdash; MovieInfo&trade;&lt;/title&gt;
&lt;header&gt;
 &lt;h1&gt;Mirror Mirror&lt;/h1&gt;
 &lt;p&gt;Part of the MovieInfo&trade; Database&lt;/p&gt;
 &lt;nav&gt;
  <strong>&lt;iframe seamless src="nav.inc"&gt;&lt;/iframe&gt;</strong>
 &lt;/nav&gt;
&lt;/header&gt;
...</pre>

  </div>

  <div class=impl>

  <p>An <code><a href=#the-iframe-element>iframe</a></code> element is said to be <dfn id=in-seamless-mode>in seamless mode</dfn> when all of the
  following conditions are met:</p>

  <ul><li>The <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attribute is set on the
   <code><a href=#the-iframe-element>iframe</a></code> element, and

   <li>The <code><a href=#the-iframe-element>iframe</a></code> element's owner <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag
   set</a> does not have the <a href=#sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</a> set, and

   <li>Either:

    <ul><li>The <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> has the <a href=#same-origin>same
     origin</a> as the <code><a href=#the-iframe-element>iframe</a></code> element's <code><a href=#document>Document</a></code>, or

     <li>The <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>'s <em><a href=#the-address-element><span title="the
     document's address">address</span></a></em> has the <a href=#same-origin>same origin</a> as the
     <code><a href=#the-iframe-element>iframe</a></code> element's <code><a href=#document>Document</a></code>, or

     <li>The <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> is <a href=#an-iframe-srcdoc-document>an
     <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>.

    </ul></li>

  </ul><p>When an <code><a href=#the-iframe-element>iframe</a></code> element is <a href=#in-seamless-mode>in seamless mode</a>, the following
  requirements apply:</p>

  <ul><li><p>The user agent must set the <dfn id=seamless-browsing-context-flag>seamless browsing context flag</dfn> to true for that
   <a href=#browsing-context>browsing context</a>. This will <a href=#seamlessLinks>cause links to open in the
   parent browsing context</a> unless an <a href=#explicit-self-navigation-override>explicit self-navigation override</a> is used
   (<code title="">target="_self"</code>).</li>

   <li><p>Media queries in the context of the <code><a href=#the-iframe-element>iframe</a></code>'s <a href=#browsing-context>browsing context</a>
   (e.g. on <code title=attr-style-media><a href=#attr-style-media>media</a></code> attributes of <code><a href=#the-style-element>style</a></code> elements in
   <code><a href=#document>Document</a></code>s in that <code><a href=#the-iframe-element>iframe</a></code>) must be evaluated with respect to the nearest
   <a href=#ancestor-browsing-context>ancestor browsing context</a> that is not itself being <a href=#browsing-context-nested-through title="browsing context
   nested through">nested through</a> an <code><a href=#the-iframe-element>iframe</a></code> that is <a href=#in-seamless-mode>in seamless
   mode</a>. <a href=#refsMQ>[MQ]</a></li>

   <li><p>In a CSS-supporting user agent: the user agent must add all the style sheets that apply to
   the <code><a href=#the-iframe-element>iframe</a></code> element to the cascade of the <a href=#active-document>active document</a> of the
   <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>, at the appropriate cascade
   levels, before any style sheets specified by the document itself.</li>

   <li><p>In a CSS-supporting user agent: the user agent must, for the purpose of CSS property
   inheritance only, treat the root element of the <a href=#active-document>active document</a> of the
   <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a> as being a child of the
   <code><a href=#the-iframe-element>iframe</a></code> element. (Thus inherited properties on the root element of the document in
   the <code><a href=#the-iframe-element>iframe</a></code> will inherit the computed values of those properties on the
   <code><a href=#the-iframe-element>iframe</a></code> element instead of taking their initial values.)</li>

   <li><p>In visual media, in a CSS-supporting user agent: the user agent should set the intrinsic
   width of the <code><a href=#the-iframe-element>iframe</a></code> to the width that the element would have if it was a
   non-replaced block-level element with 'width: auto', unless that width would be zero (e.g. if the
   element is floating or absolutely positioned), in which case the user agent should set the
   intrinsic width of the <code><a href=#the-iframe-element>iframe</a></code> to the shrink-to-fit width of the root element (if
   any) of the content rendered in the <code><a href=#the-iframe-element>iframe</a></code>.</li>

   <li><p>In visual media, in a CSS-supporting user agent: the user agent should set the intrinsic
   height of the <code><a href=#the-iframe-element>iframe</a></code> to the shortest height that would make the content rendered in
   the <code><a href=#the-iframe-element>iframe</a></code> at its current width (as given in the previous bullet point) have no
   scrollable overflow at its bottom edge<!--, if the scrolling position was such that the top of
   the viewport for the content rendered in the <code>iframe</code> was aligned with the origin of
   that content's canvas-->. Scrollable overflow is any overflow that would increase the range to
   which a scrollbar or other scrolling mechanism can scroll.</li>

   <li>

    <p>In visual media, in a CSS-supporting user agent: the user agent must force the height of the
    initial containing block of the <a href=#active-document>active document</a> of the <a href=#nested-browsing-context>nested browsing
    context</a> of the <code><a href=#the-iframe-element>iframe</a></code> to zero.</p>

    <p class=note>This is intended to get around the otherwise circular dependency of percentage
    dimensions that depend on the height of the containing block, thus affecting the height of the
    document's bounding box, thus affecting the height of the viewport, thus affecting the size of
    the initial containing block.</p>

   </li>

   <li><p>In speech media, the user agent should render the <a href=#nested-browsing-context>nested browsing context</a>
   without announcing that it is a separate document.</li>

   <li>

    <p>User agents should, in general, act as if the <a href=#active-document>active document</a> of the
    <code><a href=#the-iframe-element>iframe</a></code>'s <a href=#nested-browsing-context>nested browsing context</a> was part of the document that the
    <code><a href=#the-iframe-element>iframe</a></code> is in, if any.</p>

    <p class=example>For example if the user agent supports listing all the links in a document,
    links in "seamlessly" nested documents would be included in that list without being
    significantly distinguished from links in the document itself.</p>

   </li>

   <li><p>The <a href=#nested-browsing-context>nested browsing context</a>'s <code><a href=#window>Window</a></code> object's
   <a href=#cross-boundary-event-parent>cross-boundary event parent</a> is the <a href=#browsing-context-container>browsing context container</a>. <a href=#refsDOM>[DOM]</a></li>

  </ul><p>If the attribute is not specified, or if the <a href=#origin>origin</a> conditions listed above are
  not met, then the user agent should render the <a href=#nested-browsing-context>nested browsing context</a> in a manner
  that is clearly distinguishable as a separate <a href=#browsing-context>browsing context</a>, and the
  <a href=#seamless-browsing-context-flag>seamless browsing context flag</a> must be set to false for that <a href=#browsing-context>browsing
  context</a>.</p>

  <p class=warning>It is important that user agents recheck the above conditions whenever the
  <a href=#active-document>active document</a> of the <a href=#nested-browsing-context>nested browsing context</a> of the
  <code><a href=#the-iframe-element>iframe</a></code> changes, such that the <a href=#seamless-browsing-context-flag>seamless browsing context flag</a> gets unset
  if the <a href=#nested-browsing-context>nested browsing context</a> is <a href=#navigate title=navigate>navigated</a> to another
  origin.</p>

  </div>

  <p class=note>The attribute can be set or removed dynamically, with the rendering updating in
  tandem.</p>

  <div class=example>

   <p>In this example, the site's navigation is embedded using a client-side include using an
   <code><a href=#the-iframe-element>iframe</a></code>. Any links in the <code><a href=#the-iframe-element>iframe</a></code> will, in new user agents, be
   automatically opened in the <code><a href=#the-iframe-element>iframe</a></code>'s parent browsing context; for legacy user
   agents, the site could also include a <code><a href=#the-base-element>base</a></code> element with a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute with the value <code title="">_parent</code>.
   Similarly, in new user agents the styles of the parent page will be automatically applied to the
   contents of the frame, but to support legacy user agents authors might wish to include the styles
   explicitly.</p>

   <pre>&lt;nav&gt;&lt;iframe seamless src="nav.include.html"&gt;&lt;/iframe&gt;&lt;/nav&gt;</pre>

  </div>

  <p class=note>The <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute does not
  propagate into <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> <code><a href=#the-iframe-element>iframe</a></code>s.</p>


  <hr><!-- FULLSCREEN --><p>The <dfn id=attr-iframe-allowfullscreen title=attr-iframe-allowfullscreen><code>allowfullscreen</code></dfn> attribute is a
  <a href=#boolean-attribute>boolean attribute</a>. When specified, it indicates that <code><a href=#document>Document</a></code> objects in
  the <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#browsing-context>browsing context</a> are to be allowed to use <code title=dom-element-requestFullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code> (if it's not blocked for other
  reasons, e.g. there is another ancestor <code><a href=#the-iframe-element>iframe</a></code> without this attribute set).</p>


  <hr><!-- DIM ATTRIBUTES --><p>The <code><a href=#the-iframe-element>iframe</a></code> element supports <a href=#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><a href=#the-iframe-element>iframe</a></code> element never has <a href=#fallback-content>fallback content</a>, as it will always
  create a nested <a href=#browsing-context>browsing context</a>, regardless of whether the specified initial
  contents are successfully used.</p>


  <hr><!-- FALLBACK --><p>Descendants of <code><a href=#the-iframe-element>iframe</a></code> elements represent nothing. (In legacy user agents that do
  not support <code><a href=#the-iframe-element>iframe</a></code> elements, the contents would be parsed as markup that could act as
  fallback content.)</p>

  <p id=iframe-content-model>When used in <a href=#html-documents>HTML documents</a>, the allowed content model
  of <code><a href=#the-iframe-element>iframe</a></code> elements is text, except that invoking the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing
  algorithm</a> with the <code><a href=#the-iframe-element>iframe</a></code> element as the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element and the text contents as the <var title="">input</var> must result in a list of nodes that are all <a href=#phrasing-content>phrasing content</a>,
  with no <a href=#parse-error title="parse error">parse errors</a> having occurred, with no <code><a href=#the-script-element>script</a></code>
  elements being anywhere in the list or as descendants of elements in the list, and with all the
  elements in the list (including their descendants) being themselves conforming.</p>

  <p>The <code><a href=#the-iframe-element>iframe</a></code> element must be empty in <a href=#xml-documents>XML documents</a>.</p>

  <p class=note>The <a href=#html-parser>HTML parser</a> treats markup inside <code><a href=#the-iframe-element>iframe</a></code> elements as
  text.</p>


  <div class=impl>

  <hr><!-- DOM --><p>The IDL attributes <dfn id=dom-iframe-src title=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-srcdoc title=dom-iframe-srcdoc><code>srcdoc</code></dfn>, <dfn id=dom-iframe-name title=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox title=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless title=dom-iframe-seamless><code>seamless</code></dfn> must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <p>The <dfn id=dom-iframe-allowfullscreen title=dom-iframe-allowFullscreen><code>allowFullscreen</code></dfn> IDL attribute
  must <a href=#reflect>reflect</a> the <code title=attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>
  content attribute.</p>

  <p>The <dfn id=dom-iframe-contentdocument title=dom-iframe-contentDocument><code>contentDocument</code></dfn> IDL attribute
  must return the <code><a href=#document>Document</a></code> object of the <a href=#active-document>active document</a> of the
  <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>, if any, or null otherwise.</p>

  <p>The <dfn id=dom-iframe-contentwindow title=dom-iframe-contentWindow><code>contentWindow</code></dfn> IDL attribute must
  return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <code><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context>nested
  browsing context</a>, if any, or null otherwise.</p>

  </div>

  <div class=example>

   <p>Here is an example of a page using an <code><a href=#the-iframe-element>iframe</a></code> to include advertising from an
   advertising broker:</p>

   <pre>&lt;iframe src="http://ads.example.com/?customerid=923513721&amp;amp;format=banner"
        width="468" height="60"&gt;&lt;/iframe&gt;</pre>

  </div>




  <h4 id=the-embed-element><span class=secno>4.8.3 </span>The <dfn><code>embed</code></dfn> element</h4>

<!-- (v2?)
 we have all kinds of quirks we should define if they come up during
 testing, as e.g. shown in:
 http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsObjectFrame.cpp
 http://trac.webkit.org/browser/trunk/WebCore/html/HTMLEmbedElement.cpp
 http://trac.webkit.org/browser/trunk/WebCore/rendering/RenderPartObject.cpp (updateWidget)
 e.g. - 240x200 default
      - the attributes/params are sent in a name-value pair list as follows (for Gecko):
         + attributes of the element, in source order
         + a synthesised 'src' attribute, if there was no 'src' but
           there was a 'data', with the value of the 'data' attribute
         + the params, in source order
        (WebKit does something different still)
      - the HIDDEN attribute (might be moot now)
-->

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-embed-src><a href=#attr-embed-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-embed-type><a href=#attr-embed-type>type</a></code> &mdash; Type of embedded resource</dd>
   <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code> &mdash; Vertical dimension</dd>
   <dd>Any other attribute that has no namespace (see prose).</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlembedelement>HTMLEmbedElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-embed-src title=dom-embed-src>src</a>;
           attribute DOMString <a href=#dom-embed-type title=dom-embed-type>type</a>;
           attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
           attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
  <a href=#dom-embed-caller title=dom-embed-caller>legacycaller</a> any (any... arguments);

  // <a href="#HTMLEmbedElement-partial">also has obsolete members</a>
};</pre>
    <div class=impl>
    <p>Depending on the type of content instantiated by the
    <code><a href=#the-embed-element>embed</a></code> element, the node may also support other
    interfaces.</p>
    </div>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-embed-element>embed</a></code> element provides an integration point for an external (typically
  non-HTML) application or interactive content.</p>

  <p>The <dfn id=attr-embed-src title=attr-embed-src><code>src</code></dfn> attribute gives the address of the
  resource being embedded. The attribute, if present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL
  potentially surrounded by spaces</a>.</p>

  <p>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an
  <code><a href=#the-embed-element>embed</a></code> element, then the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute must also
  be specified.</p>

  <p>The <dfn id=attr-embed-type title=attr-embed-type><code>type</code></dfn> attribute, if present, gives the
  <a href=#mime-type>MIME type</a> by which the plugin to instantiate is selected. The value must be a
  <a href=#valid-mime-type>valid MIME type</a>. If both the <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute and
  the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute are present, then the <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute must specify the same type as the <a href=#content-type title=Content-Type>explicit Content-Type metadata</a> of the resource given by the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute.</p>

  <div class=impl>

  <p>When the element is created with neither a <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute
  nor a <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute, and when attributes are removed such
  that neither attribute is present on the element anymore, and when the element has a <a href=#media-element>media
  element</a> ancestor, and when the element has an ancestor <code><a href=#the-object-element>object</a></code> element that is
  <em>not</em> showing its <a href=#fallback-content>fallback content</a>, any <a href=#plugin>plugin</a> instantiated for
  the element must be removed, and the <code><a href=#the-embed-element>embed</a></code> element then represents nothing.</p>

  <p>An <code><a href=#the-embed-element>embed</a></code> element is said to be <dfn id=concept-embed-active title=concept-embed-active>potentially
  active</dfn> when the following conditions are all met simultaneously:</p>

  <ul class=brief><li>The element is <a href=#in-a-document title="in a document">in a <code>Document</code></a> or was <a href=#in-a-document title="in a document">in a <code>Document</code></a> the last time the <a href=#event-loop>event loop</a>
   reached step 1.</li>

   <li>The element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>.</li>

   <li>The element has either a <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute set or a <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute set (or both).</li>

   <li>The element's <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute is either absent or its value
   is not the empty string.</li>

   <li>The element is not a descendant of a <a href=#media-element>media element</a>.</li>

   <li>The element is not a descendant of an <code><a href=#the-object-element>object</a></code> element that is not showing its
   <a href=#fallback-content>fallback content</a>.</li>

   <li>The element is <a href=#being-rendered>being rendered</a>, or was <a href=#being-rendered>being rendered</a> the last time
   the <a href=#event-loop>event loop</a> reached step 1.</li>

  </ul><p>Whenever an <code><a href=#the-embed-element>embed</a></code> element that was not <a href=#concept-embed-active title=concept-embed-active>potentially active</a> becomes <a href=#concept-embed-active title=concept-embed-active>potentially active</a>, and whenever a <a href=#concept-embed-active title=concept-embed-active>potentially active</a> <code><a href=#the-embed-element>embed</a></code> element that is
  remaining <a href=#concept-embed-active title=concept-embed-active>potentially active</a> and has its <code title=attr-embed-type><a href=#attr-embed-type>src</a></code> attribute set, changed, or removed or its <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute set, changed, or removed, the user agent must
  <a href=#queue-a-task>queue a task</a> using the <dfn id=embed-task-source>embed task source</dfn> to run <a href=#the-embed-element-setup-steps>the
  <code>embed</code> element setup steps</a>.</p>

  <p><dfn id=the-embed-element-setup-steps>The <code>embed</code> element setup steps</dfn> are as follows:</p>

  <ol><li><p>If another <a href=#concept-task title=concept-task>task</a> has since been queued to run <a href=#the-embed-element-setup-steps>the
   <code>embed</code> element setup steps</a> for this element, then abort these steps.</li>

   <li>

    <dl class=switch><dt>If the element has a <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute set</dt>

     <dd>

      <p>The user agent must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of the element's
      <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute, relative to the element. If that is
      successful, the user agent should <a href=#fetch>fetch</a><!--FETCH--> the resulting <a href=#absolute-url>absolute
      URL</a>, from the element's <a href=#browsing-context-scope-origin>browsing context scope origin</a> if it has one<!--
      potentially http-origin privacy sensitive -->. The <a href=#concept-task title=concept-task>task</a> that
      is <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking task source</a> once
      the resource has been <a href=#fetch title=fetch>fetched</a> must run the following steps:</p>
      <!-- Note that this doesn't happen when the base URL changes. -->

      <ol><li><p>If another <a href=#concept-task title=concept-task>task</a> has since been queued to run
       <a href=#the-embed-element-setup-steps>the <code>embed</code> element setup steps</a> for this element, then abort these
       steps.</li>

       <li>

        <p>Determine the <dfn id=concept-embed-type title=concept-embed-type>type of the content</dfn> being embedded, as
        follows (stopping at the first substep that determines the type):</p>

        <ol><li><p>If the element has a <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute, and that
         attribute's value is a type that a <a href=#plugin>plugin</a> supports, then the value of the
         <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute is the <a href=#concept-embed-type title=concept-embed-type>content's type</a>.</li>

         <li>

          <!-- if we get to this point we know we can successfully parsed the URL, since this algorithm is
          only used after fetching the resource in the steps above -->

          <p>Otherwise, if applying the <a href=#url-parser>URL parser</a> algorithm to the <a href=#url>URL</a> of
          the specified resource (after any redirects) results in a <a href=#parsed-url>parsed URL</a> whose
          <a href=#concept-url-path title=concept-url-path>path</a> component matches a pattern that a
          <a href=#plugin>plugin</a> supports, then the <a href=#concept-embed-type title=concept-embed-type>content's
          type</a> is the type that that plugin can handle.</p>

          <p class=example>For example, a plugin might say that it can handle resources with <a href=#concept-url-path title=concept-url-path>path</a> components that end with the four character string
          "<code title="">.swf</code>".</p>

          <!-- it's sad that we have to do extension sniffing. sigh. -->
          <!-- see also <object> which has a similar step -->

         </li>

         <li><p>Otherwise, if the specified resource has <a href=#content-type title=Content-Type>explicit
         Content-Type metadata</a>, then that is the <a href=#concept-embed-type title=concept-embed-type>content's
         type</a>.</li>

         <li><p>Otherwise, the content has no <a href=#concept-embed-type title=concept-embed-type>type</a> and there
         can be no appropriate <a href=#plugin>plugin</a> for it.</li>

         <!-- This algorithm is a monument to bad design. Go legacy! -->

        </ol></li>

       <li>

        <p>If the previous step determined that the <a href=#concept-embed-type title=concept-embed-type>content's
        type</a> is <code title="">image/svg+xml</code>, then run the following substeps:</p>

        <ol><li><p>If the <code><a href=#the-embed-element>embed</a></code> element is not associated with a <a href=#nested-browsing-context>nested browsing
         context</a>, associate the element with a newly created <a href=#nested-browsing-context>nested browsing
         context</a>, and, if the element has a <code title=attr-embed-name><a href=#attr-embed-name>name</a></code>
         attribute, set the <a href=#browsing-context-name>browsing context name</a> of the element's <a href=#nested-browsing-context>nested
         browsing context</a> to the value of this attribute.</p>
         <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2291 - dynamic changes to 'name' don't do anything -->

         <li><p><a href=#navigate>Navigate</a><!--DONAV embed--> the <a href=#nested-browsing-context>nested browsing context</a> to
         the fetched resource, with <a href=#replacement-enabled>replacement enabled</a>, and with the
         <code><a href=#the-embed-element>embed</a></code> element's document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
         browsing context</a>. (The <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute of the
         <code><a href=#the-embed-element>embed</a></code> element doesn't get updated if the browsing context gets further
         navigated to other locations.)</li>

         <li><p>The <code><a href=#the-embed-element>embed</a></code> element now <a href=#represents>represents</a> its associated
         <a href=#nested-browsing-context>nested browsing context</a>.</li>

        </ol></li>

       <li>

        <p>Otherwise, find and instantiate an appropriate <a href=#plugin>plugin</a> based on the <a href=#concept-embed-type title=concept-embed-type>content's type</a>, and hand that <a href=#plugin>plugin</a> the
        content of the resource, replacing any previously instantiated plugin for the element. The
        <code><a href=#the-embed-element>embed</a></code> element now represents this <a href=#plugin>plugin</a> instance.</p>

       </li>

      </ol><p>Whether the resource is fetched successfully or not (e.g. whether the response code was a
      2xx code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>) must be ignored
      when determining the <a href=#concept-embed-type title=concept-embed-type>content's type</a> and when handing
      the resource to the plugin.</p>

      <p class=note>This allows servers to return data for plugins even with error responses (e.g.
      HTTP 500 Internal Server Error codes can still contain plugin data).</p>

      <p>Fetching the resource must <a href=#delay-the-load-event>delay the load event</a> of the element's document.</p>
      <!-- if we add load/error events, then replace the previous paragraph with the text one: -->
      <!-- similar text in various places -->
      <!--<p>Fetching the resource must <span>delay the load event</span> of the element's document
      until the final <span title="concept-task">task</span> that is <span title="queue a
      task">queued</span> by the <span>networking task source</span> once the resource has been
      <span title="fetch">fetched</span> has been run.</p>-->

     </dd>

     <dt>If the element has no <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute set</dt>

     <dd>

      <p>The user agent should find and instantiate an appropriate <a href=#plugin>plugin</a> based on the
      value of the <code title=attr-embed-type><a href=#attr-embed-type>type</a></code> attribute. The <code><a href=#the-embed-element>embed</a></code>
      element now represents this <a href=#plugin>plugin</a> instance.</p>

     </dd>

    </dl></li>

  </ol><p>The <code><a href=#the-embed-element>embed</a></code> element has no <a href=#fallback-content>fallback content</a>. If the user agent can't
  find a suitable plugin when attempting to find and instantiate one for the algorithm above, then
  the user agent must use a default plugin. This default could be as simple as saying "Unsupported
  Format".</p>

  <p>Whenever an <code><a href=#the-embed-element>embed</a></code> element that was <a href=#concept-embed-active title=concept-embed-active>potentially
  active</a> stops being <a href=#concept-embed-active title=concept-embed-active>potentially active</a>, any
  <a href=#plugin>plugin</a> that had been instantiated for that element must be unloaded.</p>

  <p id=sandboxPluginEmbed>When a <a href=#plugin>plugin</a> is to be instantiated but it cannot be <a href=#concept-plugin-secure title=concept-plugin-secure>secured</a> and the <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context
  flag</a> is set on the <code><a href=#the-embed-element>embed</a></code> element's <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active
  sandboxing flag set</a>, then the user agent must not instantiate the <a href=#plugin>plugin</a>, and
  must instead render the <code><a href=#the-embed-element>embed</a></code> element in a manner that conveys that the
  <a href=#plugin>plugin</a> was disabled. The user agent may offer the user the option to override the
  sandbox and instantiate the <a href=#plugin>plugin</a> anyway; if the user invokes such an option, the
  user agent must act as if the conditions above did not apply for the purposes of this element.</p>

  <p class=warning>Plugins that cannot be <a href=#concept-plugin-secure title=concept-plugin-secure>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>

  </div>

  <p>Any namespace-less attribute other than <code title=attr-embed-name><a href=#attr-embed-name>name</a></code>, <code title=attr-embed-align><a href=#attr-embed-align>align</a></code>, <code title=attr-embed-hspace><a href=#attr-embed-hspace>hspace</a></code>, and <code title=attr-embed-vspace><a href=#attr-embed-vspace>vspace</a></code> <!-- when editing, see also note below --> may be
  specified on the <code><a href=#the-embed-element>embed</a></code> element, so long as its name is <a href=#xml-compatible>XML-compatible</a>
  and contains no <a href=#uppercase-ascii-letters>uppercase ASCII letters</a>. These attributes are then passed as
  parameters to the <a href=#plugin>plugin</a>.</p>

  <p class=note>All attributes in <a href=#html-documents>HTML documents</a> get lowercased automatically, so the
  restriction on uppercase letters doesn't affect such documents.</p>

  <p class=note>The four exceptions are to exclude legacy attributes that have side-effects beyond
  just sending parameters to the <a href=#plugin>plugin</a>.</p>

  <div class=impl>

  <p>The user agent should pass the names and values of all the attributes of the <code><a href=#the-embed-element>embed</a></code>
  element that have no namespace to the <a href=#plugin>plugin</a> used, when one is instantiated.</p>

  <p>The <code><a href=#htmlembedelement>HTMLEmbedElement</a></code> object representing the element must expose the scriptable
  interface of the <a href=#plugin>plugin</a> instantiated for the <code><a href=#the-embed-element>embed</a></code> element, if any. At a
  minimum, this interface must implement the <dfn id=dom-embed-caller title=dom-embed-caller>legacy caller
  operation</dfn>. (It is suggested that the default behavior of this legacy caller operation, e.g.
  the behavior of the default plugin's legacy caller operation, be to throw a
  <code><a href=#notsupportederror>NotSupportedError</a></code> exception.)</p>

  </div>

  <p>The <code><a href=#the-embed-element>embed</a></code> element supports <a href=#dimension-attributes>dimension attributes</a>.</p>

  <div class=impl>

  <p>The IDL attributes <dfn id=dom-embed-src title=dom-embed-src><code>src</code></dfn> and <dfn id=dom-embed-type title=dom-embed-type><code>type</code></dfn> each must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  </div>

  <div class=example>

   <p>Here's a way to embed a resource that requires a proprietary plugin, like Flash:</p>

   <pre>&lt;embed src="catgame.swf"&gt;</pre>

   <p>If the user does not have the plugin (for example if the plugin vendor doesn't support the
   user's platform), then the user will be unable to use the resource.</p>

   <p>To pass the plugin a parameter "quality" with the value "high", an attribute can be
   specified:</p>

   <pre>&lt;embed src="catgame.swf" quality="high"&gt;</pre>

   <p>This would be equivalent to the following, when using an <code><a href=#the-object-element>object</a></code> element
   instead:</p>

   <pre>&lt;object data="catgame.swf"&gt;
 &lt;param name="quality" value="high"&gt;
&lt;/object&gt;</pre>

  </div>




  <h4 id=the-object-element><span class=secno>4.8.4 </span>The <dfn><code>object</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd>If the element has a <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd> <!-- also when showing a plugin or a nested browsing context, but checking that statically is hard...) -->
   <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-submit title=category-submit>submittable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-param-element>param</a></code> elements, then, <a href=#transparent>transparent</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-object-data><a href=#attr-object-data>data</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-object-type><a href=#attr-object-type>type</a></code> &mdash; Type of embedded resource</dd>
   <dd><code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code> &mdash; Whether the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute and the <a href=#content-type>Content-Type</a> value need to match for the resource to be used</dd>
   <dd><code title=attr-object-name><a href=#attr-object-name>name</a></code> &mdash; Name of <a href=#nested-browsing-context>nested browsing context</a></dd>
   <dd><code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> &mdash; Name of <a href=#image-map>image map</a> to use</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code> &mdash; Vertical dimension</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlobjectelement>HTMLObjectElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-object-data title=dom-object-data>data</a>;
           attribute DOMString <a href=#dom-object-type title=dom-object-type>type</a>;
           attribute boolean <a href=#dom-object-typemustmatch title=dom-object-typeMustMatch>typeMustMatch</a>;
           attribute DOMString <a href=#dom-object-name title=dom-object-name>name</a>;
           attribute DOMString <a href=#dom-object-usemap title=dom-object-useMap>useMap</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-dim-width title=dom-dim-width>width</a>;
           attribute DOMString <a href=#dom-dim-height title=dom-dim-height>height</a>;
  readonly attribute Document? <a href=#dom-object-contentdocument title=dom-object-contentDocument>contentDocument</a>;
  readonly attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-object-contentwindow title=dom-object-contentWindow>contentWindow</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  <a href=#dom-object-caller title=dom-object-caller>legacycaller</a> any (any... arguments);

  // <a href="#HTMLObjectElement-partial">also has obsolete members</a>
};</pre>
    <div class=impl>
    <p>Depending on the type of content instantiated by the
    <code><a href=#the-object-element>object</a></code> element, the node also supports other
    interfaces.</p>
    </div>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><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>nested browsing
  context</a>, or as an external resource to be processed by a <a href=#plugin>plugin</a>.</p>

  <p>The <dfn id=attr-object-data title=attr-object-data><code>data</code></dfn> attribute, if present, specifies the
  address of the resource. If present, the attribute must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially
  surrounded by spaces</a>.</p>

  <p class=warning>Authors who reference resources from other <a href=#origin title=origin>origins</a>
  that they do not trust are urged to use the <code title=attr-object-typemustmatch><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> <!-- for example, if the user doesn't have flash installed but
  does have java installed, and the remote site unexpectedly returns java instead of flash, then
  java will run, and it will ignore the allowScriptAccess thing -->

  <p>The <dfn id=attr-object-type title=attr-object-type><code>type</code></dfn> attribute, if present, specifies the
  type of the resource. If present, the attribute must be a <a href=#valid-mime-type>valid MIME type</a>.</p>

  <p>At least one of either the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute or the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute must be present.</p>

  <p>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an <code><a href=#the-object-element>object</a></code>
  element, then the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute must also be specified.</p>

  <p>The <dfn id=attr-object-typemustmatch title=attr-object-typemustmatch><code>typemustmatch</code></dfn> attribute is a
  <a href=#boolean-attribute>boolean attribute</a> whose presence indicates that the resource specified by the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute is only to be used if the value of the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute and the <a href=#content-type>Content-Type</a> of the
  aforementioned resource match.</p>

  <p>The <code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute must not be
  specified unless both the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute and the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute are present.</p>

  <p>The <dfn id=attr-object-name title=attr-object-name><code>name</code></dfn> attribute, if present, must be a
  <a href=#valid-browsing-context-name>valid browsing context name</a>. The given value is used to name the <a href=#nested-browsing-context>nested
  browsing context</a>, if applicable.</p>

  <div class=impl>

  <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>stack of open elements</a> of an <a href=#html-parser>HTML
   parser</a> or <a href=#xml-parser>XML parser</a>,

   <li>the element is not on the <a href=#stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser>HTML parser</a>
   or <a href=#xml-parser>XML parser</a>, and it is either <a href=#insert-an-element-into-a-document title="insert an element into a
   document">inserted into a document</a> or <a href=#remove-an-element-from-a-document title="remove an element from a
   document">removed from a document</a>,

   <li>the element's <code><a href=#document>Document</a></code> changes whether it is <a href=#fully-active>fully active</a>,

   <li>one of the element's ancestor <code><a href=#the-object-element>object</a></code> elements changes to or from showing its
   <a href=#fallback-content>fallback content</a>,

   <li>the element's <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute is set, changed, or removed,

   <li>the element's <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute is not present, and
   its <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute is set, changed, or removed,

   <li>neither the element's <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute nor its
   <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute are present, and its <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute is set, changed, or removed,

   <li>the element changes from <a href=#being-rendered>being rendered</a> to not being rendered, or vice versa,

  </ul><!-- Changing the base URL doesn't trigger this. --><p>...the user agent must <a href=#queue-a-task>queue a task</a> to run the following steps to (re)determine
  what the <code><a href=#the-object-element>object</a></code> element represents. The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#dom-manipulation-task-source>DOM manipulation task source</a>. This <a href=#concept-task title=concept-task>task</a> being <a href=#queue-a-task title="queue a task">queued</a> or actively
  running must <a href=#delay-the-load-event>delay the load event</a> of the element's document. <!--As described in the
  algorithm, once the algorithm starts fetching a resource, the fetch is what starts delaying the
  load event. But to tide us over from when the parser finds the <object> element and the fetching
  begins, we have to block the load event like this, lest the parse end before this task gets
  run.--></p>

  <ol><li>

    <p>If the user has indicated a preference that this <code><a href=#the-object-element>object</a></code> element's <a href=#fallback-content>fallback
    content</a> be shown instead of the element's usual behavior, then jump to the step below labeled <i>fallback</i>.</p>

    <p class=note>For example, a user could ask for the element's <a href=#fallback-content>fallback content</a> to
    be shown because that content uses a format that the user finds more accessible.</p>

   </li>

   <li>

    <p>If the element has an ancestor <a href=#media-element>media element</a>, or has an ancestor
    <code><a href=#the-object-element>object</a></code> element that is <em>not</em> showing its <a href=#fallback-content>fallback content</a>, or
    if the element is not <a href=#in-a-document title="in a document">in a <code>Document</code></a> with a
    <a href=#browsing-context>browsing context</a>, or if the element's <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully
    active</a>, or if the element is still in the <a href=#stack-of-open-elements>stack of open elements</a> of an
    <a href=#html-parser>HTML parser</a> or <a href=#xml-parser>XML parser</a>, or if the element is not <a href=#being-rendered>being
    rendered</a>, then jump to the step below labeled <i>fallback</i>.</p>

   </li>

   <li>

    <!-- what if it's not in the document? if that should prevent plugin instantiation, then here
    just skip to the last step -->

    <p>If the <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute is present, and has a value
    that isn't the empty string, then: if the user agent can find a <a href=#plugin>plugin</a> suitable
    according to the value of the <code title=attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute, and
    either <a href=#sandboxPluginObject>plugins aren't being sandboxed</a> or that
    <a href=#plugin>plugin</a> can be <a href=#concept-plugin-secure title=concept-plugin-secure>secured</a>, then that
    <a href=#plugin>plugin</a> <a href=#object-plugin>should be used</a>, and the value of the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute, if any, should be passed to the
    <a href=#plugin>plugin</a>. If no suitable <a href=#plugin>plugin</a> can be found, or if the
    <a href=#plugin>plugin</a> reports an error, jump to the step below labeled <i>fallback</i>.</p>

    <!--
     case insensitive:
      is "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" -> application/x-shockwave-flash
      is "clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa" -> audio/x-pn-realaudio-plugin
      is "clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" -> video/quicktime
      is "clsid:166b1bca-3f9c-11cf-8075-444553540000" -> application/x-director
      is "clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" -> application/x-mplayer2
      starts with "java:"                             -> application/x-java-vm
      starts with "clsid:"                            -> application/x-oleobject
    -->

   </li>

   <!-- (v2?)
   we may have to define magic fallback to <param> if it turns out to
   be needed in testing:
   <hyatt> apparently your url can come from <param>
   <hyatt> not just the data attribute
   <hyatt> our code looks for params with "src", "movie", "code" and "url"
   <hyatt> and also tries to find the type on a param
   <Hixie> oh that's you trying to have hacky activex support
   <Hixie> opera does that too
   <hyatt> yeah we support activex versions of plugins that are common
   <hyatt> like flash and quicktime and realaudio
   <Hixie> that would be a step 1b. if no data attribute, then look for a <param> to get you a URL instead.
   <Hixie> and if you find one, carry on as if that was your data="".
   -->

   <li><p>If the <code title=attr-object-data><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 title=attr-object-type><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>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>

     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> specified by the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute, relative to the element.</li>

     <li><p>If that failed, <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the element, then jump to the step below labeled
     <i>fallback</i>.</li>

     <li>

      <p><a href=#fetch>Fetch</a><!--FETCH--> the resulting <a href=#absolute-url>absolute URL</a>, from the element's
      <a href=#browsing-context-scope-origin>browsing context scope origin</a> if it has one<!-- potentially http-origin privacy
      sensitive -->.</p>

      <!-- similar text in various places -->
      <p>Fetching the resource must <a href=#delay-the-load-event>delay the load event</a> of the element's document
      until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
      task">queued</a> by the <a href=#networking-task-source>networking task source</a> once the resource has been
      <a href=#fetch title=fetch>fetched</a> (defined next) has been run.</p>

      <p>For the purposes of the <a href=#application-cache>application cache</a> networking model, this
      <a href=#fetch>fetch</a> operation is not for a <a href=#child-browsing-context>child browsing context</a> (though it might
      end up being used for one after all, as defined below).</p>

     </li>

     <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 title=concept-task>task</a> that is
     <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>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>

     <li><p>If the load failed (e.g. there was an HTTP 404 error, there was a DNS error), <a href=#fire-a-simple-event>fire
     a simple event</a> named <code title=event-error>error</code> at the element, then jump to
     the step below labeled <i>fallback</i>.</li>

     <li id=object-type-detection>

      <p>Determine the <var title="">resource type</var>, as follows:</p>

<!-- Hopefully this step is exactly equivalent to the following:

 START
   |
   V
 Is there a Content-Type and is the UA going to obey it blindly?
   |                   |
   | YES               | NO
   |                   V                                                          YES
   |                 Is there a type="" attribute whose value is a plugin type? ============================================-.
   |                   |                                                                                                     |
   |                   | NO                                                                                                  |
   |                   V                        NO                                       YES                                 |
   |                 Is there a Content type? ========-> Is there a type="" attribute? ==========> Let TYPE be type=""       |
   |                   |                                                           |               attribute value           |
   |                   | YES                                                       | NO                    |                 |
   V            NO     V                                                           |                       V                 |
   +-<============== Is it text/plain or application/octet-stream?                 `==> Let TYPE be  =====>+                 |
   |                   |                                     |                          Sniffed type       |                 |
   |                   | text/plain                          | octet-stream                                V                 |
   |                   V                              YES    V                                          Is TYPE              |
   |                 Does the page sniff as binary? ======> Is there a type="" attribute?       application/octet-stream?    |
   |                   |                                     |              |                      |                |        |
   |                   | NO                                  | YES          | NO                   | YES            | NO     |
   |                   |                                     |       YES    V                      V                |        |
   |                   |                  application/octet-stream? =====> Extension that is plugin type?           |        |
   |                   |                                     |                          |          |                |        |
   |                   |                                     | NO                       | NO       | YES            |        |
   |                   |                                     V                          |          |                |        |
   |                   |                           Type attribute is XML or     YES     V          |                |        |
   |                   |                           doesn't start with image/* ======> FALLBACK     |                |        |
   |                   |                           and is not a plugin type?                       |                |        |
   |                   |                                          |                                |                |        |
   |                   |                                          | NO                             |                |        V
   V                   V                                          V                                V                V       Use
  Use                 Use                                        Use it (will be                  Use              Use      type=""
  Content-Type        text/plain                                 bitmap or plugin)                extension        TYPE     attribute
   |                   |                                          |                                |                |        |
   |                   V                                          V                                V                V        |
   `================->-+========================================>-+==============>-+-<============-+-<==============+-<======'
                                                                                   |
                                                                                   V
                                                                  Continue following rules in the spec, which might
                                                                  result in a plugin, a browsing context, an image,
                                                                  or using fallback, depending on the UA and the type.


   "Extension that is plugin type?" means "Is there an extension that matches one that a plugin supports?".
   Plugins are not allowed to register text/plain or application/octet-stream.

-->

      <ol><li>

        <p>Let the <var title="">resource type</var> be unknown.</p>

       </li>

       <li>

        <p>If the <code><a href=#the-object-element>object</a></code> element has a <code title=attr-object-type><a href=#attr-object-type>type</a></code>
        attribute and a <code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute, and
        the resource has <a href=#content-type title=Content-Type>associated Content-Type metadata</a>, and the
        type specified in <a href=#content-type title=Content-Type>the resource's Content-Type metadata</a> is
        an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the value of the element's <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute, then let <var title="">resource type</var>
        be that type and jump to the step below labeled <i>handler</i>.</p>

        <!-- do we need to <span>strip leading and trailing whitespace</span> from anything here?
        collapse sequences of spaces? drop parameters? -->

       </li>

       <li>

        <p>If the <code><a href=#the-object-element>object</a></code> element has a <code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute, jump to the step below
        labeled <i>handler</i>.</p>

       </li>

       <li>

        <!-- by request: http://www.w3.org/Bugs/Public/show_bug.cgi?id=8479 -->

        <p>If the user agent is configured to strictly obey Content-Type headers for this resource,
        and the resource has <a href=#content-type title=Content-Type>associated Content-Type metadata</a>,
        then let the <var title="">resource type</var> be the type specified in <a href=#content-type title=Content-Type>the resource's Content-Type metadata</a>, and jump to the step below
        labeled <i>handler</i>.</p>

        <p class=warning>This can introduce a vulnerability, wherein a site is trying to embed a
        resource that uses a particular plugin, but the remote site overrides that and instead
        furnishes the user agent with a resource that triggers a different plugin with different
        security characteristics. <!-- e.g. the example given above, where the site is expecting
        Flash with allowScriptAccess=never, and instead gets back Java with its unrestricted DOM
        access --></p>

       </li>

       <li>

        <p>If there is a <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute present on the
        <code><a href=#the-object-element>object</a></code> element, and that attribute's value is not a type that the user agent
        supports, but it <em>is</em> a type that a <a href=#plugin>plugin</a> supports, then let the <var title="">resource type</var> be the type specified in that <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute, and jump to the step below labeled
        <i>handler</i>.</p>

       </li>

       <li>

        <p>Run the appropriate set of steps from the following
        list:</p>

        <dl class=switch><dt>If the resource has <a href=#content-type title=Content-Type>associated Content-Type
         metadata</a></dt>

         <dd>

          <ol><li>

            <p>Let <var title="">binary</var> be false.</p>

           </li>

           <li>

            <p>If the type specified in <a href=#content-type title=Content-Type>the resource's Content-Type
            metadata</a> is "<code>text/plain</code>", and the result of applying the <a href=#content-type-sniffing:-text-or-binary title="Content-Type sniffing: text or binary">rules for distinguishing if a resource is
            text or binary</a> to the resource is that the resource is not
            <code>text/plain</code>, then set <var title="">binary</var> to true.</p>

           </li>

           <li>

            <p>If the type specified in <a href=#content-type title=Content-Type>the resource's Content-Type
            metadata</a> is "<code>application/octet-stream</code>", then set <var title="">binary</var> to true.</p>

           </li>

           <li>

            <p>If <var title="">binary</var> is false, then let the <var title="">resource
            type</var> be the type specified in <a href=#content-type title=Content-Type>the resource's
            Content-Type metadata</a>, and jump to the step below labeled <i>handler</i>.</p>

           </li>

           <li>

            <p>If there is a <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute present on the
            <code><a href=#the-object-element>object</a></code> element, and its value is not <code>application/octet-stream</code>,
            then run the following steps:</p>

            <ol><li>

              <p>If the attribute's value is a type that a <a href=#plugin>plugin</a> supports, or the
              attribute's value is a type that starts with "<code>image/</code>" that is not also an
              <a href=#xml-mime-type>XML MIME type</a>, then let the <var title="">resource type</var> be the type
              specified in that <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute.</p>

             </li>

             <li>

              <p>Jump to the step below labeled <i>handler</i>.</p>

             </li>

            </ol></li>

          </ol></dd>

         <dt>Otherwise, if the resource does not have <a href=#content-type title=Content-Type>associated
         Content-Type metadata</a></dt>

         <dd>

          <ol><li>

            <p>If there is a <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute present on the
            <code><a href=#the-object-element>object</a></code> element, then let the <var title="">tentative type</var> be the type
            specified in that <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute.</p>

            <p>Otherwise, let <var title="">tentative type</var> be the <a href=#content-type-sniffing-0 title="content-type
            sniffing">sniffed type of the resource</a>.</p>

           </li>

           <li>

            <p>If <var title="">tentative type</var> is <em>not</em>
            <code>application/octet-stream</code>, then let <var title="">resource type</var> be
            <var title="">tentative type</var> and jump to the step below labeled
            <i>handler</i>.</p>

           </li>

          </ol></dd>

        </dl></li>

       <li>

        <!-- if we get to this point we know we can successfully parsed the URL, since this
        algorithm is only used after fetching the resource in the steps above -->

        <p>If applying the <a href=#url-parser>URL parser</a> algorithm to the <a href=#url>URL</a> of the
        specified resource (after any redirects) results in a <a href=#parsed-url>parsed URL</a> whose <a href=#concept-url-path title=concept-url-path>path</a> component matches a pattern that a <a href=#plugin>plugin</a>
        supports, then let <var title="">resource type</var> be the type that that plugin can
        handle.</p>

        <p class=example>For example, a plugin might say that it can handle resources with <a href=#concept-url-path title=concept-url-path>path</a> components that end with the four character string
        "<code title="">.swf</code>".</p>

        <!-- it's sad that we have to do extension sniffing. sigh. -->
        <!-- see also <embed> which has a similar step -->

       </li>

      </ol><p class=note>It is possible for this step to finish, or for one of the substeps above to
      jump straight to the next step, with <var title="">resource type</var> still being unknown. In
      both cases, the next step will trigger fallback.</p>

     </li>

     <li><p><i>Handler</i>: Handle the content as given by the first of the following cases that
     matches:</p>

      <dl class=switch><dt>If the <var title="">resource type</var> is not a type that the user agent supports, but
       it <em>is</em> a type that a <a href=#plugin>plugin</a> supports</dt>

       <dd>

        <p>If <a href=#sandboxPluginObject>plugins are being sandboxed</a> and the plugin that
        supports <var title="">resource type</var> cannot be <a href=#concept-plugin-secure title=concept-plugin-secure>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 title="">resource type</var></a> and pass the content of the resource to that
        <a href=#plugin>plugin</a>. If the <a href=#plugin>plugin</a> reports an error, then jump to the step
        below labeled <i>fallback</i>.</p>

       </dd>


       <dt>If the <var title="">resource type</var> is an <a href=#xml-mime-type>XML MIME type</a>, or
       <!-- (redundant with the next one) if the <var title="">resource type</var> is HTML, or -->
       if the <var title="">resource type</var> does not start with "<code>image/</code>"</dt>

       <dd>

        <p>The <code><a href=#the-object-element>object</a></code> element must be associated with a newly created <a href=#nested-browsing-context>nested
        browsing context</a>, if it does not already have one.</p>

        <p>If the <a href=#url>URL</a> of the given resource is not <code><a href=#about:blank>about:blank</a></code>, the
        element's <a href=#nested-browsing-context>nested browsing context</a> must then be <a href=#navigate title=navigate>navigated</a><!--DONAV object--> to that resource, with
        <a href=#replacement-enabled>replacement enabled</a>, and with the <code><a href=#the-object-element>object</a></code> element's document's
        <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source browsing context</a>. (The <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute of the <code><a href=#the-object-element>object</a></code> element doesn't
        get updated if the browsing context gets further navigated to other locations.)</p>

        <p>If the <a href=#url>URL</a> of the given resource <em>is</em> <code><a href=#about:blank>about:blank</a></code>, then,
        instead, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
        named <code title=event-load>load</code> at the <code><a href=#the-object-element>object</a></code> element. <span class=note>No <code title=event-load>load</code> event is fired at the
        <code><a href=#about:blank>about:blank</a></code> document itself.</span></p>

        <p>The <code><a href=#the-object-element>object</a></code> element <a href=#represents>represents</a> the <a href=#nested-browsing-context>nested browsing
        context</a>.</p>

        <p>If the <code title=attr-object-name><a href=#attr-object-name>name</a></code> attribute is present, the
        <a href=#browsing-context-name>browsing context name</a> must be set to the value of this attribute; otherwise,
        the <a href=#browsing-context-name>browsing context name</a> must be set to the empty string.</p>

        <p class=note>In certain situations, e.g. if the resource was <a href=#fetch title=fetch>fetched</a> from an <a href=#application-cache>application cache</a> but it is an HTML file
        with a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute that points to a different
        <a href=#concept-appcache-manifest title=concept-appcache-manifest>application cache manifest</a>, the <a href=#navigate title=navigate>navigation</a> of the <a href=#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>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>nested browsing context</a>: only the <a href=#navigate>navigate</a> algorithm
        is restarted, not this <code><a href=#the-object-element>object</a></code> algorithm.</p>

        <!-- note that malformed XML files don't cause fallback -->

       </dd>


       <dt>If the <var title="">resource type</var> starts with "<code>image/</code>", and support
       for images has not been disabled</dt>

       <dd>

        <p>Apply the <a href=#content-type-sniffing:-image title="content-type sniffing: image">image sniffing</a> rules to
        determine the type of the image.</p>

        <p>The <code><a href=#the-object-element>object</a></code> element <a href=#represents>represents</a> the specified image. The image is
        not a <a href=#nested-browsing-context>nested browsing context</a>.</p>

        <p>If the image cannot be rendered, e.g. because it is malformed or in an unsupported
        format, jump to the step below labeled <i>fallback</i>.</p>

       </dd>


       <dt>Otherwise</dt>

       <dd>

        <p>The given <var title="">resource type</var> is not supported. Jump to the step below
        labeled <i>fallback</i>.</p>

        <p class=note>If the previous step ended with the <var title="">resource type</var> being
        unknown, this is the case that is triggered.</p>

       </dd>

      </dl></li>

     <li><p>The element's contents are not part of what the <code><a href=#the-object-element>object</a></code> element
     represents.</p>

     <li>

      <p>Once the resource is completely loaded, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
      event</a> named <code title=event-load>load</code> at the element.</p>

      <p>The <a href=#task-source>task source</a> for this task<!--tasks mentioned in this section--> is the
      <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>

     </li>

    </ol></li>

   <li><p>If the <code title=attr-object-data><a href=#attr-object-data>data</a></code> attribute is absent but the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute is present, and the user agent can find a
   <a href=#plugin>plugin</a> suitable according to the value of the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute, and either <a href=#sandboxPluginObject>plugins
   aren't being sandboxed</a> or the <a href=#plugin>plugin</a> can be <a href=#concept-plugin-secure title=concept-plugin-secure>secured</a>, then that <a href=#plugin>plugin</a> <a href=#object-plugin>should be used</a>. If these conditions cannot be met, or if the
   <a href=#plugin>plugin</a> reports an error, jump to the step below labeled <i>fallback</i>.</li>

   <li><p><i>Fallback</i>: The <code><a href=#the-object-element>object</a></code> element <a href=#represents>represents</a> the element's
   children, ignoring any leading <code><a href=#the-param-element>param</a></code> element children. This is the element's
   <a href=#fallback-content>fallback content</a>. If the element has an instantiated <a href=#plugin>plugin</a>, then
   unload it.</li>

  </ol><p id=object-plugin>When the algorithm above instantiates a <a href=#plugin>plugin</a>, the user agent
  should pass to the <a href=#plugin>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 title=concept-param-parameter>parameters</a> given by
  <code><a href=#the-param-element>param</a></code> elements that are children of the <code><a href=#the-object-element>object</a></code> element, in <a href=#tree-order>tree
  order</a>. If the <a href=#plugin>plugin</a> supports a scriptable interface, the
  <code><a href=#htmlobjectelement>HTMLObjectElement</a></code> object representing the element should expose that interface. The
  <code><a href=#the-object-element>object</a></code> element <a href=#represents>represents</a> the <a href=#plugin>plugin</a>. The
  <a href=#plugin>plugin</a> is not a nested <a href=#browsing-context>browsing context</a>.</p>

  <p id=sandboxPluginObject>Plugins are considered sandboxed for the purpose of an
  <code><a href=#the-object-element>object</a></code> element if the <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> is set on
  the <code><a href=#the-object-element>object</a></code> element's <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag
  set</a>.</p>

  <p>Due to the algorithm above, the contents of <code><a href=#the-object-element>object</a></code> elements act as <a href=#fallback-content>fallback
  content</a>, used only when referenced resources can't be shown (e.g. because it returned a 404
  error). This allows multiple <code><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>Whenever the <code title=attr-object-name><a href=#attr-object-name>name</a></code> attribute is set, if the
  <code><a href=#the-object-element>object</a></code> element has a nested <a href=#browsing-context>browsing context</a>, its <a href=#browsing-context-name title="browsing
  context name">name</a> must be changed to the new value. If the attribute is removed, if the
  <code><a href=#the-object-element>object</a></code> element has a <a href=#browsing-context>browsing context</a>, the <a href=#browsing-context-name>browsing context
  name</a> must be set to the empty string.</p>

  </div>

  <p>The <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute, if present while the
  <code><a href=#the-object-element>object</a></code> element represents an image, can indicate that the object has an associated
  <a href=#image-map>image map</a>. <span class=impl>The attribute must be ignored if the
  <code><a href=#the-object-element>object</a></code> element doesn't represent an image.</span></p>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
  <code><a href=#the-object-element>object</a></code> element with its <a href=#form-owner>form owner</a>.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: <code><a href=#the-object-element>object</a></code> elements are always <a href=#barred-from-constraint-validation>barred
  from constraint validation</a>.</p>

  </div>

  <p>The <code><a href=#the-object-element>object</a></code> element supports <a href=#dimension-attributes>dimension attributes</a>.</p>

  <div class=impl>

  <p>The IDL attributes <dfn id=dom-object-data title=dom-object-data><code>data</code></dfn>, <dfn id=dom-object-type title=dom-object-type><code>type</code></dfn> and <dfn id=dom-object-name title=dom-object-name><code>name</code></dfn> each must <a href=#reflect>reflect</a> the respective
  content attributes of the same name. The <dfn id=dom-object-typemustmatch title=dom-object-typeMustMatch><code>typeMustMatch</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code> content
  attribute. The <dfn id=dom-object-usemap title=dom-object-useMap><code>useMap</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> content attribute.</p>

  <p>The <dfn id=dom-object-contentdocument title=dom-object-contentDocument><code>contentDocument</code></dfn> IDL attribute
  must return the <code><a href=#document>Document</a></code> object of the <a href=#active-document>active document</a> of the
  <code><a href=#the-object-element>object</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>, if it has one; otherwise, it
  must return null.</p>

  <p>The <dfn id=dom-object-contentwindow title=dom-object-contentWindow><code>contentWindow</code></dfn> IDL attribute must
  return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <code><a href=#the-object-element>object</a></code> element's <a href=#nested-browsing-context>nested
  browsing context</a>, if it has one; otherwise, it must return null.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
  <a href=#the-constraint-validation-api>constraint validation API</a>. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute
  is part of the element's forms API.</p>

  <p>All <code><a href=#the-object-element>object</a></code> elements have a <dfn id=dom-object-caller title=dom-object-caller>legacy caller
  operation</dfn>. If the <code><a href=#the-object-element>object</a></code> element has an instantiated <a href=#plugin>plugin</a> that
  supports a scriptable interface that defines a legacy caller operation, then that must be the
  behavior of the object's legacy caller operation. Otherwise, the object's legacy caller operation
  must be to throw a <code><a href=#notsupportederror>NotSupportedError</a></code> exception.</p>

  </div>

  <div class=example>

   <p>In the following example, a Java applet is embedded in a page using the <code><a href=#the-object-element>object</a></code>
   element. (Generally speaking, it is better to avoid using applets like these and instead use
   native JavaScript and HTML to provide the functionality, since that way the application will work
   on all Web browsers without requiring a third-party plugin. Many devices, especially embedded
   devices, do not support third-party technologies like Java.)</p>

   <pre>&lt;figure&gt;
 &lt;object type="application/x-java-applet"&gt;
  &lt;param name="code" value="MyJavaClass"&gt;
  &lt;p&gt;You do not have Java available, or it is disabled.&lt;/p&gt;
 &lt;/object&gt;
 &lt;figcaption&gt;My Java Clock&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>In this example, an HTML page is embedded in another using the <code><a href=#the-object-element>object</a></code>
   element.</p>

   <pre>&lt;figure&gt;
 &lt;object data="clock.html"&gt;&lt;/object&gt;
 &lt;figcaption&gt;My HTML Clock&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>

  <div class=example>

   <p>The following example shows how a plugin can be used in HTML (in this case the Flash plugin,
   to show a video file). Fallback is provided for users who do not have Flash enabled, in this case
   using the <code><a href=#the-video-element>video</a></code> element to show the video for those using user agents that support
   <code><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><a href=#the-video-element>video</a></code>-capable browser.</p>

   <pre>&lt;p&gt;Look at my video:
 &lt;object type="application/x-shockwave-flash"&gt;
  &lt;param name=movie value="http://video.example.com/library/watch.swf"&gt;
  &lt;param name=allowfullscreen value=true&gt;
  &lt;param name=flashvars value="http://video.example.com/vids/315981"&gt;
  &lt;video controls src="http://video.example.com/vids/315981"&gt;
   &lt;a href="http://video.example.com/vids/315981"&gt;View video&lt;/a&gt;.
  &lt;/video&gt;
 &lt;/object&gt;
&lt;/p&gt;</pre>

  </div>



  <h4 id=the-param-element><span class=secno>4.8.5 </span>The <dfn><code>param</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of an <code><a href=#the-object-element>object</a></code> element, before any <a href=#flow-content>flow content</a>.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-param-name><a href=#attr-param-name>name</a></code> &mdash; Name of parameter</dd>
   <dd><code title=attr-param-value><a href=#attr-param-value>value</a></code> &mdash; Value of parameter</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlparamelement>HTMLParamElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-param-name title=dom-param-name>name</a>;
           attribute DOMString <a href=#dom-param-value title=dom-param-value>value</a>;

  // <a href="#HTMLParamElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-param-element>param</a></code> element defines parameters for plugins invoked by <code><a href=#the-object-element>object</a></code>
  elements. It does not <a href=#represents title=represents>represent</a> anything on its own.</p>

  <p>The <dfn id=attr-param-name title=attr-param-name><code>name</code></dfn> attribute gives the name of the
  parameter.</p>

  <p>The <dfn id=attr-param-value title=attr-param-value><code>value</code></dfn> attribute gives the value of the
  parameter.</p>

  <p>Both attributes must be present. They may have any value.</p>

  <div class=impl>

  <p>If both attributes are present, and if the parent element of the <code><a href=#the-param-element>param</a></code> is an
  <code><a href=#the-object-element>object</a></code> element, then the element defines a <dfn id=concept-param-parameter title=concept-param-parameter>parameter</dfn> with the given name-value pair.</p>

  <p>If either the name or value of a <a href=#concept-param-parameter title=concept-param-parameter>parameter</a> defined
  by a <code><a href=#the-param-element>param</a></code> element that is the child of an <code><a href=#the-object-element>object</a></code> element that
  <a href=#represents>represents</a> an instantiated <a href=#plugin>plugin</a> changes, and if that
  <a href=#plugin>plugin</a> is communicating with the user agent using an API that features the ability to
  update the <a href=#plugin>plugin</a> when the name or value of a <a href=#concept-param-parameter title=concept-param-parameter>parameter</a> so changes, then the user agent must
  appropriately exercise that ability to notify the <a href=#plugin>plugin</a> of the change.</p>

  <p>The IDL attributes <dfn id=dom-param-name title=dom-param-name><code>name</code></dfn> and <dfn id=dom-param-value title=dom-param-value><code>value</code></dfn> must both <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  </div>

  <div class=example>

   <p>The following example shows how the <code><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>&lt;!DOCTYPE HTML&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
   &lt;title&gt;O3D Utah Teapot&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;p&gt;
    &lt;object type="application/vnd.o3d.auto"&gt;
     <strong>&lt;param name="o3d_features" value="FloatingPointTextures"&gt;</strong>
     &lt;img src="o3d-teapot.png"
          title="3D Utah Teapot illustration rendered using O3D."
          alt="When O3D renders the Utah Teapot, it appears as a squat
          teapot with a shiny metallic finish on which the
          surroundings are reflected, with a faint shadow caused by
          the lighting."&gt;
     &lt;p&gt;To see the teapot actually rendered by O3D on your
     computer, please download and install the &lt;a
     href="http://code.google.com/apis/o3d/docs/gettingstarted.html#install"&gt;O3D plugin&lt;/a&gt;.&lt;/p&gt;
    &lt;/object&gt;
    &lt;script src="o3d-teapot.js"&gt;&lt;/script&gt;
   &lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>


<!--TOPIC:Video and Audio-->
  <h4 id=the-video-element><span class=secno>4.8.6 </span>The <dfn id=video><code>video</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd>If the element has a <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>If the element has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute:
 zero or more <code><a href=#the-track-element>track</a></code> elements, then
 <a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
   <dd>If the element does not have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute: zero or more <code><a href=#the-source-element>source</a></code> elements, then
 zero or more <code><a href=#the-track-element>track</a></code> elements, then
 <a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-media-src><a href=#attr-media-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> &mdash; How the element handles crossorigin requests</dd>
   <dd><code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> &mdash; Poster frame to show prior to video playback</dd>
   <dd><code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> &mdash; Hints how much buffering the <a href=#media-resource>media resource</a> will likely need</dd>
   <dd><code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> &mdash; Hint that the <a href=#media-resource>media resource</a> can be started automatically when the page is loaded</dd>
   <dd><code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> &mdash; Groups <a href=#media-element title="media element">media elements</a> together with an implicit <code><a href=#mediacontroller>MediaController</a></code></dd>
   <dd><code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> &mdash; Whether to loop the <a href=#media-resource>media resource</a></dd>
   <dd><code title=attr-media-muted><a href=#attr-media-muted>muted</a></code> &mdash; Whether to mute the <a href=#media-resource>media resource</a> by default</dd>
   <dd><code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> &mdash; Show user agent controls</dd>
   <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code> &mdash; Vertical dimension</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmlvideoelement>HTMLVideoElement</dfn> : <a href=#htmlmediaelement>HTMLMediaElement</a> {
           attribute unsigned long <a href=#dom-dim-width title=dom-dim-width>width</a>;
           attribute unsigned long <a href=#dom-dim-height title=dom-dim-height>height</a>;
  readonly attribute unsigned long <a href=#dom-video-videowidth title=dom-video-videoWidth>videoWidth</a>;
  readonly attribute unsigned long <a href=#dom-video-videoheight title=dom-video-videoHeight>videoHeight</a>;
           attribute DOMString <a href=#dom-video-poster title=dom-video-poster>poster</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>A <code><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><a href=#the-video-element>video</a></code> element<span class=impl>. User agents
  should not show this content to the user</span>; it is intended for older Web browsers which do
  not support <code><a href=#the-video-element>video</a></code>, so that legacy video plugins can be tried, or to show text to the
  users of these older browsers informing them of how to access the video contents.</p>

  <p class=note>In particular, this content is not intended to address accessibility concerns. To
  make video content accessible to the partially sighted, the blind, the hard-of-hearing, the deaf,
  and those with other physical or cognitive disabilities, a variety of features are available.
  Captions can be provided, either embedded in the video stream or as external files using the
  <code><a href=#the-track-element>track</a></code> element. Sign-language tracks can be provided, again either embedded in the
  video stream or by synchronizing multiple <code><a href=#the-video-element>video</a></code> elements using the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute or a <code><a href=#mediacontroller>MediaController</a></code>
  object. Audio descriptions can be provided, either as a separate track embedded in the video
  stream, or a separate audio track in an <code><a href=#the-audio-element>audio</a></code> element <a href=#slaved-media-elements title="slaved media
  elements">slaved</a> to the same controller as the <code><a href=#the-video-element>video</a></code> element(s), or in text
  form using a <a href=#webvtt-file>WebVTT file</a> referenced using the <code><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><a href=#the-video-element>video</a></code> element. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>The <code><a href=#the-video-element>video</a></code> element is a <a href=#media-element>media element</a> whose <a href=#media-data>media data</a> is
  ostensibly video data, possibly with associated audio data.</p>

  <p>The <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>,
  <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>, <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>, <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>
  attributes are <a href=#media-element-attributes title="media element attributes">the attributes common to all media
  elements</a>.</p>

  <p>The <dfn id=attr-video-poster title=attr-video-poster><code>poster</code></dfn> attribute gives the address of an
  image file that the user agent can show while no video data is available. The attribute, if
  present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>.</p>

  <div class=impl>

  <p>If the specified resource is to be used, then, when the element is created or when the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> attribute is set, changed, or removed, the user agent must
  run the following steps to determine the element's <dfn id=poster-frame>poster frame</dfn> (regardless of the
  value of the element's <a href=#show-poster-flag>show poster flag</a>):</p> <!-- thus it is unaffected by changes
  to the base URL. -->

  <ol><li><p>If there is an existing instance of this algorithm running for this <code><a href=#the-video-element>video</a></code>
   element, abort that instance of this algorithm without changing the <a href=#poster-frame>poster
   frame</a>.</li>

   <li><p>If the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> attribute's value is the empty string
   or if the attribute is absent, then there is no <a href=#poster-frame>poster frame</a>; abort these
   steps.</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> attribute's value relative to the element. If this fails,
   then there is no <a href=#poster-frame>poster frame</a>; abort these steps.</li>

   <li><p><a href=#fetch>Fetch</a><!--FETCH--> the resulting <a href=#absolute-url>absolute URL</a>, from the element's
   <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>. This must <a href=#delay-the-load-event>delay the load event</a> of the
   element's document.</li>

   <!-- could define how to sniff for an image here -->

   <li><p>If an image is thus obtained, the <a href=#poster-frame>poster frame</a> is that image. Otherwise,
   there is no <a href=#poster-frame>poster frame</a>.</li>

  </ol></div>

  <p class=note>The image given by the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> attribute,
  the <i><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>

  <div class=impl>

  <hr><p>A <code><a href=#the-video-element>video</a></code> element represents what is given for the first matching condition in the
  list below:</p>

  <dl class=switch><dt>When no video data is available (the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, or <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> but no video data has yet been obtained at
   all, or the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is any
   subsequent value but the <a href=#media-resource>media resource</a> does not have a video channel)</dt>

   <dt>When the <code><a href=#the-video-element>video</a></code> element is <a href=#dom-media-paused title=dom-media-paused>paused</a>, the <a href=#current-playback-position title="current playback position">current playback position</a> is the first frame of video,
   and the element's <a href=#show-poster-flag>show poster flag</a> is set</dt>

   <dd>The <code><a href=#the-video-element>video</a></code> element <a href=#represents>represents</a> its <a href=#poster-frame>poster frame</a>.</dd>

   <dt>When the <code><a href=#the-video-element>video</a></code> element is <a href=#dom-media-paused title=dom-media-paused>paused</a>, and the
   frame of video corresponding to the <a href=#current-playback-position title="current playback position">current playback
   position</a> is not available (e.g. because the video is seeking or buffering)</dt>

   <dt>When the <code><a href=#the-video-element>video</a></code> element is neither <a href=#potentially-playing>potentially playing</a> nor <a href=#dom-media-paused title=dom-media-paused>paused</a> (e.g. when seeking or stalled)</dt>

   <dd>The <code><a href=#the-video-element>video</a></code> element <a href=#represents>represents</a> the last frame of the video to have
   been rendered.</dd>

   <dt>When the <code><a href=#the-video-element>video</a></code> element is <a href=#dom-media-paused title=dom-media-paused>paused</a></dt>

   <dd>The <code><a href=#the-video-element>video</a></code> element <a href=#represents>represents</a> the frame of video corresponding to
   the <a href=#current-playback-position title="current playback position">current playback position</a>.</dd>

   <dt>Otherwise (the <code><a href=#the-video-element>video</a></code> element has a video channel and is <a href=#potentially-playing>potentially
   playing</a>)</dt>

   <dd>The <code><a href=#the-video-element>video</a></code> element <a href=#represents>represents</a> the frame of video at the continuously
   increasing <a href=#current-playback-position title="current playback position">"current" position</a>. When the
   <a href=#current-playback-position>current playback position</a> changes such that the last frame rendered is no longer the
   frame corresponding to the <a href=#current-playback-position>current playback position</a> in the video, the new frame
   must be rendered.</dd>

  </dl><p class=note>Which frame in a video stream corresponds to a particular playback position is
  defined by the video stream's format.</p>

  <p>The <code><a href=#the-video-element>video</a></code> element also <a href=#represents>represents</a> any <a href=#text-track-cue title="text track
  cue">text track cues</a> whose <a href=#text-track-cue-active-flag>text track cue active flag</a> is set and whose
  <a href=#text-track>text track</a> is in the <a href=#text-track-showing title="text track showing">showing</a> mode, and any
  audio from the <a href=#media-resource>media resource</a>, at the <a href=#current-playback-position>current playback position</a>.</p>

  <p>Any audio associated with the <a href=#media-resource>media resource</a> must, if played, be played
  synchronized with the <a href=#current-playback-position>current playback position</a>, at the element's <a href=#effective-media-volume>effective
  media volume</a>.</p>

  <p>In addition to the above, the user agent may provide messages to the user (such as "buffering",
  "no video loaded", "error", or more detailed information) by overlaying text or icons on the video
  or other areas of the element's playback area, or in another appropriate manner.</p>

  <p>User agents that cannot render the video may instead make the element <a href=#represents title=represents>represent</a> a link to an external video playback utility or to the video
  data itself.</p>

  <p>When a <code><a href=#the-video-element>video</a></code> element's <a href=#media-resource>media resource</a> has a video channel, the
  element <a href=#provides-a-paint-source>provides a paint source</a> whose width is the <a href=#media-resource>media resource</a>'s
  <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a>, whose height is the
  <a href=#media-resource>media resource</a>'s <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic
  height</a>, and whose appearance is the frame of video corresponding to the <a href=#current-playback-position title="current playback position">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></div>

  <dl class=domintro><dt><var title="">video</var> . <code title=dom-video-videoWidth><a href=#dom-video-videowidth>videoWidth</a></code></dt>
   <dt><var title="">video</var> . <code title=dom-video-videoHeight><a href=#dom-video-videoheight>videoHeight</a></code></dt>

   <dd>

    <p>These attributes return the intrinsic dimensions of the video,
    or zero if the dimensions are not known.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</dfn> and <dfn id=concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</dfn> of the <a href=#media-resource>media resource</a>
  are the dimensions of the resource in CSS pixels after taking into account the resource's
  dimensions, aspect ratio, clean aperture, resolution, and so forth, as defined for the format used
  by the resource. If an anamorphic format does not define how to apply the aspect ratio to the
  video data's dimensions to obtain the "correct" dimensions, then the user agent must apply the
  ratio by increasing one dimension and leaving the other unchanged.</p>

  <p>The <dfn id=dom-video-videowidth title=dom-video-videoWidth><code>videoWidth</code></dfn> IDL attribute must return
  the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> of the video in CSS pixels.
  The <dfn id=dom-video-videoheight title=dom-video-videoHeight><code>videoHeight</code></dfn> IDL attribute must return
  the <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a> of the video in CSS
  pixels. If the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then the attributes must return 0.</p>

  </div>

  <p>The <code><a href=#the-video-element>video</a></code> element supports <a href=#dimension-attributes>dimension attributes</a>.</p>

  <div class=impl>

  <p>In the absence of style rules to the contrary, video content should be rendered inside the
  element's playback area such that the video content is shown centered in the playback area at the
  largest possible size that fits completely within it, with the video content's aspect ratio being
  preserved. Thus, if the aspect ratio of the playback area does not match the aspect ratio of the
  video, the video will be shown letterboxed or pillarboxed. Areas of the element's playback area
  that do not contain the video represent nothing.</p>

  <p class=note>In user agents that implement CSS, the above requirement can be implemented by
  using the <a href=#video-object-fit>style rule suggested in the rendering section</a>.</p>

  <p>The intrinsic width of a <code><a href=#the-video-element>video</a></code> element's playback area is the intrinsic width of
  the <a href=#poster-frame>poster frame</a>, if that is available and the element currently
  <a href=#represents>represents</a> its poster frame; otherwise, it is the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> of the video resource, if that is
  available; otherwise the intrinsic width is missing.</p>

  <p>The intrinsic height of a <code><a href=#the-video-element>video</a></code> element's playback area is the intrinsic height of
  the <a href=#poster-frame>poster frame</a>, if that is available and the element currently
  <a href=#represents>represents</a> its poster frame; otherwise it is the <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a> of the video resource, if that is
  available; otherwise the intrinsic height is missing.</p>

  <p>The <a href=#default-object-size>default object size</a> is a width of 300 CSS pixels and a height of 150 CSS
  pixels. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

  <hr><p>User agents should provide controls to enable or disable the display of closed captions, audio
  description tracks, and other additional data associated with the video stream, though such
  features should, again, not interfere with the page's normal rendering.</p>

  <p>User agents may allow users to view the video content in manners more suitable to the user
  (e.g. full-screen or in an independent resizable window). As for the other user interface
  features, controls to enable this should not interfere with the page's normal rendering unless the
  user agent is <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the user">exposing a user interface</a>.
  In such an independent context, however, user agents may make full user interfaces visible, with,
  e.g., play, pause, seeking, and volume controls, even if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is absent.</p>

  <p>User agents may allow video playback to affect system features that could interfere with the
  user's experience; for example, user agents could disable screensavers while video playback is in
  progress.</p>

  <hr><p>The <dfn id=dom-video-poster title=dom-video-poster><code>poster</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code> content attribute.</p>

  </div>

  <div class=example>

   <p>This example shows how to detect when a video has failed to play correctly:</p>

   <pre>&lt;script&gt;
 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;
   }
 }
&lt;/script&gt;
&lt;p&gt;&lt;video src="tgif.vid" autoplay controls onerror="failed(event)"&gt;&lt;/video&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="tgif.vid"&gt;Download the video file&lt;/a&gt;.&lt;/p&gt;</pre>

  </div>




  <!--CODECS

  <div class="impl">

  <h5>Video and audio codecs for <code>video</code> elements</h5>

  <p>User agents may support any video and audio codecs and container formats.</p>

  <p class="note">Certain user agents might support no codecs at all, e.g. text browsers running
  over SSH connections.</p>

  <!- - similar note in audio codecs section - ->
  <p class="note">Implementations are free to implement support for video codecs either natively, or
  using platform-specific APIs, or using plugins: this specification does not specify how codecs are
  to be implemented.</p>

  </div>

  (when replacing this text, also fix "- -" nested comments)-->





  <h4 id=the-audio-element><span class=secno>4.8.7 </span>The <dfn id=audio><code>audio</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd>If the element has a <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#interactive-content>Interactive content</a>.</dd>
   <dd>If the element has a <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>If the element has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute: 
zero or more <code><a href=#the-track-element>track</a></code> elements, then 
<a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
   <dd>If the element does not have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute: zero or more <code><a href=#the-source-element>source</a></code> elements, then
 zero or more <code><a href=#the-track-element>track</a></code> elements, then
 <a href=#transparent>transparent</a>, but with no <a href=#media-element>media element</a> descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-media-src><a href=#attr-media-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> &mdash; How the element handles crossorigin requests</dd>
   <dd><code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> &mdash; Hints how much buffering the <a href=#media-resource>media resource</a> will likely need</dd>
   <dd><code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> &mdash; Hint that the <a href=#media-resource>media resource</a> can be started automatically when the page is loaded</dd>
   <dd><code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> &mdash; Groups <a href=#media-element title="media element">media elements</a> together with an implicit <code><a href=#mediacontroller>MediaController</a></code></dd>
   <dd><code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> &mdash; Whether to loop the <a href=#media-resource>media resource</a></dd>
   <dd><code title=attr-media-muted><a href=#attr-media-muted>muted</a></code> &mdash; Whether to mute the <a href=#media-resource>media resource</a> by default</dd>
   <dd><code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> &mdash; Show user agent controls</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>[NamedConstructor=<a href=#dom-audio title=dom-Audio>Audio</a>(optional DOMString src)]
interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediaelement>HTMLMediaElement</a> {};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>An <code><a href=#the-audio-element>audio</a></code> element <a href=#represents>represents</a> a sound or audio stream.</p>

  <!-- v2 (actually v3) suggestions:
    * Audio syntesis. Use cases from Charles Pritchard:
      > Use a sound of varying pitch to hint to a user the location of their
      > mouse (is it hovering over a button, is it x/y pixels away from the edge
      > of the screen, how close is it to the center).
      >
      > Alter the pitch of a sound to make a very cheap midi instrument.
      >
      > Pre-mix a few generated sounds, because the client processor is slow.
      >
      > Alter the pitch of an actual audio recording, and pre-mix it, to give
      > different sounding voices to pre-recorded readings of a single text. As
      > has been tried for "male" "female" sound fonts.
      >
      > Support very simple audio codecs, and programmable synthesizers.
  -->

  <p>Content may be provided inside the <code><a href=#the-audio-element>audio</a></code> element<span class=impl>. User agents
  should not show this content to the user</span>; it is intended for older Web browsers which do
  not support <code><a href=#the-audio-element>audio</a></code>, so that legacy audio plugins can be tried, or to show text to the
  users of these older browsers informing them of how to access the audio contents.</p>

  <p class=note>In particular, this content is not intended to address accessibility concerns. To
  make audio content accessible to the deaf or to those with other physical or cognitive
  disabilities, a variety of features are available. If captions or a sign language video are
  available, the <code><a href=#the-video-element>video</a></code> element can be used instead of the <code><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><a href=#the-track-element>track</a></code> element and a <a href=#webvtt-file>WebVTT file</a>. And,
  naturally, transcripts or other textual alternatives can be provided by simply linking to them in
  the prose near the <code><a href=#the-audio-element>audio</a></code> element. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>The <code><a href=#the-audio-element>audio</a></code> element is a <a href=#media-element>media element</a> whose <a href=#media-data>media data</a> is
  ostensibly audio data.</p>

  <p>The <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>,
  <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>, <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>, <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>
  attributes are <a href=#media-element-attributes title="media element attributes">the attributes common to all media
  elements</a>.</p>

  <div class=impl>

  <p>When an <code><a href=#the-audio-element>audio</a></code> element is <a href=#potentially-playing>potentially playing</a>, it must have its audio
  data played synchronized with the <a href=#current-playback-position>current playback position</a>, at the element's
  <a href=#effective-media-volume>effective media volume</a>.</p>

  <p>When an <code><a href=#the-audio-element>audio</a></code> element is not <a href=#potentially-playing>potentially playing</a>, audio must not play
  for the element.</p>

  </div>

  <dl class=domintro><dt><var title="">audio</var> = new <code title=dom-Audio><a href=#dom-audio>Audio</a></code>( [ <var title="">url</var> ] )</dt>

   <dd>

    <p>Returns a new <code><a href=#the-audio-element>audio</a></code> element, with the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
    attribute set to the value passed in the argument, if applicable.</p>

   </dd>

  </dl><div class=impl>

  <p>A constructor is provided for creating <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> objects (in addition to
  the factory methods from DOM such as <code title="">createElement()</code>): <dfn id=dom-audio title=dom-Audio><code>Audio(<var title="">src</var>)</code></dfn>. When invoked as a
  constructor, it must return a new <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> object (a new <code><a href=#the-audio-element>audio</a></code>
  element). The element must have its <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute set
  to the literal value "<code title=attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>". If the <var title="">src</var> argument is present, the object created must have its <code title=attr-media-src><a href=#attr-media-src>src</a></code> content attribute set to the provided value, and the user agent
  must invoke the object's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
  algorithm</a> before returning. The element's document must be the <a href=#active-document>active document</a>
  of the <a href=#browsing-context>browsing context</a> of the <code><a href=#window>Window</a></code> object on which the interface
  object of the invoked constructor is found.</p>

  </div>



  <!--CODECS

  <div class="impl">

  <h5>Audio codecs for <code>audio</code> elements</h5>

  <p>User agents may support any audio codecs and container formats.</p>

  <p>User agents must support the WAVE container format with audio encoded using the 16 bit PCM (LE)
  codec, at sampling frequencies of 11.025kHz, 22.050kHz, and 44.100kHz, and for both mono and
  stereo. <a href="#- -refsWAVE">[WAVE]</a></p>

  <!- -
   <dt id="- -refsWAVE">WAVE</dt>
   <dd>http://en.wikipedia.org/wiki/WAV? </dd>
  - ->

  <!- - similar note in video codecs section - ->
  <p class="note">Implementations are free to implement support for audio codecs either natively, or
  using platform-specific APIs, or using plugins: this specification does not specify how codecs are
  to be implemented.</p>

  </div>

  (when replacing this text, also fix "- -" nested comments)-->



  <h4 id=the-source-element><span class=secno>4.8.8 </span>The <dfn><code>source</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <a href=#media-element>media element</a>, before any <a href=#flow-content>flow content</a>
 or <code><a href=#the-track-element>track</a></code> elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-source-src><a href=#attr-source-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-source-type><a href=#attr-source-type>type</a></code> &mdash; Type of embedded resource</dd>
   <dd><code title=attr-source-media><a href=#attr-source-media>media</a></code> &mdash; Applicable media</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlsourceelement>HTMLSourceElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-source-src title=dom-source-src>src</a>;
           attribute DOMString <a href=#dom-source-type title=dom-source-type>type</a>;
           attribute DOMString <a href=#dom-source-media title=dom-source-media>media</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><!--CLEANUP--><p>The <code><a href=#the-source-element>source</a></code> element allows authors to specify
  multiple alternative <a href=#media-resource title="media resource">media
  resources</a> for <a href=#media-element title="media element">media
  elements</a>. It does not <a href=#represents title=represents>represent</a> anything on its own.</p>

  <p>The <dfn id=attr-source-src title=attr-source-src><code>src</code></dfn> attribute
  gives the address of the <a href=#media-resource>media resource</a>. The value must
  be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
  spaces</a>. This attribute must be present.</p>

  <p class=note>Dynamically modifying a <code><a href=#the-source-element>source</a></code> element
  and its attribute when the element is already inserted in a
  <code><a href=#the-video-element>video</a></code> or <code><a href=#the-audio-element>audio</a></code> element will have no
  effect. To change what is playing, just use the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute on the <a href=#media-element>media
  element</a> directly, possibly making use of the <code title=dom-navigator-canPlayType><a href=#dom-navigator-canplaytype>canPlayType()</a></code> method to
  pick from amongst available resources. Generally, manipulating
  <code><a href=#the-source-element>source</a></code> elements manually after the document has been
  parsed is an unnecessarily complicated approach.</p>

  <p>The <dfn id=attr-source-type title=attr-source-type><code>type</code></dfn>
  attribute gives the type of the <a href=#media-resource>media resource</a>, to help
  the user agent determine if it can play this <a href=#media-resource>media
  resource</a> before fetching it. If specified, its value must be
  a <a href=#valid-mime-type>valid MIME type</a>. The <code title="">codecs</code>
  parameter, which certain MIME types define, might be necessary to
  specify exactly how the resource is encoded. <a href=#refsRFC4281>[RFC4281]</a></p>

  <div class=example>

   <p>The following list shows some examples of how to use the <code title="">codecs=</code> MIME parameter in the <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute.</p>

   <dl><dt>H.264 Constrained baseline profile video (main and extended video compatible) level 3 and Low-Complexity AAC audio in MP4 container</dt>
    <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'&gt;</pre></dd>

    <dt>H.264 Extended profile video (baseline-compatible) level 3 and Low-Complexity AAC audio in MP4 container</dt>
    <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.58A01E, mp4a.40.2"'&gt;</pre></dd>

    <dt>H.264 Main profile video level 3 and Low-Complexity AAC audio in MP4 container</dt>
    <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'&gt;</pre></dd>

    <dt>H.264 'High' profile video (incompatible with main, baseline, or extended profiles) level 3 and Low-Complexity AAC audio in MP4 container</dt>
    <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="avc1.64001E, mp4a.40.2"'&gt;</pre></dd>


    <dt>MPEG-4 Visual Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container</dt>
    <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="mp4v.20.8, mp4a.40.2"'&gt;</pre></dd>

    <dt>MPEG-4 Advanced Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container</dt>
    <dd><pre>&lt;source src='video.mp4' type='video/mp4; codecs="mp4v.20.240, mp4a.40.2"'&gt;</pre></dd>

    <dt>MPEG-4 Visual Simple Profile Level 0 video and AMR audio in 3GPP container</dt>
    <dd><pre>&lt;source src='video.3gp' type='video/3gpp; codecs="mp4v.20.8, samr"'&gt;</pre></dd>


    <dt>Theora video and Vorbis audio in Ogg container</dt>
    <dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'&gt;</pre></dd>

    <dt>Theora video and Speex audio in Ogg container</dt>
    <dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="theora, speex"'&gt;</pre></dd>

    <dt>Vorbis audio alone in Ogg container</dt>
    <dd><pre>&lt;source src='audio.ogg' type='audio/ogg; codecs=vorbis'&gt;</pre></dd>

    <dt>Speex audio alone in Ogg container</dt>
    <dd><pre>&lt;source src='audio.spx' type='audio/ogg; codecs=speex'&gt;</pre></dd>

    <dt>FLAC audio alone in Ogg container</dt>
    <dd><pre>&lt;source src='audio.oga' type='audio/ogg; codecs=flac'&gt;</pre></dd>

    <dt>Dirac video and Vorbis audio in Ogg container</dt>
    <dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="dirac, vorbis"'&gt;</pre></dd>

<!-- awaiting definition by the Matroska guys:
    <dt>Theora video and Vorbis audio in Matroska container</dt>
    <dd><pre>&lt;source src='video.mkv' type='video/x-matroska; codecs="theora, vorbis"'></pre></dd>
-->

<!-- awaiting definition by the Ogg or BBC guys:
    <dt>Dirac video and Vorbis audio in Matroska container</dt>
    <dd><pre>&lt;source src='video.mkv' type='video/x-matroska; codecs='></pre></dd>
-->

<!-- awaiting definition by the Microsoft guys:
    <dt>WMV9 video and WMA 2 audio in ASF container</dt>
    <dd><pre>&lt;source src='video.wmv' type='video/x-ms-wmv; codecs='></pre></dd>

    <dt>WMV8 video and WMA 2 audio in ASF container</dt>
    <dd><pre>&lt;source src='video.wmv' type='video/x-ms-wmv; codecs='></pre></dd>

    <dt>VC-1 video and WMA 10 Pro audio in ASF container</dt>
    <dd><pre>&lt;source src='video.wmv' type='video/x-ms-wmv; codecs='></pre></dd>

    <dt>XviD video and MP3 audio in AVI container</dt>
    <dd><pre>&lt;source src='video.avi' type='video/x-msvideo; codecs='></pre></dd>

    <dt>Motion-JPEG video and uncompressed PCM audio in AVI container</dt>
    <dd><pre>&lt;source src='video.avi' type='video/x-msvideo; codecs='></pre></dd>
-->

<!-- awaiting definition by Real:
    <dt>Real Video 10 video and High-Efficiency AAC audio in Real Media container</dt>
    <dd><pre>&lt;source src='video.rm' type='application/vnd.rn-realmedia; codecs='></pre></dd>
-->

<!--  undefined:
    <dt>MPEG-1 video and MPEG-1 Audio Layer II audio in MPEG-1 program stream</dt>
    <dd><pre>&lt;source src='video.mpg' type='video/mpeg; codecs='></pre></dd>
-->

   </dl></div>

  <p>The <dfn id=attr-source-media title=attr-source-media><code>media</code></dfn> attribute gives the intended media
  type of the <a href=#media-resource>media resource</a>, to help the user agent determine if this <a href=#media-resource>media
  resource</a> is useful to the user before fetching it. Its value must be a <a href=#valid-media-query>valid media
  query</a>.</p>

  <!-- for similar paragraphs, search for "The default, if the" -->
  <p id=source-default-media class=note>The <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource
  selection algorithm</a> is defined in such a way that when the <code title=attr-source-media><a href=#attr-source-media>media</a></code> attribute is omitted the user agent acts the same as if the
  value was "<code title="">all</code>", i.e. by default the <a href=#media-resource>media resource</a> is suitable
  for all media.</p>

  <div class=impl>

  <p>If a <code><a href=#the-source-element>source</a></code> element is inserted as a child of a <a href=#media-element>media element</a> that
  has no <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute and whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> has the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, the user agent must invoke the <a href=#media-element>media
  element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
  algorithm</a>.</p>

  <p>The IDL attributes <dfn id=dom-source-src title=dom-source-src><code>src</code></dfn>, <dfn id=dom-source-type title=dom-source-type><code>type</code></dfn>, and <dfn id=dom-source-media title=dom-source-media><code>media</code></dfn> must <a href=#reflect>reflect</a> the respective content
  attributes of the same name.</p>

  </div>

  <div class=example>

   <p>If the author isn't sure if user agents will all be able to render the media resources
   provided, the author can listen to the <code title=event-error>error</code> event on the last
   <code><a href=#the-source-element>source</a></code> element and trigger fallback behavior:</p>

   <pre>&lt;script&gt;
 function fallback(video) {
   // replace &lt;video&gt; 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);
 }
&lt;/script&gt;
&lt;video controls autoplay&gt;
 &lt;source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'&gt;
 &lt;source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'
         onerror="fallback(parentNode)"&gt;
 ...
&lt;/video&gt;</pre>

  </div>


<!--TOPIC:Video Text Tracks-->
  <h4 id=the-track-element><span class=secno>4.8.9 </span>The <dfn><code>track</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <a href=#media-element>media element</a>, before any <a href=#flow-content>flow content</a>.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> &mdash; The type of text track</dd>
   <dd><code title=attr-track-src><a href=#attr-track-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> &mdash; Language of the text track</dd>
   <dd><code title=attr-track-label><a href=#attr-track-label>label</a></code> &mdash; User-visible label</dd>
   <dd><code title=attr-track-default><a href=#attr-track-default>default</a></code> &mdash; Enable the track if no other <a href=#text-track>text track</a> is more suitable</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltrackelement>HTMLTrackElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-track-kind title=dom-track-kind>kind</a>;
           attribute DOMString <a href=#dom-track-src title=dom-track-src>src</a>;
           attribute DOMString <a href=#dom-track-srclang title=dom-track-srclang>srclang</a>;
           attribute DOMString <a href=#dom-track-label title=dom-track-label>label</a>;
           attribute boolean <a href=#dom-track-default title=dom-track-default>default</a>;

  const unsigned short <a href=#dom-track-none title=dom-track-NONE>NONE</a> = 0;
  const unsigned short <a href=#dom-track-loading title=dom-track-LOADING>LOADING</a> = 1;
  const unsigned short <a href=#dom-track-loaded title=dom-track-LOADED>LOADED</a> = 2;
  const unsigned short <a href=#dom-track-error title=dom-track-ERROR>ERROR</a> = 3;
  readonly attribute unsigned short <a href=#dom-track-readystate title=dom-track-readyState>readyState</a>;

  readonly attribute <a href=#texttrack>TextTrack</a> <a href=#dom-track-track title=dom-track-track>track</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-track-element>track</a></code> element allows authors to specify explicit external timed <a href=#text-track title="text track">text tracks</a> for <a href=#media-element title="media element">media elements</a>. It
  does not <a href=#represents title=represents>represent</a> anything on its own.</p>

  <p>The <dfn id=attr-track-kind title=attr-track-kind><code>kind</code></dfn> attribute is an <a href=#enumerated-attribute>enumerated
  attribute</a>. The following table lists the keywords defined for this attribute. The keyword
  given in the first cell of each row maps to the state given in the second cell.</p>

  <table><thead><tr><th>Keyword
     <th>State
     <th>Brief description
   <tbody><tr><td><dfn id=attr-track-kind-keyword-subtitles title=attr-track-kind-keyword-subtitles><code>subtitles</code></dfn>
     <td><dfn id=attr-track-kind-subtitles title=attr-track-kind-subtitles>Subtitles</dfn>
     <td>
      Transcription or translation of the dialogue, suitable for when the sound is available but not understood (e.g. because the user does not understand the language of the <a href=#media-resource>media resource</a>'s audio track).
      Overlaid on the video.
    <tr><td><dfn id=attr-track-kind-keyword-captions title=attr-track-kind-keyword-captions><code>captions</code></dfn>
     <td><dfn id=attr-track-kind-captions title=attr-track-kind-captions>Captions</dfn>
     <td>
      Transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information, suitable for when sound is unavailable or not clearly audible (e.g. because it is muted, drowned-out by ambient noise, or because the user is deaf).
      Overlaid on the video; labeled as appropriate for the hard-of-hearing.
    <tr><td><dfn id=attr-track-kind-keyword-descriptions title=attr-track-kind-keyword-descriptions><code>descriptions</code></dfn>
     <td><dfn id=attr-track-kind-descriptions title=attr-track-kind-descriptions>Descriptions</dfn>
     <td>
      Textual descriptions of the video component of the <a href=#media-resource>media resource</a>, intended for audio synthesis when the visual component is obscured, unavailable, or not usable (e.g. because the user is interacting with the application without a screen while driving, or because the user is blind).
      Synthesized as audio.
    <tr><td><dfn id=attr-track-kind-keyword-chapters title=attr-track-kind-keyword-chapters><code>chapters</code></dfn>
     <td><dfn id=attr-track-kind-chapters title=attr-track-kind-chapters>Chapters</dfn>
     <td>
      Chapter titles, intended to be used for navigating the <a href=#media-resource>media resource</a>.
      Displayed as an interactive (potentially nested) list in the user agent's interface.
    <tr><td><dfn id=attr-track-kind-keyword-metadata title=attr-track-kind-keyword-metadata><code>metadata</code></dfn>
     <td><dfn id=attr-track-kind-metadata title=attr-track-kind-metadata>Metadata</dfn>
     <td>
      Tracks intended for use from script.
      Not displayed by the user agent.
  </table><p>The attribute may be omitted. The <i>missing value default</i> is the <a href=#attr-track-kind-subtitles title=attr-track-kind-subtitles>subtitles</a> state.</p>

  <p>The <dfn id=attr-track-src title=attr-track-src><code>src</code></dfn> attribute gives the address of the text
  track data. The value must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>.
  This attribute must be present.</p>

  <div class=impl>

  <p>If the element has a <code title=attr-track-src><a href=#attr-track-src>src</a></code> attribute whose value is not the
  empty string and whose value, when the attribute was set, could be successfully <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element, then the element's <dfn id=track-url>track
  URL</dfn> is the resulting <a href=#absolute-url>absolute URL</a>. Otherwise, the element's <a href=#track-url>track
  URL</a> is the empty string.</p>

  </div>

  <p>If the element's <a href=#track-url>track URL</a> identifies a <a href=#webvtt>WebVTT</a> resource, and the
  element's <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is not in the <a href=#attr-track-kind-metadata title=attr-track-kind-metadata>metadata</a> state, then the <a href=#webvtt>WebVTT</a> file must be
  a <a href=#webvtt-file-using-cue-text>WebVTT file using cue text</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>Furthermore, if the element's <a href=#track-url>track URL</a> identifies a <a href=#webvtt>WebVTT</a> resource,
  and the element's <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-chapters title=attr-track-kind-chapters>chapters</a> state, then the <a href=#webvtt>WebVTT</a> file must be
  both a <a href=#webvtt-file-using-chapter-title-text>WebVTT file using chapter title text</a> and a <a href=#webvtt-file-using-only-nested-cues>WebVTT file using only nested
  cues</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>The <dfn id=attr-track-srclang title=attr-track-srclang><code>srclang</code></dfn> attribute gives the language of
  the text track data. The value must be a valid BCP 47 language tag. This attribute must be present
  if the element's <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-subtitles title=attr-track-kind-subtitles>subtitles</a> state. <a href=#refsBCP47>[BCP47]</a></p>

  <div class=impl>

  <p>If the element has a <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attribute whose value is
  not the empty string, then the element's <dfn id=track-language>track language</dfn> is the value of the attribute.
  Otherwise, the element has no <a href=#track-language>track language</a>.</p>

  </div>

  <p>The <dfn id=attr-track-label title=attr-track-label><code>label</code></dfn> attribute gives a user-readable
  title for the track. This title is used by user agents when listing <a href=#attr-track-kind-subtitles title=attr-track-kind-subtitles>subtitle</a>, <a href=#attr-track-kind-captions title=attr-track-kind-captions>caption</a>, and <a href=#attr-track-kind-descriptions title=attr-track-kind-descriptions>audio description</a> tracks in their user interface.</p>

  <p>The value of the <code title=attr-track-label><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><a href=#the-track-element>track</a></code>
  element children of the same <a href=#media-element>media element</a> whose <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attributes are in the same state, whose <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attributes are both missing or have values that
  represent the same language, and whose <code title=attr-track-label><a href=#attr-track-label>label</a></code> attributes are
  again both missing or both have the same value.</p>

  <div class=impl>

  <p>If the element has a <code title=attr-track-label><a href=#attr-track-label>label</a></code> attribute whose value is not
  the empty string, then the element's <dfn id=track-label>track label</dfn> is the value of the attribute.
  Otherwise, the element's <a href=#track-label>track label</a> is an empty string.</p>

  </div>

  <p>The <dfn id=attr-track-default title=attr-track-default><code>default</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>, which, if specified, indicates that the track is to be enabled if the user's
  preferences do not indicate that another track would be more appropriate.</p>

  <p>Each <a href=#media-element>media element</a> must have no more than one <code><a href=#the-track-element>track</a></code> element child
  whose <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-subtitles title=attr-track-kind-subtitles>subtitles</a> or <a href=#attr-track-kind-captions title=attr-track-kind-captions>captions</a> state and whose <code title=attr-track-default><a href=#attr-track-default>default</a></code> attribute is specified.</p>

  <p>Each <a href=#media-element>media element</a> must have no more than one <code><a href=#the-track-element>track</a></code> element child
  whose <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-descriptions title=attr-track-kind-descriptions>description</a> state and whose <code title=attr-track-default><a href=#attr-track-default>default</a></code> attribute is specified.</p>

  <p>Each <a href=#media-element>media element</a> must have no more than one <code><a href=#the-track-element>track</a></code> element child
  whose <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-chapters title=attr-track-kind-chapters>chapters</a> state and whose <code title=attr-track-default><a href=#attr-track-default>default</a></code> attribute is specified.</p>

  <p class=note>There is no limit on the number of <code><a href=#the-track-element>track</a></code> elements whose <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-metadata title=attr-track-kind-metadata>metadata</a> state and whose <code title=attr-track-default><a href=#attr-track-default>default</a></code> attribute is specified.</p>

  <dl class=domintro><dt><var title="">track</var> . <code title=dom-track-readyState><a href=#dom-track-readystate>readyState</a></code></dt>
   <dd>
    <p>Returns the <a href=#text-track-readiness-state>text track readiness state</a>,
    represented by a number from the following list:</p>
    <dl><dt><var title="">track</var> . <code title=dom-track-NONE><a href=#dom-track-none>NONE</a></code> (0)</dt>
     <dd>
      <p>The <a href=#text-track-not-loaded>text track not loaded</a> state.</p>
     </dd>
     <dt><var title="">track</var> . <code title=dom-track-LOADING><a href=#dom-track-loading>LOADING</a></code> (1)</dt>
     <dd>
      <p>The <a href=#text-track-loading>text track loading</a> state.</p>
     </dd>
     <dt><var title="">track</var> . <code title=dom-track-LOADED><a href=#dom-track-loaded>LOADED</a></code> (2)</dt>
     <dd>
      <p>The <a href=#text-track-loaded>text track loaded</a> state.</p>
     </dd>
     <dt><var title="">track</var> . <code title=dom-track-ERROR><a href=#dom-track-error>ERROR</a></code> (3)</dt>
     <dd>
      <p>The <a href=#text-track-failed-to-load>text track failed to load</a> state.</p>
     </dd>
    </dl></dd>

   <dt><var title="">track</var> . <code title=dom-track-track><a href=#dom-track-track>track</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#texttrack>TextTrack</a></code> object corresponding to the <a href=#text-track>text track</a> of the <code><a href=#the-track-element>track</a></code> element.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-track-readystate title=dom-track-readyState><code>readyState</code></dfn> attribute must return the
  numeric value corresponding to the <a href=#text-track-readiness-state>text track readiness state</a> of the
  <code><a href=#the-track-element>track</a></code> element's <a href=#text-track>text track</a>, as defined by the following list:</p>

  <dl><dt><dfn id=dom-track-none title=dom-track-NONE><code>NONE</code></dfn> (numeric value 0)</dt>
   <dd>The <a href=#text-track-not-loaded>text track not loaded</a> state.</dd>
   <dt><dfn id=dom-track-loading title=dom-track-LOADING><code>LOADING</code></dfn> (numeric value 1)</dt>
   <dd>The <a href=#text-track-loading>text track loading</a> state.</dd>
   <dt><dfn id=dom-track-loaded title=dom-track-LOADED><code>LOADED</code></dfn> (numeric value 2)</dt>
   <dd>The <a href=#text-track-loaded>text track loaded</a> state.</dd>
   <dt><dfn id=dom-track-error title=dom-track-ERROR><code>ERROR</code></dfn> (numeric value 3)</dt>
   <dd>The <a href=#text-track-failed-to-load>text track failed to load</a> state.</dd>
  </dl><p>The <dfn id=dom-track-track title=dom-track-track><code>track</code></dfn> IDL attribute must, on getting,
  return the <code><a href=#the-track-element>track</a></code> element's <a href=#text-track>text track</a>'s corresponding
  <code><a href=#texttrack>TextTrack</a></code> object.</p>

  <p>The <dfn id=dom-track-src title=dom-track-src><code>src</code></dfn>, <dfn id=dom-track-srclang title=dom-track-srclang><code>srclang</code></dfn>, <dfn id=dom-track-label title=dom-track-label><code>label</code></dfn>, and <dfn id=dom-track-default title=dom-track-default><code>default</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name. The <dfn id=dom-track-kind title=dom-track-kind><code>kind</code></dfn> IDL attribute must <a href=#reflect>reflect</a> the content
  attribute of the same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  </div>

  <div class=example>

   <p>This video has subtitles in several languages:</p>

   <pre>&lt;video src="brave.webm"&gt;
 &lt;track kind=subtitles src=brave.en.vtt srclang=en label="English"&gt;
 &lt;track kind=captions src=brave.en.hoh.vtt srclang=en label="English for the Hard of Hearing"&gt;
 &lt;track kind=subtitles src=brave.fr.vtt srclang=fr lang=fr label="Fran&ccedil;ais"&gt;
 &lt;track kind=subtitles src=brave.de.vtt srclang=de lang=de label="Deutsch"&gt;
&lt;/video&gt;</pre>

   <p>(The <code title=attr-lang><a href=#attr-lang>lang</a></code> attributes on the last two describe the language of
   the <code title=attr-track-label><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 title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attribute.)</p>

  </div>

<!--TOPIC:Video and Audio-->
  <h4 id=media-elements><span class=secno>4.8.10 </span>Media elements</h4>

  <p><dfn id=media-element title="media element">Media elements</dfn> (<code><a href=#the-audio-element>audio</a></code> and <code><a href=#the-video-element>video</a></code>, in
  this specification) implement the following interface:</p>

  <pre class=idl>enum <dfn id=canplaytypeenum>CanPlayTypeEnum</dfn> { "" /* <a href=#dom-canplaytypeenum-nil title=dom-CanPlayTypeEnum-nil>empty string</a> */, "<a href=#dom-canplaytypeenum-maybe title=dom-CanPlayTypeEnum-maybe>maybe</a>", "<a href=#dom-canplaytypeenum-probably title=dom-CanPlayTypeEnum-probably>probably</a>" };
interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {

  // error state
  readonly attribute <a href=#mediaerror>MediaError</a>? <a href=#dom-media-error title=dom-media-error>error</a>;

  // network state
           attribute DOMString <a href=#dom-media-src title=dom-media-src>src</a>;
  readonly attribute DOMString <a href=#dom-media-currentsrc title=dom-media-currentSrc>currentSrc</a>;
           attribute DOMString <a href=#dom-media-crossorigin title=dom-media-crossOrigin>crossOrigin</a>;
  const unsigned short <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a> = 0;
  const unsigned short <a href=#dom-media-network_idle title=dom-media-NETWORK_IDLE>NETWORK_IDLE</a> = 1;
  const unsigned short <a href=#dom-media-network_loading title=dom-media-NETWORK_LOADING>NETWORK_LOADING</a> = 2;
  const unsigned short <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a> = 3;
  readonly attribute unsigned short <a href=#dom-media-networkstate title=dom-media-networkState>networkState</a>;
           attribute DOMString <a href=#dom-media-preload title=dom-media-preload>preload</a>;
<!--v3BUF  readonly attribute double <span title="dom-media-bufferingRate">bufferingRate</span>;
  readonly attribute boolean <span title="dom-media-bufferingThrottled">bufferingThrottled</span>;
-->  readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-media-buffered title=dom-media-buffered>buffered</a>;
  void <a href=#dom-media-load title=dom-media-load>load</a>();
  <a href=#canplaytypeenum>CanPlayTypeEnum</a> <a href=#dom-navigator-canplaytype title=dom-navigator-canPlayType>canPlayType</a>(DOMString type);

  // ready state
  const unsigned short <a href=#dom-media-have_nothing title=dom-media-HAVE_NOTHING>HAVE_NOTHING</a> = 0;
  const unsigned short <a href=#dom-media-have_metadata title=dom-media-HAVE_METADATA>HAVE_METADATA</a> = 1;
  const unsigned short <a href=#dom-media-have_current_data title=dom-media-HAVE_CURRENT_DATA>HAVE_CURRENT_DATA</a> = 2;
  const unsigned short <a href=#dom-media-have_future_data title=dom-media-HAVE_FUTURE_DATA>HAVE_FUTURE_DATA</a> = 3;
  const unsigned short <a href=#dom-media-have_enough_data title=dom-media-HAVE_ENOUGH_DATA>HAVE_ENOUGH_DATA</a> = 4;
  readonly attribute unsigned short <a href=#dom-media-readystate title=dom-media-readyState>readyState</a>;
  readonly attribute boolean <a href=#dom-media-seeking title=dom-media-seeking>seeking</a>;

  // playback state
           attribute double <a href=#dom-media-currenttime title=dom-media-currentTime>currentTime</a>;
  void <a href=#dom-media-fastseek title=dom-media-fastSeek>fastSeek</a>(double time);
  readonly attribute unrestricted double <a href=#dom-media-duration title=dom-media-duration>duration</a>;
  <span>Date</span> <a href=#dom-media-getstartdate title=dom-media-getStartDate>getStartDate</a>();
  readonly attribute boolean <a href=#dom-media-paused title=dom-media-paused>paused</a>;
           attribute double <a href=#dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate>defaultPlaybackRate</a>;
           attribute double <a href=#dom-media-playbackrate title=dom-media-playbackRate>playbackRate</a>;
  readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-media-played title=dom-media-played>played</a>;
  readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-media-seekable title=dom-media-seekable>seekable</a>;
  readonly attribute boolean <a href=#dom-media-ended title=dom-media-ended>ended</a>;
           attribute boolean <a href=#dom-media-autoplay title=dom-media-autoplay>autoplay</a>;
           attribute boolean <a href=#dom-media-loop title=dom-media-loop>loop</a>;
  void <a href=#dom-media-play title=dom-media-play>play</a>();
  void <a href=#dom-media-pause title=dom-media-pause>pause</a>();

  // media controller
           attribute DOMString <a href=#dom-media-mediagroup title=dom-media-mediaGroup>mediaGroup</a>;
           attribute <a href=#mediacontroller>MediaController</a>? <a href=#dom-media-controller title=dom-media-controller>controller</a>;

  // controls
           attribute boolean <a href=#dom-media-controls title=dom-media-controls>controls</a>;
           attribute double <a href=#dom-media-volume title=dom-media-volume>volume</a>;
           attribute boolean <a href=#dom-media-muted title=dom-media-muted>muted</a>;
           attribute boolean <a href=#dom-media-defaultmuted title=dom-media-defaultMuted>defaultMuted</a>;

  // tracks
  readonly attribute <a href=#audiotracklist>AudioTrackList</a> <a href=#dom-media-audiotracks title=dom-media-audioTracks>audioTracks</a>;
  readonly attribute <a href=#videotracklist>VideoTrackList</a> <a href=#dom-media-videotracks title=dom-media-videoTracks>videoTracks</a>;
  readonly attribute <a href=#texttracklist>TextTrackList</a> <a href=#dom-media-texttracks title=dom-media-textTracks>textTracks</a>;
  <a href=#texttrack>TextTrack</a> <a href=#dom-media-addtexttrack title=dom-media-addTextTrack>addTextTrack</a>(<a href=#texttrackkind>TextTrackKind</a> kind, optional DOMString label = "", optional DOMString language = "");
};</pre>

  <p>The <dfn id=media-element-attributes>media element attributes</dfn>, <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>, <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>,
  <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>,
  <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>, apply to all <a href=#media-element title="media element">media
  elements</a>. They are defined in this section.</p>

  <!-- proposed v2 (actually v3!) features:
    * frame forward / backwards / step(n) while paused
    * per-frame control: get current frame; set current frame
    * queue of content
      - pause current stream and insert content at front of queue to play immediately
      - pre-download another stream
      - add stream(s) to play at end of current stream
      - pause playback upon reaching a certain time
      - playlists, with the ability to get metadata out of them (e.g. xspf)
    * general meta data, implemented as getters (don't expose the whole thing)
      - getMetadata(key: string, language: string) => HTMLImageElement or string
      - onmetadatachanged (no context info)
      - general custom metadata store (ratings, etc.)
    * video: applying CSS filters
    * an event to notify people of when the video size changes
      (e.g. for chained Ogg streams of multiple independent videos)
      (or for when the current video track changes)
    * balance and 3D position audio
    * audio filters
    * audio synthesis (see <audio> section for use cases)
    * feedback to the script on how well the video is playing
       - frames per second?
       - skipped frames per second?
       - an event that reports playback difficulties?
       - an arbitrary quality metric?
    * bufferingRate/bufferingThrottled (see v3BUF)
    * events for when the user agent's controls get shown or hidden
      so that the author's controls can get away of the UA's
  -->

  <!-- v2 features that already have experimental implementations:
    * webkitPreservesPitch (for when playbackRate != 1.0)
  -->

  <p><a href=#media-element title="media element">Media elements</a> are used to present audio data, or video and
  audio data, to the user. This is referred to as <dfn id=media-data>media data</dfn> in this section, since this
  section applies equally to <a href=#media-element title="media element">media elements</a> for audio or for
  video.

  The term <dfn id=media-resource>media resource</dfn> is used to refer to the complete set of media data, e.g. the
  complete video file, or complete audio file.

  </p>

  <p>A <a href=#media-resource>media resource</a> can have multiple audio and video tracks. For the purposes of a
  <a href=#media-element>media element</a>, the video data of the <a href=#media-resource>media resource</a> is only that of the
  currently selected track (if any) given by the element's <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute, and the audio data of the <a href=#media-resource>media
  resource</a> is the result of mixing all the currently enabled tracks (if any) given by the
  element's <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> attribute.</p>

  <p class=note>Both <code><a href=#the-audio-element>audio</a></code> and <code><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><a href=#the-audio-element>audio</a></code> element has
  no playback area for visual content (such as video or captions), whereas the <code><a href=#the-video-element>video</a></code>
  element does.</p>

  <div class=impl>

  <p>Except where otherwise explicitly specified, the <a href=#task-source>task source</a> for all the tasks
  <a href=#queue-a-task title="queue a task">queued</a> in this section and its subsections is the <dfn id=media-element-event-task-source>media
  element event task source</dfn>.</p>

  </div>



  <h5 id=error-codes><span class=secno>4.8.10.1 </span>Error codes</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-error><a href=#dom-media-error>error</a></code></dt>

   <dd>

    <p>Returns a <code><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>

   </dd>

  </dl><div class=impl>

  <p>All <a href=#media-element title="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 title=concept-media-load-algorithm>resource selection algorithm</a> was last invoked. The
  <dfn id=dom-media-error title=dom-media-error><code>error</code></dfn> attribute, on getting, must return the
  <code><a href=#mediaerror>MediaError</a></code> object created for this last error, or null if there has not been an
  error.</p>

  </div>

  <pre class=idl>interface <dfn id=mediaerror>MediaError</dfn> {
  const unsigned short <a href=#dom-mediaerror-media_err_aborted title=dom-MediaError-MEDIA_ERR_ABORTED>MEDIA_ERR_ABORTED</a> = 1;
  const unsigned short <a href=#dom-mediaerror-media_err_network title=dom-MediaError-MEDIA_ERR_NETWORK>MEDIA_ERR_NETWORK</a> = 2;
  const unsigned short <a href=#dom-mediaerror-media_err_decode title=dom-MediaError-MEDIA_ERR_DECODE>MEDIA_ERR_DECODE</a> = 3;
  const unsigned short <a href=#dom-mediaerror-media_err_src_not_supported title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED>MEDIA_ERR_SRC_NOT_SUPPORTED</a> = 4;
  readonly attribute unsigned short <a href=#dom-mediaerror-code title=dom-MediaError-code>code</a>;
};</pre>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-error><a href=#dom-media-error>error</a></code> . <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code></dt>

   <dd>

    <p>Returns the current error's error code, from the list below.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-mediaerror-code title=dom-MediaError-code><code>code</code></dfn> attribute of a
  <code><a href=#mediaerror>MediaError</a></code> object must return the code for the error, which must be one of the
  following:</p>

  </div>

  <dl><dt><dfn id=dom-mediaerror-media_err_aborted title=dom-MediaError-MEDIA_ERR_ABORTED><code>MEDIA_ERR_ABORTED</code></dfn> (numeric value 1)</dt>

   <dd>The fetching process for the <a href=#media-resource>media resource</a> was aborted by the user agent at the
   user's request.</dd>

   <dt><dfn id=dom-mediaerror-media_err_network title=dom-MediaError-MEDIA_ERR_NETWORK><code>MEDIA_ERR_NETWORK</code></dfn> (numeric value 2)</dt>

   <dd>A network error of some description caused the user agent to stop fetching the <a href=#media-resource>media
   resource</a>, after the resource was established to be usable.</dd>

   <dt><dfn id=dom-mediaerror-media_err_decode title=dom-MediaError-MEDIA_ERR_DECODE><code>MEDIA_ERR_DECODE</code></dfn> (numeric value 3)</dt>

   <dd>An error of some description occurred while decoding the <a href=#media-resource>media resource</a>, after
   the resource was established to be usable.</dd>

   <dt><dfn id=dom-mediaerror-media_err_src_not_supported title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED><code>MEDIA_ERR_SRC_NOT_SUPPORTED</code></dfn> (numeric value 4)</dt>

   <dd>The <a href=#media-resource>media resource</a> indicated by the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
   attribute was not suitable.</dd>

  </dl><h5 id=location-of-the-media-resource><span class=secno>4.8.10.2 </span>Location of the media resource</h5>

  <p>The <dfn id=attr-media-src title=attr-media-src><code>src</code></dfn> content attribute on <a href=#media-element title="media
  element">media elements</a> gives the address of the media resource (video, audio) to show. The
  attribute, if present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
  spaces</a>.</p>

  <p>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on the <a href=#media-element>media
  element</a>, then the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute must also be
  specified.</p>

  <p>The <dfn id=attr-media-crossorigin title=attr-media-crossorigin><code>crossorigin</code></dfn> content attribute on
  <a href=#media-element title="media element">media elements</a> is a <a href=#cors-settings-attribute>CORS settings attribute</a>.</p>

  <div class=impl>

  <p>If a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute of a <a href=#media-element>media element</a> is set
  or changed, the user agent must invoke the <a href=#media-element>media element</a>'s <a href=#media-element-load-algorithm>media element load
  algorithm</a>. (<em>Removing</em> the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute does
  not do this, even if there are <code><a href=#the-source-element>source</a></code> elements present.)</p>

  <p>The <dfn id=dom-media-src title=dom-media-src><code>src</code></dfn> IDL attribute on <a href=#media-element title="media
  element">media elements</a> must <a href=#reflect>reflect</a> the content attribute of the same
  name.</p>

  <p>The <dfn id=dom-media-crossorigin title=dom-media-crossOrigin><code>crossOrigin</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> content
  attribute, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  </div>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code></dt>

   <dd>

    <p>Returns the address of the current <a href=#media-resource>media resource</a>.</p>

    <p>Returns the empty string when there is no <a href=#media-resource>media resource</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-currentsrc title=dom-media-currentSrc><code>currentSrc</code></dfn> IDL attribute is initially
  the empty string. Its value is changed by the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource
  selection algorithm</a> defined below.</p>

  </div>

  <p class=note>There are two ways to specify a <a href=#media-resource>media resource</a>, the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute, or <code><a href=#the-source-element>source</a></code> elements. The attribute
  overrides the elements.</p>



  <h5 id=mime-types><span class=secno>4.8.10.3 </span>MIME types</h5>

  <p>A <a href=#media-resource>media resource</a> can be described in terms of its <em>type</em>, specifically a
  <a href=#mime-type>MIME type</a>, in some cases with a <code title="">codecs</code> parameter. (Whether the
  <code title="">codecs</code> parameter is allowed or not depends on the MIME type.) <a href=#refsRFC4281>[RFC4281]</a></p>

  <p>Types are usually somewhat incomplete descriptions; for example "<code title="">video/mpeg</code>" doesn't say anything except what the container type is, and even a
  type like "<code title="">video/mp4; codecs="avc1.42E01E, mp4a.40.2"</code>" doesn't
  include information like the actual bitrate (only the maximum bitrate). Thus, given a type, a user
  agent can often only know whether it <em>might</em> be able to play media of that type (with
  varying levels of confidence), or whether it definitely <em>cannot</em> play media of that
  type.</p>

  <p><dfn id=a-type-that-the-user-agent-knows-it-cannot-render>A type that the user agent knows it cannot render</dfn> is one that describes a resource
  that the user agent definitely does not support, for example because it doesn't recognize the
  container type, or it doesn't support the listed codecs.</p>

  <p>The <a href=#mime-type>MIME type</a> "<code>application/octet-stream</code>" with no parameters is never
  <a href=#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 title=Content-Type>Content-Type metadata</a>
  when it is used to label a potential <a href=#media-resource>media resource</a>.</p>

  <p class=note>Only the <a href=#mime-type>MIME type</a> "<code>application/octet-stream</code>" with no
  parameters is special-cased here; if any parameter appears with it, it will be treated just like
  any other <a href=#mime-type>MIME type</a>. This is a deviation from the rule <!-- in RFC 2046, section 1,
  paragraph 3 --> that unknown <a href=#mime-type>MIME type</a> parameters should be ignored.</p> <!-- but not
  really a "willful violation" since it's not that the types are not being ignored, just that before
  the type is handled as a type, there's a special case for a particular set of strings -->

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-navigator-canPlayType><a href=#dom-navigator-canplaytype>canPlayType</a></code>(<var title="">type</var>)</dt>

   <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>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-navigator-canplaytype title=dom-navigator-canPlayType><code>canPlayType(<var title="">type</var>)</code></dfn> method must return <dfn id=dom-canplaytypeenum-nil title=dom-CanPlayTypeEnum-nil>the
  empty string</dfn> if <var title="">type</var> is <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot
  render</a> or is the type "<code>application/octet-stream</code>"; it must return "<dfn id=dom-canplaytypeenum-probably title=dom-CanPlayTypeEnum-probably><code>probably</code></dfn>" if the user agent is confident
  that the type represents a <a href=#media-resource>media resource</a> that it can render if used in with this
  <code><a href=#the-audio-element>audio</a></code> or <code><a href=#the-video-element>video</a></code> element; and it must return "<dfn id=dom-canplaytypeenum-maybe title=dom-CanPlayTypeEnum-maybe><code>maybe</code></dfn>" otherwise. Implementors are encouraged
  to return "<code title=dom-CanPlayTypeEnum-maybe><a href=#dom-canplaytypeenum-maybe>maybe</a></code>" unless the type can be
  confidently established as being supported or not. Generally, a user agent should never return
  "<code title=dom-CanPlayTypeEnum-probably><a href=#dom-canplaytypeenum-probably>probably</a></code>" for a type that allows the <code title="">codecs</code> parameter if that parameter is not present.</p>

  </div>

  <div class=example>

   <p>This script tests to see if the user agent supports a (fictional) new format to dynamically
   decide whether to use a <code><a href=#the-video-element>video</a></code> element or a plugin:</p>

   <pre>&lt;section id="video"&gt;
 &lt;p&gt;&lt;a href="playing-cats.nfv"&gt;Download video&lt;/a&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;script&gt;
 var videoSection = document.getElementById('video');
 var videoElement = document.createElement('video');
 var support = videoElement.canPlayType('video/x-new-fictional-format;codecs="kittens,bunnies"');
 if (support != "probably" &amp;&amp; "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);
 }
&lt;/script&gt;</pre>

  </div>

  <p class=note>The <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute of the
  <code><a href=#the-source-element>source</a></code> element allows the user agent to avoid downloading resources that use formats
  it cannot render.</p>


  <h5 id=network-states><span class=secno>4.8.10.4 </span>Network states</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code></dt>

   <dd>

    <p>Returns the current state of network activity for the element, from the codes in the list
    below.</p>

   </dd>

  </dl><div class=impl>

  <p>As <a href=#media-element title="media element">media elements</a> interact with the network, their current
  network activity is represented by the <dfn id=dom-media-networkstate title=dom-media-networkState><code>networkState</code></dfn> attribute. On getting, it must
  return the current network state of the element, which must be one of the following values:</p>

  </div>

  <dl><dt><dfn id=dom-media-network_empty title=dom-media-NETWORK_EMPTY><code>NETWORK_EMPTY</code></dfn> (numeric value 0)</dt>

   <dd>The element has not yet been initialized. All attributes are in their initial states.</dd>

   <dt><dfn id=dom-media-network_idle title=dom-media-NETWORK_IDLE><code>NETWORK_IDLE</code></dfn> (numeric value 1)</dt>

   <dd>The element<span class=impl>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource
   selection algorithm</a> is active and</span> has selected a <a href=#media-resource title="media
   resource">resource</a>, but it is not actually using the network at this time.</dd>

   <dt><dfn id=dom-media-network_loading title=dom-media-NETWORK_LOADING><code>NETWORK_LOADING</code></dfn> (numeric value 2)</dt>

   <dd>The user agent is actively trying to download data.</dd>

   <dt><dfn id=dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE><code>NETWORK_NO_SOURCE</code></dfn> (numeric value 3)</dt>

   <dd>The element<span class=impl>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource
   selection algorithm</a> is active, but it</span> has not yet found a <a href=#media-resource title="media
   resource">resource</a> to use.</dd>

  </dl><div class=impl>

  <p>The <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a> defined
  below describes exactly when the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
  attribute changes value and what events fire to indicate changes in this state.</p>

  </div>




  <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the media resource</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-load><a href=#dom-media-load>load</a></code>()</dt>

   <dd>

    <p>Causes the element to reset and start selecting and loading a new <a href=#media-resource>media resource</a>
    from scratch.</p>

   </dd>

  </dl><div class=impl>

  <p>All <a href=#media-element title="media element">media elements</a> have an <dfn id=autoplaying-flag>autoplaying flag</dfn>,
  which must begin in the true state, and a <dfn id=delaying-the-load-event-flag>delaying-the-load-event flag</dfn>, which must
  begin in the false state. While the <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> is true, the element
  must <a href=#delay-the-load-event>delay the load event</a> of its document.</p>

  <p>When the <dfn id=dom-media-load title=dom-media-load><code>load()</code></dfn> method on a <a href=#media-element>media
  element</a> is invoked, the user agent must run the <a href=#media-element-load-algorithm>media element load
  algorithm</a>.</p>

  <p>The <dfn id=media-element-load-algorithm>media element load algorithm</dfn> consists of the following steps.</p>

  <ol><li><p>Abort any already-running instance of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a> for this
   element.</li>

   <li>

    <p>If there are any <a href=#concept-task title=concept-task>tasks</a> from the <a href=#media-element>media
    element</a>'s <a href=#media-element-event-task-source>media element event task source</a> in one of the <a href=#task-queue title="task
    queue">task queues</a>, then remove those tasks.</p>

    <p>If there are any <a href=#concept-task title=concept-task>tasks</a> that were <a href=#queue-a-task title="queue a
    task">queued</a> by the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
    algorithm</a> (including the algorithms that it itself invokes) for this same <a href=#media-element>media
    element</a> from the <a href=#dom-manipulation-task-source>DOM manipulation task source</a> in one of the <a href=#task-queue title="task queue">task queues</a>, then remove those tasks.</p>

    <p class=note>Basically, pending events and callbacks for the media element are discarded when
    the media element starts loading a new resource.</p>

   </li>

   <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is set to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
   simple event</a> named <code title=event-media-abort><a href=#event-media-abort>abort</a></code> at the <a href=#media-element>media
   element</a>.</li>

   <li>

    <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
    is not set to <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then run these
    substeps:</p>

    <ol><li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the <a href=#media-element>media element</a>.</li>

     <li><p>If a fetching process is in progress for the <a href=#media-element>media
     element</a>, the user agent should stop it.</li>

     <!--(no point doing this, since we always call the resource selection algorithm synchronously
     at the end of this algorithm, and that switches it to NETWORK_NO_SOURCE and sets the flag)
     <li><p>Set the <code title="dom-media-networkState">networkState</code> attribute to <code
     title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>.</p></li>
     <li><p>Set the element's <span>show poster flag</span> to true.</p></li>
     -->

     <li><p><a href="#forget-the-media-element's-media-resource-specific-tracks">Forget the media element's media-resource-specific tracks</a>.</li>

     <li><p>If <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is not set to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then set it to that state.
     <!-- this can do the "report the controller state" thing -->
     </li>

     <li><p>If the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, then set it to
     true.</li>

     <li><p>If <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true, set it to false.</li>

     <li>

      <p>Set the <a href=#current-playback-position>current playback position</a> to 0.</p>

      <p>Set the <a href=#official-playback-position>official playback position</a> to 0.</p>

      <p>If this changed the <a href=#official-playback-position>official playback position</a>, then <a href=#queue-a-task>queue a task</a>
      to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element>media element</a>.</p>

     </li>

     <li><p>Set the <a href=#initial-playback-position>initial playback position</a> to 0.</li>

     <li><p>Set the <a href=#timeline-offset>timeline offset</a> to Not-a-Number (NaN).</li>

     <li>

      <p>Update the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute to Not-a-Number
      (NaN).</p>

      <p class=note>The user agent <a href=#durationChange>will not</a> fire a <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event for this particular change of
      the duration.</p>

     </li>

    </ol></li>

   <li><p>Set the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute to the value of
   the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> attribute.</li>

   <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to null and the
   <a href=#autoplaying-flag>autoplaying flag</a> to true.</li>

   <li><p>Invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a>.</li>

   <li>

    <p class=note>Playback of any previously playing <a href=#media-resource>media resource</a> for this element
    stops.</p>

   </li>

  </ol><p>The <dfn id=concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</dfn> for a
  <a href=#media-element>media element</a> is as follows. This algorithm is always invoked synchronously, but one
  of the first steps in the algorithm is to return and continue running the remaining steps
  asynchronously, meaning that it runs in the background with scripts and other <a href=#concept-task title=concept-task>tasks</a> running in parallel. In addition, this algorithm interacts
  closely with the <a href=#event-loop>event loop</a> mechanism; in particular, it has <a href=#synchronous-section title="synchronous
  section">synchronous sections</a> (which are triggered as part of the <a href=#event-loop>event loop</a>
  algorithm). Steps in such sections are marked with &#x231b;.</p>

  <ol><!-- precondition: networkState == NETWORK_EMPTY or we're coming straight from the algorithm above
                      (where setting it to empty is commented out) --><li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
   the <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code> value.</li>

   <li><p>Set the element's <a href=#show-poster-flag>show poster flag</a> to true.</li>

   <li><p>Set the <a href=#media-element>media element</a>'s <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to true
   (this <a href=#delay-the-load-event title="delay the load event">delays the load event</a>).</li>

   <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to continue. The <a href=#synchronous-section>synchronous
   section</a> consists of all the remaining steps of this algorithm until the algorithm says the
   <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous
   section">synchronous sections</a> are marked with &#x231b;.)</li>

   <li>

    <p>&#x231b; If the <a href=#media-element>media element</a>'s <a href=#blocked-on-parser>blocked-on-parser</a> flag is false,
    then <a href=#populate-the-list-of-pending-text-tracks>populate the list of pending text tracks</a>.</p>

   </li>

   <li>

    <p>&#x231b; If the <a href=#media-element>media element</a> has a <code title=attr-media-src><a href=#attr-media-src>src</a></code>
    attribute, then let <var title="">mode</var> be <i title="">attribute</i>.</p>

    <p>&#x231b; Otherwise, if the <a href=#media-element>media element</a> does not have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute but has a <code><a href=#the-source-element>source</a></code> element child, then
    let <var title="">mode</var> be <i title="">children</i> and let <var title="">candidate</var>
    be the first such <code><a href=#the-source-element>source</a></code> element child in <a href=#tree-order>tree order</a>.</p>

    <p>&#x231b; Otherwise the <a href=#media-element>media element</a> has neither a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor a <code><a href=#the-source-element>source</a></code> element child: set the
    <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code><!-- no need to set the <span>show poster
    flag</span> to true since we set it up there already -->, and abort these steps; the
    <a href=#synchronous-section>synchronous section</a> ends.</p>

   </li>

   <li><p>&#x231b; Set the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>

   <li><p>&#x231b; <a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> at the <a href=#media-element>media element</a>.</li>

   <li>

    <p>If <var title="">mode</var> is <i title="">attribute</i>, then run these substeps:</p>

    <ol><li><p>&#x231b; If the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
     attribute's value is the empty string, then end the <a href=#synchronous-section>synchronous section</a>, and jump
     down to the <i title="">failed with attribute</i> step below.</li>

     <li><p>&#x231b; Let <var title="">absolute URL</var> be the <a href=#absolute-url>absolute URL</a> that
     would have resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
     specified by the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute's value relative to the
     <a href=#media-element>media element</a> when the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was last
     changed.</p> <!-- i.e. changing xml:base or <base> after src="" has no effect -->

     <li><p>&#x231b; If <var title="">absolute URL</var> was obtained successfully, set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to <var title="">absolute
     URL</var>.</li>

     <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the remaining steps
     asynchronously.</li>

     <li><p>If <var title="">absolute URL</var> was obtained successfully, run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch algorithm</a> with <var title="">absolute
     URL</var>. If that algorithm returns without aborting <em>this</em> one, then the load
     failed.</li>

     <li>

      <p><i title="">Failed with attribute</i>: Reaching this step indicates that the media resource
      failed to load or that the given <a href=#url>URL</a> could not be <a href=#resolve-a-url title="resolve a
      url">resolved</a>. <a href=#queue-a-task>Queue a task</a> to run the following steps, using the
      <a href=#dom-manipulation-task-source>DOM manipulation task source</a>:</p>

      <ol><li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
       <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute
       is set to <code title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED><a href=#dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_SUPPORTED</a></code>.</li>

       <li><p><a href="#forget-the-media-element's-media-resource-specific-tracks">Forget the media element's media-resource-specific tracks</a>.</li>

       <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
       to the <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code> value.</li>

       <li><p>Set the element's <a href=#show-poster-flag>show poster flag</a> to true.</li>

       <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-media-error><a href=#event-media-error>error</a></code> at
       the <a href=#media-element>media element</a>.</li>

       <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying the load event</a>.</li>

      </ol></li>

     <li><p>Wait for the <a href=#concept-task title=concept-task>task</a> queued by the previous step to have
     executed.</li>

     <li><p>Abort these steps. Until the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method is
     invoked or the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute is changed, the element won't
     attempt to load another resource.</li>
     <!-- it took its ball and went home, sulking. -->

    </ol><p>Otherwise, the <code><a href=#the-source-element>source</a></code> elements will be used; run these substeps:</p>

    <ol><li>

      <p>&#x231b; Let <var title="">pointer</var> be a position defined by two adjacent nodes in the
      <a href=#media-element>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 title="">pointer</var>, and the
      other node is the node after <var title="">pointer</var>. Initially, let <var title="">pointer</var> be the position between the <var title="">candidate</var> node and the
      next node, if there are any, or the end of the list, if it is the last node.</p>

      <p>As nodes are inserted and removed into the <a href=#media-element>media element</a>, <var title="">pointer</var> must be updated as follows:</p>

      <dl><dt>If a new node is inserted between the two nodes that define <var title="">pointer</var></dt>

       <dd>Let <var title="">pointer</var> be the point between the node before <var title="">pointer</var> and the new node. In other words, insertions at <var title="">pointer</var> go after <var title="">pointer</var>.</dd>

       <dt>If the node before <var title="">pointer</var> is removed</dt>

       <dd>Let <var title="">pointer</var> be the point between the node after <var title="">pointer</var> and the node before the node after <var title="">pointer</var>. In
       other words, <var title="">pointer</var> doesn't move relative to the remaining nodes.</dd>

       <dt>If the node after <var title="">pointer</var> is removed</dt>

       <dd>Let <var title="">pointer</var> be the point between the node before <var title="">pointer</var> and the node after the node before <var title="">pointer</var>. Just
       as with the previous case, <var title="">pointer</var> doesn't move relative to the remaining
       nodes.</dd>

      </dl><p>Other changes don't affect <var title="">pointer</var>.</p>

     </li>

     <li><p>&#x231b; <i>Process candidate</i>: If <var title="">candidate</var> does not have a
     <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute, or if its <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute's value is the empty string, then end the
     <a href=#synchronous-section>synchronous section</a>, and jump down to the <i title="">failed with elements</i> step
     below.</li>

     <li><p>&#x231b; Let <var title="">absolute URL</var> be the <a href=#absolute-url>absolute URL</a> that
     would have resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
     specified by <var title="">candidate</var>'s <code title=attr-source-src><a href=#attr-source-src>src</a></code>
     attribute's value relative to the <var title="">candidate</var> when the <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute was last changed.</p> <!-- i.e. changing xml:base
     or <base> after src="" has no effect -->

     <li><p>&#x231b; If <var title="">absolute URL</var> was not obtained successfully, then end the
     <a href=#synchronous-section>synchronous section</a>, and jump down to the <i title="">failed with elements</i> step
     below.</li>

     <li><p>&#x231b; If <var title="">candidate</var> has a <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute whose value, when parsed as a <a href=#mime-type>MIME
     type</a> (including any codecs described by the <code title="">codecs</code> parameter, for
     types that define that parameter), represents <a href=#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>synchronous section</a>, and jump down to the <i title="">failed with elements</i> step below.</li>

     <li><p>&#x231b; If <var title="">candidate</var> has a <code title=attr-source-media><a href=#attr-source-media>media</a></code> attribute whose value does not <a href=#matches-the-environment title="matches the
     environment">match the environment</a>, then end the <a href=#synchronous-section>synchronous section</a>, and
     jump down to the <i title="">failed with elements</i> step below.</li>

     <li><p>&#x231b; Set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to <var title="">absolute URL</var>.</li>

     <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the remaining steps
     asynchronously.</li>

     <li><p>Run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch algorithm</a> with
     <var title="">absolute URL</var>. If that algorithm returns without aborting <em>this</em> one,
     then the load failed.</li>

     <li><p><i title="">Failed with elements</i>: <a href=#queue-a-task>Queue a task</a>, using the <a href=#dom-manipulation-task-source>DOM
     manipulation task source</a>, to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <var title="">candidate</var> element.</li>

     <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The <a href=#synchronous-section>synchronous section</a>
     consists of all the remaining steps of this algorithm until the algorithm says the
     <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous
     section">synchronous sections</a> are marked with &#x231b;.)</li>

     <li><p>&#x231b; <a href="#forget-the-media-element's-media-resource-specific-tracks">Forget the media element's media-resource-specific
     tracks</a>.</li>

     <li><p>&#x231b; <i title="">Find next candidate</i>: Let <var title="">candidate</var> be
     null.</li>

     <li><p>&#x231b; <i title="">Search loop</i>: If the node after <var title="">pointer</var> is
     the end of the list, then jump to the <i title="">waiting</i> step below.</li>

     <li><p>&#x231b; If the node after <var title="">pointer</var> is a <code><a href=#the-source-element>source</a></code> element,
     let <var title="">candidate</var> be that element.</li>

     <li><p>&#x231b; Advance <var title="">pointer</var> so that the node before <var title="">pointer</var> is now the node that was after <var title="">pointer</var>, and the node
     after <var title="">pointer</var> is the node after the node that used to be after <var title="">pointer</var>, if any.</li>

     <li><p>&#x231b; If <var title="">candidate</var> is null, jump back to the <i title="">search
     loop</i> step. Otherwise, jump back to the <i title="">process candidate</i> step.</li>

     <li><p>&#x231b; <i title="">Waiting</i>: Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to the <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code> value.</li>

     <li><p>&#x231b; Set the element's <a href=#show-poster-flag>show poster flag</a> to true.</li>

     <li><p>&#x231b; Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This
     stops <a href=#delay-the-load-event title="delay the load event">delaying the load event</a>.</li>

     <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the remaining steps
     asynchronously.</li>

     <li><p>Wait until the node after <var title="">pointer</var> is a node other than the end of
     the list. (This step might wait forever.)</li>

     <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The <a href=#synchronous-section>synchronous section</a>
     consists of all the remaining steps of this algorithm until the algorithm says the
     <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous
     section">synchronous sections</a> are marked with &#x231b;.)</li>

     <li><p>&#x231b; Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> back to true (this
     <a href=#delay-the-load-event title="delay the load event">delays the load event</a> again, in case it hasn't been
     fired yet).</p>

     <li><p>&#x231b; Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> back to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>

     <li><p>&#x231b; Jump back to the <i title="">find next candidate</i> step above.</li>

    </ol></li>

  </ol><p>The <dfn id=concept-media-load-resource title=concept-media-load-resource>resource fetch algorithm</dfn> for a <a href=#media-element>media
  element</a> and a given <a href=#absolute-url>absolute URL</a> is as follows:</p>

  <ol><li><p>Let the <var title="">current media resource</var> be the resource given by the
   <a href=#absolute-url>absolute URL</a> passed to this algorithm. This is now the element's <a href=#media-resource>media
   resource</a>.</li>

   <li><p>Remove all <a href=#media-resource-specific-text-track title="media-resource-specific text track">media-resource-specific text
   tracks</a> from the <a href=#media-element>media element</a>'s <a href=#list-of-pending-text-tracks>list of pending text tracks</a>, if
   any.</p>

   <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 title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute's <code title=attr-media-preload-none><a href=#attr-media-preload-none>none</a></code> keyword).</p>

    <ol><li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>.</li>

     <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code> at the element, using the <a href=#dom-manipulation-task-source>DOM manipulation
     task source</a>.</li>

     <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying the load event</a>.</li>

     <li><p>Wait for the task to be run.</li>

     <li><p>Wait for an implementation-defined event (e.g. the user requesting that the media
     element begin playback).</li>

     <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> back to true (this <a href=#delay-the-load-event title="delay the load event">delays the load event</a> again, in case it hasn't been fired
     yet).</p>

     <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>

    </ol></li>

   <li>

    <p>Perform a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the <var title="">current media resource</var>'s <a href=#absolute-url>absolute URL</a>, with the <i>mode</i> being
    the state of the <a href=#media-element>media element</a>'s <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> content attribute, the <i title="">origin</i>
    being the <a href=#origin>origin</a> of the <a href=#media-element>media element</a>'s <code><a href=#document>Document</a></code>, and the
    <i>default origin behaviour</i> set to <i>taint</i>.</p>

    <p>The resource obtained in this fashion, if any, contains the <a href=#media-data>media data</a>. It can
    be <a href=#cors-same-origin>CORS-same-origin</a> or <a href=#cors-cross-origin>CORS-cross-origin</a>; this affects whether
    subtitles referenced in the <a href=#media-data>media data</a> are exposed in the API and, for
    <code><a href=#the-video-element>video</a></code> elements, whether a <code><a href=#the-canvas-element>canvas</a></code> gets tainted when the video is drawn
    on it.</p>

    <p>While the load is not suspended (see below), every 350ms (&plusmn;200ms) or for every byte
    received, whichever is <em>least</em> frequent, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
    event</a> named <code title=event-media-progress><a href=#event-media-progress>progress</a></code> at the element.</p>

    <p>The <dfn id=stall-timeout>stall timeout</dfn> is a user-agent defined length of time, which should be about
    three seconds. When a <a href=#media-element>media element</a> that is actively attempting to obtain
    <a href=#media-data>media data</a> has failed to receive any data for a duration equal to the <a href=#stall-timeout>stall
    timeout</a>, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
    event</a> named <code title=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>media data</a> downloads.
    When a <a href=#media-element>media element</a>'s download has been blocked altogether, the user agent must
    act as if it was stalled (as opposed to acting as if the connection was closed). The rate of the
    download may also be throttled automatically by the user agent, e.g. to balance the download
    with other connections sharing the same bandwidth.</p>

    <p id=resourceSuspend>User agents may decide to not download more content at any time, e.g.
    after buffering five minutes of a one hour media resource, while waiting for the user to decide
    whether to play the resource or not, while waiting for user input in an interactive resource, or
    when the user navigates away from the page. When a <a href=#media-element>media element</a>'s download has
    been suspended, the user agent must <a href=#queue-a-task>queue a task</a>, using the <a href=#dom-manipulation-task-source>DOM manipulation
    task source</a>, to set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and <a href=#fire-a-simple-event>fire a simple event</a> named
    <code title=event-media-suspend><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>queue a task</a> to set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>. Between the queuing of these tasks,
    the load is suspended (so <code title=event-media-progress><a href=#event-media-progress>progress</a></code> events don't fire,
    as described above).</p>

    <p class=note>The <code title=attr-media-preload><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 title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute.</p>

    <p>When a user agent decides to completely stall a download, e.g. if it is waiting until the
    user starts playback before downloading any further content, the element's
    <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> must be set to false. This stops <a href=#delay-the-load-event title="delay
    the load event">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 class=critical>This specification does not currently say whether or how to check the MIME
    types of the media resources, or whether or how to perform file type sniffing using the actual
    file data. Implementors differ in their intentions on this matter and it is therefore unclear
    what the right solution is. In the absence of any requirement here, the HTTP specification's
    strict requirement to follow the Content-Type header prevails ("Content-Type specifies the media
    type of the underlying data." ... "If and only if the media type is not given by a Content-Type
    field, the recipient MAY attempt to guess the media type via inspection of its content
    and<!---->/<!---->or the name extension(s) of the URI used to identify the resource.").</p>

    <p>The <a href=#networking-task-source>networking task source</a> <a href=#concept-task title=concept-task>tasks</a> to process
    the data as it is being fetched must, when appropriate, include the relevant substeps from the
    following list:</p>

    <dl class=switch><dt>If the <a href=#media-data>media data</a> cannot be fetched at all, due to network errors, causing the
     user agent to give up trying to fetch the resource</dt>

     <dt>If the <a href=#media-data>media data</a> can be fetched but is found by inspection to be in an
     unsupported format, or can otherwise not be rendered at all</dt>

     <dd>

      <p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in other protocols), and other fatal
      network errors that occur before the user agent has established whether the <var title="">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>

       <li><p>Abort this subalgorithm, returning to the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a>.</p>

      </ol></dd>


     <!-- insert content sniffing here if we want to define that -->
     <!-- (in practice I don't think that's necessary since it's not like you can do anything with
     the resource if you sniff it as the wrong type) -->


     <dt id=found-another-audio-track>If the <a href=#media-resource>media resource</a> is found to have an audio
     track</dt>

     <dd>

      <ol><li><p>Create an <code><a href=#audiotrack>AudioTrack</a></code> object to represent the audio track.</li>

       <li><p>Update the <a href=#media-element>media element</a>'s <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> attribute's <code><a href=#audiotracklist>AudioTrackList</a></code>
       object with the new <code><a href=#audiotrack>AudioTrack</a></code> object.</li>

       <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and
       that uses the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to the new
       <code><a href=#audiotrack>AudioTrack</a></code> object, at this <code><a href=#audiotracklist>AudioTrackList</a></code> object.</li>

      </ol></dd>


     <dt id=found-another-video-track>If the <a href=#media-resource>media resource</a> is found to have a video
     track</dt>

     <dd>

      <ol><li><p>Create a <code><a href=#videotrack>VideoTrack</a></code> object to represent the video track.</li>

       <li><p>Update the <a href=#media-element>media element</a>'s <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute's <code><a href=#videotracklist>VideoTrackList</a></code>
       object with the new <code><a href=#videotrack>VideoTrack</a></code> object.</li>

       <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and that
       uses the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to the new
       <code><a href=#videotrack>VideoTrack</a></code> object, at this <code><a href=#videotracklist>VideoTrackList</a></code> object.</li>

      </ol></dd>


     <dt id=getting-media-metadata>Once enough of the <a href=#media-data>media data</a> has been fetched to
     determine the duration of the <a href=#media-resource>media resource</a>, its dimensions, and other
     metadata</dt>

     <dd>

      <p>This indicates that the resource is usable. The user agent must follow these substeps:</p>

      <ol><li>

        <p><a href=#defineTimeline>Establish the media timeline</a> for the purposes of the <a href=#current-playback-position>current playback
        position</a>, the <a href=#earliest-possible-position>earliest possible position</a>, and the <a href=#initial-playback-position>initial playback
        position</a>, based on the <a href=#media-data>media data</a>.</p>

       </li>

       <li>

        <p>Update the <a href=#timeline-offset>timeline offset</a> to the date and time that corresponds to the zero
        time in the <a href=#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>media resource</a>, the <a href=#timeline-offset>timeline
        offset</a> must be set to Not-a-Number (NaN).</p>

       </li>

       <li><p>Set the <a href=#current-playback-position>current playback position</a> and the <a href=#official-playback-position>official playback
       position</a> to the <a href=#earliest-possible-position>earliest possible position</a>.</li>

       <li>

        <p>Update the <code title=dom-media-duration><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>media timeline</a> established
        above. If it is not known (e.g. a stream that is in principle infinite), update the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute to the value positive Infinity.</p>

        <p class=note>The user agent <a href=#durationChange>will</a> <a href=#queue-a-task>queue a task</a>
        to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the element at this point.</p>

       </li>

       <li><p>For <code><a href=#the-video-element>video</a></code> elements, set the <code title=dom-video-videoWidth><a href=#dom-video-videowidth>videoWidth</a></code> and <code title=dom-video-videoHeight><a href=#dom-video-videoheight>videoHeight</a></code> attributes.</li>

       <li>

        <p>Set the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute to <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>.</p>

        <p class=note>A <code title=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 title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute to a new value.</p>

        <!-- this can also do the "report the controller state" thing -->

       </li>

       <li><p>Let <var title="">jumped</var> be false.</li>

       <li><p>If the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback start position</a> is
       greater than zero, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time, and let <var title="">jumped</var> be true.</li>

       <li><p>Let the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback
       start position</a> be zero.</li>

       <li>

        <p>If either the <a href=#media-resource>media resource</a> or the address of the <var title="">current
        media resource</var> indicate a particular start time, then set the <a href=#initial-playback-position>initial playback
        position</a> to that time and, if <var title="">jumped</var> is still false, <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time and let <var title="">jumped</var> be
        true.</p>

        <p class=example>For example, with media formats that support the <cite>Media Fragments
        URI</cite> fragment identifier syntax, the fragment identifier can be used to indicate a
        start position. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

       </li>

       <li>

        <p>If either the <a href=#media-resource>media resource</a> or the address of the <var title="">current
        media resource</var> indicate a particular set of audio or video tracks to enable, then the
        selected audio tracks must be enabled in the element's <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> object, and, of the selected video tracks,
        the one that is listed first in the element's <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> object must be selected.</p>

       </li>

       <li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then:
       if <var title="">jumped</var> is true and the <a href=#initial-playback-position>initial playback position</a>,
       relative to the <a href=#current-media-controller>current media controller</a>'s timeline, is greater than the
       <a href=#current-media-controller>current media controller</a>'s <a href=#media-controller-position>media controller position</a>, then
       <a href=#seek-the-media-controller>seek the media controller</a> to the <a href=#media-element>media element</a>'s <a href=#initial-playback-position>initial
       playback position</a>, relative to the <a href=#current-media-controller>current media controller</a>'s timeline;
       otherwise, <a href=#dom-media-seek title=dom-media-seek>seek</a> the <a href=#media-element>media element</a> to the
       <a href=#media-controller-position>media controller position</a>, relative to the <a href=#media-element>media element</a>'s
       timeline.</li> <!-- i.e. "bring the media element up to speed with its new media
       controller" --> <!-- we do this because otherwise the fragment identifier initial position is
       lost. Basically this means that if you are attached to a media controller when you load your
       resource, and you have a fragment identifier with a start time, you'll jump the media
       controller to that time if it's not already past it. (So if there are several, you'll jump
       the media controller to the furthest one in the timeline.) --> <!-- note that this can also
       trigger "report the controller state" since it can change the element's readyState -->

      </ol><p>Once the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute reaches <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, <a href=#fire-loadeddata>after
      the <code title=event-media-loadeddata>loadeddata</code> event has been fired</a>, set the
      element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event title="delay
      the load event">delaying the load event</a>.</p>

      <p class=note>A user agent that is attempting to reduce network usage while still fetching
      the metadata for each <a href=#media-resource>media resource</a> would also stop buffering at this point,
      following <a href=#resourceSuspend>the rules described previously</a>, which involve the
      <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute switching to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value and a <code title=event-suspend>suspend</code> event firing.</p>

      <p class=note>The user agent is <em>required</em> to determine the duration of the
      <a href=#media-resource>media resource</a> and go through this step before playing.</p> <!-- actually defined
      in the 'duration' section -->

     </dd>


     <dt>Once the entire <a href=#media-resource>media resource</a> has been <a href=#fetch title=fetch>fetched</a>
     (but potentially before any of it has been decoded)</dt>

     <dd>

      <p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-media-progress><a href=#event-media-progress>progress</a></code>
      at the <a href=#media-element>media element</a>.</p>

      <p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and <a href=#fire-a-simple-event>fire a simple event</a> named
      <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code> at the <a href=#media-element>media element</a>.</p>

      <p>If the user agent ever discards any <a href=#media-data>media data</a> and then needs to resume the
      network activity to obtain it again, then it must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</p>

      <p class=note>If the user agent can keep the <a href=#media-resource>media resource</a> loaded, then the
      algorithm will continue to its final step below, which aborts the algorithm.</p><!-- see FINAL
      STEP below -->

     </dd>


     <dt>If the connection is interrupted after some <a href=#media-data>media data</a> has been received,
     causing the user agent to give up trying to fetch the resource</dt>

     <dd>

      <p>Fatal network errors that occur after the user agent has established whether the <var title="">current media resource</var> is usable (i.e. once the <a href=#media-element>media element</a>'s
      <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is no longer <code title=dom-media-HAVE_NOTHING><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>

       <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
       <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute
       is set to <code title=dom-MediaError-MEDIA_ERR_NETWORK><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code>.</li>

       <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-media-error><a href=#event-media-error>error</a></code> at
       the <a href=#media-element>media element</a>.</li>

       <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
       to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.</li>

       <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying the load event</a>.</li>

       <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
       algorithm</a>.</li>

      </ol></dd>


     <dt id=fatal-decode-error>If the <a href=#media-data>media data</a> is corrupted</dt>

     <dd>

      <p>Fatal errors in decoding the <a href=#media-data>media data</a> that occur after the user agent has
      established whether the <var title="">current media resource</var> is usable must cause the
      user agent to execute the following steps:</p>

      <ol><li><p>The user agent should cancel the fetching process.</li>

       <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
       <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute
       is set to <code title=dom-MediaError-MEDIA_ERR_DECODE><a href=#dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a></code>.</li>

       <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-media-error><a href=#event-media-error>error</a></code> at
       the <a href=#media-element>media element</a>.</li>

       <li>

        <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
        attribute has a value equal to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, set
        the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to the
        <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> value, set the element's
        <a href=#show-poster-flag>show poster flag</a> to true, and <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the element.</p>

        <p>Otherwise, set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
        attribute to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.</p>

       </li>

       <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying the load event</a>.</li>

       <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
       algorithm</a>.</li>

      </ol></dd>


     <dt>If the <a href=#media-data>media data</a> fetching process is aborted by the user</dt>

     <dd>

      <p>The fetching process is aborted by the user, e.g. because the user 
      pressed a "stop" button, the user agent must execute the following steps. These steps are not
      followed if the <code title=dom-media-load><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>

       <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
       <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute
       is set to <code title=dom-MediaError-MEDIA_ERR_ABORTED><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>.</li>

       <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-media-abort><a href=#event-media-abort>abort</a></code> at
       the <a href=#media-element>media element</a>.</li>

       <li>

        <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
        attribute has a value equal to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, set
        the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to the
        <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> value, set the element's
        <a href=#show-poster-flag>show poster flag</a> to true, and <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the element.</p>

        <p>Otherwise, set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
        attribute to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.</p>

       </li>

       <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying the load event</a>.</li>

       <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
       algorithm</a>.</li>

      </ol></dd>


     <dt id=non-fatal-media-error>If the <a href=#media-data>media data</a> can be fetched but has non-fatal
     errors or uses, in part, codecs that are unsupported, preventing the user agent from rendering
     the content completely correctly but not preventing playback altogether</dt>

     <dd>

      <p>The server returning data that is partially usable but cannot be optimally rendered must
      cause the user agent to render just the bits it can handle, and ignore the rest.</p>

      <!-- v2: fire a 'warning' event and set the 'error' flag to 'MEDIA_ERR_SUBOPTIMAL' or something -->

     </dd>


     <dt id=found-a-media-resource-specific-timed-track>If the <a href=#media-resource>media resource</a> is
     found to declare a <a href=#media-resource-specific-text-track>media-resource-specific text track</a> that the user agent
     supports</dt>

     <dd>

      <p>If the <a href=#media-data>media data</a> is <a href=#cors-same-origin>CORS-same-origin</a>, run the <a href=#steps-to-expose-a-media-resource-specific-text-track>steps to
      expose a media-resource-specific text track</a> with the relevant data.</p>

      <p class=note>Cross-origin videos do not expose their subtitles, since that would allow
      attacks such as hostile sites reading subtitles from confidential videos on a user's
      intranet.</p>

     </dd>

    </dl><p>When the <a href=#networking-task-source>networking task source</a> has <a href=#queue-a-task title="queue a task">queued</a> the
    last <a href=#concept-task title=concept-task>task</a> as part of <a href=#fetch title=fetch>fetching</a> the
    <a href=#media-resource>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 next step.
    This might never happen, e.g. when streaming an infinite resource such as Web radio, or if the
    resource is longer than the user agent's ability to cache data.</p>

    <p>While the user agent might still need network access to obtain parts of the <a href=#media-resource>media
    resource</a>, the user agent must remain on this step.</p>

    <p class=example>For example, if the user agent has discarded the first half of a video, the
    user agent will remain at this step even once the <a href=#ended-playback title="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 title="ended playback">playback has ended</a>, the user agent
    will end up firing a <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code> event, as described
    earlier.</p>

   </li>

   <!-- this step is mentioned above, search for "FINAL STEP" -->
   <li><p>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 title=concept-media-load-algorithm>resource selection algorithm</a>.</li>

  </ol><p>When a <a href=#media-element>media element</a> is to <dfn id="forget-the-media-element's-media-resource-specific-tracks">forget the media element's media-resource-specific
  tracks</dfn>, the user agent must remove from the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text
  tracks</a> all the <a href=#media-resource-specific-text-track title="media-resource-specific text track">media-resource-specific
  text tracks</a>, then empty the <a href=#media-element>media element</a>'s <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> attribute's <code><a href=#audiotracklist>AudioTrackList</a></code> object,
  then empty the <a href=#media-element>media element</a>'s <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code>
  attribute's <code><a href=#videotracklist>VideoTrackList</a></code> object. No events (in particular, no <code title=event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code> events) are fired as part of this; the <code title=event-media-error><a href=#event-media-error>error</a></code> and <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code>
  events, fired by the algorithms that invoke this one, can be used instead.</p>

  </div>

  <hr><p>The <dfn id=attr-media-preload title=attr-media-preload><code>preload</code></dfn> attribute is an <a href=#enumerated-attribute>enumerated
  attribute</a>. The following table lists the keywords and states for the attribute &mdash; 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>media resource</a> is being
  buffered or played; the descriptions in the table below are to be interpreted with that in
  mind.</p>

  <table><thead><tr><th> Keyword
     <th> State
     <th> Brief description
   <tbody><tr><td><dfn id=attr-media-preload-none title=attr-media-preload-none><code>none</code></dfn>
     <td><dfn id=attr-media-preload-none-state title=attr-media-preload-none-state>None</dfn>
     <td>Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to 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 id=attr-media-preload-metadata title=attr-media-preload-metadata><code>metadata</code></dfn>
     <td><dfn id=attr-media-preload-metadata-state title=attr-media-preload-metadata-state>Metadata</dfn>
     <td>Hints to the user agent that the author does not expect the user to need the media resource, but that fetching the resource metadata (dimensions, track list, duration, etc), and maybe even the first few frames, is reasonable. If the user agent precisely fetches no more than the metadata, then the <a href=#media-element>media element</a> will end up with its <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute set to <code title=dom-media-HAVE_METADATA><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 title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>.
         When the media resource is playing, hints to the user agent that bandwidth is to be considered scarce, e.g. suggesting throttling the download so that the media data is obtained at the slowest possible rate that still maintains consistent playback.
    <tr><td><dfn id=attr-media-preload-auto title=attr-media-preload-auto><code>auto</code></dfn>
     <td><dfn id=attr-media-preload-auto-state title=attr-media-preload-auto-state>Automatic</dfn>
     <td>Hints to the user agent that the user agent can put the user's needs first without risk to the server, up to and including optimistically downloading the entire resource.
  </table><p>The empty string is also a valid keyword, and maps to the <a href=#attr-media-preload-auto-state title=attr-media-preload-auto-state>Automatic</a> state. The attribute's <i>missing value
  default</i> is user-agent defined, though the <a href=#attr-media-preload-metadata-state title=attr-media-preload-metadata-state>Metadata</a> state is suggested as a compromise
  between reducing server load and providing an optimal user experience.</p>

  <p class=note>Authors might switch the attribute from "<code title=attr-media-preload-none><a href=#attr-media-preload-none>none</a></code>" or "<code title=attr-media-preload-metadata><a href=#attr-media-preload-metadata>metadata</a></code>" to "<code title=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>

  <div class=impl>

  <p>The <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute is intended to provide a hint to
  the user agent about what the author thinks will lead to the best user experience. The attribute
  may be ignored altogether, for example based on explicit user preferences or based on the
  available connectivity.</p>

  <p>The <dfn id=dom-media-preload title=dom-media-preload><code>preload</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values>limited to only known
  values</a>.</p>

  </div>

  <p class=note>The <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute can override the
  <code title=attr-media-preload><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 title=attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute). Including both is not an error, however.</p>

  <hr><!--v3BUF (when readding this, also add a domintro block)
  <p>The <dfn title="dom-media-bufferingRate"><code>bufferingRate</code></dfn> attribute must return
  the average number of bits received per second for the current download over the past few seconds.
  If there is no download in progress, the attribute must return 0.</p>

  <p>The <dfn title="dom-media-bufferingThrottled"><code>bufferingThrottled</code></dfn> attribute
  must return true if the user agent is intentionally throttling the bandwidth used by the download
  (including when throttling to zero to pause the download altogether), and false otherwise.</p>

  <hr>
--><dl class=domintro><dt><var title="">media</var> . <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the ranges of the <a href=#media-resource>media
    resource</a> that the user agent has buffered.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-buffered title=dom-media-buffered><code>buffered</code></dfn> attribute must return a new
  static <a href=#normalized-timeranges-object>normalized <code>TimeRanges</code> object</a> that represents the ranges of the
  <a href=#media-resource>media resource</a>, if any, that the user agent has buffered, at the time the attribute
  is evaluated. Users agents must accurately determine the ranges available, even for media streams
  where this can only be determined by tedious inspection.</p>

  <p class=note>Typically this will be a single range anchored at the zero point, but if, e.g. the
  user agent uses HTTP range requests in response to seeking, then there could be multiple
  ranges.</p>

  <p>User agents may discard previously buffered data.</p>

  <p class=note>Thus, a time position included within a range of the objects return by the <code title=dom-media-buffered><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>

  </div>



  <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets into the media resource</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code></dt>

   <dd>

    <p>Returns the length of the <a href=#media-resource>media resource</a>, in seconds, assuming that the start of
    the <a href=#media-resource>media resource</a> is at time zero.</p>

    <p>Returns NaN if the duration isn't available.</p>

    <p>Returns Infinity for unbounded streams.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the <a href=#official-playback-position>official playback position</a>, in seconds.</p>

    <p>Can be set, to seek to the given time.</p>

    <p>Will throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if there is no selected <a href=#media-resource>media
    resource</a> or if there is a <a href=#current-media-controller>current media controller</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>A <a href=#media-resource>media resource</a> has a <dfn id=media-timeline>media timeline</dfn> that maps times (in seconds) to
  positions in the <a href=#media-resource>media resource</a>. The origin of a timeline is its earliest defined
  position. The duration of a timeline is its last defined position.</p>

  <p><dfn id=defineTimeline title="establish the media timeline">Establishing the media
  timeline</dfn>: If the <a href=#media-resource>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>media timeline</a> should be that timeline. (Whether
  the <a href=#media-resource>media resource</a> can specify a timeline or not depends on the <a href=#media-resource title="media
  resource">media resource's</a> format.) If the <a href=#media-resource>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>media timeline</a>; the <a href=#timeline-offset>timeline offset</a> will be the time and date,
  exposed using the <code title=dom-media-getStartDate><a href=#dom-media-getstartdate>getStartDate()</a></code> method.</p>

  <p>If the <a href=#media-resource>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>media
  timeline</a> of the <a href=#media-resource>media resource</a> increases linearly starting from the
  <a href=#earliest-possible-position>earliest possible position</a> (as defined below), even if the underlying <a href=#media-data>media
  data</a> has out-of-order or even overlapping time codes.</p>

  <p class=example>For example, if two clips have been concatenated into one video file, but the
  video format exposes the original times for the two clips, the video data might expose a timeline
  that goes, say, 00:15..00:29 and then 00:05..00:38. However, the user agent would not expose those
  times; it would instead expose the times as 00:15..00:29 and 00:29..01:02, as a single video.</p>

  <p>In the rare case of a <a href=#media-resource>media resource</a> that does not have an explicit timeline, the
  zero time on the <a href=#media-timeline>media timeline</a> should correspond to the first frame of the
  <a href=#media-resource>media resource</a>. In the even rarer case of a <a href=#media-resource>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 class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p class=note>An example of a file format with no explicit timeline but with explicit frame
  durations is the Animated GIF format. An example of a file format with no explicit timings at all
  is the JPEG-push format (<code><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>media resource</a>;
  otherwise, it should correspond to the first frame received from the server (the point in the
  <a href=#media-resource>media resource</a> at which the user agent began receiving the stream).</p>

  <p class=note>At the time of writing, there is no known format that lacks explicit frame time
  offsets yet still supports seeking to a frame before the first frame sent by the server.</p>

  <div class=example>

   <p>Consider a stream from a TV broadcaster, which begins streaming on a sunny Friday afternoon in
   October, and always sends connecting user agents the media data on the same media timeline, with
   its zero time set to the start of this stream. Months later, user agents connecting to this
   stream will find that the first frame they receive has a time with millions of seconds. The <code title=dom-media-getStartDate><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>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 title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute would then
   return 3,600. The <code title=dom-media-getStartDate><a href=#dom-media-getstartdate>getStartDate()</a></code> method would return a
   <code>Date</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>media timeline</a>
   starting at 0s and extending to 3,300s (fifty five minutes). In this case, the <code title=dom-media-getStartDate><a href=#dom-media-getstartdate>getStartDate()</a></code> method would return a <code>Date</code> object
   with a time corresponding to 2010-03-20 23:20:00 UTC.</p>

   <p>In both of these examples, the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute
   would give the ranges that the controller would want to actually display in its UI; typically, if
   the servers don't support seeking to arbitrary times, this would be the range of time from the
   moment the user agent connected to the stream up to the latest frame that the user agent has
   obtained; however, if the user agent starts discarding earlier information, the actual range
   might be shorter.</p>

  </div>

  <p>In any case, the user agent must ensure that the <a href=#earliest-possible-position>earliest possible position</a> (as
  defined below) using the established <a href=#media-timeline>media timeline</a>, is greater than or equal to
  zero.</p>

  <p>The <a href=#media-timeline>media timeline</a> also has an associated clock. Which clock is used is user-agent
  defined, and may be <a href=#media-resource>media resource</a>-dependent, but it should approximate the user's
  wall clock.</p>

  <p class=note>All the <a href=#media-element title="media element">media elements</a> that share <a href=#current-media-controller>current
  media controller</a> use the same clock for their <a href=#media-timeline>media timeline</a>.</p>

  <p><a href=#media-element title="media element">Media elements</a> have a <dfn id=current-playback-position>current playback position</dfn>,
  which must initially (i.e. in the absence of <a href=#media-data>media data</a>) be zero seconds. The
  <a href=#current-playback-position>current playback position</a> is a time on the <a href=#media-timeline>media timeline</a>.</p>

  <p><a href=#media-element title="media element">Media elements</a> also have an <dfn id=official-playback-position>official playback
  position</dfn>, which must initially be set to zero seconds. The <a href=#official-playback-position>official playback
  position</a> is an approximation of the <a href=#current-playback-position>current playback position</a> that is kept
  stable while scripts are running.</p>

  <p><a href=#media-element title="media element">Media elements</a> also have a <dfn id=default-playback-start-position>default playback start
  position</dfn>, which must initially be set to zero seconds. This time is used to allow the
  element to be seeked even before the media is loaded.</p>

  <p>Each <a href=#media-element>media element</a> has a <dfn id=show-poster-flag>show poster flag</dfn>. When a <a href=#media-element>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><a href=#the-video-element>video</a></code> element instead of showing the video
  contents.</p>

  <p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn> attribute must, on
  getting, return the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback start position</a>,
  unless that is zero, in which case it must return the element's <a href=#official-playback-position>official playback
  position</a>. The returned value must be expressed in seconds. On setting, if the <a href=#media-element>media
  element</a> has a <a href=#current-media-controller>current media controller</a>, then the user agent must throw an
  <code><a href=#invalidstateerror>InvalidStateError</a></code> exception; otherwise, if the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then it must set the <a href=#media-element>media
  element</a>'s <a href=#default-playback-start-position>default playback start position</a> to the new value; otherwise, it must
  set the <a href=#official-playback-position>official playback position</a> to the new value and then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the new value. The new value must be interpreted as being in
  seconds.</p>

  <p><a href=#media-element title="media element">Media elements</a> have an <dfn id=initial-playback-position>initial playback position</dfn>,
  which must initially (i.e. in the absence of <a href=#media-data>media data</a>) be zero seconds. The
  <a href=#initial-playback-position>initial playback position</a> is updated when a <a href=#media-resource>media resource</a> is loaded.
  The <a href=#initial-playback-position>initial playback position</a> is a time on the <a href=#media-timeline>media timeline</a>.</p>

  <p>If the <a href=#media-resource>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 title="media resource">media resources</a> might have a <a href=#media-timeline>media timeline</a> that
  doesn't start at zero. The <dfn id=earliest-possible-position>earliest possible position</dfn> is the earliest position in the
  stream or resource that the user agent can ever obtain again. It is also a time on the <a href=#media-timeline>media
  timeline</a>.</p>

  <p class=note>The <a href=#earliest-possible-position>earliest possible position</a> is not explicitly exposed in the API;
  it corresponds to the start time of the first range in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute's <code><a href=#timeranges>TimeRanges</a></code> object, if any, or
  the <a href=#current-playback-position>current playback position</a> otherwise.</p>

  <p>When the <a href=#earliest-possible-position>earliest possible position</a> changes, then: if the <a href=#current-playback-position>current playback
  position</a> is before the <a href=#earliest-possible-position>earliest possible position</a>, the user agent must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible position</a>; otherwise, if
  the user agent has not fired a <code title=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>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>

  <p class=note>Because of the above requirement and the requirement in the <a href=#concept-media-load-resource title=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>current
  playback position</a> can never be less than the <a href=#earliest-possible-position>earliest possible position</a>.</p>

  <!-- see https://www.w3.org/Bugs/Public/show_bug.cgi?id=14492 -->
  <!-- basically this is to handle very-long-running streams that use different video and audio
       tracks per TV show -->

  <p>If at any time the user agent learns that an audio or video track has ended and all <a href=#media-data>media
  data</a> relating to that track corresponds to parts of the <a href=#media-timeline>media timeline</a> that
  are <em>before</em> the <a href=#earliest-possible-position>earliest possible position</a>, the user agent may <a href=#queue-a-task>queue a
  task</a> to first remove the track from the <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code>
  attribute's <code><a href=#audiotracklist>AudioTrackList</a></code> object or the <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute's <code><a href=#videotracklist>VideoTrackList</a></code> object as
  appropriate and then <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>, that does not bubble and is not cancelable, and that
  uses the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to the <code><a href=#audiotrack>AudioTrack</a></code> or
  <code><a href=#videotrack>VideoTrack</a></code> object representing the track, at the <a href=#media-element>media element</a>'s
  aforementioned <code><a href=#audiotracklist>AudioTrackList</a></code> or <code><a href=#videotracklist>VideoTrackList</a></code> object.</p>

  <p>The <dfn id=dom-media-duration title=dom-media-duration><code>duration</code></dfn> attribute must return the time
  of the end of the <a href=#media-resource>media resource</a>, in seconds, on the <a href=#media-timeline>media timeline</a>. If
  no <a href=#media-data>media data</a> is available, then the attributes must return the Not-a-Number (NaN)
  value. If the <a href=#media-resource>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>media resource</a> before playing
  any part of the <a href=#media-data>media data</a> and before setting <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> to a value equal to or greater than <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, even if doing so requires fetching multiple
  parts of the resource.</p>

  <p id=durationChange>When the length of the <a href=#media-resource>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>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the <a href=#media-element>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>current playback position</a> ends up being greater
  than the time of the end of the <a href=#media-resource>media resource</a>, then the user agent must also <a href=#dom-media-seek title=dom-media-seek>seek</a> to the time of the end of the <a href=#media-resource>media resource</a>.</p>

  <p class=example>If an "infinite" stream ends for some reason, then the duration would change
  from positive Infinity to the time of the last frame or sample in the stream, and the <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event would be fired. Similarly, if the
  user agent initially estimated the <a href=#media-resource>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 title=event-media-durationchange><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>media timeline</a>, known as the <dfn id=timeline-offset>timeline offset</dfn>. Initially, the
  <a href=#timeline-offset>timeline offset</a> must be set to Not-a-Number (NaN).</p>

  <p>The <dfn id=dom-media-getstartdate title=dom-media-getStartDate><code>getStartDate()</code></dfn> method must return <a href=#create-a-date-object title="create a Date object">a new <code>Date</code> object</a> representing the current
  <a href=#timeline-offset>timeline offset</a>.</p>

  </div>

  <hr><p>The <dfn id=attr-media-loop title=attr-media-loop><code>loop</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a> that, if specified, indicates that the <a href=#media-element>media element</a> is to seek back
  to the start of the <a href=#media-resource>media resource</a> upon reaching the end.</p>

  <p>The <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute has no effect while the element has a
  <a href=#current-media-controller>current media controller</a>.</p>

  <div class=impl>

  <p>The <dfn id=dom-media-loop title=dom-media-loop><code>loop</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  </div>



  <h5 id=ready-states><span class=secno>4.8.10.7 </span>Ready states</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code></dt>

   <dd>

    <p>Returns a value that expresses the current state of the element with respect to rendering the
    <a href=#current-playback-position>current playback position</a>, from the codes in the list below.</p>

   </dd>

  </dl><div class=impl>

  <p><a href=#media-element title="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>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>

  </div>

  <dl><dt><dfn id=dom-media-have_nothing title=dom-media-HAVE_NOTHING><code>HAVE_NOTHING</code></dfn> (numeric value 0)</dt>

   <dd><p>No information regarding the <a href=#media-resource>media resource</a> is available. No data for the
   <a href=#current-playback-position>current playback position</a> is available. <a href=#media-element title="media element">Media
   elements</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute are set
   to <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> are always in the <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> state.</dd>

   <dt><dfn id=dom-media-have_metadata title=dom-media-HAVE_METADATA><code>HAVE_METADATA</code></dfn> (numeric value 1)</dt>

   <dd><p>Enough of the resource has been obtained that the duration of the resource is available.
   In the case of a <code><a href=#the-video-element>video</a></code> element, the dimensions of the video are also available. The
   API will no longer throw an exception when seeking. No <a href=#media-data>media data</a> is available for
   the immediate <a href=#current-playback-position>current playback position</a>.</dd>

   <dt><dfn id=dom-media-have_current_data title=dom-media-HAVE_CURRENT_DATA><code>HAVE_CURRENT_DATA</code></dfn> (numeric value 2)</dt>

   <dd><p>Data for the immediate <a href=#current-playback-position>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>current
   playback position</a> in the <a href=#direction-of-playback>direction of playback</a> at all without immediately
   reverting to the <code title=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>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>current playback position</a> is at the end of the current frame; and to when <a href=#ended-playback title="ended playback">playback has ended</a>.</dd>

   <dt><dfn id=dom-media-have_future_data title=dom-media-HAVE_FUTURE_DATA><code>HAVE_FUTURE_DATA</code></dfn> (numeric value 3)</dt>

   <dd><p>Data for the immediate <a href=#current-playback-position>current playback position</a> is available, as well as
   enough data for the user agent to advance the <a href=#current-playback-position>current playback position</a> in the
   <a href=#direction-of-playback>direction of playback</a> at least a little without immediately reverting to the <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> state, and <a href=#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>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>current playback
   position</a> is in the middle of a frame. The user agent cannot be in this state if <a href=#ended-playback title="ended playback">playback has ended</a>, as the <a href=#current-playback-position>current playback position</a>
   can never advance in this case.</dd>

   <dt><dfn id=dom-media-have_enough_data title=dom-media-HAVE_ENOUGH_DATA><code>HAVE_ENOUGH_DATA</code></dfn> (numeric value 4)</dt>

   <dd>

   <p>All the conditions described for the <code title=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>current
     playback position</a>, if it were to advance at the <a href=#effective-playback-rate>effective playback rate</a>,
     would not overtake the available data before playback reaches the end of the <a href=#media-resource>media
     resource</a>.</li>

     <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.)</li>

    </ul></dd>

  </dl><p class=note>In practice, the difference between <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> and <code title=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><a href=#the-video-element>video</a></code> element onto a
  <code><a href=#the-canvas-element>canvas</a></code>, where it distinguishes the case where something will be drawn (<code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater) from the case where
  nothing is drawn (<code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or less). Similarly,
  the difference between <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> (only
  the current frame) and <code title=dom-media-HAVE_FUTURE_DATA><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>

  <div class=impl>

  <p>When the ready state of a <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is not <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> changes, the user agent must follow the steps
  given below:</p>

  <ol><li>

    <p>Apply the first applicable set of substeps from the following list:</p>


    <dl class=switch><!-- going up to metadata --><dt>If the previous ready state was <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>,
     and the new ready state is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code></dt>

     <dd id=fire-loadedmetadata>

      <p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> at the element.</p>

      <p class=note>Before this task is run, as part of the <a href=#event-loop>event loop</a> mechanism, the
      rendering will have been updated to resize the <code><a href=#the-video-element>video</a></code> element if appropriate.</p>

     </dd>

     <!-- going up to current for the first time -->

     <dt id=handling-first-frame-available>If the previous ready state was <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> and the new ready state is <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater</dt>

     <dd>

      <p id=fire-loadeddata>If this is the first time this occurs for this <a href=#media-element>media
      element</a> since the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> algorithm was last
      invoked, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
      named <code title=event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> at the element.</p>

      <p>If the new ready state is <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>
      or <code title=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>

     </dd>

     <!-- going down -->
     <dt>If the previous ready state was <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or more, and the new ready state is
     <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or less</dt>

     <dd>

      <p id=fire-waiting-when-waiting>If the <a href=#media-element>media element</a> was <a href=#potentially-playing>potentially
      playing</a> before its <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
      changed to a value lower than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, and the element has not
      <a href=#ended-playback>ended playback</a>, and playback has not <a href=#stopped-due-to-errors>stopped due to errors</a>,
      <a href=#paused-for-user-interaction>paused for user interaction</a>, or <a href=#paused-for-in-band-content>paused for in-band content</a>, the user
      agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element, and <a href=#queue-a-task>queue a task</a>
      to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> at
      the element.</p>

     </dd>

     <!-- going up to future -->
     <dt>If the previous ready state was <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or less, and the new ready state
     is <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code></dt>

     <dd>

      <p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
      <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code> at the element.</p>

      <p>If the element's <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, the user
      agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code> at the element.</p>

     </dd>

     <!-- going up to enough -->
     <dt>If the new ready state is <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code></dt>

     <dd>

      <p>If the previous ready state was <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or less, the user agent must
      <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code> at the element, and, if the element's <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, <a href=#queue-a-task>queue a task</a> to
      <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code>
      at the element.</p>

      <p>If the <a href=#autoplaying-flag>autoplaying flag</a> is true, and the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true, and the <a href=#media-element>media element</a>
      has an <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute specified, and the
      <a href=#media-element>media element</a>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a>
      does not have the <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a> set, then
      the user agent may also run the following substeps:</p>

      <ol><li>Set the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute to false.</li>

       <li>If the element's <a href=#show-poster-flag>show poster flag</a> is true, set it to false and run the
       <i><a href=#time-marches-on>time marches on</a></i> steps.</li>

       <li><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-play><a href=#event-media-play>play</a></code> at the element.</li>

       <li><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code> at the element.</li>

      </ol><p class=note>User agents do not need to support autoplay, and it is suggested that user
      agents honor user preferences on the matter. Authors are urged to use the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute rather than using script to force the
      video to play, so as to allow the user to override the behavior if so desired.</p>

      <p>In any case, the user agent must finally <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
      event</a> named <code title=event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> at the element.</p>

     </dd>

    </dl></li>

   <li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then
   <a href=#report-the-controller-state>report the controller state</a> for the <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media
   controller</a>.</li>

  </ol></div>

  <p class=note>It is possible for the ready state of a media element to jump between these states
  discontinuously. For example, the state of a media element can jump straight from <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> to <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> without passing through the <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> and <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> states.</p>

  <div class=impl>

  <p>The <dfn id=dom-media-readystate title=dom-media-readyState><code>readyState</code></dfn> IDL attribute must, on
  getting, return the value described above that describes the current ready state of the
  <a href=#media-element>media element</a>.</p>

  </div>

  <p>The <dfn id=attr-media-autoplay title=attr-media-autoplay><code>autoplay</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. When present, the user agent <span class=impl>(as described in the algorithm
  described herein)</span> will automatically begin playback of the <a href=#media-resource>media resource</a> as
  soon as it can do so without stopping.</p>

  <p class=note>Authors are urged to use the <code title=attr-media-autoplay><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>

  <div class=impl>

  <p>The <dfn id=dom-media-autoplay title=dom-media-autoplay><code>autoplay</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  </div>



  <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the media resource</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code></dt>

   <dd>

    <p>Returns true if playback is paused; false otherwise.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code></dt>

   <dd>

    <p>Returns true if playback has reached the end of the <a href=#media-resource>media resource</a>.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the default rate of playback, for when the user is not fast-forwarding or reversing
    through the <a href=#media-resource>media resource</a>.</p>

    <p>Can be set, to change the default rate of playback.</p>

    <p>The default rate has no direct effect on playback, but if the user switches to a fast-forward
    mode, when they return to the normal playback mode, it is expected that the rate of playback
    will be returned to the default rate of playback.</p>

    <p>When the element has a <a href=#current-media-controller>current media controller</a>, the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> attribute is ignored and the
    <a href=#current-media-controller>current media controller</a>'s <code title=dom-MediaController-defaultPlaybackRate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code> is used instead.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current rate playback, where 1.0 is normal speed.</p>

    <p>Can be set, to change the rate of playback.</p>

    <p>When the element has a <a href=#current-media-controller>current media controller</a>, the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute is ignored and the <a href=#current-media-controller>current
    media controller</a>'s <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> is
    used instead.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-played><a href=#dom-media-played>played</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the ranges of the <a href=#media-resource>media
    resource</a> that the user agent has played.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-play><a href=#dom-media-play>play</a></code>()</dt>

   <dd>

    <p>Sets the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute to false, loading the
    <a href=#media-resource>media resource</a> and beginning playback if necessary. If the playback had ended, will
    restart it from the start.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-pause><a href=#dom-media-pause>pause</a></code>()</dt>

   <dd>

    <p>Sets the <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute to true, loading the
    <a href=#media-resource>media resource</a> if necessary.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-paused title=dom-media-paused><code>paused</code></dfn> attribute represents whether the
  <a href=#media-element>media element</a> is paused or not. The attribute must initially be true.</p>

  <p>A <a href=#media-element>media element</a> is a <dfn id=blocked-media-element>blocked media element</dfn> if its <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is in the <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> state, the <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> state, or the <code title=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>paused for user interaction</a> or <a href=#paused-for-in-band-content>paused for in-band content</a>.</p>

  <p>A <a href=#media-element>media element</a> is said to be <dfn id=potentially-playing>potentially playing</dfn> when its <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, the element has not <a href=#ended-playback>ended
  playback</a>, playback has not <a href=#stopped-due-to-errors>stopped due to errors</a>, the element either has no
  <a href=#current-media-controller>current media controller</a> or has a <a href=#current-media-controller>current media controller</a> but is not
  <a href=#blocked-on-its-media-controller>blocked on its media controller</a>, and the element is not a <a href=#blocked-media-element>blocked media
  element</a>.</p>

  <p class=note>A <code title=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>potentially playing</a> stopping playback due to its <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute changing to a value lower than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>.</p>

  <p>A <a href=#media-element>media element</a> is said to have <dfn id=ended-playback>ended playback</dfn> when:</p>

  <ul><li>The element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and

   <li>

    <p>Either:

    <ul><li>The <a href=#current-playback-position>current playback position</a> is the end of the <a href=#media-resource>media resource</a>,
     and

     <li>The <a href=#direction-of-playback>direction of playback</a> is forwards, and

     <li>Either the <a href=#media-element>media element</a> does not have a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified, or the <a href=#media-element>media element</a> has
     a <a href=#current-media-controller>current media controller</a>.

    </ul><p>Or:

    <ul><li>The <a href=#current-playback-position>current playback position</a> is the <a href=#earliest-possible-position>earliest possible position</a>,
     and

     <li>The <a href=#direction-of-playback>direction of playback</a> is backwards.

    </ul></li>

  </ul><p>The <dfn id=dom-media-ended title=dom-media-ended><code>ended</code></dfn> attribute must return true if, the
  last time the <a href=#event-loop>event loop</a> reached step 1, the <a href=#media-element>media element</a> had
  <a href=#ended-playback>ended playback</a> and the <a href=#direction-of-playback>direction of playback</a> was forwards, and false
  otherwise.</p>

  <p>A <a href=#media-element>media element</a> is said to have <dfn id=stopped-due-to-errors>stopped due to errors</dfn> when the
  element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><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>media data</a>, and due to that error, is not able to play the content at the
  <a href=#current-playback-position>current playback position</a>.</p>

  <p>A <a href=#media-element>media element</a> is said to have <dfn id=paused-for-user-interaction>paused for user interaction</dfn> when its
  <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or <code title=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>media resource</a> where the user has to make a selection for the resource to
  continue. If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a> when this
  happens, then the user agent must <a href=#report-the-controller-state>report the controller state</a> for the <a href=#media-element>media
  element</a>'s <a href=#current-media-controller>current media controller</a>. If the <a href=#media-element>media element</a> has a
  <a href=#current-media-controller>current media controller</a> when the user makes a selection, allowing playback to
  resume, the user agent must similarly <a href=#report-the-controller-state>report the controller state</a> for the <a href=#media-element>media
  element</a>'s <a href=#current-media-controller>current media controller</a>.</p>

  <p>It is possible for a <a href=#media-element>media element</a> to have both <a href=#ended-playback>ended playback</a> and
  <a href=#paused-for-user-interaction>paused for user interaction</a> at the same time.</p>

  <p>When a <a href=#media-element>media element</a> that is <a href=#potentially-playing>potentially playing</a> stops playing
  because it has <a href=#paused-for-user-interaction>paused for user interaction</a>, the user agent must <a href=#queue-a-task>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>

  <p>A <a href=#media-element>media element</a> is said to have <dfn id=paused-for-in-band-content>paused for in-band content</dfn> when its
  <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or <code title=dom-media-HAVE_ENOUGH_DATA><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>media resource</a> in order to play content that is temporally anchored
  to the <a href=#media-resource>media resource</a> and has a non-zero length, or to play content that is
  temporally anchored to a segment of the <a href=#media-resource>media resource</a> but has a length longer than
  that segment. If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a> when
  this happens, then the user agent must <a href=#report-the-controller-state>report the controller state</a> for the
  <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media controller</a>. If the <a href=#media-element>media
  element</a> has a <a href=#current-media-controller>current media controller</a> when the user agent unsuspends
  playback, the user agent must similarly <a href=#report-the-controller-state>report the controller state</a> for the
  <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media controller</a>.</p>

  <p class=example>One example of when a <a href=#media-element>media element</a> would be <a href=#paused-for-in-band-content>paused for
  in-band content</a> is when the user agent is playing <a href=#attr-track-kind-descriptions title=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>text track
  cue start time</a> and the <a href=#text-track-cue-end-time>text track cue end time</a>.</p>

  <hr><p>When the <a href=#current-playback-position>current playback position</a> reaches the end of the <a href=#media-resource>media
  resource</a> when the <a href=#direction-of-playback>direction of playback</a> is forwards, then the user agent must
  follow these steps:</p>

  <ol><li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>
   attribute specified and does not have a <a href=#current-media-controller>current media controller</a>, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible position</a> of the
   <a href=#media-resource>media resource</a> and abort these steps.</li> <!-- v2/v3: We should fire a
   'looping' event here to explain why this immediately fires a 'playing' event, otherwise the
   'playing' event that fires from the readyState going from HAVE_CURRENT_DATA back to
   HAVE_FUTURE_DATA will seem inexplicable (since the normally matching 'ended' given below event
   doesn't fire in the loop case). -->

   <li><p>As defined above, the <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> IDL attribute starts
   returning true once the <a href=#event-loop>event loop</a>'s current <a href=#concept-task title=concept-task>task</a>
   ends.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element>media element</a>.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> that, if the <a href=#media-element>media element</a> does not have a
   <a href=#current-media-controller>current media controller</a>, and the <a href=#media-element>media element</a> has still <a href=#ended-playback>ended
   playback</a>, and the <a href=#direction-of-playback>direction of playback</a> is still forwards, and <a href=#dom-media-paused title=dom-media-paused>paused</a> is false, changes <a href=#dom-media-paused title=dom-media-paused>paused</a> to true and <a href=#fire-a-simple-event title="fire a simple event">fires a
   simple event</a> named <code title=event-media-pause><a href=#event-media-pause>pause</a></code> at the <a href=#media-element>media
   element</a>.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-ended><a href=#event-media-ended>ended</a></code> at the <a href=#media-element>media element</a>.</li>

   <li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then
   <a href=#report-the-controller-state>report the controller state</a> for the <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media
   controller</a>.</li>

  </ol><p>When the <a href=#current-playback-position>current playback position</a> reaches the <a href=#earliest-possible-position>earliest possible
  position</a> of the <a href=#media-resource>media resource</a> when the <a href=#direction-of-playback>direction of playback</a> is
  backwards, then the user agent must only <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>

  <hr><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn> attribute
  gives the desired speed at which the <a href=#media-resource>media resource</a> is to play, as a multiple of its
  intrinsic speed. The attribute is mutable: on getting it must return the last value it was set to,
  or 1.0 if it hasn't yet been set; on setting the attribute must be set to the new value.</p>

  <p class=note>The <code title=dom-media-defaultPlaybackRate><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 title="expose a user interface to the user">exposes a user
  interface to the user</a>.</p>

  <p>The <dfn id=dom-media-playbackrate title=dom-media-playbackRate><code>playbackRate</code></dfn> attribute gives the
  <a href=#effective-playback-rate>effective playback rate</a> (assuming there is no <a href=#current-media-controller>current media controller</a>
  overriding it), which is the speed at which the <a href=#media-resource>media resource</a> plays, as a multiple
  of its intrinsic speed. If it is not equal to the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>, then the implication is that the
  user is using a feature such as fast forward or slow motion playback. The attribute is mutable: on
  getting it must return the last value it was set to, or 1.0 if it hasn't yet been set; on setting
  the attribute must be set to the new value, and the playback will change speed (if the element is
  <a href=#potentially-playing>potentially playing</a> and there is no <a href=#current-media-controller>current media controller</a>).</p>

  <p id=rateUpdate>When the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
  or <code title=dom-media-playbackRate><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>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
  <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the <a href=#media-element>media element</a>.</p>

  <p class=note>The <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> and
  <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attributes have no effect when the
  <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>; the namesake attributes on
  the <code><a href=#mediacontroller>MediaController</a></code> object are used instead in that situation.</p>

  <hr><p>The <dfn id=dom-media-played title=dom-media-played><code>played</code></dfn> attribute must return a new static
  <a href=#normalized-timeranges-object>normalized <code>TimeRanges</code> object</a> that represents the ranges of points on the
  <a href=#media-timeline>media timeline</a> of the <a href=#media-resource>media resource</a> reached through the usual monotonic
  increase of the <a href=#current-playback-position>current playback position</a> during normal playback, if any, at the time
  the attribute is evaluated.</p>

  <hr><p>When the <dfn id=dom-media-play title=dom-media-play><code>play()</code></dfn> method on a <a href=#media-element>media
  element</a> is invoked, the user agent must run the following steps.</p>

  <ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the <a href=#media-element>media element</a>'s
   <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a>.</li>

   <li>

    <p>If the <a href=#ended-playback title="ended playback">playback has ended</a> and the <a href=#direction-of-playback>direction of
    playback</a> is forwards, and the <a href=#media-element>media element</a> does not have a <a href=#current-media-controller>current
    media controller</a>, <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible
    position</a> of the <a href=#media-resource>media resource</a>.</p>

    <p class=note>This <a href=#seekUpdate>will cause</a> the user agent to <a href=#queue-a-task>queue a
    task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element>media element</a>.</p>
    <!-- if we're already playing at this point, it might also fire 'waiting' -->

   </li>

   <li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then
   <a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>bring the media element up to speed with its new media controller</a>.</p>

   <li>

    <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is
    true, run the following substeps:</p>

    <ol><li><p>Change the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> to false.</li>

     <li><p>If the <a href=#show-poster-flag>show poster flag</a> is true, set the element's <a href=#show-poster-flag>show poster
     flag</a> to false and run the <i><a href=#time-marches-on>time marches on</a></i> steps.</li>

     <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-play><a href=#event-media-play>play</a></code> at the element.</li>

     <li>

      <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
      attribute has the value <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, or <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, <a href=#queue-a-task>queue a task</a> to
      <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> at the
      element.</p>

      <p>Otherwise, the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has the value <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>: <a href=#queue-a-task>queue a task</a> to
      <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-playing><a href=#event-media-playing>playing</a></code> at the
      element.</p>

     </li>

    </ol></li>

   <li><p>Set the <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying flag</a> to false.</li>

   <li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then
   <a href=#report-the-controller-state>report the controller state</a> for the <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media
   controller</a>.</li>

  </ol><hr><p>When the <dfn id=dom-media-pause title=dom-media-pause><code>pause()</code></dfn> method is invoked, and when
  the user agent is required to pause the <a href=#media-element>media element</a>, the user agent must run the
  following steps:</p>

  <ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the <a href=#media-element>media element</a>'s
   <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a>.</li>

   <li><p>Set the <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying flag</a> to false.</li>

   <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute
   is false, run the following steps:</p>

    <ol><li><p>Change the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> to true.</li>

     <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
     event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
     element.</li>

     <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
     event</a> named <code title=event-media-pause><a href=#event-media-pause>pause</a></code>
     at the element.</li>

     <li><p>Set the <a href=#official-playback-position>official playback position</a> to the <a href=#current-playback-position>current playback
     position</a>.</li>

    </ol></li>

   <li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then
   <a href=#report-the-controller-state>report the controller state</a> for the <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media
   controller</a>.</li>

  </ol><hr><p>The <dfn id=effective-playback-rate>effective playback rate</dfn> is not necessarily the element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>. When a <a href=#media-element>media element</a> has a
  <a href=#current-media-controller>current media controller</a>, its <a href=#effective-playback-rate>effective playback rate</a> is the
  <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback rate</a>. Otherwise, the
  <a href=#effective-playback-rate>effective playback rate</a> is just the element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>. Thus, the <a href=#current-media-controller>current media
  controller</a> overrides the <a href=#media-element>media element</a>.</p>

  <p>If the <a href=#effective-playback-rate>effective playback rate</a> is positive or zero, then the <dfn id=direction-of-playback>direction of
  playback</dfn> is forwards. Otherwise, it is backwards.</p>

  <p id=media-playback>When a <a href=#media-element>media element</a> is <a href=#potentially-playing>potentially playing</a> and
  its <code><a href=#document>Document</a></code> is a <a href=#fully-active>fully active</a> <code><a href=#document>Document</a></code>, its <a href=#current-playback-position>current
  playback position</a> must increase monotonically at <a href=#effective-playback-rate>effective playback rate</a> units
  of media time per unit time of the <a href=#media-timeline>media timeline</a>'s clock. (This specification always
  refers to this as an <i>increase</i>, but that increase could actually be a <em>de</em>crease if
  the <a href=#effective-playback-rate>effective playback rate</a> is negative.)</p>

  <p class=note>The <a href=#effective-playback-rate>effective playback rate</a> can be 0.0, in which case the
  <a href=#current-playback-position>current playback position</a> doesn't move, despite playback not being paused (<code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> doesn't become true, and the <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event doesn't fire).</p>

  <p class=note>This specification doesn't define how the user agent achieves the appropriate
  playback rate &mdash; depending on the protocol and media available, it is plausible that the user
  agent could negotiate with the server to have the server provide the media data at the appropriate
  rate, so that (except for the period between when the rate is changed and when the server updates
  the stream's playback rate) the client doesn't actually have to drop or interpolate any
  frames.</p>
 
  <p>Any time the user agent <a href=#provide-a-stable-state title="provide a stable state">provides a stable state</a>,
  the <a href=#official-playback-position>official playback position</a> must be set to the <a href=#current-playback-position>current playback
  position</a>.</p>

  <p>When the <a href=#direction-of-playback>direction of playback</a> is backwards, any corresponding audio must be
  muted. When the <a href=#effective-playback-rate>effective playback rate</a> is so low or so high that the user agent
  cannot play audio usefully, the corresponding audio must also be muted. If the <a href=#effective-playback-rate>effective
  playback rate</a> is not 1.0, the user agent may apply pitch adjustments to the audio as
  necessary to render it faithfully.</p>

  <p><a href=#media-element title="media element">Media elements</a> that are <a href=#potentially-playing>potentially playing</a>
  while not <a href=#in-a-document>in a <code>Document</code></a> must not play any video, but should play any
  audio component. Media elements must not stop playing just because all references to them have
  been removed; only once a media element is in a state where no further audio could ever be played
  by that element may the element be garbage collected.</p>

  <p class=note>It is possible for an element to which no explicit references exist to play audio,
  even if such an element is not still actively playing: for instance, it could have a <a href=#current-media-controller>current
  media controller</a> that still has references and can still be unpaused, or it could be
  unpaused but stalled waiting for content to buffer.</p>

  <hr><p>Each <a href=#media-element>media element</a> has a <dfn id=list-of-newly-introduced-cues>list of newly introduced cues</dfn>, which must be
  initially empty. Whenever a <a href=#text-track-cue>text track cue</a> is added to the <a href=#text-track-list-of-cues title="text track
  list of cues">list of cues</a> of a <a href=#text-track>text track</a> that is in the <a href=#list-of-text-tracks>list of text
  tracks</a> for a <a href=#media-element>media element</a>, that <a href=#text-track-cue title="text track cue">cue</a> must
  be added to the <a href=#media-element>media element</a>'s <a href=#list-of-newly-introduced-cues>list of newly introduced cues</a>. Whenever
  a <a href=#text-track>text track</a> is added to the <a href=#list-of-text-tracks>list of text tracks</a> for a <a href=#media-element>media
  element</a>, all of the <a href=#text-track-cue title="text track cue">cues</a> in that <a href=#text-track>text
  track</a>'s <a href=#text-track-list-of-cues title="text track list of cues">list of cues</a> must be added to the
  <a href=#media-element>media element</a>'s <a href=#list-of-newly-introduced-cues>list of newly introduced cues</a>. When a <a href=#media-element>media
  element</a>'s <a href=#list-of-newly-introduced-cues>list of newly introduced cues</a> has new cues added while the
  <a href=#media-element>media element</a>'s <a href=#show-poster-flag>show poster flag</a> is not set, then the user agent must
  run the <i><a href=#time-marches-on>time marches on</a></i> steps.</p>

  <p>When a <a href=#text-track-cue>text track cue</a> is removed from the <a href=#text-track-list-of-cues title="text track list of
  cues">list of cues</a> of a <a href=#text-track>text track</a> that is in the <a href=#list-of-text-tracks>list of text
  tracks</a> for a <a href=#media-element>media element</a>, and whenever a <a href=#text-track>text track</a> is removed
  from the <a href=#list-of-text-tracks>list of text tracks</a> of a <a href=#media-element>media element</a>, if the <a href=#media-element>media
  element</a>'s <a href=#show-poster-flag>show poster flag</a> is not set, then the user agent must run the
  <i><a href=#time-marches-on>time marches on</a></i> steps.</p>

  <p>When the <a href=#current-playback-position>current playback position</a> of a <a href=#media-element>media element</a> changes (e.g.
  due to playback or seeking), the user agent must run the <i><a href=#time-marches-on>time marches on</a></i> steps. If the
  <a href=#current-playback-position>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 &mdash; if one iteration takes a long time, this can cause
  certain <a href=#text-track-cue title="text track cue">cues</a> to be skipped over as the user agent rushes ahead
  to "catch up".)</p>

  <p>The <dfn id=time-marches-on><i>time marches on</i></dfn> steps are as follows:</p>

  <ol><li><p>Let <var title="">current cues</var> be a list of <a href=#text-track-cue title="text track
   cue">cues</a>, initialized to contain all the <a href=#text-track-cue title="text track cue">cues</a> of all
   the <a href=#text-track-hidden title="text track hidden">hidden</a> or <a href=#text-track-showing title="text track
   showing">showing</a> <a href=#text-track title="text track">text tracks</a> of the <a href=#media-element>media
   element</a> (not the <a href=#text-track-disabled title="text track disabled">disabled</a> ones) whose <a href=#text-track-cue-start-time title="text track cue start time">start times</a> are less than or equal to the <a href=#current-playback-position>current
   playback position</a> and whose <a href=#text-track-cue-end-time title="text track cue end time">end times</a> are
   greater than the <a href=#current-playback-position>current playback position</a>.</li>

   <li><p>Let <var title="">other cues</var> be a list of <a href=#text-track-cue title="text track cue">cues</a>,
   initialized to contain all the <a href=#text-track-cue title="text track cue">cues</a> of <a href=#text-track-hidden title="text
   track hidden">hidden</a> and <a href=#text-track-showing title="text track showing">showing</a> <a href=#text-track title="text
   track">text tracks</a> of the <a href=#media-element>media element</a> that are not present in <var title="">current cues</var>.</li>

   <li><p>Let <var title="">last time</var> be the <a href=#current-playback-position>current playback position</a> at the
   time this algorithm was last run for this <a href=#media-element>media element</a>, if this is not the first
   time it has run.</li>

   <li><p>If the <a href=#current-playback-position>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 title="">missed cues</var> be the list of <a href=#text-track-cue title="text track cue">cues</a> in <var title="">other cues</var> whose <a href=#text-track-cue-start-time title="text track cue start time">start times</a> are
   greater than or equal to <var title="">last time</var> and whose <a href=#text-track-cue-end-time title="text track cue end
   time">end times</a> are less than or equal to the <a href=#current-playback-position>current playback position</a>.
   Otherwise, let <var title="">missed cues</var> be an empty list.</li>

   <li><p>Remove all the <a href=#text-track-cue title="text track cue">cues</a> in <var title="">missed cues</var>
   that are also in the <a href=#media-element>media element</a>'s <a href=#list-of-newly-introduced-cues>list of newly introduced cues</a>, and
   then empty the element's <a href=#list-of-newly-introduced-cues>list of newly introduced cues</a>.</li>

   <li><p>If the time was reached through the usual monotonic increase of the <a href=#current-playback-position>current playback
   position</a> during normal playback, and if the user agent has not fired a <code title=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>queue a
   task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><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>current playback position</a>.)</p>

   <p class=note>The event thus is not to be fired faster than about 66Hz or slower than 4Hz
   (assuming the event handlers don't take longer than 250ms to run). User agents are encouraged to
   vary the frequency of the event based on the system load and the average cost of processing the
   event each time, so that the UI updates are not any more frequent than the user agent can
   comfortably handle while decoding the video.</li>

   <li><p>If all of the <a href=#text-track-cue title="text track cue">cues</a> in <var title="">current cues</var>
   have their <a href=#text-track-cue-active-flag>text track cue active flag</a> set, none of the <a href=#text-track-cue title="text track
   cue">cues</a> in <var title="">other cues</var> have their <a href=#text-track-cue-active-flag>text track cue active
   flag</a> set, and <var title="">missed cues</var> is empty, then abort these steps.</li>

   <li>

    <p>If the time was reached through the usual monotonic increase of the <a href=#current-playback-position>current playback
    position</a> during normal playback, and there are <a href=#text-track-cue title="text track cue">cues</a>
    in <var title="">other cues</var> that have their <a href=#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>text track cue active flag</a> set or are also in <var title="">missed cues</var>, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the
    <a href=#media-element>media element</a>. <!-- "pause" can in theory call load(), but never can it do so as
    part of this invocation, since we wouldn't be in this algorithm if the media element was empty.
    So, no need to couch all this in a task. --></p>

    <p class=note>In the other cases, such as explicit seeks, playback is not paused by going past
    the end time of a <a href=#text-track-cue title="text track cue">cue</a>, even if that <a href=#text-track-cue title="text track
    cue">cue</a> has its <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag</a> set.</p>

   </li>

   <li>

    <p>Let <var title="">events</var> be a list of <a href=#concept-task title=concept-task>tasks</a>,
    initially empty. Each <a href=#concept-task title=concept-task>task</a> in this list will be associated
    with a <a href=#text-track>text track</a>, a <a href=#text-track-cue>text track cue</a>, and a time, which are used to
    sort the list before the <a href=#concept-task title=concept-task>tasks</a> are queued.</p>

    <p>Let <var title="">affected tracks</var> be a list of <a href=#text-track title="text track">text
    tracks</a>, initially empty.</p>

    <p>When the steps below say to <dfn id=prepare-an-event>prepare an event</dfn> named <var title="">event</var> for a
    <a href=#text-track-cue>text track cue</a> <var title="">target</var> with a time <var title="">time</var>, the
    user agent must run these substeps:</p>

    <ol><li><p>Let <var title="">track</var> be the <a href=#text-track>text track</a> with which the <a href=#text-track-cue>text
     track cue</a> <var title="">target</var> is associated.</li>

     <li><p>Create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
     named <var title="">event</var> at <var title="">target</var>.</li>

     <li><p>Add the newly created <a href=#concept-task title=concept-task>task</a> to <var title="">events</var>, associated with the time <var title="">time</var>, the <a href=#text-track>text
     track</a> <var title="">track</var>, and the <a href=#text-track-cue>text track cue</a> <var title="">target</var>.</li>

     <li><p>Add <var title="">track</var> to <var title="">affected tracks</var>.</li>

    </ol></li>

   <li><p>For each <a href=#text-track-cue title="text track cue">text track cue</a> in <var title="">missed
   cues</var>, <a href=#prepare-an-event>prepare an event</a> named <code title=event-enter>enter</code> for the
   <code><a href=#texttrackcue>TextTrackCue</a></code> object with the <a href=#text-track-cue-start-time>text track cue start time</a>.</li>

   <li><p>For each <a href=#text-track-cue title="text track cue">text track cue</a> in <var title="">other
   cues</var> that either has its <a href=#text-track-cue-active-flag>text track cue active flag</a> set or is in <var title="">missed cues</var>, <a href=#prepare-an-event>prepare an event</a> named <code title=event-exit>exit</code> for the <code><a href=#texttrackcue>TextTrackCue</a></code> object with the later of the
   <a href=#text-track-cue-end-time>text track cue end time</a> and the <a href=#text-track-cue-start-time>text track cue start time</a>.</li>

   <li><p>For each <a href=#text-track-cue title="text track cue">text track cue</a> in <var title="">current
   cues</var> that does not have its <a href=#text-track-cue-active-flag>text track cue active flag</a> set, <a href=#prepare-an-event>prepare an
   event</a> named <code title=event-enter>enter</code> for the <code><a href=#texttrackcue>TextTrackCue</a></code>
   object with the <a href=#text-track-cue-start-time>text track cue start time</a>.</li>

   <li>

    <p>Sort the <a href=#concept-task title=concept-task>tasks</a> in <var title="">events</var> in ascending
    time order (<a href=#concept-task title=concept-task>tasks</a> with earlier times first).</p>

    <p>Further sort <a href=#concept-task title=concept-task>tasks</a> in <var title="">events</var> that have
    the same time by the relative <a href=#text-track-cue-order>text track cue order</a> of the <a href=#text-track-cue title="text track
    cue">text track cues</a> associated with these <a href=#concept-task title=concept-task>tasks</a>.</p>

    <p>Finally, sort <a href=#concept-task title=concept-task>tasks</a> in <var title="">events</var> that have
    the same time and same <a href=#text-track-cue-order>text track cue order</a> by placing <a href=#concept-task title=concept-task>tasks</a> that fire <code title=event-enter>enter</code> events before
    those that fire <code title=event-exit>exit</code> events.</p>

   </li>

   <li><p><a href=#queue-a-task title="queue a task">Queue</a> each <a href=#concept-task title=concept-task>task</a> in
   <var title="">events</var>, in list order.</li>

   <li><p>Sort <var title="">affected tracks</var> in the same order as the <a href=#text-track title="text
   track">text tracks</a> appear in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text
   tracks</a>, and remove duplicates.</p>

   <li><p>For each <a href=#text-track>text track</a> in <var title="">affected tracks</var>, in the list
   order, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-cuechange>cuechange</code> at the <code><a href=#texttrack>TextTrack</a></code> object, and, if the
   <a href=#text-track>text track</a> has a corresponding <code><a href=#the-track-element>track</a></code> element, to then <a href=#fire-a-simple-event>fire a
   simple event</a> named <code title=event-cuechange>cuechange</code> at the
   <code><a href=#the-track-element>track</a></code> element as well.</li>

   <li><p>Set the <a href=#text-track-cue-active-flag>text track cue active flag</a> of all the <a href=#text-track-cue title="text track
   cue">cues</a> in the <var title="">current cues</var>, and unset the <a href=#text-track-cue-active-flag>text track cue
   active flag</a> of all the <a href=#text-track-cue title="text track cue">cues</a> in the <var title="">other
   cues</var>.</li>

   <li><p>Run the <a href=#rules-for-updating-the-text-track-rendering>rules for updating the text track rendering</a> of each of the <a href=#text-track title="text track">text tracks</a> in <var title="">affected tracks</var> that are <a href=#text-track-showing title="text track showing">showing</a>. For example, for <a href=#text-track title="text track">text
   tracks</a> based on <a href=#webvtt>WebVTT</a>, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT
   text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a> </li>

  </ol><p>For the purposes of the algorithm above, a <a href=#text-track-cue>text track cue</a> is considered to be part
  of a <a href=#text-track>text track</a> only if it is listed in the <a href=#text-track-list-of-cues>text track list of cues</a>, not
  merely if it is associated with the <a href=#text-track>text track</a>.</p>

  <p class=note>If the <a href=#media-element>media element</a>'s <code><a href=#document>Document</a></code> stops being a
  <a href=#fully-active>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>media element</a> is <a href=#remove-an-element-from-a-document title="remove an element from a document">removed
  from a <code>Document</code></a>, the user agent must run the following steps:</p>

  <ol><li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>, allowing the <a href=#concept-task title=concept-task>task</a> that removed the <a href=#media-element>media element</a> from the
   <code><a href=#document>Document</a></code> to continue. The <a href=#synchronous-section>synchronous section</a> consists of all the
   remaining steps of this algorithm. (Steps in the <a href=#synchronous-section>synchronous section</a> are marked with
   &#x231b;.)</li>

   <li><p>&#x231b; If the <a href=#media-element>media element</a> is <a href=#in-a-document>in a <code>Document</code></a>,
   abort these steps.</li>

   <li><p>&#x231b; If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, abort these steps.</li>

   <li><p>&#x231b; <a href=#dom-media-pause title=dom-media-pause>Pause</a> the <a href=#media-element>media element</a>.</p>

  </ol></div>



  <h5 id=seeking><span class=secno>4.8.10.9 </span>Seeking</h5>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code></dt>

   <dd>

    <p>Returns true if the user agent is currently seeking.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the ranges of the <a href=#media-resource>media
    resource</a> to which it is possible for the user agent to seek.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-fastSeek><a href=#dom-media-fastseek>fastSeek</a></code>( <var title="">time</var> )</dt>

   <dd>

    <p>Seeks to near the given <var title="">time</var> as fast as possible, trading precision for
    speed. (To seek to a precise time, use the <code title=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>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-seeking title=dom-media-seeking><code>seeking</code></dfn> attribute must initially have the
  value false.</p>

  <p>The <dfn id=dom-media-fastseek title=dom-media-fastSeek><code>fastSeek()</code></dfn> method must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the time given by the method's argument, with the
  <i>approximate-for-speed</i> flag set.</p>

  <p>When the user agent is required to <dfn id=dom-media-seek title=dom-media-seek>seek</dfn> to a particular <var title="">new playback position</var> in the <a href=#media-resource>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>event loop</a> mechanism; in particular, it has
  a <a href=#synchronous-section>synchronous section</a> (which is triggered as part of the <a href=#event-loop>event loop</a>
  algorithm). Steps in that section are marked with &#x231b;.</p>

  <ol><li><p>Set the <a href=#media-element>media element</a>'s <a href=#show-poster-flag>show poster flag</a> to false.</li>

   <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
   is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, abort these steps.</li>

   <li><p>If the element's <code title=dom-media-seeking><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>

   <li><p>Set the <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute to true.</li>

   <li><p>If the seek was in response to a DOM method call or setting of an IDL attribute, then
   continue the script. The remainder of these steps must be run asynchronously. With the exception
   of the steps marked with &#x231b;, they could be aborted at any time by another instance of this
   algorithm being invoked.</li>

   <li><p>If the <var title="">new playback position</var> is later than the end of the <a href=#media-resource>media
   resource</a>, then let it be the end of the <a href=#media-resource>media resource</a> instead.</li>

   <li><p>If the <var title="">new playback position</var> is less than the <a href=#earliest-possible-position>earliest possible
   position</a>, let it be that position instead.</li>

   <li><p>If the (possibly now changed) <var title="">new playback position</var> is not in one of
   the ranges given in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute, then let it
   be the position in one of the ranges given in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute that is the nearest to the <var title="">new
   playback position</var>. If two positions both satisfy that constraint (i.e. the <var title="">new playback position</var> is exactly in the middle between two ranges in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute) then use the position that is closest to
   the <a href=#current-playback-position>current playback position</a>. If there are no ranges given in the <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute then set the <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute to false and abort these steps.</li>

   <li>

    <p>If the <i>approximate-for-speed</i> flag is set, adjust the <var title="">new playback
    position</var> to a value that will allow for playback to resume promptly. If <var title="">new
    playback position</var> before this step is before <a href=#current-playback-position>current playback position</a>, then
    the adjusted <var title="">new playback position</var> must also be before the <a href=#current-playback-position>current
    playback position</a>. Similarly, if the <var title="">new playback position</var> before
    this step is after <a href=#current-playback-position>current playback position</a>, then the adjusted <var title="">new
    playback position</var> must also be after the <a href=#current-playback-position>current playback position</a>.</p>

    <p class=example>For example, the user agent could snap to the nearest key frame, so that it
    doesn't have to spend time decoding then discarding intermediate frames before resuming
    playback.</p>

    </li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-seeking><a href=#event-media-seeking>seeking</a></code> at the element.</li>

   <li>

    <p>Set the <a href=#current-playback-position>current playback position</a> to the given <var title="">new playback
    position</var>.</p>

    <p class=note>If the <a href=#media-element>media element</a> was <a href=#potentially-playing>potentially playing</a>
    immediately before it started seeking, but seeking caused its <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute to change to a value lower than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, then a <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> <a href=#fire-waiting-when-waiting>will be
    fired</a> at the element.</p> <!-- also, timeupdate -->
    <!-- also, it will do the "report the controller state" thing -->

    <p class=note>The <code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> attribute does not
    get updated asynchronously, as it returns the <a href=#official-playback-position>official playback position</a>, not the
    <a href=#current-playback-position>current playback position</a>.</p>

   </li>

   <li><p>Wait until the user agent has established whether or not the <a href=#media-data>media data</a> for
   the <var title="">new playback position</var> is available, and, if it is, until it has decoded
   enough data to play back that position.</p>
   <!-- at which point, it will do the "port the controller state"
   thing again -->
   </li>

   <li><p><a href=#await-a-stable-state>Await a stable state</a>. The <a href=#synchronous-section>synchronous section</a> consists of all
   the remaining steps of this algorithm. (Steps in the <a href=#synchronous-section>synchronous section</a> are marked
   with &#x231b;.)</li>

   <li><p>&#x231b; Set the <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute to
   false.</li>

   <li><p>&#x231b; Run the <a href=#time-marches-on>time marches on</a> steps.</li>

   <li id=seekUpdate><p>&#x231b; <a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
   named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</li>

   <li><p>&#x231b; <a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-seeked><a href=#event-media-seeked>seeked</a></code> at the element.</li>

  </ol><hr><p>The <dfn id=dom-media-seekable title=dom-media-seekable><code>seekable</code></dfn> attribute must return a new
  static <a href=#normalized-timeranges-object>normalized <code>TimeRanges</code> object</a> that represents the ranges of the
  <a href=#media-resource>media resource</a>, if any, that the user agent is able to seek to, at the time the
  attribute is evaluated.</p>

  <p class=note>If the user agent can seek to anywhere in the <a href=#media-resource>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>earliest possible position</a>, typically zero), and whose end is the same as
  the time of the first frame plus the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute's
  value (which would equal the time of the last frame, and might be positive Infinity).</p>

  <p class=note>The range might be continuously changing, e.g. if the user agent is buffering a
  sliding window on an infinite stream. This is the behavior seen with DVRs viewing live TV, for
  instance.</p>

  <p><a href=#media-resource title="media resource">Media resources</a> might be internally scripted or
  interactive. Thus, a <a href=#media-element>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 title=dom-media-seek>seeking</a> was used whenever the <a href=#current-playback-position>current playback position</a>
  changes in a discontinuous fashion (so that the relevant events fire). If the <a href=#media-element>media
  element</a> has a <a href=#current-media-controller>current media controller</a>, then the user agent must <a href=#seek-the-media-controller>seek
  the media controller</a> appropriately instead. </p>

  </div>


  <h5 id=media-resources-with-multiple-media-tracks><span class=secno>4.8.10.10 </span>Media resources with multiple media tracks</h5>

  <p>A <a href=#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>media resource</a> could have
  foreign-language dubbed dialogues, director's commentaries, audio descriptions, alternative
  angles, or sign-language overlays.</p>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#audiotracklist>AudioTrackList</a></code> object representing the audio tracks available in the
    <a href=#media-resource>media resource</a>.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#videotracklist>VideoTrackList</a></code> object representing the video tracks available in the
    <a href=#media-resource>media resource</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-audiotracks title=dom-media-audioTracks><code>audioTracks</code></dfn> attribute of a
  <a href=#media-element>media element</a> must return a <a href=#live>live</a> <code><a href=#audiotracklist>AudioTrackList</a></code> object
  representing the audio tracks available in the <a href=#media-element>media element</a>'s <a href=#media-resource>media
  resource</a>. The same object must be returned each time.</p>

  <p>The <dfn id=dom-media-videotracks title=dom-media-videoTracks><code>videoTracks</code></dfn> attribute of a
  <a href=#media-element>media element</a> must return a <a href=#live>live</a> <code><a href=#videotracklist>VideoTrackList</a></code> object
  representing the video tracks available in the <a href=#media-element>media element</a>'s <a href=#media-resource>media
  resource</a>. The same object must be returned each time.</p>

  <p class=note>There are only ever one <code><a href=#audiotracklist>AudioTrackList</a></code> object and one
  <code><a href=#videotracklist>VideoTrackList</a></code> object per <a href=#media-element>media element</a>, even if another <a href=#media-resource>media
  resource</a> is loaded into the element: the objects are reused. (The <code><a href=#audiotrack>AudioTrack</a></code>
  and <code><a href=#videotrack>VideoTrack</a></code> objects are not, though.)</p>

  </div>

  <div class=example>

   <p>In this example, a script defines a function that takes a URL to a video and a reference to an
   element where the video is to be placed. That function then tries to load the video, and, once it
   is loaded, checks to see if there is a sign-language track available. If there is, it also
   displays that track. Both tracks are just placed in the given container; it's assumed that styles
   have been applied to make this work in a pretty way!</p>

   <pre>&lt;script&gt;
 function loadVideo(url, container) {
   var controller = new MediaController();
   var video = document.createElement('video');
   video.src = url;
   video.autoplay = true;
   video.controls = true;
   video.controller = controller;
   container.appendChild(video);
   video.onloadedmetadata = function (event) {
     for (var i = 0; i &lt; video.videoTracks.length; i += 1) {
       if (video.videoTracks[i].kind == 'sign') {
         var sign = document.createElement('video');
         sign.src = url + '#track=' + video.videoTracks[i].id; <!-- should escape this probably -->
         sign.autoplay = true;
         sign.controller = controller;
         container.appendChild(sign);
         return;
       }
     }
   };
 }
&lt;/script&gt;</pre>

  </div>


  <h6 id=audiotracklist-and-videotracklist-objects><span class=secno>4.8.10.10.1 </span><code><a href=#audiotracklist>AudioTrackList</a></code> and <code><a href=#videotracklist>VideoTrackList</a></code> objects</h6>

  <p>The <code><a href=#audiotracklist>AudioTrackList</a></code> and <code><a href=#videotracklist>VideoTrackList</a></code> interfaces are used by
  attributes defined in the previous section.</p>

  <pre class=idl>interface <dfn id=audiotracklist>AudioTrackList</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute unsigned long <a href=#dom-audiotracklist-length title=dom-AudioTrackList-length>length</a>;
  getter <a href=#audiotrack>AudioTrack</a> (unsigned long index);
  <a href=#audiotrack>AudioTrack</a>? <a href=#dom-audiotracklist-gettrackbyid title=dom-AudioTrackList-getTrackById>getTrackById</a>(DOMString id);

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-tracklist-onchange title=handler-TrackList-onchange>onchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-tracklist-onaddtrack title=handler-TrackList-onaddtrack>onaddtrack</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-tracklist-onremovetrack title=handler-TrackList-onremovetrack>onremovetrack</a>;
};

interface <dfn id=audiotrack>AudioTrack</dfn> {
  readonly attribute DOMString <a href=#dom-audiotrack-id title=dom-AudioTrack-id>id</a>;
  readonly attribute DOMString <a href=#dom-audiotrack-kind title=dom-AudioTrack-kind>kind</a>;
  readonly attribute DOMString <a href=#dom-audiotrack-label title=dom-AudioTrack-label>label</a>;
  readonly attribute DOMString <a href=#dom-audiotrack-language title=dom-AudioTrack-language>language</a>;
           attribute boolean <a href=#dom-audiotrack-enabled title=dom-AudioTrack-enabled>enabled</a>;
};

interface <dfn id=videotracklist>VideoTrackList</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute unsigned long <a href=#dom-videotracklist-length title=dom-VideoTrackList-length>length</a>;
  getter <a href=#videotrack>VideoTrack</a> (unsigned long index);
  <a href=#videotrack>VideoTrack</a>? <a href=#dom-videotracklist-gettrackbyid title=dom-VideoTrackList-getTrackById>getTrackById</a>(DOMString id);
  readonly attribute long <a href=#dom-videotracklist-selectedindex title=dom-VideoTrackList-selectedIndex>selectedIndex</a>;

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-tracklist-onchange title=handler-TrackList-onchange>onchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-tracklist-onaddtrack title=handler-TrackList-onaddtrack>onaddtrack</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-tracklist-onremovetrack title=handler-TrackList-onremovetrack>onremovetrack</a>;
};

interface <dfn id=videotrack>VideoTrack</dfn> {
  readonly attribute DOMString <a href=#dom-videotrack-id title=dom-VideoTrack-id>id</a>;
  readonly attribute DOMString <a href=#dom-videotrack-kind title=dom-VideoTrack-kind>kind</a>;
  readonly attribute DOMString <a href=#dom-videotrack-label title=dom-VideoTrack-label>label</a>;
  readonly attribute DOMString <a href=#dom-videotrack-language title=dom-VideoTrack-language>language</a>;
           attribute boolean <a href=#dom-videotrack-selected title=dom-VideoTrack-selected>selected</a>;
};</pre>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> . <code title=dom-AudioTrackList-length><a href=#dom-audiotracklist-length>length</a></code></dt>
   <dt><var title="">media</var> . <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> . <code title=dom-VideoTrackList-length><a href=#dom-videotracklist-length>length</a></code></dt>

   <dd>

    <p>Returns the number of tracks in the list.</p>

   </dd>

   <dt><var title="">audioTrack</var> = <var title="">media</var> . <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code>[<var title="">index</var>]</dt>
   <dt><var title="">videoTrack</var> = <var title="">media</var> . <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code>[<var title="">index</var>]</dt>

   <dd>

    <p>Returns the specified <code><a href=#audiotrack>AudioTrack</a></code> or <code><a href=#videotrack>VideoTrack</a></code> object.</p>

   </dd>

   <dt><var title="">audioTrack</var> = <var title="">media</var> . <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> . <code title=dom-AudioTrackList-getTrackById><a href=#dom-audiotracklist-gettrackbyid>getTrackById</a></code>( <var title="">id</var> )</dt>
   <dt><var title="">videoTrack</var> = <var title="">media</var> . <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> . <code title=dom-VideoTrackList-getTrackById><a href=#dom-videotracklist-gettrackbyid>getTrackById</a></code>( <var title="">id</var> )</dt>

   <dd>

    <p>Returns the <code><a href=#audiotrack>AudioTrack</a></code> or <code><a href=#videotrack>VideoTrack</a></code> object with the given identifier, or null if no track has that identifier.</p>

   </dd>

   <dt><var title="">audioTrack</var> . <code title=dom-AudioTrack-id><a href=#dom-audiotrack-id>id</a></code></dt>
   <dt><var title="">videoTrack</var> . <code title=dom-VideoTrack-id><a href=#dom-videotrack-id>id</a></code></dt>

   <dd>

    <p>Returns the ID of the given track. This is the ID that can be used with a fragment identifier
    if the format supports the <cite>Media Fragments URI</cite> syntax, and that can be used with
    the <code title="">getTrackById()</code> method. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

   </dd>

   <dt><var title="">audioTrack</var> . <code title=dom-AudioTrack-kind><a href=#dom-audiotrack-kind>kind</a></code></dt>
   <dt><var title="">videoTrack</var> . <code title=dom-VideoTrack-kind><a href=#dom-videotrack-kind>kind</a></code></dt>

   <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>

   </dd>

   <dt><var title="">audioTrack</var> . <code title=dom-AudioTrack-label><a href=#dom-audiotrack-label>label</a></code></dt>
   <dt><var title="">videoTrack</var> . <code title=dom-VideoTrack-label><a href=#dom-videotrack-label>label</a></code></dt>

   <dd>

    <p>Returns the label of the given track, if known, or the empty string otherwise.</p>

   </dd>

   <dt><var title="">audioTrack</var> . <code title=dom-AudioTrack-language><a href=#dom-audiotrack-language>language</a></code></dt>
   <dt><var title="">videoTrack</var> . <code title=dom-VideoTrack-language><a href=#dom-videotrack-language>language</a></code></dt>

   <dd>

    <p>Returns the language of the given track, if known, or the empty string otherwise.</p>

   </dd>

   <dt><var title="">audioTrack</var> . <code title=dom-AudioTrack-enabled><a href=#dom-audiotrack-enabled>enabled</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> . <code title=dom-VideoTrackList-selectedIndex><a href=#dom-videotracklist-selectedindex>selectedIndex</a></code></dt>

   <dd>

    <p>Returns the index of the currently selected track, if any, or &minus;1 otherwise.</p>

   </dd>

   <dt><var title="">videoTrack</var> . <code title=dom-VideoTrack-selected><a href=#dom-videotrack-selected>selected</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

  </dl><div class=impl>

  <p>An <code><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><a href=#audiotrack>AudioTrack</a></code> object.</p>

  <p>A <code><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><a href=#videotrack>VideoTrack</a></code> object.</p>

  <p>Tracks in <code><a href=#audiotracklist>AudioTrackList</a></code> and <code><a href=#videotracklist>VideoTrackList</a></code> objects must be
  consistently ordered. If the <a href=#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>media resource</a>. The order used is called the <i>natural order</i>
  of the list.</p>

  <p class=note>Each track in a <code>TrackList</code> 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>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>media resource</a> changes entirely, then all the
  previous tracks will be removed and replaced with new tracks.</p>

  <p>The <dfn id=dom-audiotracklist-length title=dom-AudioTrackList-length><code>AudioTrackList.length</code></dfn> and <dfn id=dom-videotracklist-length title=dom-VideoTrackList-length><code>VideoTrackList.length</code></dfn> attributes must return
  the number of tracks represented by their objects at the time of getting.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> of <code><a href=#audiotracklist>AudioTrackList</a></code> and
  <code><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><a href=#audiotracklist>AudioTrackList</a></code> or <code><a href=#videotracklist>VideoTrackList</a></code> object represents no tracks, it has no
  <a href=#supported-property-indices>supported property indices</a>.</p>

  <p>To <a href=#determine-the-value-of-an-indexed-property>determine the value of an indexed property</a> for a given index <var title="">index</var> in an <code><a href=#audiotracklist>AudioTrackList</a></code> or <code><a href=#videotracklist>VideoTrackList</a></code> object <var title="">list</var>, the user agent must return the <code><a href=#audiotrack>AudioTrack</a></code> or
  <code><a href=#videotrack>VideoTrack</a></code> object that represents the <var title="">index</var>th track in <var title="">list</var>.</p>

  <p>The <dfn id=dom-audiotracklist-gettrackbyid title=dom-AudioTrackList-getTrackById><code>AudioTrackList.getTrackById(<var title="">id</var>)</code></dfn> and <dfn id=dom-videotracklist-gettrackbyid title=dom-VideoTrackList-getTrackById><code>VideoTrackList.getTrackById(<var title="">id</var>)</code></dfn> methods must return the first <code><a href=#audiotrack>AudioTrack</a></code> or
  <code><a href=#videotrack>VideoTrack</a></code> object (respectively) in the <code><a href=#audiotracklist>AudioTrackList</a></code> or
  <code><a href=#videotracklist>VideoTrackList</a></code> object (respectively) whose identifier is equal to the value of the
  <var title="">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><a href=#audiotrack>AudioTrack</a></code> and <code><a href=#videotrack>VideoTrack</a></code> objects represent specific tracks of a
  <a href=#media-resource>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>media resource</a>'s <code><a href=#audiotracklist>AudioTrackList</a></code> or <code><a href=#videotracklist>VideoTrackList</a></code>
  objects, those aspects do not change.</p>

  <p>In addition, <code><a href=#audiotrack>AudioTrack</a></code> objects can each be enabled or disabled; this is the audio
  track's <i>enabled state</i>. When an <code><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 title=concept-media-load-resource>resource fetch
  algorithm</a> can override this.</p>

  <p>Similarly, a single <code><a href=#videotrack>VideoTrack</a></code> object per <code><a href=#videotracklist>VideoTrackList</a></code> object can
  be selected, this is the video track's <i>selection state</i>. When a <code><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 title=concept-media-load-resource>resource fetch algorithm</a> can override this.</p>

  <p>The <dfn id=dom-audiotrack-id title=dom-AudioTrack-id><code>AudioTrack.id</code></dfn> and <dfn id=dom-videotrack-id title=dom-VideoTrack-id><code>VideoTrack.id</code></dfn> attributes must return the identifier
  of the track, if it has one, or the empty string otherwise. If the <a href=#media-resource>media resource</a> is
  in a format that supports the <cite>Media Fragments URI</cite> fragment identifier syntax, the
  identifier returned for a particular track must be the same identifier that would enable the track
  if used as the name of a track in the track dimension of such a fragment identifier. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

  <p class=example>For example, in Ogg files, this would be the Name header field of the track. <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a></p>

  <p>The <dfn id=dom-audiotrack-kind title=dom-AudioTrack-kind><code>AudioTrack.kind</code></dfn> and <dfn id=dom-videotrack-kind title=dom-VideoTrack-kind><code>VideoTrack.kind</code></dfn> attributes must return the category
  of the track, if it has one, or the empty string otherwise.</p>

  <p>The category of a track is the string given in the first column of the table below that is the
  most appropriate for the track based on the definitions in the table's second and third columns,
  as determined by the metadata included in the track in the <a href=#media-resource>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><a href=#audiotrack>AudioTrack</a></code> objects if they are appropriate for audio, and must
  only be returned for <code><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 title="">Role</code> element conveys the information. For WebM, only the
  <code title="">FlagDefault</code> element currently maps to a value. <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a> <a href=#refsDASH>[DASH]</a> <a href=#refsWEBMCG>[WEBMCG]</a></p>

  </div>

  <table id=dom-TrackList-getKind-categories><caption>Return values for <code title=dom-AudioTrack-kind><a href=#dom-audiotrack-kind>AudioTrack.kind()</a></code> and <code title=dom-VideoTrack-kind><a href=#dom-videotrack-kind>VideoTrack.kind()</a></code></caption>
   <thead><tr><th>Category
     <th>Definition
     <th>Applies to...</th>
     <th>Examples
   <tbody><tr><td>"<dfn id=value-track-kind-alternate title=value-track-kind-alternate><code>alternative</code></dfn>"
     <td>A possible alternative to the main track, e.g. a different take of a song (audio), or a different angle (video).
     <td>Audio and video.
     <td>Ogg: "audio/alternate" or "video/alternate"; DASH: "alternate" without "main" and "commentary" roles, and, for audio, without the "dub" role (other roles ignored).

    <tr><td>"<dfn id=value-track-kind-caption title=value-track-kind-caption><code>captions</code></dfn>"
     <td>A version of the main video track with captions burnt in. (For legacy content; new content would use text tracks.)
     <td>Video only.
     <td>DASH: "caption" and "main" roles together (other roles ignored).

    <tr><td>"<dfn id=value-track-kind-description title=value-track-kind-description><code>description</code></dfn>"
     <td>An audio description of a video track.
     <td>Audio only.
     <td>Ogg: "audio/audiodesc".

    <tr><td>"<dfn id=value-track-kind-main title=value-track-kind-main><code>main</code></dfn>"
     <td>The primary audio or video track.
     <td>Audio and video.
     <td>Ogg: "audio/main" or "video/main"; WebM: the "FlagDefault" element is set; DASH: "main" role without "caption", "subtitle", and "dub" roles (other roles ignored).

    <tr><td>"<dfn id=value-track-kind-main-desc title=value-track-kind-main-desc><code>main-desc</code></dfn>"
     <td>The primary audio track, mixed with audio descriptions.
     <td>Audio only.
     <td>AC3 audio in MPEG-2 TS: bsmod=2 and full_svc=1. <!-- see https://www.w3.org/Bugs/Public/show_bug.cgi?id=17797#c1 -->

    <tr><td>"<dfn id=value-track-kind-sign title=value-track-kind-sign><code>sign</code></dfn>"
     <td>A sign-language interpretation of an audio track.
     <td>Video only.
     <td>Ogg: "video/sign".

    <tr><td>"<dfn id=value-track-kind-subtitle title=value-track-kind-subtitle><code>subtitles</code></dfn>"
     <td>A version of the main video track with subtitles burnt in. (For legacy content; new content would use text tracks.)
     <td>Video only.
     <td>DASH: "subtitle" and "main" roles together (other roles ignored).

    <tr><td>"<dfn id=value-track-kind-translation title=value-track-kind-translation><code>translation</code></dfn>"
     <td>A translated version of the main audio track.
     <td>Audio only.
     <td>Ogg: "audio/dub". DASH: "dub" and "main" roles together (other roles ignored).

    <tr><td>"<dfn id=value-track-kind-commentary title=value-track-kind-commentary><code>commentary</code></dfn>"
     <td>Commentary on the primary audio or video track, e.g. a director's commentary.
     <td>Audio and video.
     <td>DASH: "commentary" role without "main" role (other roles ignored).

    <tr><td>"<dfn id=value-track-kind-none title=value-track-kind-none><code></code></dfn>" (empty string)
     <td>No explicit kind, or the kind given by the track's metadata is not recognised by the user agent.
     <td>Audio and video.
     <td>Any other track type, track role, or combination of track roles not described above.

  </table><div class=impl>

  <p>The <dfn id=dom-audiotrack-label title=dom-AudioTrack-label><code>AudioTrack.label</code></dfn> and <dfn id=dom-videotrack-label title=dom-VideoTrack-label><code>VideoTrack.label</code></dfn> attributes must return the label
  of the track, if it has one, or the empty string otherwise.</p>

  <p>The <dfn id=dom-audiotrack-language title=dom-AudioTrack-language><code>AudioTrack.language</code></dfn> and <dfn id=dom-videotrack-language title=dom-VideoTrack-language><code>VideoTrack.language</code></dfn> attributes must return the
  BCP 47 language tag of the language of the track, if it has one, or the empty string otherwise. If
  the user agent is not able to express that language as a BCP 47 language tag (for example because
  the language information in the <a href=#media-resource>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.</p>

  <p>The <dfn id=dom-audiotrack-enabled title=dom-AudioTrack-enabled><code>AudioTrack.enabled</code></dfn> attribute, on
  getting, must return true if the track is currently enabled, and false otherwise. On setting, it
  must enable the track if the new value is true, and disable it otherwise. (If the track is no
  longer in an <code><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><a href=#audiotrack>AudioTrack</a></code> object.)</p>

  <p>Whenever an audio track in an <code><a href=#audiotracklist>AudioTrackList</a></code> is enabled or disabled, the user
  agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-change><a href=#event-media-change>change</a></code> at the <code><a href=#audiotracklist>AudioTrackList</a></code> object.</p>

  <p>The <dfn id=dom-videotracklist-selectedindex title=dom-VideoTrackList-selectedIndex><code>VideoTrackList.selectedIndex</code></dfn> attribute
  must return the index of the currently selected track, if any. If the <code><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 &minus;1.</p>

  <p>The <dfn id=dom-videotrack-selected title=dom-VideoTrack-selected><code>VideoTrack.selected</code></dfn> attribute, on
  getting, must return true if the track is currently selected, and false otherwise. On setting, it
  must select the track if the new value is true, and unselect it otherwise. If the track is in a
  <code><a href=#videotracklist>VideoTrackList</a></code>, then all the other <code><a href=#videotrack>VideoTrack</a></code> objects in that list must
  be unselected. (If the track is no longer in a <code><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><a href=#videotrack>VideoTrack</a></code> object.)</p>

  <p>Whenever a track in a <code><a href=#videotracklist>VideoTrackList</a></code> that was previously not selected is selected,
  the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-change><a href=#event-media-change>change</a></code> at the <code><a href=#videotracklist>VideoTrackList</a></code> object.</p>

  <hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) <span class=impl>that must be</span> supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>,
  by all objects implementing the <code><a href=#audiotracklist>AudioTrackList</a></code> and <code><a href=#videotracklist>VideoTrackList</a></code>
  interfaces:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-tracklist-onchange title=handler-TrackList-onchange><code>onchange</code></dfn> <td> <code title=event-media-change><a href=#event-media-change>change</a></code>
    <tr><td><dfn id=handler-tracklist-onaddtrack title=handler-TrackList-onaddtrack><code>onaddtrack</code></dfn> <td> <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>
    <tr><td><dfn id=handler-tracklist-onremovetrack title=handler-TrackList-onremovetrack><code>onremovetrack</code></dfn> <td> <code title=event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>
  </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this
  section is the <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>

  <!-- v2 should also fire an event when the list changes (but note that that should be on the media element event task source) -->

  </div>


  <h6 id=selecting-specific-audio-and-video-tracks-declaratively><span class=secno>4.8.10.10.2 </span>Selecting specific audio and video tracks declaratively</h6>

  <p>The <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> and <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> attributes allow scripts to select which track
  should play, but it is also possible to select specific tracks declaratively, by specifying
  particular tracks in the fragment identifier of the <a href=#url>URL</a> of the <a href=#media-resource>media
  resource</a>. The format of the fragment identifier depends on the <a href=#mime-type>MIME type</a> of
  the <a href=#media-resource>media resource</a>. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsURL>[URL]</a></p>

  <div class=example>

   <p>In this example, a video that uses a format that supports the <cite>Media Fragments URI</cite>
   fragment identifier syntax is embedded in such a way that the alternative angles labeled
   "Alternative" are enabled instead of the default video track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

   <pre>&lt;video src="myvideo#track=Alternative"&gt;&lt;/video&gt;</pre>

   <!-- XXX need to check with the mediafrag people about whether there's a way to select a specific
   audio or video track without affecting the default track selection of the other axis, e.g.
   setting the video track without changing the default audio track selection -->

  </div>


  <h5 id=synchronising-multiple-media-elements><span class=secno>4.8.10.11 </span>Synchronising multiple media elements</h5>

  <h6 id=introduction-0><span class=secno>4.8.10.11.1 </span>Introduction</h6>

  <p>Each <a href=#media-element>media element</a> can have a <code><a href=#mediacontroller>MediaController</a></code>. A
  <code><a href=#mediacontroller>MediaController</a></code> is an object that coordinates the playback of multiple <a href=#media-element title="media element">media elements</a>, for instance so that a sign-language interpreter
  track can be overlaid on a video track, with the two being kept in sync.</p>

  <p>By default, a <a href=#media-element>media element</a> has no <code><a href=#mediacontroller>MediaController</a></code>. An implicit
  <code><a href=#mediacontroller>MediaController</a></code> can be assigned using the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> content attribute. An explicit
  <code><a href=#mediacontroller>MediaController</a></code> can be assigned directly using the <code title=dom-media-controller><a href=#dom-media-controller>controller</a></code> IDL attribute.</p>

  <p><a href=#media-element title="media element">Media elements</a> with a <code><a href=#mediacontroller>MediaController</a></code> are said
  to be <i>slaved</i> to their controller. The <code><a href=#mediacontroller>MediaController</a></code> modifies the playback
  rate and the playback volume of each of the <a href=#media-element title="media element">media elements</a>
  slaved to it, and ensures that when any of its slaved <a href=#media-element title="media element">media
  elements</a> unexpectedly stall, the others are stopped at the same time.</p>

  <p>When a <a href=#media-element>media element</a> is slaved to a <code><a href=#mediacontroller>MediaController</a></code>, its playback
  rate is fixed to that of the other tracks in the same <code><a href=#mediacontroller>MediaController</a></code>, and any
  looping is disabled.</p>

<!-- v2: add control to loop, add control to playback rate
  <div class="example">

   <p>In this example, two audio elements are slaved to the same (implicit) controller so that a
   waltz played by one audio element is kept exactly synchronised to the "tick tock tock" sound of
   the metronome played by the second element:</p>

   <pre>&lt;audio src="The%20Amelia%20Earhart%20Waltz.wav" controls autoplay mediagroup="song">&lt;/audio>
&lt;audio src="metronomes/3-4.wav" autoplay loop mediagroup="song">&lt;/audio></pre>

   <p>Assuming the song keeps a regular tempo throughout and assuming the metronome has the same
   tempo, this works even though if the metronome file only has one measure's worth of "tick tock
   tock", because the controller (implied by the <code
   title="attr-media-mediagroup">mediagroup</code> attribute) guarantees that the two elements will
   be kept synchronised, even if the user rewinds, jumps to a different part of the song, etc (the
   user agent controls made available by the <code title="attr-media-controls">controls</code>
   attribute on the song's <code>audio</code> element affect the <code>MediaController</code>'s
   state).</p>

   <p>If the metronome has the wrong rate, its rate can be adjusted by script separately from the
   song's (using the <code title="dom-media-playbackRate">audio.playbackRate</code> IDL attribute).
   The two elements will play back their <span>media data</span> at different rates, but the ratio
   will again be controlled by the <code>MediaController</code>.</p>

  </div>
-->


  <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers</h6>

  <pre class=idl>enum <dfn id=mediacontrollerplaybackstate>MediaControllerPlaybackState</dfn> { "<a href=#dom-mediacontroller-waiting title=dom-MediaController-waiting>waiting</a>", "<a href=#dom-mediacontroller-playing title=dom-MediaController-playing>playing</a>", "<a href=#dom-mediacontroller-ended title=dom-MediaController-ended>ended</a>" };
[<a href=#dom-mediacontroller title=dom-MediaController>Constructor</a>]
interface <dfn id=mediacontroller>MediaController</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute unsigned short <a href=#dom-mediacontroller-readystate title=dom-MediaController-readyState>readyState</a>; // uses <a href=#htmlmediaelement>HTMLMediaElement</a>.<a href=#dom-media-readystate title=dom-media-readyState>readyState</a>'s values

  readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-buffered title=dom-MediaController-buffered>buffered</a>;
  readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-seekable title=dom-MediaController-seekable>seekable</a>;
  readonly attribute unrestricted double <a href=#dom-mediacontroller-duration title=dom-MediaController-duration>duration</a>;
           attribute double <a href=#dom-mediacontroller-currenttime title=dom-MediaController-currentTime>currentTime</a>;

  readonly attribute boolean <a href=#dom-mediacontroller-paused title=dom-MediaController-paused>paused</a>;
  readonly attribute <a href=#mediacontrollerplaybackstate>MediaControllerPlaybackState</a> <a href=#dom-mediacontroller-playbackstate title=dom-MediaController-playbackState>playbackState</a>;
  readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-played title=dom-MediaController-played>played</a>;
  void <a href=#dom-mediacontroller-pause title=dom-MediaController-pause>pause</a>();
  void <a href=#dom-mediacontroller-unpause title=dom-MediaController-unpause>unpause</a>();
  void <a href=#dom-mediacontroller-play title=dom-MediaController-play>play</a>(); // calls play() on all media elements as well

           attribute double <a href=#dom-mediacontroller-defaultplaybackrate title=dom-MediaController-defaultPlaybackRate>defaultPlaybackRate</a>;
           attribute double <a href=#dom-mediacontroller-playbackrate title=dom-MediaController-playbackRate>playbackRate</a>;

           attribute double <a href=#dom-mediacontroller-volume title=dom-MediaController-volume>volume</a>;
           attribute boolean <a href=#dom-mediacontroller-muted title=dom-MediaController-muted>muted</a>;

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onemptied title=handler-MediaController-onemptied>onemptied</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onloadedmetadata title=handler-MediaController-onloadedmetadata>onloadedmetadata</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onloadeddata title=handler-MediaController-onloadeddata>onloadeddata</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-oncanplay title=handler-MediaController-oncanplay>oncanplay</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-oncanplaythrough title=handler-MediaController-oncanplaythrough>oncanplaythrough</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onplaying title=handler-MediaController-onplaying>onplaying</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onended title=handler-MediaController-onended>onended</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onwaiting title=handler-MediaController-onwaiting>onwaiting</a>;

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-ondurationchange title=handler-MediaController-ondurationchange>ondurationchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-ontimeupdate title=handler-MediaController-ontimeupdate>ontimeupdate</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onplay title=handler-MediaController-onplay>onplay</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onpause title=handler-MediaController-onpause>onpause</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onratechange title=handler-MediaController-onratechange>onratechange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onvolumechange title=handler-MediaController-onvolumechange>onvolumechange</a>;
};</pre>

  <dl class=domintro><dt><var title="">controller</var> = new <code title=dom-MediaController><a href=#dom-mediacontroller>MediaController</a></code>()</dt>

   <dd>

    <p>Returns a new <code><a href=#mediacontroller>MediaController</a></code> object.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-controller><a href=#dom-media-controller>controller</a></code> [ = <var title="">controller</var> ]</dt>

   <dd>

    <p>Returns the current <code><a href=#mediacontroller>MediaController</a></code> for the <a href=#media-element>media element</a>, if any;
    returns null otherwise.</p>

    <p>Can be set, to set an explicit <code><a href=#mediacontroller>MediaController</a></code>. Doing so removes the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, if any.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-readyState><a href=#dom-mediacontroller-readystate>readyState</a></code></dt>

   <dd>

    <p>Returns the state that the <code><a href=#mediacontroller>MediaController</a></code> was in the last time it fired events
    as a result of <a href=#report-the-controller-state title="report the controller state">reporting the controller state</a>.
    The values of this attribute are the same as for the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute of <a href=#media-element title="media element">media
    elements</a>.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-buffered><a href=#dom-mediacontroller-buffered>buffered</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the intersection of the time ranges
    for which the user agent has all relevant media data for all the slaved <a href=#media-element title="media
    element">media elements</a>.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-seekable><a href=#dom-mediacontroller-seekable>seekable</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the intersection of the time ranges
    into which the user agent can seek for all the slaved <a href=#media-element title="media element">media
    elements</a>.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code></dt>

   <dd>

    <p>Returns the difference between the earliest playable moment and the latest playable moment
    (not considering whether the data in question is actually buffered or directly seekable, but not
    including time in the future for infinite streams). Will return zero if there is no media.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-currentTime><a href=#dom-mediacontroller-currenttime>currentTime</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the <a href=#current-playback-position>current playback position</a>, in seconds, as a position between zero
    time and the current <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code>.</p>

    <p>Can be set, to seek to the given time.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code></dt>

   <dd>

    <p>Returns true if playback is paused; false otherwise. When this attribute is true, any
    <a href=#media-element>media element</a> slaved to this controller will be stopped.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-playbackState><a href=#dom-mediacontroller-playbackstate>playbackState</a></code></dt>

   <dd>

    <p>Returns the state that the <code><a href=#mediacontroller>MediaController</a></code> was in the last time it fired events
    as a result of <a href=#report-the-controller-state title="report the controller state">reporting the controller state</a>.
    The value of this attribute is either "<code title=dom-MediaController-playing><a href=#dom-mediacontroller-playing>playing</a></code>", indicating that the media is actively
    playing, "<code title=dom-MediaController-ended><a href=#dom-mediacontroller-ended>ended</a></code>", indicating that the media is
    not playing because playback has reached the end of all the <a href=#slaved-media-elements>slaved media elements</a>,
    or "<code title=dom-MediaController-waiting><a href=#dom-mediacontroller-waiting>waiting</a></code>", indicating that the media is not
    playing for some other reason (e.g. the <code><a href=#mediacontroller>MediaController</a></code> is paused).</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-pause><a href=#dom-mediacontroller-pause>pause</a></code>()</dt>

   <dd>

    <p>Sets the <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute to true.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-unpause><a href=#dom-mediacontroller-unpause>unpause</a></code>()</dt>

   <dd>

    <p>Sets the <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute to false.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-play><a href=#dom-mediacontroller-play>play</a></code>()</dt>

   <dd>

    <p>Sets the <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute to false and
    invokes the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method of each <a href=#slaved-media-elements title="slaved media
    elements">slaved media element</a>.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-played><a href=#dom-mediacontroller-played>played</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the union of the time ranges in all
    the slaved <a href=#media-element title="media element">media elements</a> that have been played.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-defaultPlaybackRate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the default rate of playback.</p>

    <p>Can be set, to change the default rate of playback.</p>

    <p>This default rate has no direct effect on playback, but if the user switches to a
    fast-forward mode, when they return to the normal playback mode, it is expected that rate of
    playback (<code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will be returned
    to this default rate.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current rate of playback.</p>

    <p>Can be set, to change the rate of playback.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-volume><a href=#dom-mediacontroller-volume>volume</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current playback volume multiplier, as a number in the range 0.0 to 1.0, where
    0.0 is the quietest and 1.0 the loudest.</p>

    <p>Can be set, to change the volume multiplier.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the new value is not in the range 0.0 .. 1.0.</p>

   </dd>

   <dt><var title="">controller</var> . <code title=dom-MediaController-muted><a href=#dom-mediacontroller-muted>muted</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns true if all audio is muted (regardless of other attributes either on the controller
    or on any <a href=#media-element title="media element">media elements</a> slaved to this controller), and
    false otherwise.</p>

    <p>Can be set, to change whether the audio is muted or not.</p>

   </dd>

  </dl><div class=impl>

  <p>A <a href=#media-element>media element</a> can have a <dfn id=current-media-controller>current media controller</dfn>, which is a
  <code><a href=#mediacontroller>MediaController</a></code> object. When a <a href=#media-element>media element</a> is created without a <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, it does not have a <a href=#current-media-controller>current media
  controller</a>. (If it is created <em>with</em> such an attribute, then that attribute
  initializes the <a href=#current-media-controller>current media controller</a>, as defined below.)</p>

  <p>The <dfn id=slaved-media-elements>slaved media elements</dfn> of a <code><a href=#mediacontroller>MediaController</a></code> are the <a href=#media-element title="media element">media elements</a> whose <a href=#current-media-controller>current media controller</a> is that
  <code><a href=#mediacontroller>MediaController</a></code>. All the <a href=#slaved-media-elements>slaved media elements</a> of a
  <code><a href=#mediacontroller>MediaController</a></code> must use the same clock for their definition of their <a href=#media-timeline>media
  timeline</a>'s unit time. When the user agent is required to act on each <a href=#slaved-media-elements title="slaved
  media elements">slaved media element</a> in turn, they must be processed in the order that they
  were last associated with the <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <hr><p>The <dfn id=dom-media-controller title=dom-media-controller><code>controller</code></dfn> attribute on a <a href=#media-element>media
  element</a>, on getting, must return the element's <a href=#current-media-controller>current media controller</a>, if
  any, or null otherwise. On setting, the user agent must run the following steps:</p>

  <ol><!-- very similar to the algorithm below for setting the content attribute --><li><p>Let <var title="">m</var> be the <a href=#media-element>media element</a> in question.</li>

   <li><p>Let <var title="">old controller</var> be <var title="">m</var>'s <a href=#current-media-controller>current media
   controller</a>, if it currently has one, and null otherwise.</li>

   <li><p>Let <var title="">new controller</var> be null.</li>

   <li><p>Let <var title="">m</var> have no <a href=#current-media-controller>current media controller</a>, if it currently
   has one.</li>

   <li><p>Remove the element's <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> content
   attribute, if any.</li>

   <li><p>If the new value is null, then jump to the <i>update controllers</i> step below.</li>

   <li><p>Let <var title="">m</var>'s <a href=#current-media-controller>current media controller</a> be the new
   value.</li>

   <li><p>Let <var title="">new controller</var> be <var title="">m</var>'s <a href=#current-media-controller>current media
   controller</a>.</li>

   <li><p><a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>Bring the media element up to speed with its new media controller</a>.</li>

   <li><p><i>Update controllers</i>: If <var title="">old controller</var> and <var title="">new
   controller</var> are the same (whether both null or both the same controller) then abort these
   steps.</li>

   <li><p>If <var title="">old controller</var> is not null and still has one or more <a href=#slaved-media-elements>slaved
   media elements</a>, then <a href=#report-the-controller-state>report the controller state</a> for <var title="">old
   controller</var>.</li>

   <li><p>If <var title="">new controller</var> is not null, then <a href=#report-the-controller-state>report the controller
   state</a> for <var title="">new controller</var>.</li>

  </ol><hr><p>The <dfn id=dom-mediacontroller title=dom-MediaController><code>MediaController()</code></dfn> constructor, when
  invoked, must return a newly created <code><a href=#mediacontroller>MediaController</a></code> object.</p>

  <hr><p>The <dfn id=dom-mediacontroller-readystate title=dom-MediaController-readyState><code>readyState</code></dfn> attribute must
  return the value to which it was most recently set. When the <code><a href=#mediacontroller>MediaController</a></code> object
  is created, the attribute must be set to the value 0 (<code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>). The value is updated by the <a href=#report-the-controller-state>report the
  controller state</a> algorithm below.</p>

  <p>The <dfn id=dom-mediacontroller-seekable title=dom-MediaController-seekable><code>seekable</code></dfn> attribute must return
  a new static <a href=#normalized-timeranges-object>normalized <code>TimeRanges</code> object</a> that represents the
  intersection of the ranges of the <a href=#media-resource title="media resource">media resources</a> of the
  <a href=#slaved-media-elements>slaved media elements</a> that the user agent is able to seek to, at the time the
  attribute is evaluated.</p>

  <p>The <dfn id=dom-mediacontroller-buffered title=dom-MediaController-buffered><code>buffered</code></dfn> attribute must return
  a new static <a href=#normalized-timeranges-object>normalized <code>TimeRanges</code> object</a> that represents the
  intersection of the ranges of the <a href=#media-resource title="media resource">media resources</a> of the
  <a href=#slaved-media-elements>slaved media elements</a> that the user agent has buffered, at the time the attribute is
  evaluated. Users agents must accurately determine the ranges available, even for media streams
  where this can only be determined by tedious inspection.</p>

  <p>The <dfn id=dom-mediacontroller-duration title=dom-MediaController-duration><code>duration</code></dfn> attribute must return
  the <a href=#media-controller-duration>media controller duration</a>.</p>

  <p>Every 15 to 250ms, or whenever the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-duration>media controller
  duration</a> changes, whichever happens least often, the user agent must <a href=#queue-a-task>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-durationchange><a href=#event-mediacontroller-durationchange>durationchange</a></code> at the
  <code><a href=#mediacontroller>MediaController</a></code>. If the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-duration>media controller
  duration</a> decreases such that the <a href=#media-controller-position>media controller position</a> is greater than the
  <a href=#media-controller-duration>media controller duration</a>, the user agent must immediately <a href=#seek-the-media-controller>seek the media
  controller</a> to <a href=#media-controller-duration>media controller duration</a>.</p>

  <p>The <dfn id=dom-mediacontroller-currenttime title=dom-MediaController-currentTime><code>currentTime</code></dfn> attribute must
  return the <a href=#media-controller-position>media controller position</a> on getting, and on setting must <a href=#seek-the-media-controller>seek the
  media controller</a> to the new value.</p>

  <p>Every 15 to 250ms, or whenever the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller
  position</a> changes, whichever happens least often, the user agent must <a href=#queue-a-task>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-timeupdate><a href=#event-mediacontroller-timeupdate>timeupdate</a></code> at the
  <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <hr><p>When a <code><a href=#mediacontroller>MediaController</a></code> is created it is a <dfn id=playing-media-controller>playing media controller</dfn>. It
  can be changed into a <dfn id=paused-media-controller>paused media controller</dfn> and back either via the user agent's user
  interface (when the element is <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the user">exposing a user
  interface to the user</a>) or by script using the APIs defined in this section (see below).</p>

  <p>The <dfn id=dom-mediacontroller-paused title=dom-MediaController-paused><code>paused</code></dfn> attribute must return
  true if the <code><a href=#mediacontroller>MediaController</a></code> object is a <a href=#paused-media-controller>paused media controller</a>, and
  false otherwise.</p>

  <p>When the <dfn id=dom-mediacontroller-pause title=dom-MediaController-pause><code>pause()</code></dfn> method is invoked,
  if the <code><a href=#mediacontroller>MediaController</a></code> is a <a href=#playing-media-controller>playing media controller</a> then the user agent
  must change the <code><a href=#mediacontroller>MediaController</a></code> into a <a href=#paused-media-controller>paused media controller</a>,
  <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-pause><a href=#event-mediacontroller-pause>pause</a></code> at the <code><a href=#mediacontroller>MediaController</a></code>, and then
  <a href=#report-the-controller-state>report the controller state</a> of the <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <p>When the <dfn id=dom-mediacontroller-unpause title=dom-MediaController-unpause><code>unpause()</code></dfn> method is
  invoked, if the <code><a href=#mediacontroller>MediaController</a></code> is a <a href=#paused-media-controller>paused media controller</a>, the user
  agent must change the <code><a href=#mediacontroller>MediaController</a></code> into a <a href=#playing-media-controller>playing media controller</a>,
  <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-play><a href=#event-mediacontroller-play>play</a></code> at the <code><a href=#mediacontroller>MediaController</a></code>, and then
  <a href=#report-the-controller-state>report the controller state</a> of the <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <p>When the <dfn id=dom-mediacontroller-play title=dom-MediaController-play><code>play()</code></dfn> method is invoked, the
  user agent must invoke the <code title=dom-media-play><a href=#dom-media-play>play</a></code> method of each <a href=#slaved-media-elements title="slaved media elements">slaved media element</a> in turn, and then invoke the <code title=dom-MediaController-unpause><a href=#dom-mediacontroller-unpause>unpause</a></code> method of the <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <p>The <dfn id=dom-mediacontroller-playbackstate title=dom-MediaController-playbackState><code>playbackState</code></dfn> attribute
  must return the value to which it was most recently set. When the <code><a href=#mediacontroller>MediaController</a></code>
  object is created, the attribute must be set to the value "<code title=dom-MediaController-waiting><a href=#dom-mediacontroller-waiting>waiting</a></code>". The value is updated by the <a href=#report-the-controller-state>report the
  controller state</a> algorithm below.</p>

  <p>The <dfn id=dom-mediacontroller-played title=dom-MediaController-played><code>played</code></dfn> attribute must return a
  new static <a href=#normalized-timeranges-object>normalized <code>TimeRanges</code> object</a> that represents the union of the
  ranges of points on the <a href=#media-timeline title="media timeline">media timelines</a> of the <a href=#media-resource title="media resource">media resources</a> of the <a href=#slaved-media-elements>slaved media elements</a> that the
  user agent has so far reached through the usual monotonic increase of their <a href=#current-playback-position title="current
  playback position">current playback positions</a> during normal playback, at the time the
  attribute is evaluated.</p>

  <hr><p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-default-playback-rate>media controller default playback rate</dfn> and a
  <dfn id=media-controller-playback-rate>media controller playback rate</dfn>, which must both be set to 1.0 when the
  <code><a href=#mediacontroller>MediaController</a></code> object is created.</p>

  <p>The <dfn id=dom-mediacontroller-defaultplaybackrate title=dom-MediaController-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
  attribute, on getting, must return the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate>media controller
  default playback rate</a>, and on setting, must set the <code><a href=#mediacontroller>MediaController</a></code>'s
  <a href=#media-controller-default-playback-rate>media controller default playback rate</a> to the new value, then <a href=#queue-a-task>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-ratechange><a href=#event-mediacontroller-ratechange>ratechange</a></code> at the
  <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <p>The <dfn id=dom-mediacontroller-playbackrate title=dom-MediaController-playbackRate><code>playbackRate</code></dfn> attribute, on
  getting, must return the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
  rate</a>, and on setting, must set the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller
  playback rate</a> to the new value, then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-MediaController-ratechange><a href=#event-mediacontroller-ratechange>ratechange</a></code> at the
  <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <hr><p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-volume-multiplier>media controller volume multiplier</dfn>, which must
  be set to 1.0 when the <code><a href=#mediacontroller>MediaController</a></code> object is created, and a <dfn id=media-controller-mute-override>media controller
  mute override</dfn>, much must initially be false.</p>

  <p>The <dfn id=dom-mediacontroller-volume title=dom-MediaController-volume><code>volume</code></dfn> attribute, on getting,
  must return the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-volume-multiplier>media controller volume multiplier</a>,
  and on setting, if the new value is in the range 0.0 to 1.0 inclusive, must set the
  <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-volume-multiplier>media controller volume multiplier</a> to the new value
  and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-volumechange><a href=#event-mediacontroller-volumechange>volumechange</a></code> at the
  <code><a href=#mediacontroller>MediaController</a></code>. If the new value is outside the range 0.0 to 1.0 inclusive, then, on
  setting, an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown instead.</p>

  <p>The <dfn id=dom-mediacontroller-muted title=dom-MediaController-muted><code>muted</code></dfn> attribute, on getting, must
  return the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-mute-override>media controller mute override</a>, and on
  setting, must set the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-mute-override>media controller mute override</a>
  to the new value and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-MediaController-volumechange><a href=#event-mediacontroller-volumechange>volumechange</a></code> at the
  <code><a href=#mediacontroller>MediaController</a></code>.</p>

  <hr><p>The <a href=#media-resource title="media resource">media resources</a> of all the <a href=#slaved-media-elements>slaved media
  elements</a> of a <code><a href=#mediacontroller>MediaController</a></code> have a defined temporal relationship which
  provides relative offsets between the zero time of each such <a href=#media-resource>media resource</a>: for
  <a href=#media-resource title="media resource">media resources</a> with a <a href=#timeline-offset>timeline offset</a>, their
  relative offsets are the difference between their <a href=#timeline-offset>timeline offset</a>; the zero times of
  all the <a href=#media-resource title="media resource">media resources</a> without a <a href=#timeline-offset>timeline offset</a>
  are not offset from each other (i.e. the origins of their timelines are cotemporal); and finally,
  the zero time of the <a href=#media-resource>media resource</a> with the earliest <a href=#timeline-offset>timeline offset</a>
  (if any) is not offset from the zero times of the <a href=#media-resource title="media resource">media
  resources</a> without a <a href=#timeline-offset>timeline offset</a> (i.e. the origins of <a href=#media-resource title="media
  resource">media resources</a> without a <a href=#timeline-offset>timeline offset</a> are further cotemporal
  with the earliest defined point on the timeline of the <a href=#media-resource>media resource</a> with the
  earliest <a href=#timeline-offset>timeline offset</a>).</p>

  <p>The <dfn id=media-resource-end-position>media resource end position</dfn> of a <a href=#media-resource>media resource</a> in a <a href=#media-element>media
  element</a> is defined as follows: if the <a href=#media-resource>media resource</a> has a finite and known
  duration, the <a href=#media-resource-end-position>media resource end position</a> is the duration of the <a href=#media-resource>media
  resource</a>'s timeline (the last defined position on that timeline); otherwise, the
  <a href=#media-resource>media resource</a>'s duration is infinite or unknown, and the <a href=#media-resource-end-position>media resource end
  position</a> is the time of the last frame of <a href=#media-data>media data</a> currently available for
  that <a href=#media-resource>media resource</a>.</p>

  <p>Each <code><a href=#mediacontroller>MediaController</a></code> also has its own defined timeline. On this timeline, all the
  <a href=#media-resource title="media resource">media resources</a> of all the <a href=#slaved-media-elements>slaved media elements</a>
  of the <code><a href=#mediacontroller>MediaController</a></code> are temporally aligned according to their defined offsets. The
  <dfn id=media-controller-duration>media controller duration</dfn> of that <code><a href=#mediacontroller>MediaController</a></code> is the time from the
  earliest <a href=#earliest-possible-position>earliest possible position</a>, relative to this <code><a href=#mediacontroller>MediaController</a></code>
  timeline, of any of the <a href=#media-resource title="media resource">media resources</a> of the <a href=#slaved-media-elements>slaved
  media elements</a> of the <code><a href=#mediacontroller>MediaController</a></code>, to the time of the latest <a href=#media-resource-end-position>media
  resource end position</a> of the <a href=#media-resource title="media resource">media resources</a> of the
  <a href=#slaved-media-elements>slaved media elements</a> of the <code><a href=#mediacontroller>MediaController</a></code>, again relative to this
  <code><a href=#mediacontroller>MediaController</a></code> timeline.</p>

  <p>Each <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-position>media controller position</dfn>. This is the time
  on the <code><a href=#mediacontroller>MediaController</a></code>'s timeline at which the user agent is trying to play the
  <a href=#slaved-media-elements>slaved media elements</a>. When a <code><a href=#mediacontroller>MediaController</a></code> is created, its
  <a href=#media-controller-position>media controller position</a> is initially zero.</p>

  <p>When the user agent is to <dfn id=bring-the-media-element-up-to-speed-with-its-new-media-controller title="bring the media element up to speed with its new media
  controller">bring a media element up to speed with its new media controller</dfn>, it must <a href=#dom-media-seek title=dom-media-seek>seek</a> that <a href=#media-element>media element</a> to the
  <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller position</a> relative to the <a href=#media-element>media
  element</a>'s timeline.</p>

  <p>When the user agent is to <dfn id=seek-the-media-controller>seek the media controller</dfn> to a particular <var title="">new playback position</var>, it must follow these steps:</p>

  <ol><li><p>If the <var title="">new playback position</var> is less than zero, then set it to
   zero.</li>

   <li><p>If the <var title="">new playback position</var> is greater than the <a href=#media-controller-duration>media
   controller duration</a>, then set it to the <a href=#media-controller-duration>media controller duration</a>.</li>

   <li><p>Set the <a href=#media-controller-position>media controller position</a> to the <var title="">new playback
   position</var>.</li>

   <li><p><a href=#dom-media-seek title=dom-media-seek>Seek</a> each <a href=#slaved-media-elements title="slaved media elements">slaved
   media element</a> to the <var title="">new playback position</var> relative to the <a href=#media-element>media
   element</a> timeline.</li> <!-- i.e. "bring the media element up to speed with its new
   media controller" -->

  </ol><p>A <code><a href=#mediacontroller>MediaController</a></code> is a <dfn id=blocked-media-controller>blocked media controller</dfn> if the
  <code><a href=#mediacontroller>MediaController</a></code> is a <a href=#paused-media-controller>paused media controller</a>, or if any of its
  <a href=#slaved-media-elements>slaved media elements</a> are <a href=#blocked-media-element title="blocked media element">blocked media
  elements</a>, or if any of its <a href=#slaved-media-elements>slaved media elements</a> whose <a href=#autoplaying-flag>autoplaying
  flag</a> is true still have their <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute set to
  true, or if all of its <a href=#slaved-media-elements>slaved media elements</a> have their <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute set to true.</p>

  <p>A <a href=#media-element>media element</a> is <dfn id=blocked-on-its-media-controller>blocked on its media controller</dfn> if the
  <code><a href=#mediacontroller>MediaController</a></code> is a <a href=#blocked-media-controller>blocked media controller</a>, or if its <a href=#media-controller-position>media
  controller position</a> is either before the <a href=#media-resource>media resource</a>'s <a href=#earliest-possible-position>earliest
  possible position</a> relative to the <code><a href=#mediacontroller>MediaController</a></code>'s timeline or after the end
  of the <a href=#media-resource>media resource</a> relative to the <code><a href=#mediacontroller>MediaController</a></code>'s timeline.</p>

  <p id=controller-playback>When a <code><a href=#mediacontroller>MediaController</a></code> is not a <a href=#blocked-media-controller>blocked media
  controller</a> and it has at least one <a href=#slaved-media-elements title="slaved media elements">slaved media
  element</a> whose <code><a href=#document>Document</a></code> is a <a href=#fully-active>fully active</a> <code><a href=#document>Document</a></code>,
  the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller position</a> must increase
  monotonically at <a href=#media-controller-playback-rate>media controller playback rate</a> units of time on the
  <code><a href=#mediacontroller>MediaController</a></code>'s timeline per unit time of the clock used by its <a href=#slaved-media-elements>slaved media
  elements</a>.</p>

  <p>When the zero point on the timeline of a <code><a href=#mediacontroller>MediaController</a></code> moves relative to the
  timelines of the <a href=#slaved-media-elements>slaved media elements</a> by a time difference <var title="">&Delta;T</var>, the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller
  position</a> must be decremented by <var title="">&Delta;T</var>.</p>

  <p class=note>In some situations, e.g. when playing back a live stream without buffering
  anything, the <a href=#media-controller-position>media controller position</a> would increase monotonically as described
  above at the same rate as the <var title="">&Delta;T</var> described in the previous paragraph
  decreases it, with the end result that for all intents and purposes, the <a href=#media-controller-position>media controller
  position</a> would appear to remain constant (probably with the value 0).</p>

  <hr><p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=most-recently-reported-readiness-state>most recently reported readiness state</dfn>, which
  is a number from 0 to 4 derived from the numbers used for the <a href=#media-element>media element</a> <code title=attr-media-readyState>readyState</code> attribute, and a <dfn id=most-recently-reported-playback-state>most recently reported
  playback state</dfn>, which is either <i>playing</i>, <i>waiting</i>, or <i>ended</i>.</p>

  <p>When a <code><a href=#mediacontroller>MediaController</a></code> is created, its <a href=#most-recently-reported-readiness-state>most recently reported readiness
  state</a> must be set to 0, and its <a href=#most-recently-reported-playback-state>most recently reported playback state</a> must be
  set to <i>waiting</i>.</p>

  <p>When a user agent is required to <dfn id=report-the-controller-state>report the controller state</dfn> for a
  <code><a href=#mediacontroller>MediaController</a></code>, the user agent must run the following steps:</p>

  <ol><li>

    <p>If the <code><a href=#mediacontroller>MediaController</a></code> has no <a href=#slaved-media-elements>slaved media elements</a>, let <var title="">new readiness state</var> be 0.</p>

    <p>Otherwise, let it have the lowest value of the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> IDL attributes of all of its <a href=#slaved-media-elements>slaved media
    elements</a>.</p>

   </li>

   <li>

    <p>If the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state>most recently reported readiness state</a> is
    less than the <var title="">new readiness state</var>, then run these substeps:</p>

    <ol><li><p>Let <var title="">next state</var> be the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state>most
     recently reported readiness state</a>.</li>

     <li><p><i>Loop</i>: Increment <var title="">next state</var> by one.</li>

     <li>

      <p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

      <ol><li><p>Set the <code><a href=#mediacontroller>MediaController</a></code>'s <code title=dom-MediaController-readyState><a href=#dom-mediacontroller-readystate>readyState</a></code> attribute to the value <var title="">next state</var>.</li>

       <li><p><a href=#fire-a-simple-event>Fire a simple event</a> at the <code><a href=#mediacontroller>MediaController</a></code> object, whose
       name is the event name corresponding to the value of <var title="">next state</var> given in
       the table below.</li>

      </ol></li>

     <li><p>If <var title="">next state</var> is less than <var title="">new readiness state</var>,
     then return to the step labeled <i>loop</i>.</li>

    </ol><p>Otherwise, if the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state>most recently reported readiness
    state</a> is greater than <var title="">new readiness state</var> then <a href=#queue-a-task>queue a
    task</a> to <a href=#fire-a-simple-event>fire a simple event</a> at the <code><a href=#mediacontroller>MediaController</a></code> object,
    whose name is the event name corresponding to the value of <var title="">new readiness
    state</var> given in the table below.</p>

    <table><thead><tr><th>Value of <var title="">new readiness state</var>
       <th>Event name

     <tbody><tr><td> 0
       <td> <code title=event-MediaController-emptied><a href=#event-mediacontroller-emptied>emptied</a></code>

      <tr><td> 1
       <td> <code title=event-MediaController-loadedmetadata><a href=#event-mediacontroller-loadedmetadata>loadedmetadata</a></code>

      <tr><td> 2
       <td> <code title=event-MediaController-loadeddata><a href=#event-mediacontroller-loadeddata>loadeddata</a></code>

      <tr><td> 3
       <td> <code title=event-MediaController-canplay><a href=#event-mediacontroller-canplay>canplay</a></code>

      <tr><td> 4
       <td> <code title=event-MediaController-canplaythrough><a href=#event-mediacontroller-canplaythrough>canplaythrough</a></code>

    </table></li>

   <li><p>Let the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state>most recently reported readiness state</a>
   be <var title="">new readiness state</var>.</li>

   <li>

    <p>Initialize <var title="">new playback state</var> by setting it to the state given for the
    first matching condition from the following list:</p>

    <dl class=switch><dt>If the <code><a href=#mediacontroller>MediaController</a></code> has no <a href=#slaved-media-elements>slaved media elements</a></dt>

     <dd>Let <var title="">new playback state</var> be <i>waiting</i>.</dd>

     <dt>If all of the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#slaved-media-elements>slaved media elements</a> have
     <a href=#ended-playback>ended playback</a> and the <a href=#media-controller-playback-rate>media controller playback rate</a> is positive or
     zero</dt>

     <dd>Let <var title="">new playback state</var> be <i>ended</i>.</dd>

     <dt>If the <code><a href=#mediacontroller>MediaController</a></code> is a <a href=#blocked-media-controller>blocked media controller</a></dt>

     <dd>Let <var title="">new playback state</var> be <i>waiting</i>.</dd>

     <dt>Otherwise</dt>

     <dd>Let <var title="">new playback state</var> be <i>playing</i>.</dd>

    </dl></li>

   <li><p>If the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-playback-state>most recently reported playback state</a>
   is not equal to <var title="">new playback state</var> and the <var title="">new playback
   state</var> is <i>ended</i>, then <a href=#queue-a-task>queue a task</a> that, if the
   <code><a href=#mediacontroller>MediaController</a></code> object is a <a href=#playing-media-controller>playing media controller</a>, and all of the
   <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#slaved-media-elements>slaved media elements</a> have still <a href=#ended-playback>ended
   playback</a>, and the <a href=#media-controller-playback-rate>media controller playback rate</a> is still positive or zero,
   changes the <code><a href=#mediacontroller>MediaController</a></code> object to a <a href=#paused-media-controller>paused media controller</a> and
   then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a> named <code title=event-MediaController-pause><a href=#event-mediacontroller-pause>pause</a></code> at the <code><a href=#mediacontroller>MediaController</a></code>
   object.</li>

   <li>

    <p>If the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-playback-state>most recently reported playback state</a> is
    not equal to <var title="">new playback state</var> then <a href=#queue-a-task>queue a task</a> to run the
    following steps:</p>

    <ol><li><p>Set the <code><a href=#mediacontroller>MediaController</a></code>'s <code title=dom-MediaController-playbackState><a href=#dom-mediacontroller-playbackstate>playbackState</a></code> attribute to the value given in
     the second column of the row of the following table whose first column contains the <var title="">new playback state</var>.</li>

     <li><p><a href=#fire-a-simple-event>Fire a simple event</a> at the <code><a href=#mediacontroller>MediaController</a></code> object, whose name
     is the value given in the third column of the row of the following table whose first column
     contains the <var title="">new playback state</var>.</li>

    </ol><table><thead><tr><th>New playback state
       <th>New value for <code title=dom-MediaController-playbackState><a href=#dom-mediacontroller-playbackstate>playbackState</a></code>
       <th>Event name
     <tbody><tr><td><i>playing</i>
       <td>"<dfn id=dom-mediacontroller-playing title=dom-MediaController-playing><code>playing</code></dfn>"
       <td><code title=event-MediaController-playing><a href=#event-mediacontroller-playing>playing</a></code>
      <tr><td><i>waiting</i>
       <td>"<dfn id=dom-mediacontroller-waiting title=dom-MediaController-waiting><code>waiting</code></dfn>"
       <td><code title=event-MediaController-waiting><a href=#event-mediacontroller-waiting>waiting</a></code>
      <tr><td><i>ended</i>
       <td>"<dfn id=dom-mediacontroller-ended title=dom-MediaController-ended><code>ended</code></dfn>"
       <td><code title=event-MediaController-ended><a href=#event-mediacontroller-ended>ended</a></code>
    </table></li>

   <li><p>Let the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-playback-state>most recently reported playback state</a>
   be <var title="">new playback state</var>.</li>

  </ol><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) <span class=impl>that must be</span> supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>,
  by all objects implementing the <code><a href=#mediacontroller>MediaController</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-mediacontroller-onemptied title=handler-MediaController-onemptied><code>onemptied</code></dfn> <td> <code title=event-MediaController-emptied><a href=#event-mediacontroller-emptied>emptied</a></code>
    <tr><td><dfn id=handler-mediacontroller-onloadedmetadata title=handler-MediaController-onloadedmetadata><code>onloadedmetadata</code></dfn> <td> <code title=event-MediaController-loadedmetadata><a href=#event-mediacontroller-loadedmetadata>loadedmetadata</a></code>
    <tr><td><dfn id=handler-mediacontroller-onloadeddata title=handler-MediaController-onloadeddata><code>onloadeddata</code></dfn> <td> <code title=event-MediaController-loadeddata><a href=#event-mediacontroller-loadeddata>loadeddata</a></code>
    <tr><td><dfn id=handler-mediacontroller-oncanplay title=handler-MediaController-oncanplay><code>oncanplay</code></dfn> <td> <code title=event-MediaController-canplay><a href=#event-mediacontroller-canplay>canplay</a></code>
    <tr><td><dfn id=handler-mediacontroller-oncanplaythrough title=handler-MediaController-oncanplaythrough><code>oncanplaythrough</code></dfn> <td> <code title=event-MediaController-canplaythrough><a href=#event-mediacontroller-canplaythrough>canplaythrough</a></code>
    <tr><td><dfn id=handler-mediacontroller-onplaying title=handler-MediaController-onplaying><code>onplaying</code></dfn> <td> <code title=event-MediaController-playing><a href=#event-mediacontroller-playing>playing</a></code>
    <tr><td><dfn id=handler-mediacontroller-onended title=handler-MediaController-onended><code>onended</code></dfn> <td> <code title=event-MediaController-ended><a href=#event-mediacontroller-ended>ended</a></code>
    <tr><td><dfn id=handler-mediacontroller-onwaiting title=handler-MediaController-onwaiting><code>onwaiting</code></dfn> <td> <code title=event-MediaController-waiting><a href=#event-mediacontroller-waiting>waiting</a></code>
   <tbody><tr><td><dfn id=handler-mediacontroller-ondurationchange title=handler-MediaController-ondurationchange><code>ondurationchange</code></dfn> <td> <code title=event-MediaController-durationchange><a href=#event-mediacontroller-durationchange>durationchange</a></code>
    <tr><td><dfn id=handler-mediacontroller-ontimeupdate title=handler-MediaController-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code title=event-MediaController-timeupdate><a href=#event-mediacontroller-timeupdate>timeupdate</a></code>
    <tr><td><dfn id=handler-mediacontroller-onplay title=handler-MediaController-onplay><code>onplay</code></dfn> <td> <code title=event-MediaController-play><a href=#event-mediacontroller-play>play</a></code>
    <tr><td><dfn id=handler-mediacontroller-onpause title=handler-MediaController-onpause><code>onpause</code></dfn> <td> <code title=event-MediaController-pause><a href=#event-mediacontroller-pause>pause</a></code>
    <tr><td><dfn id=handler-mediacontroller-onratechange title=handler-MediaController-onratechange><code>onratechange</code></dfn> <td> <code title=event-MediaController-ratechange><a href=#event-mediacontroller-ratechange>ratechange</a></code>
    <tr><td><dfn id=handler-mediacontroller-onvolumechange title=handler-MediaController-onvolumechange><code>onvolumechange</code></dfn> <td> <code title=event-MediaController-volumechange><a href=#event-mediacontroller-volumechange>volumechange</a></code>
  </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this
  section is the <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>

  </div>


  <h6 id=assigning-a-media-controller-declaratively><span class=secno>4.8.10.11.3 </span>Assigning a media controller declaratively</h6>

  <p>The <dfn id=attr-media-mediagroup title=attr-media-mediagroup><code>mediagroup</code></dfn> content attribute on <a href=#media-element title="media element">media elements</a> can be used to link multiple <a href=#media-element title="media
  element">media elements</a> together by implicitly creating a <code><a href=#mediacontroller>MediaController</a></code>. The
  value is text; <a href=#media-element title="media element">media elements</a> with the same value are
  automatically linked by the user agent.</p>

  <div class=impl>

  <p>When a <a href=#media-element>media element</a> is created with a <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, and when a <a href=#media-element>media element</a>'s
  <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute is set, changed, or removed, the
  user agent must run the following steps:</p>

  <ol><!-- very similar to the algorithm above for setting the IDL attribute --><li><p>Let <var title="">m</var> be the <a href=#media-element>media element</a> in question.</li>

   <li><p>Let <var title="">old controller</var> be <var title="">m</var>'s <a href=#current-media-controller>current media
   controller</a>, if it currently has one, and null otherwise.</li>

   <li><p>Let <var title="">new controller</var> be null.</li>

   <li><p>Let <var title="">m</var> have no <a href=#current-media-controller>current media controller</a>, if it currently
   has one.</li>

   <li><p>If <var title="">m</var>'s <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute
   is being removed, then jump to the <i>update controllers</i> step below.</li>

   <li>

    <p>If there is another <a href=#media-element>media element</a> whose <code><a href=#document>Document</a></code> is the same as
    <var title="">m</var>'s <code><a href=#document>Document</a></code> (even if one or both of these elements are not
    actually <a href=#in-a-document title="in a Document"><em>in</em> the <code>Document</code></a>), and which
    also has a <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, and whose <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute has the same value as the new value of
    <var title="">m</var>'s <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, then
    let <var title="">controller</var> be that <a href=#media-element>media element</a>'s <a href=#current-media-controller>current media
    controller</a>.</p>

    <p>Otherwise, let <var title="">controller</var> be a newly created
    <code><a href=#mediacontroller>MediaController</a></code>.</p>

   </li>

   <li><p>Let <var title="">m</var>'s <a href=#current-media-controller>current media controller</a> be <var title="">controller</var>.</li>

   <li><p>Let <var title="">new controller</var> be <var title="">m</var>'s <a href=#current-media-controller>current media
   controller</a>.</li>

   <li><p><a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>Bring the media element up to speed with its new media
   controller</a>.</li>

   <li><p><i>Update controllers</i>: If <var title="">old
   controller</var> and <var title="">new controller</var> are the
   same (whether both null or both the same controller) then abort
   these steps.</li>

   <li><p>If <var title="">old controller</var> is not null and still has one or more <a href=#slaved-media-elements>slaved
   media elements</a>, then <a href=#report-the-controller-state>report the controller state</a> for <var title="">old
   controller</var>.</li>

   <li><p>If <var title="">new controller</var> is not null, then <a href=#report-the-controller-state>report the controller
   state</a> for <var title="">new controller</var>.</li>

  </ol><p>The <dfn id=dom-media-mediagroup title=dom-media-mediaGroup><code>mediaGroup</code></dfn> IDL attribute on <a href=#media-element title="media element">media elements</a> must <a href=#reflect>reflect</a> the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> content attribute.</p>

  </div>

  <div class=example>

   <p>Multiple <a href=#media-element title="media element">media elements</a> referencing the same <a href=#media-resource>media
   resource</a> will share a single network request. This can be used to efficiently play two
   (video) tracks from the same <a href=#media-resource>media resource</a> in two different places on the screen.
   Used with the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, these elements can
   also be kept synchronised.</p>

   <p>In this example, a sign-languge interpreter track from a movie file is overlaid on the primary
   video track of that same video file using two <code><a href=#the-video-element>video</a></code> elements, some CSS, and an
   implicit <code><a href=#mediacontroller>MediaController</a></code>:</p>

   <pre>&lt;article&gt;
 &lt;style scoped&gt;
  div { margin: 1em auto; position: relative; width: 400px; height: 300px; }
  video { position; absolute; bottom: 0; right: 0; }
  video:first-child { width: 100%; height: 100%; }
  video:last-child { width: 30%; }
 &lt;/style&gt;
 &lt;div&gt;
  &lt;video src="movie.vid#track=Video&amp;amp;track=English" autoplay controls mediagroup=movie&gt;&lt;/video&gt;
  &lt;video src="movie.vid#track=sign" autoplay mediagroup=movie&gt;&lt;/video&gt;
 &lt;/div&gt;
&lt;/article&gt;</pre>

  </div>


<!--v2:
  <h6>Ducking</h6>

  <p><dfn>Ducking</dfn> is the process of reducing the volume of one audio track when another audio
  track is playing, for example occasionally reducing the volume of a soundtrack to allow the viewer
  to hear an intermittent commentary track.</p>

  (add an "autoduck" attribute that reduces the volume of other media elements with the same
  <span>current media controller</span> whenever this media element is playing audio)

   <video src="movie.vid#track=Video&amp;amp;track=English" autoplay controls mediagroup=main></video>
   <audio src="movie.vid#track=Descriptions" mediagroup=main autoduck></audio>
-->


<!--TOPIC:Video Text Tracks-->
  <h5 id=timed-text-tracks><span class=secno>4.8.10.12 </span>Timed text tracks</h5>

  <h6 id=text-track-model><span class=secno>4.8.10.12.1 </span>Text track model</h6>

  <p>A <a href=#media-element>media element</a> can have a group of associated <dfn id=text-track title="text track">text
  tracks</dfn>, known as the <a href=#media-element>media element</a>'s <dfn id=list-of-text-tracks>list of text tracks</dfn>. The <a href=#text-track title="text track">text tracks</a> are sorted as follows:</p>

  <ol class=brief><li>The <a href=#text-track title="text track">text tracks</a> corresponding to <code><a href=#the-track-element>track</a></code> element
   children of the <a href=#media-element>media element</a>, in <a href=#tree-order>tree order</a>.</li>

   <li>Any <a href=#text-track title="text track">text tracks</a> added using the <code title=dom-media-addTextTrack><a href=#dom-media-addtexttrack>addTextTrack()</a></code> method, in the order they were added, oldest
   first.</li>

   <li>Any <a href=#media-resource-specific-text-track title="media-resource-specific text track">media-resource-specific text
   tracks</a> (<a href=#text-track title="text track">text tracks</a> corresponding to data in the
   <a href=#media-resource>media resource</a>), in the order defined by the <a href=#media-resource>media resource</a>'s format
   specification.</li>

  </ol><p>A <a href=#text-track>text track</a> consists of:</p>

  <dl><dt><dfn id=text-track-kind title="text track kind">The kind of text track</dfn>

   <dd>

    <p>This decides how the track is handled by the user agent. The kind is represented by a string.
    The possible strings are:</p>

    <ul class=brief><li><dfn id=dom-texttrack-kind-subtitles title=dom-TextTrack-kind-subtitles><code>subtitles</code></dfn>
     <li><dfn id=dom-texttrack-kind-captions title=dom-TextTrack-kind-captions><code>captions</code></dfn>
     <li><dfn id=dom-texttrack-kind-descriptions title=dom-TextTrack-kind-descriptions><code>descriptions</code></dfn>
     <li><dfn id=dom-texttrack-kind-chapters title=dom-TextTrack-kind-chapters><code>chapters</code></dfn>
     <li><dfn id=dom-texttrack-kind-metadata title=dom-TextTrack-kind-metadata><code>metadata</code></dfn>
    </ul><p>The <a href=#text-track-kind title="text track kind">kind of track</a> can change dynamically, in the case of
    a <a href=#text-track>text track</a> corresponding to a <code><a href=#the-track-element>track</a></code> element.</p>

   </dd>

   <dt><dfn id=text-track-label title="text track label">A label</dfn>

   <dd>

    <p>This is a human-readable string intended to identify the track for the user.</p>

    <p>The <a href=#text-track-label title="text track label">label of a track</a> can change dynamically, in the
    case of a <a href=#text-track>text track</a> corresponding to a <code><a href=#the-track-element>track</a></code> element.</p>

    <p>When a <a href=#text-track-label>text track label</a> is the empty string, the user agent should automatically
    generate an appropriate label from the text track's other properties (e.g. the kind of text
    track and the text track's language) for use in its user interface. This automatically-generated
    label is not exposed in the API.</p>

   </dd>

   <dt><dfn id=text-track-in-band-metadata-track-dispatch-type title="text track in-band metadata track dispatch type">An in-band metadata track dispatch type</dfn>

   <dd>

    <p>This is a string extracted from the <a href=#media-resource>media resource</a> specifically for in-band
    metadata tracks to enable such tracks to be dispatched to different scripts in the document.</p>

    <p class=example>For example, a traditional TV station broadcast streamed on the Web and
    augmented with Web-specific interactive features could include text tracks with metadata for ad
    targeting, trivia game data during game shows, player states during sports games, recipe
    information during food programs, and so forth. As each program starts and ends, new tracks
    might be added or removed from the stream, and as each one is added, the user agent could bind
    them to dedicated script modules using the value of this attribute.</p>

    <p>Other than for in-band metadata text tracks, the <a href=#text-track-in-band-metadata-track-dispatch-type title="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>steps to expose a
    media-resource-specific text track</a>.</p>

   </dd>

   <dt><dfn id=text-track-language title="text track language">A language</dfn>

   <dd>

    <p>This is a string (a BCP 47 language tag) representing the language of the text track's cues.
    <a href=#refsBCP47>[BCP47]</a></p>

    <p>The <a href=#text-track-language title="text track language">language of a text track</a> can change dynamically,
    in the case of a <a href=#text-track>text track</a> corresponding to a <code><a href=#the-track-element>track</a></code> element.</p>

   </dd>

   <dt><dfn id=text-track-readiness-state title="text track readiness state">A readiness state</dfn>

   <dd>

    <p>One of the following:</p>

    <dl><dt><dfn id=text-track-not-loaded title="text track not loaded">Not loaded</dfn>

     <dd>

      <p>Indicates that the text track's cues have not been obtained.</p>

     </dd>

     <dt><dfn id=text-track-loading title="text track loading">Loading</dfn>

     <dd>

      <p>Indicates that the text track is loading and there have been no fatal errors encountered so
      far. Further cues might still be added to the track by the parser.</p>

     </dd>

     <dt><dfn id=text-track-loaded title="text track loaded">Loaded</dfn>

     <dd>

      <p>Indicates that the text track has been loaded with no fatal errors.</p>

     </dd>

     <dt><dfn id=text-track-failed-to-load title="text track failed to load">Failed to load</dfn>

     <dd>

      <p>Indicates that the text track was enabled, but when the user agent attempted to obtain it,
      this failed in some way (e.g. <a href=#url>URL</a> could not be <a href=#resolve-a-url title="resolve a
      url">resolved</a>, network error, unknown text track format). Some or all of the cues are
      likely missing and will not be obtained.</p>

     </dd>

    </dl><p>The <a href=#text-track-readiness-state title="text track readiness state">readiness state</a> of a <a href=#text-track>text
    track</a> changes dynamically as the track is obtained.</p>

   </dd>

   <dt><dfn id=text-track-mode title="text track mode">A mode</dfn>

   <dd>

    <p>One of the following:</p>

    <dl><dt><dfn id=text-track-disabled title="text track disabled">Disabled</dfn>

     <dd>

      <p>Indicates that the text track is not active. Other than for the purposes of exposing the
      track in the DOM, the user agent is ignoring the text track. No cues are active, no events are
      fired, and the user agent will not attempt to obtain the track's cues.</p>

     </dd>

     <dt><dfn id=text-track-hidden title="text track hidden">Hidden</dfn>

     <dd>

      <p>Indicates that the text track is active, but that the user agent is not actively displaying
      the cues. If no attempt has yet been made to obtain the track's cues, the user agent will
      perform such an attempt momentarily. The user agent is maintaining a list of which cues are
      active, and events are being fired accordingly.</p>

     </dd>

     <dt><dfn id=text-track-showing title="text track showing">Showing</dfn>

     <dd>

      <p>Indicates that the text track is active. If no attempt has yet been made to obtain the
      track's cues, the user agent will perform such an attempt momentarily. The user agent is
      maintaining a list of which cues are active, and events are being fired accordingly. In
      addition, for text tracks whose <a href=#text-track-kind title="text track kind">kind</a> is <code title=dom-TextTrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code> or <code title=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 title="text track kind">kind</a> is <code title=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 title="text track kind">kind</a> is <code title=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>media
      resource</a> by selecting a cue.</p>

     </dd>

    </dl></dd>

   <dt><dfn id=text-track-list-of-cues title="text track list of cues">A list of zero or more cues</dfn>

   <dd>

    <p>A list of <a href=#text-track-cue title="text track cue">text track cues</a>, along with <dfn id=rules-for-updating-the-text-track-rendering>rules for
    updating the text track rendering</dfn>. For example, for <a href=#webvtt>WebVTT</a>, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks>rules
    for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a> </p>

    <p>The <a href=#text-track-list-of-cues title="text track list of cues">list of cues of a text track</a> can change
    dynamically, either because the <a href=#text-track>text track</a> has <a href=#text-track-not-loaded title="text track not
    loaded">not yet been loaded</a> or is still <a href=#text-track-loading title="text track loading">loading</a>,
    or due to DOM manipulation.</p>

   </dd>

  </dl><p>Each <a href=#text-track>text track</a> has a corresponding <code><a href=#texttrack>TextTrack</a></code> object.</p>

  <hr><p>Each <a href=#media-element>media element</a> has a <dfn id=list-of-pending-text-tracks>list of pending text tracks</dfn>, which must
  initially be empty, a <dfn id=blocked-on-parser>blocked-on-parser</dfn> flag, which must initially be false, and a
  <dfn id=did-perform-automatic-track-selection>did-perform-automatic-track-selection</dfn> flag, which must also initially be false.</p>

  <p>When the user agent is required to <dfn id=populate-the-list-of-pending-text-tracks>populate the list of pending text tracks</dfn> of a
  <a href=#media-element>media element</a>, the user agent must add to the element's <a href=#list-of-pending-text-tracks>list of pending text
  tracks</a> each <a href=#text-track>text track</a> in the element's <a href=#list-of-text-tracks>list of text tracks</a> whose
  <a href=#text-track-mode>text track mode</a> is not <a href=#text-track-disabled title="text track disabled">disabled</a> and whose
  <a href=#text-track-readiness-state>text track readiness state</a> is <!--either <span title="text track not loaded">not
  loaded</span> or [there can't be any in the 'not loaded' state that are not 'disabled']--> <a href=#text-track-loading title="text track loading">loading</a>.</p>

  <p>Whenever a <code><a href=#the-track-element>track</a></code> element's parent node changes, the user agent must remove the
  corresponding <a href=#text-track>text track</a> from any <a href=#list-of-pending-text-tracks>list of pending text tracks</a> that it is
  in.</p>

  <p>Whenever a <a href=#text-track>text track</a>'s <a href=#text-track-readiness-state>text track readiness state</a> changes to either
  <a href=#text-track-loaded title="text track loaded">loaded</a> or <a href=#text-track-failed-to-load title="text track failed to load">failed to
  load</a>, the user agent must remove it from any <a href=#list-of-pending-text-tracks>list of pending text tracks</a> that
  it is in.</p>

  <p>When a <a href=#media-element>media element</a> is created by an <a href=#html-parser>HTML parser</a> or <a href=#xml-parser>XML
  parser</a>, the user agent must set the element's <a href=#blocked-on-parser>blocked-on-parser</a> flag to true.
  When a <a href=#media-element>media element</a> is popped off the <a href=#stack-of-open-elements>stack of open elements</a> of an
  <a href=#html-parser>HTML parser</a> or <a href=#xml-parser>XML parser</a>, the user agent must <a href=#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>populate the list of pending text
  tracks</a>, and set the element's <a href=#blocked-on-parser>blocked-on-parser</a> flag to false.</p>

  <p>The <a href=#text-track title="text track">text tracks</a> of a <a href=#media-element>media element</a> are <dfn id=the-text-tracks-are-ready title="the text tracks are ready">ready</dfn> when both the element's <a href=#list-of-pending-text-tracks>list of pending text
  tracks</a> is empty and the element's <a href=#blocked-on-parser>blocked-on-parser</a> flag is false.</p>

  <p>Each <a href=#media-element>media element</a> has a <dfn id=pending-text-track-change-notification-flag>pending text track change notification flag</dfn>,
  which must initially be unset.</p>

  <p>Whenever a <a href=#text-track>text track</a> that is in a <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text
  tracks</a> has its <a href=#text-track-mode>text track mode</a> change value, the user agent must run the
  following steps for the <a href=#media-element>media element</a>:</p>

  <ol><li><p>If the <a href=#media-element>media element</a>'s <a href=#pending-text-track-change-notification-flag>pending text track change notification
   flag</a> is set, abort these steps.</li>

   <li><p>Set the <a href=#media-element>media element</a>'s <a href=#pending-text-track-change-notification-flag>pending text track change notification
   flag</a>.</li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> that runs the following substeps:</p>

    <ol><li><p>Unset the <a href=#media-element>media element</a>'s <a href=#pending-text-track-change-notification-flag>pending text track change notification
     flag</a>.</li>

     <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-media-change><a href=#event-media-change>change</a></code> at
     the <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code>
     attribute's <code><a href=#texttracklist>TextTrackList</a></code> object.</li>

    </ol></li>

   <li><p>If the <a href=#media-element>media element</a>'s <a href=#show-poster-flag>show poster flag</a> is not set, run the
   <i><a href=#time-marches-on>time marches on</a></i> steps.</li>

  </ol><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this
  section is the <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>

  <hr><p>A <dfn id=text-track-cue>text track cue</dfn> is the unit of time-sensitive data in a <a href=#text-track>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>text track cue</a> consists of:</p>

  <dl><dt><dfn id=text-track-cue-identifier title="text track cue identifier">An identifier</dfn>
   <dd>
    <p>An arbitrary string.</p>
   </dd>

   <dt><dfn id=text-track-cue-start-time title="text track cue start time">A start time</dfn>
   <dd>
    <p>The time, in seconds and fractions of a second, that describes the beginning of the range of
    the <a href=#media-data>media data</a> to which the cue applies.</p>
   </dd>

   <dt><dfn id=text-track-cue-end-time title="text track cue end time">An end time</dfn>
   <dd>
    <p>The time, in seconds and fractions of a second, that describes the end of the range of the
    <a href=#media-data>media data</a> to which the cue applies.</p>
   </dd>

   <dt><dfn id=text-track-cue-pause-on-exit-flag title="text track cue pause-on-exit flag">A pause-on-exit flag</dfn>
   <dd>
    <p>A boolean indicating whether playback of the <a href=#media-resource>media resource</a> is to pause when the
    end of the range to which the cue applies is reached.</p>
   </dd>

   <dt>Some additional format-specific data</dt>
   <dd>
    <p>Additional fields, as needed for the format. For example, WebVTT has a <a href=#text-track-cue-writing-direction>text track cue
    writing direction</a> and so forth. <a href=#refsWEBVTT>[WEBVTT]</a></p>
   </dd>

   <dt><dfn id=text-track-cue-text title="text track cue text">The text of the cue</dfn>
   <dd>
    <p>The raw text of the cue, and <dfn id=rules-for-rendering-the-cue-in-isolation>rules for rendering the cue in isolation</dfn>.</p>
   </dd>

  </dl><p class=note>The <a href=#text-track-cue-start-time>text track cue start time</a> and <a href=#text-track-cue-end-time>text track cue end
  time</a> can be negative. (The <a href=#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>text track cue</a> has a corresponding <code><a href=#texttrackcue>TextTrackCue</a></code> object (or more
  specifically, an object that inherits from <code><a href=#texttrackcue>TextTrackCue</a></code> &mdash; for example, WebVTT
  cues use the <code>VTTCue</code> interface). A <a href=#text-track-cue>text track cue</a>'s in-memory
  representation can be dynamically changed through this <code><a href=#texttrackcue>TextTrackCue</a></code> API. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>A <a href=#text-track-cue>text track cue</a> is associated with <a href=#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>text track
  cue</a>. These rules are used specifically when the object representing the cue is added to a
  <code><a href=#texttrack>TextTrack</a></code> object using the <code title=dom-TextTrack-addCue><a href=#dom-texttrack-addcue>addCue()</a></code>
  method.</p>

  <p>In addition, each <a href=#text-track-cue>text track cue</a> has two pieces of dynamic information:</p>

  <dl><dt>The <dfn id=text-track-cue-active-flag title="text track cue active flag">active flag</dfn>
   <dd>

    <p>This flag must be initially unset. The flag is used to ensure events are fired appropriately
    when the cue becomes active or inactive, and to make sure the right cues are rendered.</p>

    <p>The user agent must synchronously unset this flag whenever the <a href=#text-track-cue>text track cue</a> is
    removed from its <a href=#text-track>text track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>; whenever the
    <a href=#text-track>text track</a> itself is removed from its <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of
    text tracks</a> or has its <a href=#text-track-mode>text track mode</a> changed to <a href=#text-track-disabled title="text track
    disabled">disabled</a>; and whenever the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is changed back to <code title=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 title="text track">text tracks</a> that were <a href=#text-track-showing title="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>rules for updating the text track
    rendering</a> of those <a href=#text-track title="text track">text tracks</a>. For example, for <a href=#text-track title="text track">text tracks</a> based on <a href=#webvtt>WebVTT</a>, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating
    the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p> </dd>

   <dt>The <dfn id=text-track-cue-display-state title="text track cue display state">display state</dfn>
   <dd>

    <p>This is used as part of the rendering model, to keep cues in a consistent position. It must
    initially be empty. Whenever the <a href=#text-track-cue-active-flag>text track cue active flag</a> is unset, the user
    agent must empty the <a href=#text-track-cue-display-state>text track cue display state</a>.</p>

   </dd>

  </dl><p>The <a href=#text-track-cue title="text track cue">text track cues</a> of a <a href=#media-element>media element</a>'s <a href=#text-track title="text track">text tracks</a> are ordered relative to each other in the <dfn id=text-track-cue-order>text track
  cue order</dfn>, which is determined as follows: first group the <a href=#text-track-cue title="text track
  cue">cues</a> by their <a href=#text-track>text track</a>, with the groups being sorted in the same order
  as their <a href=#text-track title="text track">text tracks</a> appear in the <a href=#media-element>media element</a>'s
  <a href=#list-of-text-tracks>list of text tracks</a>; then, within each group, <a href=#text-track-cue title="text track
  cue">cues</a> must be sorted by their <a href=#text-track-cue-start-time title="text track cue start time">start
  time</a>, earliest first; then, any <a href=#text-track-cue title="text track cue">cues</a> with the same
  <a href=#text-track-cue-start-time title="text track cue start time">start time</a> must be sorted by their <a href=#text-track-cue-end-time title="text track cue end time">end time</a>, latest first; and finally, any <a href=#text-track-cue title="text
  track cue">cues</a> with identical <a href=#text-track-cue-end-time title="text track cue end time">end times</a> must
  be sorted in the order they were last added to their respective <a href=#text-track-list-of-cues>text track list of
  cues</a>, oldest first (so e.g. for cues from a <a href=#webvtt>WebVTT</a> file, that would initially
  be the order in which the cues were listed in the file). <a href=#refsWEBVTT>[WEBVTT]</a></p>


  <h6 id=sourcing-in-band-text-tracks><span class=secno>4.8.10.12.2 </span>Sourcing in-band text tracks</h6>

  <p>A <dfn id=media-resource-specific-text-track>media-resource-specific text track</dfn> is a <a href=#text-track>text track</a> that corresponds
  to data found in the <a href=#media-resource>media resource</a>.</p>


  <div class=impl>

  <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>media resource</a> is a video.</p>

  <p>When a <a href=#media-resource>media resource</a> contains data that the user agent recognises and supports as
  being equivalent to a <a href=#text-track>text track</a>, the user agent <a href=#found-a-media-resource-specific-timed-track>runs</a> the <dfn id=steps-to-expose-a-media-resource-specific-text-track>steps to expose a
  media-resource-specific text track</dfn> with the relevant data, as follows.</p>

  <!-- this runs synchronously from a fetch task -->

  <ol><li><p>Associate the relevant data with a new <a href=#text-track>text track</a> and its corresponding new
   <code><a href=#texttrack>TextTrack</a></code> object. The <a href=#text-track>text track</a> is a <a href=#media-resource-specific-text-track>media-resource-specific
   text track</a>.</li>

   <li><p>Set the new <a href=#text-track>text track</a>'s <a href=#text-track-kind title="text track kind">kind</a>, <a href=#text-track-label title="text track label">label</a>, and <a href=#text-track-language title="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 title="text track label">label</a> must be set to the
   empty string.</li>

   <li><p>Associate the <a href=#text-track-list-of-cues>text track list of cues</a> with the <a href=#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>text track</a>'s <a href=#text-track-kind title="text track kind">kind</a> is <code title=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>text track in-band
    metadata track dispatch type</a> as follows, based on the type of the <a href=#media-resource>media
    resource</a>:</p>

    <dl class=switch><dt>If the <a href=#media-resource>media resource</a> is an Ogg file</dt>

     <dd>The <a href=#text-track-in-band-metadata-track-dispatch-type>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></dd>

     <dt>If the <a href=#media-resource>media resource</a> is a WebM file</dt>

     <dd>The <a href=#text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type</a> must be set to the value
     of the <code title="">CodecID</code> element. <a href=#refsWEBMCG>[WEBMCG]</a></dd>

     <dt>If the <a href=#media-resource>media resource</a> is an MPEG-2 file</dt>

     <dd>Let <var title="">stream type</var> be the value of the "stream_type" field describing the
     text track's type in the file's program map section, interpreted as an 8-bit unsigned integer.
     Let <var title="">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 title="">descriptor bytes</var> be the <var title="">length</var> bytes
     following the "ES_info_length" field. The <a href=#text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch
     type</a> must be set to the concatenation of the <var title="">stream type</var> byte and
     the zero or more <var title="">descriptor bytes</var> bytes, expressed in hexadecimal using
     <a href=#uppercase-ascii-hex-digits>uppercase ASCII hex digits</a>. <a href=#refsMPEG2>[MPEG2]</a>

     </dd>

     <dt>If the <a href=#media-resource>media resource</a> is an MPEG-4 file</dt>

     <dd>Let the 
     first <code title="">stsd</code> box of the
     first <code title="">stbl</code> box of the
     first <code title="">minf</code> box of the
     first <code title="">mdia</code> box of the
     <a href=#text-track>text track</a>'s <code title="">trak</code> box in the
     first <code title="">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 title="">mett</code> box nor a <code title="">metx</code> box, then the <a href=#text-track-in-band-metadata-track-dispatch-type>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 title="">mett</code> box then the <a href=#text-track-in-band-metadata-track-dispatch-type>text
     track in-band metadata track dispatch type</a> must be set to the concatenation of the
     string "<code title="">mett</code>", a U+0020 SPACE character, and the value of the first <code title="">mime_format</code> field of the first <code title="">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 title="">mett</code> box but has a <code title="">metx</code> box then the <a href=#text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type</a>
     must be set to the concatenation of the string "<code title="">metx</code>", a U+0020 SPACE
     character, and the value of the first <code title="">namespace</code> field of the first <code title="">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>

     </dd>

    </dl></li>

   <li><p>Populate the new <a href=#text-track>text track</a>'s <a href=#text-track-list-of-cues title="text track list of cues">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>guidelines for exposing
   cues</a>, and begin updating it dynamically as necessary.</li>

   <li><p>Set the new <a href=#text-track>text track</a>'s <a href=#text-track-readiness-state title="text track readiness state">readiness
   state</a> to <a href=#text-track-loaded title="text track loaded">loaded</a>.</li> <!-- otherwise, you'll
   have to load the whole media file just to start playing the first frame... -->

   <li><p>Set the new <a href=#text-track>text track</a>'s <a href=#text-track-mode title="text track mode">mode</a> to the
   mode consistent with the user's preferences and the requirements of the relevant specification
   for the data.</li> <!-- it's too late to apply the normal heuristic, so we don't bother -->

   <li><p>Add the new <a href=#text-track>text track</a> to the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text
   tracks</a>.</li>

   <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and that uses
   the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code>
   attribute initialized to the <a href=#text-track>text track</a>'s <code><a href=#texttrack>TextTrack</a></code> object, at the
   <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
   <code><a href=#texttracklist>TextTrackList</a></code> object.</li>

  </ol><!-- removetrack: we don't currently ever remove an in-band text track, because it might have been
  manipulated or might be about to be manipulated. If we made in-band text tracks readonly, we could
  probably get away with cleaning them up when they fall into the time before the earliest possible
  position and are known to be over and done with. --><!-- if, after in-band text tracks have been found, there's no out-of-band text tracks, then apply
  user prefs? --></div>



  <div class=impl>

  <h6 id=sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sourcing out-of-band text tracks</h6>

  <p>When a <code><a href=#the-track-element>track</a></code> element is created, it must be associated with a new <a href=#text-track>text
  track</a> (with its value set as defined below) and its corresponding new
  <code><a href=#texttrack>TextTrack</a></code> object.</p>

  <p>The <a href=#text-track-kind>text track kind</a> is determined from the state of the element's <code title=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 title="text track kind">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 title=attr-track-kind-subtitles>Subtitles</a>
     <td><code title=dom-TextTrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code>
    <tr><td><a href=#attr-track-kind-captions title=attr-track-kind-captions>Captions</a>
     <td><code title=dom-TextTrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code>
    <tr><td><a href=#attr-track-kind-descriptions title=attr-track-kind-descriptions>Descriptions</a>
     <td><code title=dom-TextTrack-kind-descriptions><a href=#dom-texttrack-kind-descriptions>descriptions</a></code>
    <tr><td><a href=#attr-track-kind-chapters title=attr-track-kind-chapters>Chapters</a>
     <td><code title=dom-TextTrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code>
    <tr><td><a href=#attr-track-kind-metadata title=attr-track-kind-metadata>Metadata</a>
     <td><code title=dom-TextTrack-kind-metadata><a href=#dom-texttrack-kind-metadata>metadata</a></code>
  </table><p>The <a href=#text-track-label>text track label</a> is the element's <a href=#track-label>track label</a>.</p>

  <p>The <a href=#text-track-language>text track language</a> is the element's <a href=#track-language>track language</a>, if any, or
  the empty string otherwise.</p>

  <p>As the <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code>, <code title=attr-track-label><a href=#attr-track-label>label</a></code>,
  and <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attributes are set, changed, or removed, the
  <a href=#text-track>text track</a> must update accordingly, as per the definitions above.</p>

  <p class=note>Changes to the <a href=#track-url>track URL</a> are handled in the algorithm below.</p>

  <p>The <a href=#text-track-readiness-state>text track readiness state</a> is initially <a href=#text-track-not-loaded title="text track not
  loaded">not loaded</a>, and the <a href=#text-track-mode>text track mode</a> is initially <a href=#text-track-disabled title="text
  track disabled">disabled</a>.</p>

  <p>The <a href=#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>rules for updating the text
  track rendering</a> appropriate for the format in question; for <a href=#webvtt>WebVTT</a>, this is
  the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>When a <code><a href=#the-track-element>track</a></code> element's parent element changes and the new parent is a <a href=#media-element>media
  element</a>, then the user agent must add the <code><a href=#the-track-element>track</a></code> element's corresponding
  <a href=#text-track>text track</a> to the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>, and
  then <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and that uses
  the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code>
  attribute initialized to the <a href=#text-track>text track</a>'s <code><a href=#texttrack>TextTrack</a></code> object, at the
  <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
  <code><a href=#texttracklist>TextTrackList</a></code> object.</p>

  <p>When a <code><a href=#the-track-element>track</a></code> element's parent element changes and the old parent was a <a href=#media-element>media
  element</a>, then the user agent must remove the <code><a href=#the-track-element>track</a></code> element's corresponding
  <a href=#text-track>text track</a> from the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>,
  and then <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>, that does not bubble and is not cancelable, and that
  uses the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to the <a href=#text-track>text track</a>'s
  <code><a href=#texttrack>TextTrack</a></code> object, at the <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's <code><a href=#texttracklist>TextTrackList</a></code> object.</p>
  <!-- removetrack -->

  <hr><p>When a <a href=#text-track>text track</a> corresponding to a <code><a href=#the-track-element>track</a></code> element is added to a
  <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>, the user agent must <a href=#queue-a-task>queue a
  task</a> to run the following steps for the <a href=#media-element>media element</a>:</p>

  <ol><li><p>If the element's <a href=#blocked-on-parser>blocked-on-parser</a> flag is true, abort these steps.</li>

   <li><p>If the element's <a href=#did-perform-automatic-track-selection>did-perform-automatic-track-selection</a> flag is true, abort
   these steps.</li>

   <li><p><a href=#honor-user-preferences-for-automatic-text-track-selection>Honor user preferences for automatic text track selection</a> for this
   element.</li>

  </ol><p>When the user agent is required to <dfn id=honor-user-preferences-for-automatic-text-track-selection>honor user preferences for automatic text track
  selection</dfn> for a <a href=#media-element>media element</a>, the user agent must run the following steps:</p>

  <ol><li><p><a href=#perform-automatic-text-track-selection>Perform automatic text track selection</a> for <code title=dom-TextTrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code> and <code title=dom-TextTrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code>.</li>

   <li><p><a href=#perform-automatic-text-track-selection>Perform automatic text track selection</a> for <code title=dom-TextTrack-kind-descriptions><a href=#dom-texttrack-kind-descriptions>descriptions</a></code>.</li>

   <li><p><a href=#perform-automatic-text-track-selection>Perform automatic text track selection</a> for <code title=dom-TextTrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code>.</li>

   <li><p>If there are any <a href=#text-track title="text track">text tracks</a> in the <a href=#media-element>media
   element</a>'s <a href=#list-of-text-tracks>list of text tracks</a> whose <a href=#text-track-kind>text track kind</a> is <code title=dom-TextTrack-kind-metadata><a href=#dom-texttrack-kind-metadata>metadata</a></code> that correspond to <code><a href=#the-track-element>track</a></code>
   elements with a <code title=attr-track-default><a href=#attr-track-default>default</a></code> attribute set whose <a href=#text-track-mode>text
   track mode</a> is set to <a href=#text-track-disabled title="text track disabled">disabled</a>, then set the
   <a href=#text-track-mode>text track mode</a> of all such tracks to <a href=#text-track-hidden title="text track
   hidden">hidden</a></li>

   <li><p>Set the element's <a href=#did-perform-automatic-track-selection>did-perform-automatic-track-selection</a> flag to
   true.</li>

  </ol><p>When the steps above say to <dfn id=perform-automatic-text-track-selection>perform automatic text track selection</dfn> for one or more
  <a href=#text-track-kind title="text track kind">text track kinds</a>, it means to run the following steps:</p>

  <ol><li><p>Let <var title="">candidates</var> be a list consisting of the <a href=#text-track title="text
   track">text tracks</a> in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>
   whose <a href=#text-track-kind>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>list of text tracks</a>.</li>

   <li><p>If <var title="">candidates</var> is empty, then abort these steps.</li>

   <li><p>If any of the <a href=#text-track title="text track">text tracks</a> in <var title="">candidates</var> have a <a href=#text-track-mode>text track mode</a> set to <a href=#text-track-showing title="text track
   showing">showing</a>, abort these steps.</li>

   <li>

    <p>If the user has expressed an interest in having a track from <var title="">candidates</var>
    enabled based on its <a href=#text-track-kind>text track kind</a>, <a href=#text-track-language>text track language</a>, and
    <a href=#text-track-label>text track label</a>, then set its <a href=#text-track-mode>text track mode</a> to <a href=#text-track-showing title="text
    track showing">showing</a><!--, and if there are any <span title="text track">text
    tracks</span> in <var title="">candidates</var> that correspond to <code>track</code> elements
    with a <code title="attr-track-default">default</code> attribute set whose <span>text track
    mode</span> is set to <span title="text track disabled">disabled</span>, then additionally set
    the <span>text track mode</span> of the first such track to <span title="text track
    hidden">hidden</span>-->.</p> <!-- the idea behind the commented out stuff is that we still get
    events and stuff: we can expect authors to forget that default doesn't mean that it'll always be
    turned on, and that they'll still rely on events firing even if it doesn't show. But it is
    commented out, because we can equally expect authors to expect only one track is getting events,
    so we've got problems either way, and might as well go with the simpler behaviour. -->

    <p class=note>For example, the user could have set a browser preference to the effect of "I
    want French captions whenever possible", or "If there is a subtitle track with 'Commentary' in
    the title, enable it", or "If there are audio description tracks available, enable one, ideally
    in Swiss German, but failing that in Standard Swiss German or Standard German".</p>

    <p>Otherwise, if there are any <a href=#text-track title="text track">text tracks</a> in <var title="">candidates</var> that correspond to <code><a href=#the-track-element>track</a></code> elements with a <code title=attr-track-default><a href=#attr-track-default>default</a></code> attribute set whose <a href=#text-track-mode>text track mode</a> is
    set to <a href=#text-track-disabled title="text track disabled">disabled</a>, then set the <a href=#text-track-mode>text track
    mode</a> of the first such track to <a href=#text-track-showing title="text track showing">showing</a>.</p>

   </li>

  </ol><p>When a <a href=#text-track>text track</a> corresponding to a <code><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>start the <code>track</code> processing
  model</a> for that <a href=#text-track>text track</a> and its <code><a href=#the-track-element>track</a></code> element:

  <ul><li>The <code><a href=#the-track-element>track</a></code> element is created.</li>

   <li>The <a href=#text-track>text track</a> has its <a href=#text-track-mode>text track mode</a> changed.</li>

   <li>The <code><a href=#the-track-element>track</a></code> element's parent element changes and the new parent is a <a href=#media-element>media
   element</a>.</li>

  </ul><p>When a user agent is to <dfn id=start-the-track-processing-model>start the <code>track</code> processing model</dfn> for a
  <a href=#text-track>text track</a> and its <code><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>event loop</a> mechanism; in particular, it has
  a <a href=#synchronous-section>synchronous section</a> (which is triggered as part of the <a href=#event-loop>event loop</a>
  algorithm). The steps in that section are marked with &#x231b;.</p>

  <ol><li><p>If another occurrence of this algorithm is already running for this <a href=#text-track>text
   track</a> and its <code><a href=#the-track-element>track</a></code> element, abort these steps, letting that other algorithm
   take care of this element.</li>

   <li><p>If the <a href=#text-track>text track</a>'s <a href=#text-track-mode>text track mode</a> is not set to one of <a href=#text-track-hidden title="text track hidden">hidden</a> or <a href=#text-track-showing title="text track showing">showing</a>, abort
   these steps.</li>

   <li><p>If the <a href=#text-track>text track</a>'s <code><a href=#the-track-element>track</a></code> element does not have a <a href=#media-element>media
   element</a> as a parent, abort these steps.</li>

   <li><p>Run the remainder of these steps asynchronously, allowing whatever caused these steps to
   run to continue.</li>

   <li><p><i>Top</i>: <a href=#await-a-stable-state>Await a stable state</a>. The <a href=#synchronous-section>synchronous section</a>
   consists of the following steps. (The steps in the <a href=#synchronous-section>synchronous section</a> are marked
   with &#x231b;.)</li>

   <li><p>&#x231b; Set the <a href=#text-track-readiness-state>text track readiness state</a> to <a href=#text-track-loading title="text track
   loading">loading</a>.</li>

   <li><p>&#x231b; Let <var title="">URL</var> be the <a href=#track-url>track URL</a> of the
   <code><a href=#the-track-element>track</a></code> element.</li>

   <li><p>&#x231b; If the <code><a href=#the-track-element>track</a></code> element's parent is a <a href=#media-element>media element</a> then
   let <var title="">CORS mode</var> be the state of the parent <a href=#media-element>media element</a>'s <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> content attribute. Otherwise, let <var title="">CORS mode</var> be <a href=#attr-crossorigin-none title=attr-crossorigin-none>No CORS</a>.</li>

   <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the remaining steps
   asynchronously.</li>

   <li>

    <p>If <var title="">URL</var> is not the empty string, perform a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled
    fetch</a><!--FETCH--> of <var title="">URL</var>, with the <i>mode</i> being <var title="">CORS mode</var>, the <i title="">origin</i> being the <a href=#origin>origin</a> of the
    <code><a href=#the-track-element>track</a></code> element's <code><a href=#document>Document</a></code>, and the <i>default origin behaviour</i> set
    to <i>fail</i>.</p>

    <p>The resource obtained in this fashion, if any, contains the text track data. If any data is
    obtained, it is by definition <a href=#cors-same-origin>CORS-same-origin</a> (cross-origin resources that are not
    suitably CORS-enabled do not get this far).</p>

    <p>The <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> by the
    <a href=#fetch title=fetch>fetching algorithm</a> on the <a href=#networking-task-source>networking task source</a> to
    process the data as it is being fetched must <!--<span title="Content-Type
    sniffing">-->determine the <!--sniffed--> type of the resource<!--</span>-->. If the
    <!--sniffed--> type of the resource is not a supported text track format, the load will fail, as
    described below. Otherwise, the resource's data must be passed to the appropriate parser (e.g.
    the <a href=#webvtt-parser>WebVTT parser</a><!-- if the file starts with the "<code title="">WEBVTT</code>"
    signature-->) as it is received, with the <a href=#text-track-list-of-cues>text track list of cues</a> being used for
    that parser's output. <a href=#refsWEBVTT>[WEBVTT]</a></p><!-- see also critical block below,
    and the word "sniffed" in the paragraph after that -->

    <p class=note>The appropriate parser will synchronously (during these <a href=#networking-task-source>networking task
    source</a> <a href=#concept-task title=concept-task>tasks</a>) and incrementally (as each such task is
    run with whatever data has been received from the network) update the <a href=#text-track-list-of-cues>text track list of
    cues</a>.</p>

    <p class=critical>This specification does not currently say whether or how to check the MIME
    types of text tracks, or whether or how to perform file type sniffing using the actual file
    data. Implementors differ in their intentions on this matter and it is therefore unclear what
    the right solution is. In the absence of any requirement here, the HTTP specification's strict
    requirement to follow the Content-Type header prevails ("Content-Type specifies the media type
    of the underlying data." ... "If and only if the media type is not given by a Content-Type
    field, the recipient MAY attempt to guess the media type via inspection of its content
    and<!---->/<!---->or the name extension(s) of the URI used to identify the resource.").</p>

    <p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for any reason (network error, the
    server returns an error code, a cross-origin check fails, etc), if <var title="">URL</var> is
    the empty string, or if the <!--sniffed--> type of the resource is not a supported text track
    format, then run these steps:</p>

    <ol><li><p><a href=#queue-a-task>Queue a task</a> to first change the <a href=#text-track-readiness-state>text track readiness state</a> to
     <a href=#text-track-failed-to-load title="text track failed to load">failed to load</a> and then <a href=#fire-a-simple-event>fire a simple
     event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
     element.</li>

     <li><p>Wait until the <a href=#text-track-readiness-state>text track readiness state</a> is no longer set to <a href=#text-track-loading title="text track loading">loading</a>.</li>

     <li><p>Wait until the <a href=#track-url>track URL</a> is no longer equal to <var title="">URL</var>, at
     the same time as the <a href=#text-track-mode>text track mode</a> is set to <a href=#text-track-hidden title="text track
     hidden">hidden</a> or <a href=#text-track-showing title="text track showing">showing</a>.</li>

     <li><p>Jump to the step labeled <i>top</i>.</li>

    </ol><p>If the <a href=#fetch title=fetch>fetching algorithm</a> does not fail, then the final <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the
    <a href=#networking-task-source>networking task source</a> must run the following steps after it has tried to parse the
    data:</p>

    <ol><li><p>Change the <a href=#text-track-readiness-state>text track readiness state</a> to <a href=#text-track-loaded title="text track
     loaded">loaded</a>.</li>

     <li>

      <p>If the file was successfully processed, <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#the-track-element>track</a></code> element.</p>

      <p>Otherwise, 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); <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code> element.</p>

     </li>

     <li><p>Wait until the <a href=#track-url>track URL</a> is no longer equal to <var title="">URL</var>, at
     the same time as the <a href=#text-track-mode>text track mode</a> is set to <a href=#text-track-hidden title="text track
     hidden">hidden</a> or <a href=#text-track-showing title="text track showing">showing</a>.</li>

     <li><p>Jump back to the step labeled <i>top</i>.</li>

    </ol><p>If, while the <a href=#fetch title=fetch>fetching algorithm</a> is active, either:</p>

    <ul><li>the <a href=#track-url>track URL</a> changes so that it is no longer equal to <var title="">URL</var>, while the <a href=#text-track-mode>text track mode</a> is set to <a href=#text-track-hidden title="text track
     hidden">hidden</a> or <a href=#text-track-showing title="text track showing">showing</a>; or</li>

     <li>the <a href=#text-track-mode>text track mode</a> changes to <a href=#text-track-hidden title="text track hidden">hidden</a>
     or <a href=#text-track-showing title="text track showing">showing</a>, while the <a href=#track-url>track URL</a> is not
     equal to <var title="">URL</var></li>

    </ul><p>...then the user agent must run the following steps:</p>

    <ol><li><p>Abort the <a href=#fetch title=fetch>fetching algorithm</a>, discarding any pending <a href=#concept-task title=concept-task>tasks</a> generated by that algorithm (and in particular, not adding
     any cues to the <a href=#text-track-list-of-cues>text track list of cues</a> after the moment the URL
     changed).</li>

     <li><p>Jump back to the step labeled <i>top</i>.</li>

    </ol><p>Until one of the above circumstances occurs, the user agent must remain on this step.</p>

   </li>

  </ol><p>Whenever a <code><a href=#the-track-element>track</a></code> element has its <code title=attr-track-src><a href=#attr-track-src>src</a></code> attribute
  set, changed, or removed, the user agent must synchronously empty the element's <a href=#text-track>text
  track</a>'s <a href=#text-track-list-of-cues>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>

  </div>


  <div class=impl>

  <h6 id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues><span class=secno>4.8.10.12.4 </span><dfn>Guidelines for exposing cues</dfn> in various formats as <a href=#text-track-cue title="text track
  cue">text track cues</a></h6>

  <p>How a specific format's text track cues are to be interpreted for the purposes of processing by
  an HTML user agent is defined by that format. In the absence of such a specification, this section
  provides some constraints within which implementations can attempt to consistently expose such
  formats.</p>

  <p>To support the <a href=#text-track>text track</a> model of HTML, each unit of timed data is converted to a
  <a href=#text-track-cue>text track cue</a>. Where the mapping of the format's features to the aspects of a
  <a href=#text-track-cue>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>text track
  cue</a> as defined above, as well as with the following constraints:</p>

  <dl><dt>The <a href=#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>
   </dd>

   <dt>The <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag</a>
   <dd>
    <p>Should be set to false.</p>
   </dd>

  </dl></div>


  <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>

  <pre class=idl>interface <dfn id=texttracklist>TextTrackList</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute unsigned long <a href=#dom-texttracklist-length title=dom-TextTrackList-length>length</a>;
  getter <a href=#texttrack>TextTrack</a> (unsigned long index);
  <a href=#texttrack>TextTrack</a>? <a href=#dom-texttracklist-gettrackbyid title=dom-TextTrackList-getTrackById>getTrackById</a>(DOMString id);

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-texttracklist-onchange title=handler-TextTrackList-onchange>onchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-texttracklist-onaddtrack title=handler-TextTrackList-onaddtrack>onaddtrack</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-texttracklist-onremovetrack title=handler-TextTrackList-onremovetrack>onremovetrack</a>;
};</pre>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> . <code title="">length</code></dt>
   <dd>
    <p>Returns the number of <a href=#text-track title="text track">text tracks</a> associated with the <a href=#media-element>media element</a> (e.g. from <code><a href=#the-track-element>track</a></code> elements). This is the number of <a href=#text-track title="text track">text tracks</a> in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</p>
   </dd>

   <dt><var title="">media</var> . <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks[</a></code> <var title="">n</var> <code title="">]</code></dt>
   <dd>
    <p>Returns the <code><a href=#texttrack>TextTrack</a></code> object representing the <var title="">n</var>th <a href=#text-track>text track</a> in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</p>
   </dd>

   <dt><var title="">textTrack</var> = <var title="">media</var> . <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> . <code title=dom-TextTrackList-getTrackById><a href=#dom-texttracklist-gettrackbyid>getTrackById</a></code>( <var title="">id</var> )</dt>

   <dd>

    <p>Returns the <code><a href=#texttrack>TextTrack</a></code> object with the given identifier, or null if no track has that identifier.</p>

   </dd>

   <dt><var title="">track</var> . <code title=dom-track-track><a href=#dom-track-track>track</a></code></dt>
   <dd>
    <p>Returns the <code><a href=#texttrack>TextTrack</a></code> object representing the <code><a href=#the-track-element>track</a></code> element's <a href=#text-track>text track</a>.</p>
   </dd>

  </dl><div class=impl>

  <p>A <code><a href=#texttracklist>TextTrackList</a></code> object represents a dynamically
  updating list of <a href=#text-track title="text track">text tracks</a> in a
  given order.</p>

  <p>The <dfn id=dom-media-texttracks title=dom-media-textTracks><code>textTracks</code></dfn> attribute
  of <a href=#media-element title="media element">media elements</a> must return a
  <code><a href=#texttracklist>TextTrackList</a></code> object representing the
  <code><a href=#texttrack>TextTrack</a></code> objects of the <a href=#text-track title="text track">text
  tracks</a> in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text
  tracks</a>, in the same order as in the <a href=#list-of-text-tracks>list of text
  tracks</a>. The same object must be returned each time the
  attribute is accessed. <a href=#refsWEBIDL>[WEBIDL]</a></p>

  <p>The <dfn id=dom-texttracklist-length title=dom-TextTrackList-length><code>length</code></dfn> attribute
  of a <code><a href=#texttracklist>TextTrackList</a></code> object must return the number of
  <a href=#text-track title="text track">text tracks</a> in the list represented
  by the <code><a href=#texttracklist>TextTrackList</a></code> object.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> of a
  <code><a href=#texttracklist>TextTrackList</a></code> object at any instant are the numbers
  from zero to the number of <a href=#text-track title="text track">text
  tracks</a> in the list represented by the
  <code><a href=#texttracklist>TextTrackList</a></code> object minus one, if any. If there are no
  <a href=#text-track title="text track">text tracks</a> in the list, there are
  no <a href=#supported-property-indices>supported property indices</a>.</p>

  <p>To <a href=#determine-the-value-of-an-indexed-property>determine the value of an indexed property</a> of a
  <code><a href=#texttracklist>TextTrackList</a></code> object for a given index <var title="">index</var>, the user agent must return the <var title="">index</var>th <a href=#text-track>text track</a> in the list
  represented by the <code><a href=#texttracklist>TextTrackList</a></code> object.</p>

  <p>The <dfn id=dom-texttracklist-gettrackbyid title=dom-TextTrackList-getTrackById><code>getTrackById(<var title="">id</var>)</code></dfn> method must return the first <code><a href=#texttrack>TextTrack</a></code> in the
  <code><a href=#texttracklist>TextTrackList</a></code> object whose <code title=dom-TextTrack-id><a href=#dom-texttrack-id>id</a></code> IDL attribute
  would return a value equal to the value of the <var title="">id</var> argument. When no tracks
  match the given argument, the method must return null.</p>

  </div>

  <hr><pre class=idl>enum <dfn id=texttrackmode>TextTrackMode</dfn> {<!--
   --> "<a href=#dom-texttrack-disabled title=dom-TextTrack-disabled>disabled</a>", <!--
   --> "<a href=#dom-texttrack-hidden title=dom-TextTrack-hidden>hidden</a>", <!--
   --> "<a href=#dom-texttrack-showing title=dom-TextTrack-showing>showing</a>" };
enum <dfn id=texttrackkind>TextTrackKind</dfn> {<!--
   --> "<a href=#dom-texttrack-kind-subtitles title=dom-TextTrack-kind-subtitles>subtitles</a>", <!--
   --> "<a href=#dom-texttrack-kind-captions title=dom-TextTrack-kind-captions>captions</a>", <!--
   --> "<a href=#dom-texttrack-kind-descriptions title=dom-TextTrack-kind-descriptions>descriptions</a>", <!--
   --> "<a href=#dom-texttrack-kind-chapters title=dom-TextTrack-kind-chapters>chapters</a>", <!--
   --> "<a href=#dom-texttrack-kind-metadata title=dom-TextTrack-kind-metadata>metadata</a>" };
interface <dfn id=texttrack>TextTrack</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute <a href=#texttrackkind>TextTrackKind</a> <a href=#dom-texttrack-kind title=dom-TextTrack-kind>kind</a>;
  readonly attribute DOMString <a href=#dom-texttrack-label title=dom-TextTrack-label>label</a>;
  readonly attribute DOMString <a href=#dom-texttrack-language title=dom-TextTrack-language>language</a>;

  readonly attribute DOMString <a href=#dom-texttrack-id title=dom-TextTrack-id>id</a>;
  readonly attribute DOMString <a href=#dom-texttrack-inbandmetadatatrackdispatchtype title=dom-TextTrack-inBandMetadataTrackDispatchType>inBandMetadataTrackDispatchType</a>;

           attribute <a href=#texttrackmode>TextTrackMode</a> <a href=#dom-texttrack-mode title=dom-TextTrack-mode>mode</a>;

  readonly attribute <a href=#texttrackcuelist>TextTrackCueList</a>? <a href=#dom-texttrack-cues title=dom-TextTrack-cues>cues</a>;
  readonly attribute <a href=#texttrackcuelist>TextTrackCueList</a>? <a href=#dom-texttrack-activecues title=dom-TextTrack-activeCues>activeCues</a>;

  void <a href=#dom-texttrack-addcue title=dom-TextTrack-addCue>addCue</a>(<a href=#texttrackcue>TextTrackCue</a> cue);
  void <a href=#dom-texttrack-removecue title=dom-TextTrack-removeCue>removeCue</a>(<a href=#texttrackcue>TextTrackCue</a> cue);

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-texttrack-oncuechange title=handler-TextTrack-oncuechange>oncuechange</a>;
};</pre>

  <dl class=domintro><dt><var title="">textTrack</var> = <var title="">media</var> . <code title=dom-media-addTextTrack><a href=#dom-media-addtexttrack>addTextTrack</a></code>( <var title="">kind</var> [, <var title="">label</var> [, <var title="">language</var> ] ] )</dt>
   <dd>
    <p>Creates and returns a new <code><a href=#texttrack>TextTrack</a></code> object, which is also added to the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-kind><a href=#dom-texttrack-kind>kind</a></code></dt>
   <dd>
    <p>Returns the <a href=#text-track-kind>text track kind</a> string.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-label><a href=#dom-texttrack-label>label</a></code></dt>
   <dd>
    <p>Returns the <a href=#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>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-language><a href=#dom-texttrack-language>language</a></code></dt>
   <dd>
    <p>Returns the <a href=#text-track-language>text track language</a> string.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-id><a href=#dom-texttrack-id>id</a></code></dt>
   <dd>

    <p>Returns the ID of the given track.</p>

    <p>For in-band tracks, this is the ID that can be used with a fragment identifier if the format
    supports the <cite>Media Fragments URI</cite> syntax, and that can be used with the <code title=dom-TextTrackList-getTrackById><a href=#dom-texttracklist-gettrackbyid>getTrackById()</a></code> method. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

    <p>For <code><a href=#texttrack>TextTrack</a></code> objects corresponding to <code><a href=#the-track-element>track</a></code> elements, this is the
    ID of the <code><a href=#the-track-element>track</a></code> element.</p>

   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-inBandMetadataTrackDispatchType><a href=#dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType</a></code></dt>
   <dd>
    <p>Returns the <a href=#text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type</a> string.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-mode><a href=#dom-texttrack-mode>mode</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the <a href=#text-track-mode>text track mode</a>, represented by a
    string from the following list:</p>
    <dl><dt>"<code title=dom-TextTrack-disabled><a href=#dom-texttrack-disabled>disabled</a></code>"</dt>
     <dd>
      <p>The <a href=#text-track-disabled>text track disabled</a> mode.</p>
     </dd>
     <dt>"<code title=dom-TextTrack-hidden><a href=#dom-texttrack-hidden>hidden</a></code>"</dt>
     <dd>
      <p>The <a href=#text-track-hidden>text track hidden</a> mode.</p>
     </dd>
     <dt>"<code title=dom-TextTrack-showing><a href=#dom-texttrack-showing>showing</a></code>"</dt>
     <dd>
      <p>The <a href=#text-track-showing>text track showing</a> mode.</p>
     </dd>
    </dl><p>Can be set, to change the mode.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-cues><a href=#dom-texttrack-cues>cues</a></code></dt>
   <dd>
    <p>Returns the <a href=#text-track-list-of-cues>text track list of cues</a>, as a <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-activeCues><a href=#dom-texttrack-activecues>activeCues</a></code></dt>
   <dd>
    <p>Returns the <a href=#text-track-cue title="text track cue">text track cues</a> from the <a href=#text-track-list-of-cues>text track list of cues</a> that are currently active (i.e. that start before the <a href=#current-playback-position>current playback position</a> and end after it), as a <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-addCue><a href=#dom-texttrack-addcue>addCue</a></code>( <var title="">cue</var> )</dt>
   <dd>
    <p>Adds the given cue to <var title="">textTrack</var>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</p>
   </dd>

   <dt><var title="">textTrack</var> . <code title=dom-TextTrack-removeCue><a href=#dom-texttrack-removecue>removeCue</a></code>( <var title="">cue</var> )</dt>
   <dd>
    <p>Removes the given cue from <var title="">textTrack</var>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-addtexttrack title=dom-media-addTextTrack><code>addTextTrack(<var title="">kind</var>, <var title="">label</var>, <var title="">language</var>)</code></dfn> method of <a href=#media-element title="media
  element">media elements</a>, when invoked, must run the following steps:</p>

  <ol><li>

    <p>Create a new <code><a href=#texttrack>TextTrack</a></code> object.</p>

   </li>

   <li>

    <p>Create a new <a href=#text-track>text track</a> corresponding to the new object, and set its <a href=#text-track-kind>text
    track kind</a> to <var title="">kind</var>, its <a href=#text-track-label>text track label</a> to <var title="">label</var>, its <a href=#text-track-language>text track language</a> to <var title="">language</var>, its
    <a href=#text-track-readiness-state>text track readiness state</a> to the <a href=#text-track-loaded>text track loaded</a> state, its
    <a href=#text-track-mode>text track mode</a> to the <a href=#text-track-hidden>text track hidden</a> mode, and its <a href=#text-track-list-of-cues>text
    track list of cues</a> to an empty list.</p>

    <p>Initially, the <a href=#text-track-list-of-cues>text track list of cues</a> is not associated with any <a href=#rules-for-updating-the-text-track-rendering>rules
    for updating the text track rendering</a>. When a <a href=#text-track-cue>text track cue</a> is added to it,
    the <a href=#text-track-list-of-cues>text track list of cues</a> has its rules permanently set accordingly.</p>

   </li>

   <li>

    <p>Add the new <a href=#text-track>text track</a> to the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text
    tracks</a>.</p>

   </li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and that
    uses the <code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to the new <a href=#text-track>text
    track</a>'s <code><a href=#texttrack>TextTrack</a></code> object, at the <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's <code><a href=#texttracklist>TextTrackList</a></code>
    object.</p>

   </li>

   <li>

    <p>Return the new <code><a href=#texttrack>TextTrack</a></code> object.</p>

   </li>

  </ol><hr><p>The <dfn id=dom-texttrack-kind title=dom-TextTrack-kind><code>kind</code></dfn> attribute must return the
  <a href=#text-track-kind>text track kind</a> of the <a href=#text-track>text track</a> that the <code><a href=#texttrack>TextTrack</a></code> object
  represents.</p>

  <p>The <dfn id=dom-texttrack-label title=dom-TextTrack-label><code>label</code></dfn> attribute must return the
  <a href=#text-track-label>text track label</a> of the <a href=#text-track>text track</a> that the <code><a href=#texttrack>TextTrack</a></code>
  object represents.</p>

  <p>The <dfn id=dom-texttrack-language title=dom-TextTrack-language><code>language</code></dfn> attribute must return the
  <a href=#text-track-language>text track language</a> of the <a href=#text-track>text track</a> that the <code><a href=#texttrack>TextTrack</a></code>
  object represents.</p>

  <p>The <dfn id=dom-texttrack-id title=dom-TextTrack-id><code>id</code></dfn> attribute returns the track's
  identifier, if it has one, or the empty string otherwise. For tracks that correspond to
  <code><a href=#the-track-element>track</a></code> elements, the track's identifier is the value of the element's <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute, if any. For in-band tracks, the track's identifier is
  specified by the <a href=#media-resource>media resource</a>. If the <a href=#media-resource>media resource</a> is in a format
  that supports the <cite>Media Fragments URI</cite> fragment identifier syntax, the identifier
  returned for a particular track must be the same identifier that would enable the track if used as
  the name of a track in the track dimension of such a fragment identifier. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

  <p>The <dfn id=dom-texttrack-inbandmetadatatrackdispatchtype title=dom-TextTrack-inBandMetadataTrackDispatchType><code>inBandMetadataTrackDispatchType</code></dfn>
  attribute must return the <a href=#text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type</a> of the
  <a href=#text-track>text track</a> that the <code><a href=#texttrack>TextTrack</a></code> object represents.</p>

  <p>The <dfn id=dom-texttrack-mode title=dom-TextTrack-mode><code>mode</code></dfn> attribute, on getting, must return
  the string corresponding to the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text track</a> that
  the <code><a href=#texttrack>TextTrack</a></code> object represents, as defined by the following list:</p>

  <dl><dt>"<dfn id=dom-texttrack-disabled title=dom-TextTrack-disabled><code>disabled</code></dfn>"</dt>
   <dd>The <a href=#text-track-disabled>text track disabled</a> mode.</dd>
   <dt>"<dfn id=dom-texttrack-hidden title=dom-TextTrack-hidden><code>hidden</code></dfn>"</dt>
   <dd>The <a href=#text-track-hidden>text track hidden</a> mode.</dd>
   <dt>"<dfn id=dom-texttrack-showing title=dom-TextTrack-showing><code>showing</code></dfn>"</dt>
   <dd>The <a href=#text-track-showing>text track showing</a> mode.</dd>
  </dl><p>On setting, if the new value isn't equal to what the attribute would currently return, the new
  value must be processed as follows:</p>

  <dl class=switch><dt>If the new value is "<code title=dom-TextTrack-disabled><a href=#dom-texttrack-disabled>disabled</a></code>"</dt>

   <dd>

    <p>Set the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text track</a> that the
    <code><a href=#texttrack>TextTrack</a></code> object represents to the <a href=#text-track-disabled>text track disabled</a> mode.</p>

   </dd>

   <dt>If the new value is "<code title=dom-TextTrack-hidden><a href=#dom-texttrack-hidden>hidden</a></code>"</dt>

   <dd>

    <p>Set the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text track</a> that the
    <code><a href=#texttrack>TextTrack</a></code> object represents to the <a href=#text-track-hidden>text track hidden</a> mode.</p>

   </dd>

   <dt>If the new value is "<code title=dom-TextTrack-showing><a href=#dom-texttrack-showing>showing</a></code>"</dt>

   <dd>

    <p>Set the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text track</a> that the
    <code><a href=#texttrack>TextTrack</a></code> object represents to the <a href=#text-track-showing>text track showing</a> mode.</p>

   </dd>

  </dl><p>If the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text track</a> that the
  <code><a href=#texttrack>TextTrack</a></code> object represents is not the <a href=#text-track-disabled>text track disabled</a> mode, then
  the <dfn id=dom-texttrack-cues title=dom-TextTrack-cues><code>cues</code></dfn> attribute must return a
  <a href=#live>live</a> <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object that represents the subset of the
  <a href=#text-track-list-of-cues>text track list of cues</a> of the <a href=#text-track>text track</a> that the
  <code><a href=#texttrack>TextTrack</a></code> object represents whose <a href=#text-track-cue-end-time title="text track cue end time">end
  times</a> occur at or after the <a href=#earliest-possible-position-when-the-script-started>earliest possible position when the script
  started</a>, in <a href=#text-track-cue-order>text track cue order</a>. Otherwise, it must return null. When an
  object is returned, the same object must be returned each time.</p>

  <p>The <dfn id=earliest-possible-position-when-the-script-started>earliest possible position when the script started</dfn> is whatever the
  <a href=#earliest-possible-position>earliest possible position</a> was the last time the <a href=#event-loop>event loop</a> reached step
  1.</p>

  <p>If the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text track</a> that the
  <code><a href=#texttrack>TextTrack</a></code> object represents is not the <a href=#text-track-disabled>text track disabled</a> mode, then
  the <dfn id=dom-texttrack-activecues title=dom-TextTrack-activeCues><code>activeCues</code></dfn> attribute must return a
  <a href=#live>live</a> <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object that represents the subset of the
  <a href=#text-track-list-of-cues>text track list of cues</a> of the <a href=#text-track>text track</a> that the
  <code><a href=#texttrack>TextTrack</a></code> object represents whose <a href=#active-flag-was-set-when-the-script-started>active flag was set when the script
  started</a>, in <a href=#text-track-cue-order>text track cue order</a>. Otherwise, it must return null. When an
  object is returned, the same object must be returned each time.</p>

  <p>A <a href=#text-track-cue>text track cue</a>'s <dfn id=active-flag-was-set-when-the-script-started>active flag was set when the script started</dfn> if its
  <a href=#text-track-cue-active-flag>text track cue active flag</a> was set the last time the <a href=#event-loop>event loop</a> reached
  step 1.</p>

  <hr><p>The <dfn id=dom-texttrack-addcue title=dom-TextTrack-addCue><code>addCue(<var title="">cue</var>)</code></dfn> method
  of <code><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>text track list of cues</a> does not yet have any associated <a href=#rules-for-updating-the-text-track-rendering>rules
   for updating the text track rendering</a>, then associate the <a href=#text-track-list-of-cues>text track list of
   cues</a> with the <a href=#rules-for-updating-the-text-track-rendering>rules for updating the text track rendering</a> appropriate to <var title="">cue</var>.</p>

   <li><p>If <a href=#text-track-list-of-cues>text track list of cues</a>' associated <a href=#rules-for-updating-the-text-track-rendering>rules for updating the text
   track rendering</a> are not the same <a href=#rules-for-updating-the-text-track-rendering>rules for updating the text track rendering</a>
   as appropriate for <var title="">cue</var>, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
   exception and abort these steps.</p>

   <li><p>If the given <var title="">cue</var> is in a <a href=#text-track-list-of-cues>text track list of cues</a>, then
   remove <var title="">cue</var> from that <a href=#text-track-list-of-cues>text track list of cues</a>.</li>

   <li><p>Add <var title="">cue</var> to the method's <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text
   track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</li>

  </ol><p>The <dfn id=dom-texttrack-removecue title=dom-TextTrack-removeCue><code>removeCue(<var title="">cue</var>)</code></dfn>
  method of <code><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the following steps:</p>

  <ol><li><p>If the given <var title="">cue</var> is not currently listed in the method's
   <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>,
   then throw a <code><a href=#notfounderror>NotFoundError</a></code> exception and abort these steps.</li>

   <li><p>Remove <var title="">cue</var> from the method's <code><a href=#texttrack>TextTrack</a></code> object's
   <a href=#text-track>text track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</li>

  </ol></div>

  <div class=example>

   <p>In this example, an <code><a href=#the-audio-element>audio</a></code> element is used to play a specific sound-effect from a
   sound file containing many sound effects. A cue is used to pause the audio, so that it ends
   exactly at the end of the clip, even if the browser is busy running some script. If the page had
   relied on script to pause the audio, then the start of the next clip might be heard if the
   browser was not able to run the script at the exact time specified.</p>

   <pre>var sfx = new Audio('sfx.wav');
var sounds = sfx.addTextTrack('metadata');

// add sounds we care about
function addFX(start, end, name) {
  var cue = new VTTCue(start, end, '');
  cue.id = name;
  cue.pauseOnExit = true;
  sounds.addCue(cue);
}
addFX(12.783, 13.612, 'dog bark');
addFX(13.612, 15.091, 'kitten mew'))

function playSound(id) {
  sfx.currentTime = sounds.getCueById(id).startTime;
  sfx.play();
}

// play a bark as soon as we can
sfx.oncanplaythrough = function () {
  playSound('dog bark');
}
// meow when the user tries to leave
window.onbeforeunload = function () {
  playSound('kitten mew');
  return 'Are you sure you want to leave this awesome page?';
}</pre>

  </div>

  <hr><pre class=idl>interface <dfn id=texttrackcuelist>TextTrackCueList</dfn> {
  readonly attribute unsigned long <a href=#dom-texttrackcuelist-length title=dom-TextTrackCueList-length>length</a>;
  getter <a href=#texttrackcue>TextTrackCue</a> (unsigned long index);
  <a href=#texttrackcue>TextTrackCue</a>? <a href=#dom-texttrackcuelist-getcuebyid title=dom-TextTrackCueList-getCueById>getCueById</a>(DOMString id);
};</pre>

  <dl class=domintro><dt><var title="">cuelist</var> . <code title=dom-TextTrackCueList-length><a href=#dom-texttrackcuelist-length>length</a></code></dt>
   <dd>
    <p>Returns the number of <a href=#text-track-cue title="text track cue">cues</a> in the list.</p>
   </dd>

   <dt><var title="">cuelist</var>[<var title="">index</var>]</dt>
   <dd>
    <p>Returns the <a href=#text-track-cue>text track cue</a> with index <var title="">index</var> in the list. The cues are sorted in <a href=#text-track-cue-order>text track cue order</a>.</p>
   </dd>

   <dt><var title="">cuelist</var> . <code title=dom-TextTrackCueList-getCueById><a href=#dom-texttrackcuelist-getcuebyid>getCueById</a></code>( <var title="">id</var> )</dt>
   <dd>
    <p>Returns the first <a href=#text-track-cue>text track cue</a> (in <a href=#text-track-cue-order>text track cue order</a>) with <a href=#text-track-cue-identifier>text track cue identifier</a> <var title="">id</var>.</p>
    <p>Returns null if none of the cues have the given identifier or if the argument is the empty string.</p>
   </dd>

  </dl><div class=impl>

  <p>A <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object represents a dynamically updating list of <a href=#text-track-cue title="text track cue">text track cues</a> in a given order.</p>

  <p>The <dfn id=dom-texttrackcuelist-length title=dom-TextTrackCueList-length><code>length</code></dfn> attribute must return
  the number of <a href=#text-track-cue title="text track cue">cues</a> in the list represented by the
  <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> of a <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object at any
  instant are the numbers from zero to the number of <a href=#text-track-cue title="text track cue">cues</a> in the
  list represented by the <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object minus one, if any. If there are no
  <a href=#text-track-cue title="text track cue">cues</a> in the list, there are no <a href=#supported-property-indices>supported property
  indices</a>.</p>

  <p>To <a href=#determine-the-value-of-an-indexed-property>determine the value of an indexed property</a> for a given index <var title="">index</var>, the user agent must return the <var title="">index</var>th <a href=#text-track-cue>text track
  cue</a> in the list represented by the <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>

  <p>The <dfn id=dom-texttrackcuelist-getcuebyid title=dom-TextTrackCueList-getCueById><code>getCueById(<var title="">id</var>)</code></dfn> method, when called with an argument other than the empty string,
  must return the first <a href=#text-track-cue>text track cue</a> in the list represented by the
  <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object whose <a href=#text-track-cue-identifier>text track cue identifier</a> is <var title="">id</var>, if any, or null otherwise. If the argument is the empty string, then the method
  must return null.</p>

  </div>

  <hr><pre class=idl>interface <dfn id=texttrackcue>TextTrackCue</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute <a href=#texttrack>TextTrack</a>? <a href=#dom-texttrackcue-track title=dom-TextTrackCue-track>track</a>;

           attribute DOMString <a href=#dom-texttrackcue-id title=dom-TextTrackCue-id>id</a>;
           attribute double <a href=#dom-texttrackcue-starttime title=dom-TextTrackCue-startTime>startTime</a>;
           attribute double <a href=#dom-texttrackcue-endtime title=dom-TextTrackCue-endTime>endTime</a>;
           attribute boolean <a href=#dom-texttrackcue-pauseonexit title=dom-TextTrackCue-pauseOnExit>pauseOnExit</a>;

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-texttrackcue-onenter title=handler-TextTrackCue-onenter>onenter</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-texttrackcue-onexit title=handler-TextTrackCue-onexit>onexit</a>;
};</pre>

  <dl class=domintro><dt><var title="">cue</var> . <a href=#dom-texttrackcue-track title=dom-TextTrackCue-track>track</a></dt>
   <dd>
    <p>Returns the <code><a href=#texttrack>TextTrack</a></code> object to which this
    <a href=#text-track-cue>text track cue</a> belongs, if any, or null
    otherwise.</p>
   </dd>

   <dt><var title="">cue</var> . <a href=#dom-texttrackcue-id title=dom-TextTrackCue-id>id</a> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the <a href=#text-track-cue-identifier>text track cue identifier</a>.</p>
    <p>Can be set.</p>
   </dd>

   <dt><var title="">cue</var> . <a href=#dom-texttrackcue-starttime title=dom-TextTrackCue-startTime>startTime</a> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the <a href=#text-track-cue-start-time>text track cue start time</a>, in seconds.</p>
    <p>Can be set.</p>
   </dd>

   <dt><var title="">cue</var> . <a href=#dom-texttrackcue-endtime title=dom-TextTrackCue-endTime>endTime</a> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the <a href=#text-track-cue-end-time>text track cue end time</a>, in seconds.</p>
    <p>Can be set.</p>
   </dd>

   <dt><var title="">cue</var> . <a href=#dom-texttrackcue-pauseonexit title=dom-TextTrackCue-pauseOnExit>pauseOnExit</a> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns true if the <a href=#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>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-texttrackcue-track title=dom-TextTrackCue-track><code>track</code></dfn> attribute, on getting, must
  return the <code><a href=#texttrack>TextTrack</a></code> object of the <a href=#text-track>text track</a> in whose <a href=#text-track-list-of-cues title="text
  track list of cues">list of cues</a> the <a href=#text-track-cue>text track cue</a> that the
  <code><a href=#texttrackcue>TextTrackCue</a></code> object represents finds itself, if any; or null otherwise.</p>

  <p>The <dfn id=dom-texttrackcue-id title=dom-TextTrackCue-id><code>id</code></dfn> attribute, on getting, must return
  the <a href=#text-track-cue-identifier>text track cue identifier</a> of the <a href=#text-track-cue>text track cue</a> that the
  <code><a href=#texttrackcue>TextTrackCue</a></code> object represents. On setting, the <a href=#text-track-cue-identifier>text track cue
  identifier</a> must be set to the new value.</p>

  <p>The <dfn id=dom-texttrackcue-starttime title=dom-TextTrackCue-startTime><code>startTime</code></dfn> attribute, on getting,
  must return the <a href=#text-track-cue-start-time>text track cue start time</a> of the <a href=#text-track-cue>text track cue</a> that the
  <code><a href=#texttrackcue>TextTrackCue</a></code> object represents, in seconds. On setting, the <a href=#text-track-cue-start-time>text track cue
  start time</a> must be set to the new value, interpreted in seconds; then, if the
  <code><a href=#texttrackcue>TextTrackCue</a></code> object's <a href=#text-track-cue>text track cue</a> is in a <a href=#text-track>text track</a>'s
  <a href=#text-track-list-of-cues title="text track list of cues">list of cues</a>, and that <a href=#text-track>text track</a> is in
  a <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>, and the <a href=#media-element>media
  element</a>'s <a href=#show-poster-flag>show poster flag</a> is not set, then run the <i><a href=#time-marches-on>time marches on</a></i>
  steps for that <a href=#media-element>media element</a>.</p>

  <p>The <dfn id=dom-texttrackcue-endtime title=dom-TextTrackCue-endTime><code>endTime</code></dfn> attribute, on getting,
  must return the <a href=#text-track-cue-end-time>text track cue end time</a> of the <a href=#text-track-cue>text track cue</a> that the
  <code><a href=#texttrackcue>TextTrackCue</a></code> object represents, in seconds. On setting, the <a href=#text-track-cue-end-time>text track cue end
  time</a> must be set to the new value, interpreted in seconds; then, if the
  <code><a href=#texttrackcue>TextTrackCue</a></code> object's <a href=#text-track-cue>text track cue</a> is in a <a href=#text-track>text track</a>'s
  <a href=#text-track-list-of-cues title="text track list of cues">list of cues</a>, and that <a href=#text-track>text track</a> is in
  a <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>, and the <a href=#media-element>media
  element</a>'s <a href=#show-poster-flag>show poster flag</a> is not set, then run the <i><a href=#time-marches-on>time marches on</a></i>
  steps for that <a href=#media-element>media element</a>.</p>

  <p>The <dfn id=dom-texttrackcue-pauseonexit title=dom-TextTrackCue-pauseOnExit><code>pauseOnExit</code></dfn> attribute, on
  getting, must return true if the <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag</a> of the <a href=#text-track-cue>text
  track cue</a> that the <code><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>text track cue pause-on-exit flag</a> must be set if the new value is
  true, and must be unset otherwise.</p>

  </div>


  <h6 id=text-tracks-describing-chapters><span class=secno>4.8.10.12.6 </span>Text tracks describing chapters</h6>

  <p>Chapters are segments of a <a href=#media-resource>media resource</a> with a given title. Chapters can be
  nested, in the same way that sections in a document outline can have subsections.</p>

  <p>Each <a href=#text-track-cue>text track cue</a> in a <a href=#text-track>text track</a> being used for describing
  chapters has three key features: the <a href=#text-track-cue-start-time>text track cue start time</a>, giving the start time
  of the chapter, the <a href=#text-track-cue-end-time>text track cue end time</a>, giving the end time of the chapter, and
  the <a href=#text-track-cue-text>text track cue text</a> giving the chapter title.</p>

  <div class=impl>

  <p>The <dfn id=rules-for-constructing-the-chapter-tree-from-a-text-track>rules for constructing the chapter tree from a text track</dfn> are as follows. They
  produce a potentially nested list of chapters, each of which have a start time, end time, title,
  and a list of nested chapters. This algorithm discards cues that do not correctly nest within each
  other, or that are out of order.</p>

  <ol><li><p>Let <var title="">list</var> be a copy of the <a href=#text-track-list-of-cues title="text track list of cues">list
   of cues</a> of the <a href=#text-track>text track</a> being processed.</li>

   <li><p>Remove from <var title="">list</var> any <a href=#text-track-cue>text track cue</a> whose <a href=#text-track-cue-end-time>text
   track cue end time</a> is before its <a href=#text-track-cue-start-time>text track cue start time</a>.</li>

   <li><p>Let <var title="">output</var> be an empty list of chapters, where a chapter is a record
   consisting of a start time, an end time, a title, and a (potentially empty) list of nested
   chapters. For the purpose of this algorithm, each chapter also has a parent chapter.</li>

   <li><p>Let <var title="">current chapter</var> be a stand-in chapter whose start time is negative
   infinity, whose end time is positive infinity, and whose list of nested chapters is <var title="">output</var>. (This is just used to make the algorithm easier to describe.)</li>

   <!-- while not empty... -->
   <li><p><i>Loop</i>: If <var title="">list</var> is empty, jump to the step labeled
   <i>end</i>.</li>

   <!-- do... -->
   <li><p>Let <var title="">current cue</var> be the first cue in <var title="">list</var>, and then
   remove it from <var title="">list</var>.</li>

   <li><p>If <var title="">current cue</var>'s <a href=#text-track-cue-start-time>text track cue start time</a> is less than
   the start time of <var title="">current chapter</var>, then return to the step labeled
   <i>loop</i>.</p> <!-- out of order chapter -->

   <li><p>While <var title="">current cue</var>'s <a href=#text-track-cue-start-time>text track cue start time</a> is greater
   than or equal to <var title="">current chapter</var>'s end time, let <var title="">current
   chapter</var> be <var title="">current chapter</var>'s parent chapter.</li>

   <li><p>If <var title="">current cue</var>'s <a href=#text-track-cue-end-time>text track cue end time</a> is greater than
   the end time of <var title="">current chapter</var>, then return to the step labeled
   <i>loop</i>.</p> <!-- misnested chapter -->

   <li>

    <p>Create a new chapter <var title="">new chapter</var>, whose start time is <var title="">current cue</var>'s <a href=#text-track-cue-start-time>text track cue start time</a>, whose end time is <var title="">current cue</var>'s <a href=#text-track-cue-end-time>text track cue end time</a>, whose title is <var title="">current cue</var>'s <a href=#text-track-cue-text>text track cue text</a> interpreted according to its
    <a href=#rules-for-rendering-the-cue-in-isolation>rules for rendering the cue in isolation</a>, and whose list of nested chapters is
    empty.</p>

    <p class=note>For WebVTT, the <a href=#rules-for-rendering-the-cue-in-isolation>rules for rendering the cue in isolation</a> are the
    <a href=#rules-for-interpreting-webvtt-cue-text>rules for interpreting WebVTT cue text</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>

   </li>

   <li><p>Append <var title="">new chapter</var> to <var title="">current chapter</var>'s list of
   nested chapters, and let <var title="">current chapter</var> be <var title="">new chapter</var>'s
   parent.</li>

   <li><p>Let <var title="">current chapter</var> be <var title="">new chapter</var>.</li>

   <li><p>Return to the step labeled <i>loop</i>.</li>
   <!-- ...end while -->

   <li><p><i>End</i>: Return <var title="">output</var>.</li>

  </ol></div>

  <div class=example>

   <p>The following snippet of a <a href=#webvtt-file>WebVTT file</a> shows how nested chapters can be marked
   up. The file describes three 50-minute chapters, "Astrophysics", "Computational Physics", and
   "General Relativity". The first has three subchapters, the second has four, and the third has
   two. <a href=#refsWEBVTT>[WEBVTT]</a></p>

   <pre>WEBVTT

00:00:00.000 --&gt; 00:50:00.000
Astrophysics

00:00:00.000 --&gt; 00:10:00.000
Introduction to Astrophysics

00:10:00.000 --&gt; 00:45:00.000
The Solar System

00:00:00.000 --&gt; 00:10:00.000
Coursework Description

00:50:00.000 --&gt; 01:40:00.000
Computational Physics

00:50:00.000 --&gt; 00:55:00.000
Introduction to Programming

00:55:00.000 --&gt; 01:30:00.000
Data Structures

01:30:00.000 --&gt; 01:35:00.000
Answers to Last Exam

01:35:00.000 --&gt; 01:40:00.000
Coursework Description

01:40:00.000 --&gt; 02:30:00.000
General Relativity

01:40:00.000 --&gt; 02:00:00.000
Tensor Algebra

02:00:00.000 --&gt; 02:30:00.000
The General Relativistic Field Equations</pre>

  </div>


  <div class=impl>

  <h6 id=cue-events><span class=secno>4.8.10.12.7 </span>Event definitions</h6>

  <p>The following are the <a href=#event-handlers>event handlers</a> that (and their corresponding <a href=#event-handler-event-type title="event handler event type">event handler event types</a>) must be supported, as <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>, by all objects implementing the <code><a href=#texttracklist>TextTrackList</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-texttracklist-onchange title=handler-TextTrackList-onchange><code>onchange</code></dfn> <td> <code title=event-media-change><a href=#event-media-change>change</a></code>
    <tr><td><dfn id=handler-texttracklist-onaddtrack title=handler-TextTrackList-onaddtrack><code>onaddtrack</code></dfn> <td> <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>
    <tr><td><dfn id=handler-texttracklist-onremovetrack title=handler-TextTrackList-onremovetrack><code>onremovetrack</code></dfn> <td> <code title=event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>
  </table><p>The following are the <a href=#event-handlers>event handlers</a> that (and their corresponding <a href=#event-handler-event-type title="event handler event type">event handler event types</a>) must be supported, as <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>, by all objects implementing the <code><a href=#texttrack>TextTrack</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-texttrack-oncuechange title=handler-TextTrack-oncuechange><code>oncuechange</code></dfn> <td> <code title=event-cuechange>cuechange</code>
  </table><p>The following are the <a href=#event-handlers>event handlers</a> that (and their corresponding <a href=#event-handler-event-type title="event handler event type">event handler event types</a>) must be supported, as <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>, by all objects implementing the <code><a href=#texttrackcue>TextTrackCue</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-texttrackcue-onenter title=handler-TextTrackCue-onenter><code>onenter</code></dfn> <td> <code title=event-enter>enter</code>
    <tr><td><dfn id=handler-texttrackcue-onexit title=handler-TextTrackCue-onexit><code>onexit</code></dfn> <td> <code title=event-exit>exit</code>
  </table></div>


  <h5 id=user-interface><span class=secno>4.8.10.13 </span>User interface</h5>

  <p>The <dfn id=attr-media-controls title=attr-media-controls><code>controls</code></dfn> attribute is a <a href=#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>

  <div class=impl>

  <p>If the attribute is present, or if <a href=#concept-n-noscript title=concept-n-noscript>scripting is
  disabled</a> for the <a href=#media-element>media element</a>, then the user agent should <dfn id=expose-a-user-interface-to-the-user>expose a user
  interface to the user</dfn>. This user interface should include features to begin playback, pause
  playback, seek to an arbitrary position in the content (if the content supports arbitrary
  seeking), change the volume, change the display of closed captions or embedded sign-language
  tracks, select different audio tracks or turn on audio descriptions, and show the media content in
  manners more suitable to the user (e.g. full-screen video or in an independent resizable window).
  Other controls may also be made available.</p>

  <p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then the user
  agent should expose audio tracks from all the <a href=#slaved-media-elements>slaved media elements</a> (although
  avoiding duplicates if the same <a href=#media-resource>media resource</a> is being used several times). If a
  <a href=#media-resource>media resource</a>'s audio track exposed in this way has no known name, and it is the
  only audio track for a particular <a href=#media-element>media element</a>, the user agent should use the
  element's <code title=attr-title><a href=#attr-title>title</a></code> attribute, if any, as the name (or as part of the
  name) of that track.</p>

  <p>Even when the attribute is absent, however, user agents may provide controls to affect playback
  of the media resource (e.g. play, pause, seeking, and volume controls), but such features should
  not interfere with the page's normal rendering. For example, such features could be exposed in the
  <a href=#media-element>media element</a>'s context menu. The user agent may implement this simply by <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the user">exposing a user interface to the user</a> as
  described above (as if the <code title=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 title="expose a user interface to the user">exposes a user interface to
  the user</a> by displaying controls over the <a href=#media-element>media element</a>, then the user agent
  should suppress any user interaction events while the user agent is interacting with this
  interface. (For example, if the user clicks on a video's playback control, <code title=event-mousedown>mousedown</code> events and so forth would not simultaneously be fired at
  elements on the page.)</p>

  <p>Where possible (specifically, for starting, stopping, pausing, and unpausing playback, for
  seeking, for changing the rate of playback, for fast-forwarding or rewinding, for listing,
  enabling, and disabling text tracks, and for muting or changing the volume of the audio), user
  interface features exposed by the user agent must be implemented in terms of the DOM API described
  above, so that, e.g., all the same events fire.</p>

  <p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, the user agent's
  user interface for pausing and unpausing playback, for seeking, for changing the rate of playback,
  for fast-forwarding or rewinding, and for muting or changing the volume of audio of the entire
  group must be implemented in terms of the <code><a href=#mediacontroller>MediaController</a></code> API exposed on that
  <a href=#current-media-controller>current media controller</a>. When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
  controller</a>, and all the <a href=#slaved-media-elements>slaved media elements</a> of that
  <code><a href=#mediacontroller>MediaController</a></code> are paused, the user agent should also unpause all the <a href=#slaved-media-elements>slaved
  media elements</a> when the user invokes a user agent interface control for beginning
  playback.</p>

  <p>The "play" function in the user agent's interface must set the <code title="">playbackRate</code> attribute to the value of the <code title="">defaultPlaybackRate</code> attribute before invoking the <code title="">play()</code>
  method. When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, the
  attributes and method with those names on that <code><a href=#mediacontroller>MediaController</a></code> object must be used.
  Otherwise, the attributes and method with those names on the <a href=#media-element>media element</a> itself
  must be used. </p>

  <p>Features such as fast-forward or rewind must be implemented by only changing the <code title="">playbackRate</code> attribute (and not the <code title="">defaultPlaybackRate</code>
  attribute). Again, when a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>,
  the attributes with those names on that <code><a href=#mediacontroller>MediaController</a></code> object must be used;
  otherwise, the attributes with those names on the <a href=#media-element>media element</a> itself must be used.</p>

  <p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, seeking must be
  implemented in terms of the <code title=dom-MediaController-currentTime><a href=#dom-mediacontroller-currenttime>currentTime</a></code>
  attribute on that <code><a href=#mediacontroller>MediaController</a></code> object. Otherwise, the user agent must directly
  <a href=#dom-media-seek title=dom-media-seek>seek</a> to the requested position in the <a href=#media-element>media
  element</a>'s <a href=#media-timeline>media timeline</a>. For media resources where seeking to an arbitrary
  position would be slow, user agents are encouraged to use the <i>approximate-for-speed</i> flag
  when seeking in response to the user manipulating an approximate position interface such as a seek
  bar.</p>

  <p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, user agents may
  additionally provide the user with controls that directly manipulate an individual <a href=#media-element>media
  element</a> without affecting the <code><a href=#mediacontroller>MediaController</a></code>, but such features are
  considered relatively advanced and unlikely to be useful to most users.</p>

  <p>For the purposes of listing chapters in the <a href=#media-resource>media resource</a>, only <a href=#text-track title="text
  track">text tracks</a> in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>
  that are <a href=#text-track-showing title="text track showing">showing</a> and whose <a href=#text-track-kind>text track kind</a> is
  <code title=dom-TextTrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code> should be used. Such tracks must be
  interpreted according to the <a href=#rules-for-constructing-the-chapter-tree-from-a-text-track>rules for constructing the chapter tree from a text
  track</a>. When seeking in response to a user maniplating a chapter selection interface, user
  agents should not use the <i>approximate-for-speed</i> flag.</p>

  <p>The <dfn id=dom-media-controls title=dom-media-controls><code>controls</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  <hr></div>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current playback volume, as a number in the range 0.0 to 1.0, where 0.0 is the
    quietest and 1.0 the loudest.</p>

    <p>Can be set, to change the volume.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the new value is not in the range 0.0 .. 1.0.</p>

   </dd>

   <dt><var title="">media</var> . <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns true if audio is muted, overriding the <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code>
    attribute, and false if the <code title=dom-media-volume><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>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-media-volume title=dom-media-volume><code>volume</code></dfn> attribute must return the playback
  volume of any audio portions of the <a href=#media-element>media element</a>, 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. On
  setting, if the new value is in the range 0.0 to 1.0 inclusive, the playback volume of any audio
  portions of the <a href=#media-element>media element</a> must be set to the new value. If the new value is
  outside the range 0.0 to 1.0 inclusive, then, on setting, an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception
  must be thrown instead.</p>

  <p>The <dfn id=dom-media-muted title=dom-media-muted><code>muted</code></dfn> attribute must return true if the
  audio output is muted and false otherwise. Initially, the audio output should not be muted
  (false), but user agents may remember the last set value across sessions, on a per-site basis or
  otherwise, so the muted state may start as muted (true). On setting, if the new value is true then
  the audio output should be muted and if the new value is false it should be unmuted.</p>

  <p>Whenever either of the values that would be returned by the <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> and <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> attributes
  change, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
  <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the <a href=#media-element>media element</a>.</p>

  <p>An element's <dfn id=effective-media-volume>effective media volume</dfn> is determined as follows:</p>

  <ol><li><p>If the user has indicated that the user agent is to override the volume of the element,
   then the element's <a href=#effective-media-volume>effective media volume</a> is the volume desired by the user. Abort
   these steps.</li>

   <li><p>If the element's audio output is muted, the element's <a href=#effective-media-volume>effective media volume</a>
   is zero. Abort these steps.</li>

   <li><p>If the element has a <a href=#current-media-controller>current media controller</a> and that
   <code><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-mute-override>media controller mute override</a> is true, the
   element's <a href=#effective-media-volume>effective media volume</a> is zero. Abort these steps.</li>

   <li><p>Let <var title="">volume</var> be the playback volume of the audio portions of the
   <a href=#media-element>media element</a>, in range 0.0 (silent) to 1.0 (loudest).</li>

   <li><p>If the element has a <a href=#current-media-controller>current media controller</a>, multiply <var title="">volume</var> by that <code><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-volume-multiplier>media controller volume
   multiplier</a>.</li>

   <li><p>The element's <a href=#effective-media-volume>effective media volume</a> is <var title="">volume</var>,
   interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest
   setting, values in between increasing in loudness. The range need not be linear. The loudest
   setting may be lower than the system's loudest possible setting; for example the user could have
   set a maximum volume.</li>

  </ol></div>

  <p>The <dfn id=attr-media-muted title=attr-media-muted><code>muted</code></dfn> attribute on <a href=#media-element title="media
  element">media elements</a> is a <a href=#boolean-attribute>boolean attribute</a> that controls the default state
  of the audio output of the <a href=#media-resource>media resource</a>, potentially overriding user
  preferences.</p>

  <div class=impl>

  <p>When a <a href=#media-element>media element</a> is created, if it has a <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code> attribute specified, the user agent must mute the
  <a href=#media-element>media element</a>'s audio output, overriding any user preference.</p>

  <p>The <dfn id=dom-media-defaultmuted title=dom-media-defaultMuted><code>defaultMuted</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code> content attribute.</p>

  </div>

  <p class=note>This attribute has no dynamic effect (it only controls the default state of the
  element).</p>

  <div class=example>

   <p>This video (an advertisement) autoplays, but to avoid annoying users, it does so without
   sound, and allows the user to turn the sound on.</p>

   <pre>&lt;video src="adverts.cgi?kind=video" controls autoplay loop muted&gt;&lt;/video&gt;</pre>

  </div>




  <h5 id=time-ranges><span class=secno>4.8.10.14 </span>Time ranges</h5>

  <p>Objects implementing the <code><a href=#timeranges>TimeRanges</a></code> interface
  represent a list of ranges (periods) of time.</p>

  <pre class=idl>interface <dfn id=timeranges>TimeRanges</dfn> {
  readonly attribute unsigned long <a href=#dom-timeranges-length title=dom-TimeRanges-length>length</a>;
  double <a href=#dom-timeranges-start title=dom-TimeRanges-start>start</a>(unsigned long index);
  double <a href=#dom-timeranges-end title=dom-TimeRanges-end>end</a>(unsigned long index);
};</pre>

  <dl class=domintro><dt><var title="">media</var> . <code title=dom-TimeRanges-length><a href=#dom-timeranges-length>length</a></code></dt>

   <dd>

    <p>Returns the number of ranges in the object.</p>

   </dd>

   <dt><var title="">time</var> = <var title="">media</var> . <code title=dom-TimeRanges-start><a href=#dom-timeranges-start>start</a></code>(<var title="">index</var>)</dt>

   <dd>

    <p>Returns the time for the start of the range with the given index.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the index is out of range.</p>

   </dd>

   <dt><var title="">time</var> = <var title="">media</var> . <code title=dom-TimeRanges-end><a href=#dom-timeranges-end>end</a></code>(<var title="">index</var>)</dt>

   <dd>

    <p>Returns the time for the end of the range with the given index.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the index is out of range.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-timeranges-length title=dom-TimeRanges-length><code>length</code></dfn>
  IDL attribute must return the number of ranges represented by the object.</p>

  <p>The <dfn id=dom-timeranges-start title=dom-TimeRanges-start><code>start(<var title="">index</var>)</code></dfn> method must return the position
  of the start of the <var title="">index</var>th range represented by
  the object, in seconds measured from the start of the timeline that
  the object covers.</p>

  <p>The <dfn id=dom-timeranges-end title=dom-TimeRanges-end><code>end(<var title="">index</var>)</code></dfn> method must return the position
  of the end of the <var title="">index</var>th range represented by
  the object, in seconds measured from the start of the timeline that
  the object covers.</p>

  <p>These methods must throw <code><a href=#indexsizeerror>IndexSizeError</a></code> exceptions
  if called with an <var title="">index</var> argument greater than or
  equal to the number of ranges represented by the object.</p>

  <p>When a <code><a href=#timeranges>TimeRanges</a></code> object is said to be a
  <dfn id=normalized-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>

   <li>The start of a range must be less than the end of that same
   range.</li>

  </ul><p>In other words, the ranges in such an object are ordered, don't
  overlap, aren't empty, and don't touch (adjacent ranges are folded
  into one bigger range).</p>

  <p>Ranges in a <code><a href=#timeranges>TimeRanges</a></code> object must be inclusive.</p>

  <p class=example>Thus, the end of a range would be equal to the
  start of a following adjacent (touching but not overlapping) range.
  Similarly, a range covering a whole timeline anchored at zero would
  have a start equal to zero and an end equal to the duration of the
  timeline.</p>

  <p>The timelines used by the objects returned by the <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>, <code title=dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> and <code title=dom-media-played><a href=#dom-media-played>played</a></code> IDL attributes of <a href=#media-element title="media element">media elements</a> must be that element's
  <a href=#media-timeline>media timeline</a>.</p>

  </div>


  <h5 id=event-definitions><span class=secno>4.8.10.15 </span>Event definitions</h5>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#trackeventinit>TrackEventInit</a> eventInitDict)]
interface <dfn id=trackevent>TrackEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute (<a href=#videotrack>VideoTrack</a> or <a href=#audiotrack>AudioTrack</a> or <a href=#texttrack>TextTrack</a>) <a href=#dom-trackevent-track title=dom-TrackEvent-track>track</a>;
};

dictionary <dfn id=trackeventinit>TrackEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  (<a href=#videotrack>VideoTrack</a> or <a href=#audiotrack>AudioTrack</a> or <a href=#texttrack>TextTrack</a>) track;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code></dt>

   <dd>

    <p>Returns the track object (<code><a href=#texttrack>TextTrack</a></code>, <code><a href=#audiotrack>AudioTrack</a></code>, or
    <code><a href=#videotrack>VideoTrack</a></code>) to which the event relates.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-trackevent-track title=dom-TrackEvent-track><code>track</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to null. It
  represents the context information for the event.</p>

  </div>



  <h5 id=mediaevents><span class=secno>4.8.10.16 </span>Event summary</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The following events fire on <a href=#media-element title="media element">media
  elements</a> as part of the processing model described above:</p>

  <table><thead><tr><th>Event name
     <th>Interface
     <th>Fired when...
     <th>Preconditions

   <tbody><tr><td><dfn id=event-media-loadstart title=event-media-loadstart><code>loadstart</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent begins looking for <a href=#media-data>media data</a>, as part of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a>.
     <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
    <tr><td><dfn id=event-media-progress title=event-media-progress><code>progress</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent is fetching <a href=#media-data>media data</a>.
     <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
    <tr><td><dfn id=event-media-suspend title=event-media-suspend><code>suspend</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent is intentionally not currently fetching <a href=#media-data>media data</a>.
     <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>
    <tr><td><dfn id=event-media-abort title=event-media-abort><code>abort</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent stops fetching the <a href=#media-data>media data</a> before it is completely downloaded, but not due to an error.
     <td><code title=dom-media-error><a href=#dom-media-error>error</a></code> is an object with the code <code title=dom-MediaError-MEDIA_ERR_ABORTED><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>.
         <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals either <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, depending on when the download was aborted.
    <tr><td><dfn id=event-media-error title=event-media-error><code>error</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>An error occurs while fetching the <a href=#media-data>media data</a>.
     <td><code title=dom-media-error><a href=#dom-media-error>error</a></code> is an object with the code <code title=dom-MediaError-MEDIA_ERR_NETWORK><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code> or higher.
         <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals either <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, depending on when the download was aborted.
    <tr><td><dfn id=event-media-emptied title=event-media-emptied><code>emptied</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>A <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> was previously not in the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> state has just switched to that state (either because of a fatal error during load that's about to be reported, or because the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method was invoked while the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection algorithm</a> was already running).
     <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>; all the IDL attributes are in their initial states.
    <tr><td><dfn id=event-media-stalled title=event-media-stalled><code>stalled</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent is trying to fetch <a href=#media-data>media data</a>, but data is unexpectedly not forthcoming.
     <td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.

   <tbody><tr><td><dfn id=event-media-loadedmetadata title=event-media-loadedmetadata><code>loadedmetadata</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent has just determined the duration and dimensions of the <a href=#media-resource>media resource</a>
 and <a href=#the-text-tracks-are-ready>the text tracks are ready</a>.
     <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater for the first time.
    <tr><td><dfn id=event-media-loadeddata title=event-media-loadeddata><code>loadeddata</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent can render the <a href=#media-data>media data</a> at the <a href=#current-playback-position>current playback position</a> for the first time.
     <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> newly increased to <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater for the first time.
    <tr><td><dfn id=event-media-canplay title=event-media-canplay><code>canplay</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent can resume playback of the <a href=#media-data>media data</a>, but estimates that if playback were to be started now, the <a href=#media-resource>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 title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> newly increased to <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or greater.
    <tr><td><dfn id=event-media-canplaythrough title=event-media-canplaythrough><code>canplaythrough</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The user agent estimates that if playback were to be started now, the <a href=#media-resource>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 title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>.
    <tr><td><dfn id=event-media-playing title=event-media-playing><code>playing</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Playback is ready to start after having been paused or delayed due to lack of <a href=#media-data>media data</a>.
     <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to or greater than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> and <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is false, or <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly false and <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is equal to or greater than <code title=dom-media-HAVE_FUTURE_DATA><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>potentially playing</a>, e.g. if
     the element is <a href=#blocked-on-its-media-controller>blocked on its media controller</a> (e.g. because the <a href=#current-media-controller>current media controller</a> is paused, or another <a href=#slaved-media-elements title="slaved media elements">slaved media element</a> is stalled somehow, or because the <a href=#media-resource>media resource</a> has no data corresponding to the <a href=#media-controller-position>media controller position</a>), or
     the element is <a href=#paused-for-user-interaction>paused for user interaction</a> or <a href=#paused-for-in-band-content>paused for in-band content</a>.
    <tr><td><dfn id=event-media-waiting title=event-media-waiting><code>waiting</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Playback has stopped because the next frame is not available, but the user agent expects that frame to become available in due course.
     <td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is equal to or less than <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, and <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is false. Either <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true, or the <a href=#current-playback-position>current playback position</a> is not contained in any of the ranges in <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>. It is possible for playback to stop for other reasons without <code title=dom-media-paused><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 title=event-media-playing><a href=#event-media-playing>playing</a></code> event is not fired either): e.g.
     the element is newly <a href=#blocked-on-its-media-controller>blocked on its media controller</a>, or
     <a href=#ended-playback title="ended playback">playback ended</a>, or playback <a href=#stopped-due-to-errors>stopped due to errors</a>, or the element has <a href=#paused-for-user-interaction>paused for user interaction</a> or <a href=#paused-for-in-band-content>paused for in-band content</a>.
   <tbody><tr><td><dfn id=event-media-seeking title=event-media-seeking><code>seeking</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to true.
     <td>
    <tr><td><dfn id=event-media-seeked title=event-media-seeked><code>seeked</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to false.
     <td>
    <tr><td><dfn id=event-media-ended title=event-media-ended><code>ended</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Playback has stopped because the end of the <a href=#media-resource>media resource</a> was reached.
     <td><code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> equals the end of the <a href=#media-resource>media resource</a>; <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> is true.

   <tbody><tr><td><dfn id=event-media-durationchange title=event-media-durationchange><code>durationchange</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute has just been updated.
     <td>
    <tr><td><dfn id=event-media-timeupdate title=event-media-timeupdate><code>timeupdate</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <a href=#current-playback-position>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
     <td>
    <tr><td><dfn id=event-media-play title=event-media-play><code>play</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The element is no longer paused. Fired after the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method has returned, or when the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute has caused playback to begin.
     <td><code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly false.
    <tr><td><dfn id=event-media-pause title=event-media-pause><code>pause</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The element has been paused. Fired after the <code title=dom-media-pause><a href=#dom-media-pause>pause()</a></code> method has returned.
     <td><code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly true.
    <tr><td><dfn id=event-media-ratechange title=event-media-ratechange><code>ratechange</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Either the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute has just been updated.
     <td>
    <tr><td><dfn id=event-media-volumechange title=event-media-volumechange><code>volumechange</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Either the <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> attribute or the <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> attribute has changed. Fired after the relevant attribute's setter has returned.
     <td>
  </table><p>The following events fire on <code><a href=#mediacontroller>MediaController</a></code> objects:</p>

  <table><thead><tr><th>Event name
     <th>Interface
     <th>Fired when...

   <tbody><tr><td><dfn id=event-mediacontroller-emptied title=event-MediaController-emptied><code>emptied</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>All the <a href=#slaved-media-elements>slaved media elements</a> newly have <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> set to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or greater, or there are no longer any <a href=#slaved-media-elements>slaved media elements</a>.
    <tr><td><dfn id=event-mediacontroller-loadedmetadata title=event-MediaController-loadedmetadata><code>loadedmetadata</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>All the <a href=#slaved-media-elements>slaved media elements</a> newly have <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> set to <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater.
    <tr><td><dfn id=event-mediacontroller-loadeddata title=event-MediaController-loadeddata><code>loadeddata</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>All the <a href=#slaved-media-elements>slaved media elements</a> newly have <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> set to <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater.
    <tr><td><dfn id=event-mediacontroller-canplay title=event-MediaController-canplay><code>canplay</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>All the <a href=#slaved-media-elements>slaved media elements</a> newly have <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> set to <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or greater.
    <tr><td><dfn id=event-mediacontroller-canplaythrough title=event-MediaController-canplaythrough><code>canplaythrough</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>All the <a href=#slaved-media-elements>slaved media elements</a> newly have <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> set to <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> or greater.
    <tr><td><dfn id=event-mediacontroller-playing title=event-MediaController-playing><code>playing</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code><a href=#mediacontroller>MediaController</a></code> is no longer a <a href=#blocked-media-controller>blocked media controller</a>.
    <tr><td><dfn id=event-mediacontroller-ended title=event-MediaController-ended><code>ended</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code><a href=#mediacontroller>MediaController</a></code> has reached the end of all the <a href=#slaved-media-elements>slaved media elements</a>.
    <tr><td><dfn id=event-mediacontroller-waiting title=event-MediaController-waiting><code>waiting</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code><a href=#mediacontroller>MediaController</a></code> is now a <a href=#blocked-media-controller>blocked media controller</a>.
    <tr><td><dfn id=event-mediacontcoller-ended title=event-MediaContcoller-ended><code>ended</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>All the <a href=#slaved-media-elements>slaved media elements</a> have newly <a href=#ended-playback>ended playback</a>.

   <tbody><tr><td><dfn id=event-mediacontroller-durationchange title=event-MediaController-durationchange><code>durationchange</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code> attribute has just been updated.
    <tr><td><dfn id=event-mediacontroller-timeupdate title=event-MediaController-timeupdate><code>timeupdate</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <a href=#media-controller-position>media controller position</a> changed.
    <tr><td><dfn id=event-mediacontroller-play title=event-MediaController-play><code>play</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute is newly false.
    <tr><td><dfn id=event-mediacontroller-pause title=event-MediaController-pause><code>pause</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>The <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute is newly true.
    <tr><td><dfn id=event-mediacontroller-ratechange title=event-MediaController-ratechange><code>ratechange</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Either the <code title=dom-MediaController-defaultPlaybackRate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code> attribute or the <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> attribute has just been updated.
    <tr><td><dfn id=event-mediacontroller-volumechange title=event-MediaController-volumechange><code>volumechange</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>Either the <code title=dom-MediaController-volume><a href=#dom-mediacontroller-volume>volume</a></code> attribute or the <code title=dom-MediaController-muted><a href=#dom-mediacontroller-muted>muted</a></code> attribute has just been updated.
  </table><p>The following events fire on <code><a href=#audiotracklist>AudioTrackList</a></code>, <code><a href=#videotracklist>VideoTrackList</a></code>, and <code><a href=#texttracklist>TextTrackList</a></code> objects:</p>

  <table><thead><tr><th>Event name
     <th>Interface
     <th>Fired when...

   <tbody><tr><td><dfn id=event-media-change title=event-media-change><code>change</code></dfn>
     <td><code><a href=#event>Event</a></code>
     <td>One or more tracks in the track list has been enabled or disabled.

    <tr><td><dfn id=event-media-addtrack title=event-media-addtrack><code>addtrack</code></dfn>
     <td><code><a href=#trackevent>TrackEvent</a></code>
     <td>A track has been added to the track list.

    <tr><td><dfn id=event-media-removetrack title=event-media-removetrack><code>removetrack</code></dfn>
     <td><code><a href=#trackevent>TrackEvent</a></code>
     <td>A track has been removed from the track list.

  </table><!--ADD-TOPIC:Security--><div class=impl>

  <h5 id=security-and-privacy-considerations><span class=secno>4.8.10.17 </span>Security and privacy considerations</h5>

  <p>The main security and privacy implications of the
  <code><a href=#the-video-element>video</a></code> and <code><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><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>top-level browsing context</a>.</p>

  <p class=example>For instance, if an SVG animation was embedded in
  a <code><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><a href=#the-img-element>img</a></code> element, and so it has been deemed acceptable.</p>

  <p>However, significantly more sensitive information could be
  obtained if the user agent further exposes metadata within the
  content such as subtitles or chapter titles. Such information is
  therefore only exposed if the video resource passes a CORS
  <a href=#resource-sharing-check>resource sharing check</a>. The <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> attribute allows
  authors to control how this check is performed. <a href=#refsCORS>[CORS]</a></p>

  <p class=example>Without this restriction, an attacker could trick
  a user running within a corporate network into visiting a site that
  attempts to load a video from a previously leaked location on the
  corporation's intranet. If such a video included confidential plans
  for a new product, then being able to read the subtitles would
  present a serious confidentiality breach.</p>

  </div>
<!--REMOVE-TOPIC:Security-->


  <h5 id=best-practices-for-authors-using-media-elements><span class=secno>4.8.10.18 </span>Best practices for authors using media elements</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Playing audio and video resources on small devices such as
  set-top boxes or mobile phones is often constrained by limited
  hardware resources in the device. For example, a device might only
  support three simultaneous videos. For this reason, it is a good
  practice to release resources held by <a href=#media-element title="media
  element">media elements</a> when they are done playing, either by
  being very careful about removing all references to the element and
  allowing it to be garbage collected, or, even better, by removing
  the element's <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute and
  any <code><a href=#the-source-element>source</a></code> element descendants, and invoking the
  element's <code title=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>


  <div class=impl>

  <h5 id=best-practices-for-implementors-of-media-elements><span class=secno>4.8.10.19 </span>Best practices for implementors of media elements</h5>

  <p><i>This section is non-normative.</i></p>

  <p>How accurately various aspects of the <a href=#media-element>media element</a> API are implemented is
  considered a quality-of-implementation issue.</p>

  <p>For example, when implementing the <code title=attr-media-buffered>buffered</code> attribute,
  how precise an implementation reports the ranges that have been buffered depends on how carefully
  the user agent inspects the data. Since the API reports ranges as times, but the data is obtained
  in byte streams, a user agent receiving a variable-bit-rate stream might only be able to determine
  precise times by actually decoding all of the data. User agents aren't required to do this,
  however; they can instead return estimates (e.g. based on the average bit rate seen so far) which
  get revised as more information becomes available.</p>

  <p>As a general rule, user agents are urged to be conservative rather than optimistic. For
  example, it would be bad to report that everything had been buffered when it had not.</p>

  <p>Another quality-of-implementation issue would be playing a video backwards when the codec is
  designed only for forward playback (e.g. there aren't many key frames, and they are far apart, and
  the intervening frames only have deltas from the previous frame). User agents could do a poor job,
  e.g. only showing key frames; however, better implementations would do more work and thus do a
  better job, e.g. actually decoding parts of the video forwards, storing the complete frames, and
  then playing the frames backwards.</p>

  <p>Similarly, while implementations are allowed to drop buffered data at any time (there is no
  requirement that a user agent keep all the media data obtained for the lifetime of the media
  element), it is again a quality of implementation issue: user agents with sufficient resources to
  keep all the data around are encouraged to do so, as this allows for a better user experience. For
  example, if the user is watching a live stream, a user agent could allow the user only to view the
  live video; however, a better user agent would buffer everything and allow the user to seek
  through the earlier material, pause it, play it forwards and backwards, etc.</p>

  <p>When multiple tracks are synchronised with a <code><a href=#mediacontroller>MediaController</a></code>, it is possible for
  scripts to add and remove media elements from the <code><a href=#mediacontroller>MediaController</a></code>'s list of
  <a href=#slaved-media-elements>slaved media elements</a>, even while these tracks are playing. How smoothly the media
  plays back in such situations is another quality-of-implementation issue.</p>

  <hr><p>When a <a href=#media-element>media element</a> that is paused is <a href=#remove-an-element-from-a-document title="remove an element from a
  document">removed from a document</a> and not reinserted before the next time the <a href=#event-loop>event
  loop</a> spins, 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>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>

  </div>
  


<!--TOPIC:Canvas-->
  <h4 id=the-canvas-element><span class=secno>4.8.11 </span>The <dfn id=canvas><code>canvas</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#embedded-content>Embedded content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#embedded-content>embedded content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#transparent>Transparent</a>, but with no <a href=#interactive-content>interactive content</a> descendants except for <code><a href=#the-a-element>a</a></code> elements, <code><a href=#the-button-element>button</a></code> elements, <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute are in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> or <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> states, and <code><a href=#the-input-element>input</a></code> elements that are <a href=#concept-button title=concept-button>buttons</a>.</dd> <!-- and maybe <select>, I guess? I've left it our for now, since I guess authors might make accessible selects if they're simple enough, and it's not obvious how to distinguish the simple ones from the complex ones... -->
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dd><code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> &mdash; Vertical dimension</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--ADD-TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>typedef (<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> or <a href=#webglrenderingcontext>WebGLRenderingContext</a>) <dfn id=renderingcontext>RenderingContext</dfn>;

interface <dfn id=htmlcanvaselement>HTMLCanvasElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute unsigned long <a href=#dom-canvas-width title=dom-canvas-width>width</a>;
           attribute unsigned long <a href=#dom-canvas-height title=dom-canvas-height>height</a>;

  <a href=#renderingcontext>RenderingContext</a>? <a href=#dom-canvas-getcontext title=dom-canvas-getContext>getContext</a>(DOMString contextId, any... arguments);
  boolean <a href=#dom-canvas-supportscontext title=dom-canvas-supportsContext>supportsContext</a>(DOMString contextId, any... arguments);

  void <a href=#dom-canvas-setcontext title=dom-canvas-setContext>setContext</a>(<a href=#renderingcontext>RenderingContext</a> context);
  <a href=#canvasproxy>CanvasProxy</a> <a href=#dom-canvas-transfercontroltoproxy title=dom-canvas-transferControlToProxy>transferControlToProxy</a>();

  DOMString <a href=#dom-canvas-todataurl title=dom-canvas-toDataURL>toDataURL</a>(optional DOMString type, any... arguments);
  DOMString <a href=#dom-canvas-todataurlhd title=dom-canvas-toDataURLHD>toDataURLHD</a>(optional DOMString type, any... arguments);
  void <a href=#dom-canvas-toblob title=dom-canvas-toBlob>toBlob</a>(<a href=#filecallback>FileCallback</a>? _callback, optional DOMString type, any... arguments);
  void <a href=#dom-canvas-toblobhd title=dom-canvas-toBlobHD>toBlobHD</a>(<a href=#filecallback>FileCallback</a>? _callback, optional DOMString type, any... arguments);
};</pre>
   </dd>
  </dl><!--REMOVE-TOPIC:DOM APIs--><p>The <code><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><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><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><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using
  CSS and supporting technologies such as XBL.</p>

  <p>When authors use the <code><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><a href=#the-canvas-element>canvas</a></code>' bitmap. This content may be placed as content of the <code><a href=#the-canvas-element>canvas</a></code>
  element. The contents of the <code><a href=#the-canvas-element>canvas</a></code> element, if any, are the element's <a href=#fallback-content>fallback
  content</a>.</p>

  <hr><p>In interactive visual media, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for
  the <code><a href=#the-canvas-element>canvas</a></code> element, and if support for <code><a href=#the-canvas-element>canvas</a></code> elements has been enabled,
  the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> consisting
  of a dynamically created image, the element's bitmap.</p>

  <p>In non-interactive, static, visual media, if the <code><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><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a>
  <a href=#embedded-content>embedded content</a> with the element's current bitmap and size. Otherwise, the element
  represents its <a href=#fallback-content>fallback content</a> instead.</p>

  <p>In non-visual media, and in visual media if <a href=#concept-n-noscript title=concept-n-noscript>scripting is
  disabled</a> for the <code><a href=#the-canvas-element>canvas</a></code> element or if support for <code><a href=#the-canvas-element>canvas</a></code> elements
  has been disabled, the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> its <a href=#fallback-content>fallback
  content</a> instead.</p>

  <!-- CANVAS-FOCUS-FALLBACK -->
  <p>When a <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a>, the
  user can still focus descendants of the <code><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content>fallback
  content</a>). When an element is focused, 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 focusable
  elements in the <a href=#fallback-content>fallback content</a>. (Focus has no effect on mouse interaction events.)
  <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p> <!-- user interaction spec integration point -->

  <hr><p>The <code><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the size of the element's bitmap:
  <dfn id=attr-canvas-width title=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height title=attr-canvas-height><code>height</code></dfn>. These attributes, when specified, must have
  values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative integers</a>. <span class=impl>The <a href=#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.</span> The <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code>
  attribute defaults to 300, and the <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attribute
  defaults to 150.</p>

  <p>The intrinsic dimensions of the <code><a href=#the-canvas-element>canvas</a></code> element when it <a href=#represents>represents</a>
  <a href=#embedded-content>embedded content</a> are equal to the dimensions of the element's bitmap.</p>

  <p class=note>A <code><a href=#the-canvas-element>canvas</a></code> element can be sized arbitrarily by a style sheet, its
  bitmap is then subject to the 'object-fit' CSS property. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

  <div class=impl>

  <hr><!--ADD-TOPIC:Security--><p>The bitmaps of <code><a href=#the-canvas-element>canvas</a></code> elements, as well as some of the bitmaps of rendering
  contexts, such as those described in the section on the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
  object below, have an <dfn id=concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</dfn> flag, which can
  be set to true or false. Initially, when the <code><a href=#the-canvas-element>canvas</a></code> element is created, its bitmap's
  <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag must be set to true.</p>
<!--REMOVE-TOPIC:Security-->

  <p>A <code><a href=#the-canvas-element>canvas</a></code> bitmap can also have a <a href=#hit-region-list>hit region list</a>, as described in the
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> section below.</p>

  <p>A <code><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><a href=#the-canvas-element>canvas</a></code> also has a <dfn id=concept-canvas-context-mode title=concept-canvas-context-mode>canvas context mode</dfn>, which is initially <dfn id=concept-canvas-none title=concept-canvas-none>none</dfn> but can be changed to either <dfn id=concept-canvas-direct-2d title=concept-canvas-direct-2d>direct-2d</dfn>, <dfn id=concept-canvas-direct-webgl title=concept-canvas-direct-webgl>direct-webgl</dfn>, <dfn id=concept-canvas-indirect title=concept-canvas-indirect>indirect</dfn>, or <dfn id=concept-canvas-proxied title=concept-canvas-proxied>proxied</dfn> by algorithms defined in this specification.</p>

  <p>When its <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>canvas context mode</a> is <a href=#concept-canvas-none title=concept-canvas-none>none</a>, a <code><a href=#the-canvas-element>canvas</a></code> element has no rendering context,
  and its bitmap must be fully transparent black with an intrinsic width equal to the numeric value
  of the element's <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> attribute and an intrinsic height
  equal to the numeric value of the element's <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code>
  attribute, those values being interpreted in CSS pixels, and being updated as the attributes are
  set, changed, or removed.</p>

  <p>When a <code><a href=#the-canvas-element>canvas</a></code> element represents <a href=#embedded-content>embedded content</a>, it <a href=#provides-a-paint-source>provides
  a paint source</a> whose width is the element's intrinsic width, whose height is the element's
  intrinsic height, and whose appearance is the element's bitmap.</p>

  <p>Whenever the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes are set, removed, changed, or
  redundantly set to the value they already have, if the <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>canvas context mode</a> is <a href=#concept-canvas-direct-2d title=concept-canvas-direct-2d>direct-2d</a><!-- (and the rendering context's <span
  title="concept-canvas-context-bitmap-mode">context bitmap mode</span>, therefore, is <span
  title="concept-canvas-fixed">fixed</span>)-->, the user agent must <a href=#concept-canvas-set-bitmap-dimensions title=concept-canvas-set-bitmap-dimensions>set bitmap dimensions</a> to the numeric values of
  the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.</p>

  <p>The <dfn id=dom-canvas-width title=dom-canvas-width><code>width</code></dfn> and <dfn id=dom-canvas-height title=dom-canvas-height><code>height</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name, with the same defaults.</p>

  </div>

  <p class=note>The bitmaps used with <code><a href=#the-canvas-element>canvas</a></code> elements can have arbitrary pixel
  densities. Typically, the density will match that of the user's screen.</p>

  <hr><!--ADD-TOPIC:DOM APIs--><dl class=domintro><dt><var title="">context</var> = <var title="">canvas</var> . <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext</a></code>(<var title="">contextId</var> [, ... ])</dt>

   <dd>

    <p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies
    the desired API, either "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" or "<code title=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 title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context below.
    There is also a specification that defines a "<code title=canvas-context-webgl><a href=#canvas-context-webgl>webgl</a></code>"
    context. <a href=#refsWEBGL>[WEBGL]</a></p>

    <p>Returns null if the given context ID is not supported, if the canvas has already been
    initialized with the other context type (e.g. trying to get a "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context after getting a "<code title=canvas-context-webgl><a href=#canvas-context-webgl>webgl</a></code>" context).</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code title=dom-canvas-setContext><a href=#dom-canvas-setcontext>setContext()</a></code> or <code title=dom-canvas-transferControlToProxy><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy()</a></code> methods have been
    used.</p>

   </dd>

   <dt><var title="">supported</var> = <var title="">canvas</var> . <code title=dom-canvas-supportsContext><a href=#dom-canvas-supportscontext>supportsContext</a></code>(<var title="">contextId</var> [, ... ])</dt>

   <dd>

    <p>Returns false if calling <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> with the
    same arguments would definitely return null, and true otherwise.</p>

    <p>This return value is not a guarantee that <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> will or will not return an object, as
    conditions (e.g. availability of system resources) can vary over time.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code title=dom-canvas-setContext><a href=#dom-canvas-setcontext>setContext()</a></code> or <code title=dom-canvas-transferControlToProxy><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy()</a></code> methods have been
    used.</p>

   </dd>

   <dt><var title="">canvas</var> . <code title=dom-canvas-setContext><a href=#dom-canvas-setcontext>setContext</a></code>(<var title="">context</var>)</dt>

   <dd>

    <p>Sets the <code><a href=#the-canvas-element>canvas</a></code>' rendering context to the given object.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> or <code title=dom-canvas-transferControlToProxy><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy()</a></code> methods have been
    used.</p>

   </dd>

  </dl><div class=impl>

  <p>There are two ways for a <code><a href=#the-canvas-element>canvas</a></code> element to acquire a rendering context: the
  <code><a href=#the-canvas-element>canvas</a></code> element can provide one via the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method, and one can be assigned to it via the
  <code title=dom-canvas-setContext><a href=#dom-canvas-setcontext>setContext()</a></code> method. In addition, the whole issue of a
  rendering context can be taken out of the <code><a href=#the-canvas-element>canvas</a></code> element's hands and passed to a
  <code><a href=#canvasproxy>CanvasProxy</a></code> object, which itself can then be assigned a rendering context using its
  <code title=dom-CanvasProxy-setContext><a href=#dom-canvasproxy-setcontext>setContext()</a></code> method.</p>

  <p>These three methods are mutually exclusive; calling any of the three makes the other two start
  throwing <code><a href=#invalidstateerror>InvalidStateError</a></code> exceptions when called.</p>

  <p>Each rendering context has a <dfn id=concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap
  mode</dfn>, which is one of <dfn id=concept-canvas-fixed title=concept-canvas-fixed>fixed</dfn>, <dfn id=concept-canvas-unbound title=concept-canvas-unbound>unbound</dfn>, or <dfn id=concept-canvas-bound title=concept-canvas-bound>bound</dfn>.
  Initially, rendering contexts must be in the <a href=#concept-canvas-bound title=concept-canvas-bound>unbound</a>
  mode.</p>

  <hr><p>The <dfn id=dom-canvas-getcontext title=dom-canvas-getContext><code>getContext(<var title="">contextId</var>, <var title="">arguments...</var>)</code></dfn> method of the <code><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><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>canvas context mode</a>
  and whose row header describes the method's first argument.</p>

  <table><thead><tr><td>
     <th><a href=#concept-canvas-none title=concept-canvas-none>none</a>
     <th><a href=#concept-canvas-direct-2d title=concept-canvas-direct-2d>direct-2d</a>
     <th><a href=#concept-canvas-direct-webgl title=concept-canvas-direct-webgl>direct-webgl</a>
     <th><a href=#concept-canvas-indirect title=concept-canvas-indirect>indirect</a>
     <th><a href=#concept-canvas-proxied title=concept-canvas-proxied>proxied</a>
   <tbody><tr><th>"<dfn id=canvas-context-2d title=canvas-context-2d><code>2d</code></dfn>"
     <td>
      Set the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>context
      mode</a> to <a href=#concept-canvas-direct-2d title=concept-canvas-direct-2d>direct-2d</a>; follow the <a href=#2d-context-creation-algorithm>2D
      context creation algorithm</a> defined in the section below, passing it the
      <code><a href=#the-canvas-element>canvas</a></code> element, to obtain a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object; set
      that object's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> to
      <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, and return the
      <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
     <td>
      Return the same object as was return the last time the method was invoked with this same
      argument.
     <td>
      Return null.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.

    <tr><th>"<dfn id=canvas-context-webgl title=canvas-context-webgl><code>webgl</code></dfn>", if the user agent supports the WebGL feature in its current configuration
     <td>
      Follow the instructions given in the WebGL specification's <i>Context Creation</i> section to
      obtain either a <code><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> or null; if the returned value is null,
      then return null and abort these steps, otherwise, set the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>context mode</a> to <a href=#concept-canvas-direct-webgl title=concept-canvas-direct-webgl>direct-webgl</a>, set the new
      <code><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> object's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> to <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, and return the <code><a href=#webglrenderingcontext>WebGLRenderingContext</a></code>
      object&ddagger; <a href=#refsWEBGL>[WEBGL]</a>
     <td>
      Return null.
     <td>
      Return the same object as was return the last time the method was invoked with this same
      argument.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.

    <tr><th>A vendor-specific extension*
     <td>
      Behave as defined for the extension.
     <td>
      Behave as defined for the extension.
     <td>
      Behave as defined for the extension.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.

    <tr><th>An unsupported value&dagger;
     <td>
      Return null.
     <td>
      Return null.
     <td>
      Return null.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.
     <td>
      Throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.
    
  </table><p class=tablenote><small>* Vendors may define experimental contexts using the syntax <code><var title="">vendorname</var>-<var title="">context</var></code>, for example,
  <code>moz-3d</code>.</small></p>

  <p class=tablenote><small>&dagger; For example, the "<code title=canvas-context-webgl><a href=#canvas-context-webgl>webgl</a></code>" value in the case of a user agent having exhausted the
  graphics hardware's abilities and having no software fallback implementation.</small></p>

  <p class=tablenote><small>&ddagger; The second (and subsequent) argument(s) to the method, if
  any, are ignored in all cases except this one. See the WebGL specification for
  details.</small></p>

  <hr><p>The <dfn id=dom-canvas-supportscontext title=dom-canvas-supportsContext><code>supportsContext(<var title="">contextId</var>,
  <var title="">arguments...</var>)</code></dfn> method of the <code><a href=#the-canvas-element>canvas</a></code> element, when
  invoked, must return false if calling <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> on
  the same object and with the same arguments would definitely return null at this time, and true
  otherwise.</p>

  <hr><p>The <dfn id=dom-canvas-setcontext title=dom-canvas-setContext><code>setContext(<var title="">context</var>)</code></dfn> method of the <code><a href=#the-canvas-element>canvas</a></code> element, when invoked, must
  run the following steps:</p>

  <ol><li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>canvas
   context mode</a> is neither <a href=#concept-canvas-none title=concept-canvas-none>none</a> nor <a href=#concept-canvas-indirect title=concept-canvas-indirect>indirect</a>, throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
   exception and abort these steps.</li>

   <li><p>If <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
   bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, then throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>If <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
   bitmap mode</a> is <a href=#concept-canvas-bound title=concept-canvas-bound>bound</a>, then run <var title="">context</var>'s <a href=#concept-canvas-unbinding-steps title=concept-canvas-unbinding-steps>unbinding steps</a> and
   set its <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
   bitmap mode</a> to <a href=#concept-canvas-unbound title=concept-canvas-unbound>unbound</a>.</li>

   <li><p>Run <var title="">context</var>'s <a href=#concept-canvas-binding-steps title=concept-canvas-binding-steps>binding
   steps</a> to bind it to this <code><a href=#the-canvas-element>canvas</a></code> element.</li>

   <li><p>Set the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>context
   mode</a> to <a href=#concept-canvas-indirect title=concept-canvas-indirect>indirect</a> and the <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap
   mode</a> to <a href=#concept-canvas-bound title=concept-canvas-bound>bound</a>.</li>

  </ol><hr></div>

  <dl class=domintro><dt><var title="">url</var> = <var title="">canvas</var> . <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL</a></code>( [ <var title="">type</var>, ... ] )</dt>
   <dt><var title="">url</var> = <var title="">canvas</var> . <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD</a></code>( [ <var title="">type</var>, ... ] )</dt>

   <dd>

    <p>Returns a <a href=#data-protocol title="data protocol"><code title="">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 title="">image/png</code>; that type is also used if the given type
    isn't supported. The other arguments are specific to the type, and control the way that the
    image is generated, as given <a href=#canvas-serialization-arguments>in the table
    below</a>.</p>

    <p>When trying to use types other than "<code>image/png</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 title="">data:image/png,</code>" or "<code title="">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 title="">data:,</code>".)</p>

    <p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method returns the data at a
    resolution of 96dpi. The <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> method
    returns it at the native canvas bitmap resolution.</p>

   </dd>

   <dt><var title="">canvas</var> . <code title=dom-canvas-toBlob><a href=#dom-canvas-toblob>toBlob</a></code>(<var title="">callback</var> [, <var title="">type</var>, ... ])</dt>
   <dt><var title="">canvas</var> . <code title=dom-canvas-toBlobHD><a href=#dom-canvas-toblobhd>toBlobHD</a></code>(<var title="">callback</var> [, <var title="">type</var>, ... ])</dt>

   <dd>

    <p>Creates a <code><a href=#blob>Blob</a></code> object representing a file containing the image in the canvas,
    and invokes a callback with a handle to that object.</p>

    <p>The second argument, if provided, controls the type of the image to be returned (e.g. PNG or
    JPEG). The default is <code title="">image/png</code>; that type is also used if the given type
    isn't supported. The other arguments are specific to the type, and control the way that the
    image is generated, as given <a href=#canvas-serialization-arguments>in the table
    below</a>.</p>

    <p>The <code title=dom-canvas-toBlob><a href=#dom-canvas-toblob>toBlob()</a></code> method provides the data at a resolution
    of 96dpi. The <code title=dom-canvas-toBlobHD><a href=#dom-canvas-toblobhd>toBlobHD()</a></code> method provides it at the
    native canvas bitmap resolution.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-canvas-todataurl title=dom-canvas-toDataURL><code>toDataURL()</code></dfn> and <dfn id=dom-canvas-todataurlhd title=dom-canvas-toDataURLHD><code>toDataURLHD()</code></dfn> methods must run the following
  steps:</p>

  <ol><!--ADD-TOPIC:Security--><li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap's <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag is set to false, throw a
   <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
<!--REMOVE-TOPIC:Security-->

   <li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap has no pixels (i.e. either its horizontal
   dimension or its vertical dimension is zero) then return the string "<code title="">data:,</code>" and abort these steps. (This is the shortest <a href=#data-protocol title="data
   protocol"><code title="">data:</code> URL</a>; it represents the empty string in a <code title="">text/plain</code> resource.)</li>

   <li><p>Let <var title="">file</var> be <a href=#a-serialization-of-the-bitmap-as-a-file title="a serialization of the bitmap as a file">a
   serialization of the <code>canvas</code> element's bitmap as a file</a>, using the method's
   arguments (if any) as the <var title="">arguments</var>, and with the <var title="">native</var>
   flag set if the method is the <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> method,
   and not otherwise.</li>

   <li><p>Return a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a> representing
   <var title="">file</var>. <a href=#refsRFC2397>[RFC2397]</a></p>

   <!-- should we explicitly require the URL to be base64-encoded and not have any parameters, to
   ensure the same exact URL is generated in each browser? -->

  </ol><p>The <dfn id=dom-canvas-toblob title=dom-canvas-toBlob><code>toBlob()</code></dfn> and <dfn id=dom-canvas-toblobhd title=dom-canvas-toBlobHD><code>toBlobHD()</code></dfn> methods must run the following
  steps:</p>

  <ol><!--ADD-TOPIC:Security--><li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap's <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag is set to false, throw a
   <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
<!--REMOVE-TOPIC:Security-->

   <li><p>Let <var title="">callback</var> be the first argument.</li>

   <li><p>Let <var title="">arguments</var> be the second and subsequent arguments to the method, if
   any.</li>

   <li>

    <p>If the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap has no pixels (i.e. either its horizontal
    dimension or its vertical dimension is zero) then let <var title="">result</var> be null.</p>

    <p>Otherwise, let <var title="">result</var> be a <code><a href=#blob>Blob</a></code> object representing <a href=#a-serialization-of-the-bitmap-as-a-file title="a serialization of the bitmap as a file">a serialization of the <code>canvas</code>
    element's bitmap as a file</a>, using <var title="">arguments</var>, and with the <var title="">native</var> flag set if the method is the <code title=dom-canvas-toBlobHD><a href=#dom-canvas-toblobhd>toBlobHD()</a></code> method, and not otherwise. <a href=#refsFILEAPI>[FILEAPI]</a> </p>

   </li>

   <li><p>Return, but continue running these steps asynchronously.</li>

   <li><p>If <var title="">callback</var> is null, abort these steps.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to invoke the <code><a href=#filecallback>FileCallback</a></code> <var title="">callback</var> with <var title="">result</var> as its argument. The <a href=#task-source>task
   source</a> for this task is the <dfn id=canvas-blob-serialization-task-source>canvas blob serialization task source</dfn>.</li>

  </ol></div>
  <!--REMOVE-TOPIC:DOM APIs-->


  <!--ADD-TOPIC:Workers-->
  <h5 id=proxying-canvases-to-workers><span class=secno>4.8.11.1 </span>Proxying canvases to workers</h5>

  <p>Since DOM nodes cannot be accessed across worker boundaries, a proxy object is needed to enable
  workers to render to <code><a href=#the-canvas-element>canvas</a></code> elements in <code><a href=#document>Document</a></code>s.</p>

  <pre class=idl>interface <dfn id=canvasproxy>CanvasProxy</dfn> {
  void <a href=#dom-canvasproxy-setcontext title=dom-CanvasProxy-setContext>setContext</a>(<a href=#renderingcontext>RenderingContext</a> context);
};
// <a href=#canvasproxy>CanvasProxy</a> implements <a href=#transferable>Transferable</a>;</pre>

  <dl class=domintro><dt><var title="">canvasProxy</var> = <var title="">canvas</var> . <code title=dom-canvas-transferControlToProxy><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy</a></code>()</dt>

   <dd>

    <p>Returns a <code><a href=#canvasproxy>CanvasProxy</a></code> object that can be used to transfer control for this
    canvas over to another document (e.g. an <code><a href=#the-iframe-element>iframe</a></code> from another <a href=#origin>origin</a>)
    or to a worker.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> or <code title=dom-canvas-setContext><a href=#dom-canvas-setcontext>setContext()</a></code> methods have been used.</p>

   </dd>

   <dt><var title="">canvasProxy</var> . <code title=dom-CanvasProxy-setContext><a href=#dom-canvasproxy-setcontext>setContext</a></code>(<var title="">context</var>)</dt>

   <dd>

    <p>Sets the <code><a href=#canvasproxy>CanvasProxy</a></code> object's <code><a href=#the-canvas-element>canvas</a></code> element's rendering context to
    the given object.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code><a href=#canvasproxy>CanvasProxy</a></code> has been
    <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a>.</p>

   </dd>

  </dl><hr><p>The <dfn id=dom-canvas-transfercontroltoproxy title=dom-canvas-transferControlToProxy><code>transferControlToProxy()</code></dfn>
  method of the <code><a href=#the-canvas-element>canvas</a></code> element, when invoked, must run the following steps:</p>

  <ol><li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>canvas
   context mode</a> is not <a href=#concept-canvas-none title=concept-canvas-none>none</a>, throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>Set the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode title=concept-canvas-context-mode>context
   mode</a> to <a href=#concept-canvas-proxied title=concept-canvas-proxied>proxied</a>.</li>

   <li><p>Return a <code><a href=#canvasproxy>CanvasProxy</a></code> object bound to this <code><a href=#the-canvas-element>canvas</a></code>
   element.</li>

  </ol><p>A <code><a href=#canvasproxy>CanvasProxy</a></code> object can be <a href=#concept-transferable-neutered title=concept-transferable-neutered>neutered</a> (like any <code><a href=#transferable>Transferable</a></code> object),
  meaning it can no longer be <a href=#transfer-a-transferable-object title="transfer a Transferable object">transferred</a>, and
  can be <dfn id=concept-canvasproxy-disabled title=concept-CanvasProxy-disabled>disabled</dfn>, meaning it can no longer be bound
  to rendering contexts. When first created, a <code><a href=#canvasproxy>CanvasProxy</a></code> object must be neither.</p>

  <p>A <code><a href=#canvasproxy>CanvasProxy</a></code> is created with a link to a <code><a href=#the-canvas-element>canvas</a></code> element. A
  <code><a href=#canvasproxy>CanvasProxy</a></code> object that has not been <a href=#concept-canvasproxy-disabled title=concept-CanvasProxy-disabled>disabled</a> must have a strong reference to its canvas
  element.</p>

  <p>The <dfn id=dom-canvasproxy-setcontext title=dom-CanvasProxy-setContext><code>setContext(<var title="">context</var>)</code></dfn> method of <code><a href=#canvasproxy>CanvasProxy</a></code> objects, when invoked,
  must run the following steps:</p>

  <ol><li><p>If the <code><a href=#canvasproxy>CanvasProxy</a></code> object has been <a href=#concept-canvasproxy-disabled title=concept-CanvasProxy-disabled>disabled</a>, throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
   exception and abort these steps.</li>

   <li><p>If the <code><a href=#canvasproxy>CanvasProxy</a></code> object has not been <a href=#concept-transferable-neutered title=concept-transferable-neutered>neutered</a>, then <a href=#concept-transferable-neutered title=concept-transferable-neutered>neuter</a> it.</li>

   <li><p>If <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
   bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, then throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>If <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
   bitmap mode</a> is <a href=#concept-canvas-bound title=concept-canvas-bound>bound</a>, then run <var title="">context</var>'s <a href=#concept-canvas-unbinding-steps title=concept-canvas-unbinding-steps>unbinding steps</a> and
   set its <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
   bitmap mode</a> to <a href=#concept-canvas-unbound title=concept-canvas-unbound>unbound</a>.</li>

   <li><p>Run <var title="">context</var>'s <a href=#concept-canvas-binding-steps title=concept-canvas-binding-steps>binding
   steps</a> to bind it to this <code><a href=#canvasproxy>CanvasProxy</a></code> object's <code><a href=#the-canvas-element>canvas</a></code>
   element.</li>

   <li><p>Set the <var title="">context</var>'s <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> to <a href=#concept-canvas-bound title=concept-canvas-bound>bound</a>.</li>

  </ol><p id=transferCanvasProxy>To <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfer</a> a
  <code><a href=#canvasproxy>CanvasProxy</a></code> object <var title="">old</var> to a new owner <var title="">owner</var>,
  a user agent must create a new <code><a href=#canvasproxy>CanvasProxy</a></code> object linked to the same
  <code><a href=#the-canvas-element>canvas</a></code> element as <var title="">old</var>, thus obtaining <var title="">new</var>,
  must <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neuter</a> and <a href=#concept-canvasproxy-disabled title=concept-CanvasProxy-disabled>disable</a> the <var title="">old</var> object, and must
  finally return <var title="">new</var>.</p>

  <div class=example>

   <p>Here is a clock implemented on a worker. First, the main page:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Clock&lt;/title&gt;
&lt;canvas&gt;&lt;/canvas&gt; <!-- defaults to 300x150 -->
&lt;script&gt;
  var canvas = document.getElementsByTagName('canvas')[0];
  var proxy = canvas.transferControlToProxy();
  var worker = new Worker('clock.js');
  worker.postMessage(proxy, [proxy]);
&lt;/script&gt;</pre>

   <p>Second, the worker:</p>

   <pre>onmessage = function (event) {
  var context = new CanvasRenderingContext2D();
  event.data.setContext(context); // event.data is the CanvasProxy object
  setInterval(function () {
    context.clearRect(0, 0, context.width, context.height);
    context.fillText(new Date(), 0, 100);
    context.commit();
  }, 1000);
};</pre>

  </div>

  <!--REMOVE-TOPIC:Workers-->


  <h5 id=2dcontext><span class=secno>4.8.11.2 </span>The 2D rendering context</h5>

  <!-- v2: we're on v5. suggestions for subsequent versions are marked v6, v7, v8. -->

  <pre class=idl>typedef (<a href=#htmlimageelement>HTMLImageElement</a> or
         <a href=#htmlvideoelement>HTMLVideoElement</a> or
         <a href=#htmlcanvaselement>HTMLCanvasElement</a> or
         <a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> or
         <a href=#imagebitmap>ImageBitmap</a>) <dfn id=canvasimagesource>CanvasImageSource</dfn>;

enum <dfn id=canvasfillrule>CanvasFillRule</dfn> { "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>", "<a href=#dom-context-2d-fillrule-evenodd title=dom-context-2d-fillRule-evenodd>evenodd</a>" };

[<a href=#dom-context-2d title=dom-context-2d>Constructor</a>(optional unsigned long width, unsigned long height)]
interface <dfn id=canvasrenderingcontext2d>CanvasRenderingContext2D</dfn> {

  // back-reference to the canvas
  readonly attribute <a href=#htmlcanvaselement>HTMLCanvasElement</a> <a href=#dom-context-2d-canvas title=dom-context-2d-canvas>canvas</a>;

  // canvas dimensions
           attribute unsigned long <a href=#dom-context-2d-width title=dom-context-2d-width>width</a>;
           attribute unsigned long <a href=#dom-context-2d-height title=dom-context-2d-height>height</a>;

  // for contexts that aren't directly <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a> to a specific canvas
  void <a href=#dom-context-2d-commit title=dom-context-2d-commit>commit</a>(); // push the image to the <a href=#output-bitmap>output bitmap</a>

  // state
  void <a href=#dom-context-2d-save title=dom-context-2d-save>save</a>(); // push state on state stack
  void <a href=#dom-context-2d-restore title=dom-context-2d-restore>restore</a>(); // pop state stack and restore state
<!--
  // v7 we've also received requests for:
          attribute boolean <span title="dom-context-2d-forceHighQuality">forceHighQuality</span> // (default false)
  // when enabled, it would prevent the UA from falling back on lower-quality but faster rendering routines
  // useful e.g. for when an image manipulation app uses <canvas> both for UI previews and the actual work

-->
  // transformations (default transform is the identity matrix)
           attribute <a href=#svgmatrix>SVGMatrix</a> <a href=#dom-context-2d-currenttransform title=dom-context-2d-currentTransform>currentTransform</a>;
  void <a href=#dom-context-2d-scale title=dom-context-2d-scale>scale</a>(unrestricted double x, unrestricted double y);
  void <a href=#dom-context-2d-rotate title=dom-context-2d-rotate>rotate</a>(unrestricted double angle);
  void <a href=#dom-context-2d-translate title=dom-context-2d-translate>translate</a>(unrestricted double x, unrestricted double y);
  void <a href=#dom-context-2d-transform title=dom-context-2d-transform>transform</a>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
  void <a href=#dom-context-2d-settransform title=dom-context-2d-setTransform>setTransform</a>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
  void <a href=#dom-context-2d-resettransform title=dom-context-2d-resetTransform>resetTransform</a>();
<!--
  // v7 we've also received requests (though not many so far) for:
  void skew(...);                             // is this common enough that one can't just use setTransform()?
  void reflect(...);  and  void mirror(...);  // aren't negative values in scale() sufficient for these?

-->
  // compositing
           attribute unrestricted double <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>globalAlpha</a>; // (default 1.0)
           attribute DOMString <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>globalCompositeOperation</a>; // (default source-over)

  // image smoothing
           attribute boolean <a href=#dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled>imageSmoothingEnabled</a>; // (default true)
<!--
  // v7 we've also received requests for:
  - turning off antialiasing to avoid seams when patterns are painted next to each other
    - might be better to overdraw?
    - might be better to just draw at a higher res then downsample, like for 3d?
  - nested layers
    - the ability to composite an entire set of drawing operations with one shadow all at once
      http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/015567.html

-->
  // colors and styles (see also the <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> interface)
           attribute (DOMString or CanvasGradient or CanvasPattern) <a href=#dom-context-2d-strokestyle title=dom-context-2d-strokeStyle>strokeStyle</a>; // (default black)
           attribute (DOMString or CanvasGradient or CanvasPattern) <a href=#dom-context-2d-fillstyle title=dom-context-2d-fillStyle>fillStyle</a>; // (default black)
  <a href=#canvasgradient>CanvasGradient</a> <a href=#dom-context-2d-createlineargradient title=dom-context-2d-createLinearGradient>createLinearGradient</a>(double x0, double y0, double x1, double y1);
  <a href=#canvasgradient>CanvasGradient</a> <a href=#dom-context-2d-createradialgradient title=dom-context-2d-createRadialGradient>createRadialGradient</a>(double x0, double y0, double r0, double x1, double y1, double r1);
  <a href=#canvaspattern>CanvasPattern</a> <a href=#dom-context-2d-createpattern title=dom-context-2d-createPattern>createPattern</a>(<a href=#canvasimagesource>CanvasImageSource</a> image, DOMString repetition);
<!--
  // v8 we received one request from Ralf Richard G&oml;bel for a new kind of pattern: a hatch.
  // basically it would be a series of dash styles, angles, line widths, and offsets
-->
  // shadows
           attribute unrestricted double <a href=#dom-context-2d-shadowoffsetx title=dom-context-2d-shadowOffsetX>shadowOffsetX</a>; // (default 0)
           attribute unrestricted double <a href=#dom-context-2d-shadowoffsety title=dom-context-2d-shadowOffsetY>shadowOffsetY</a>; // (default 0)
           attribute unrestricted double <a href=#dom-context-2d-shadowblur title=dom-context-2d-shadowBlur>shadowBlur</a>; // (default 0)
           attribute DOMString <a href=#dom-context-2d-shadowcolor title=dom-context-2d-shadowColor>shadowColor</a>; // (default transparent black)

  // rects
  void <a href=#dom-context-2d-clearrect title=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 title=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 title=dom-context-2d-strokeRect>strokeRect</a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);

  // path API (see also <a href=#canvaspathmethods>CanvasPathMethods</a>)
  void <a href=#dom-context-2d-beginpath title=dom-context-2d-beginPath>beginPath</a>();
  void <a href=#dom-context-2d-fill title=dom-context-2d-fill>fill</a>(optional <a href=#canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>");
  void <a href=#dom-context-2d-fill title=dom-context-2d-fill>fill</a>(<a href=#path>Path</a> path, optional <a href=#canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>");
  void <a href=#dom-context-2d-stroke title=dom-context-2d-stroke>stroke</a>();
  void <a href=#dom-context-2d-stroke title=dom-context-2d-stroke>stroke</a>(<a href=#path>Path</a> path);
  void <a href=#dom-context-2d-drawsystemfocusring title=dom-context-2d-drawSystemFocusRing>drawSystemFocusRing</a>(<a href=#element>Element</a> element);
  void <a href=#dom-context-2d-drawsystemfocusring title=dom-context-2d-drawSystemFocusRing>drawSystemFocusRing</a>(<a href=#path>Path</a> path, <a href=#element>Element</a> element);
  boolean <a href=#dom-context-2d-drawcustomfocusring title=dom-context-2d-drawCustomFocusRing>drawCustomFocusRing</a>(<a href=#element>Element</a> element);
  boolean <a href=#dom-context-2d-drawcustomfocusring title=dom-context-2d-drawCustomFocusRing>drawCustomFocusRing</a>(<a href=#path>Path</a> path, <a href=#element>Element</a> element);
  void <a href=#dom-context-2d-scrollpathintoview title=dom-context-2d-scrollPathIntoView>scrollPathIntoView</a>();
  void <a href=#dom-context-2d-scrollpathintoview title=dom-context-2d-scrollPathIntoView>scrollPathIntoView</a>(<a href=#path>Path</a> path);
  void <a href=#dom-context-2d-clip title=dom-context-2d-clip>clip</a>(optional <a href=#canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>");
  void <a href=#dom-context-2d-clip title=dom-context-2d-clip>clip</a>(<a href=#path>Path</a> path, optional <a href=#canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>");
  void <a href=#dom-context-2d-resetclip title=dom-context-2d-resetClip>resetClip</a>();
  boolean <a href=#dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath>isPointInPath</a>(unrestricted double x, unrestricted double y, optional <a href=#canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>");
  boolean <a href=#dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath>isPointInPath</a>(<a href=#path>Path</a> path, unrestricted double x, unrestricted double y, optional <a href=#canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>");
  boolean <a href=#dom-context-2d-ispointinstroke title=dom-context-2d-isPointInStroke>isPointInStroke</a>(unrestricted double x, unrestricted double y);
  boolean <a href=#dom-context-2d-ispointinstroke title=dom-context-2d-isPointInStroke>isPointInStroke</a>(<a href=#path>Path</a> path, unrestricted double x, unrestricted double y);

  // text (see also the <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> interface)
  void <a href=#dom-context-2d-filltext title=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 title=dom-context-2d-strokeText>strokeText</a>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);<!-- v6DVT
  void <span title="dom-context-2d-fillVerticalText">fillVerticalText</span>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxHeight);
  void <span title="dom-context-2d-strokeVerticalText">strokeVerticalText</span>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxHeight); -->
  <a href=#textmetrics>TextMetrics</a> <a href=#dom-context-2d-measuretext title=dom-context-2d-measureText>measureText</a>(DOMString text);

  // drawing images
  void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(<a href=#canvasimagesource>CanvasImageSource</a> image, unrestricted double dx, unrestricted double dy);
  void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(<a href=#canvasimagesource>CanvasImageSource</a> image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
  void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>(<a href=#canvasimagesource>CanvasImageSource</a> image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);

  // hit regions
  void <a href=#dom-context-2d-addhitregion title=dom-context-2d-addHitRegion>addHitRegion</a>(optional <a href=#hitregionoptions>HitRegionOptions</a> options);
  void <a href=#dom-context-2d-removehitregion title=dom-context-2d-removeHitRegion>removeHitRegion</a>(DOMString id);

  // pixel manipulation
  <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata title=dom-context-2d-createImageData>createImageData</a>(double sw, double sh);
  <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata title=dom-context-2d-createImageData>createImageData</a>(<a href=#imagedata>ImageData</a> imagedata);
  <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedatahd title=dom-context-2d-createImageDataHD>createImageDataHD</a>(double sw, double sh);
  <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-getimagedata title=dom-context-2d-getImageData>getImageData</a>(double sx, double sy, double sw, double sh);
  <a href=#imagedata>ImageData</a> <a href=#dom-context-2d-getimagedatahd title=dom-context-2d-getImageDataHD>getImageDataHD</a>(double sx, double sy, double sw, double sh);
  void <a href=#dom-context-2d-putimagedata title=dom-context-2d-putImageData>putImageData</a>(<a href=#imagedata>ImageData</a> imagedata, double dx, double dy);
  void <a href=#dom-context-2d-putimagedata title=dom-context-2d-putImageData>putImageData</a>(<a href=#imagedata>ImageData</a> imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
  void <a href=#dom-context-2d-putimagedatahd title=dom-context-2d-putImageDataHD>putImageDataHD</a>(<a href=#imagedata>ImageData</a> imagedata, double dx, double dy);
  void <a href=#dom-context-2d-putimagedatahd title=dom-context-2d-putImageDataHD>putImageDataHD</a>(<a href=#imagedata>ImageData</a> imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
};
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvasdrawingstyles>CanvasDrawingStyles</a>;
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvaspathmethods>CanvasPathMethods</a>;

[NoInterfaceObject]
interface <dfn id=canvasdrawingstyles>CanvasDrawingStyles</dfn> {
  // line caps/joins
           attribute unrestricted double <a href=#dom-context-2d-linewidth title=dom-context-2d-lineWidth>lineWidth</a>; // (default 1)
           attribute DOMString <a href=#dom-context-2d-linecap title=dom-context-2d-lineCap>lineCap</a>; // "butt", "round", "square" (default "butt")
           attribute DOMString <a href=#dom-context-2d-linejoin title=dom-context-2d-lineJoin>lineJoin</a>; // "round", "bevel", "miter" (default "miter")
           attribute unrestricted double <a href=#dom-context-2d-miterlimit title=dom-context-2d-miterLimit>miterLimit</a>; // (default 10)

  // dashed lines
  void <a href=#dom-context-2d-setlinedash title=dom-context-2d-setLineDash>setLineDash</a>(sequence&lt;unrestricted double&gt; segments); // default empty
  sequence&lt;unrestricted double&gt; <a href=#dom-context-2d-getlinedash title=dom-context-2d-getLineDash>getLineDash</a>();
           attribute unrestricted double <a href=#dom-context-2d-linedashoffset title=dom-context-2d-lineDashOffset>lineDashOffset</a>;

  // text
           attribute DOMString <a href=#dom-context-2d-font title=dom-context-2d-font>font</a>; // (default 10px sans-serif)
           attribute DOMString <a href=#dom-context-2d-textalign title=dom-context-2d-textAlign>textAlign</a>; // "start", "end", "left", "right", "center" (default: "start")
           attribute DOMString <a href=#dom-context-2d-textbaseline title=dom-context-2d-textBaseline>textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
           attribute DOMString <a href=#dom-context-2d-direction title=dom-context-2d-direction>direction</a>; // "ltr", "rtl"<!--, "auto"-->, "inherit" (default: "inherit")
};

[NoInterfaceObject]
interface <dfn id=canvaspathmethods>CanvasPathMethods</dfn> {
  // shared path API methods
  void <a href=#dom-context-2d-closepath title=dom-context-2d-closePath>closePath</a>();
  void <a href=#dom-context-2d-moveto title=dom-context-2d-moveTo>moveTo</a>(unrestricted double x, unrestricted double y);
  void <a href=#dom-context-2d-lineto title=dom-context-2d-lineTo>lineTo</a>(unrestricted double x, unrestricted double y);
  void <a href=#dom-context-2d-quadraticcurveto title=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 title=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 title=dom-context-2d-arcTo>arcTo</a>(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius); <!-- see ARC-ORDER note below -->
  void <a href=#dom-context-2d-arcto title=dom-context-2d-arcTo>arcTo</a>(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation); <!-- see ARC-ORDER note below -->
  void <a href=#dom-context-2d-rect title=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 title=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); <!-- see ARC-ORDER note below -->
  void <a href=#dom-context-2d-ellipse title=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, boolean anticlockwise); <!-- see ARC-ORDER note below -->
};

interface <dfn id=canvasgradient>CanvasGradient</dfn> {
  // opaque object
  void <a href=#dom-canvasgradient-addcolorstop title=dom-canvasgradient-addColorStop>addColorStop</a>(double offset, DOMString color);
};

interface <dfn id=canvaspattern>CanvasPattern</dfn> {
  // opaque object
  void <a href=#dom-canvaspattern-settransform title=dom-canvaspattern-setTransform>setTransform</a>(<a href=#svgmatrix>SVGMatrix</a> transform);
};

interface <dfn id=textmetrics>TextMetrics</dfn> {
  // x-direction
  readonly attribute double <a href=#dom-textmetrics-width title=dom-textmetrics-width>width</a>; // advance width
  readonly attribute double <a href=#dom-textmetrics-actualboundingboxleft title=dom-textmetrics-actualBoundingBoxLeft>actualBoundingBoxLeft</a>;
  readonly attribute double <a href=#dom-textmetrics-actualboundingboxright title=dom-textmetrics-actualBoundingBoxRight>actualBoundingBoxRight</a>;

  // y-direction
  readonly attribute double <a href=#dom-textmetrics-fontboundingboxascent title=dom-textmetrics-fontBoundingBoxAscent>fontBoundingBoxAscent</a>;
  readonly attribute double <a href=#dom-textmetrics-fontboundingboxdescent title=dom-textmetrics-fontBoundingBoxDescent>fontBoundingBoxDescent</a>;
  readonly attribute double <a href=#dom-textmetrics-actualboundingboxascent title=dom-textmetrics-actualBoundingBoxAscent>actualBoundingBoxAscent</a>;
  readonly attribute double <a href=#dom-textmetrics-actualboundingboxdescent title=dom-textmetrics-actualBoundingBoxDescent>actualBoundingBoxDescent</a>;
  readonly attribute double <a href=#dom-textmetrics-emheightascent title=dom-textmetrics-emHeightAscent>emHeightAscent</a>;
  readonly attribute double <a href=#dom-textmetrics-emheightdescent title=dom-textmetrics-emHeightDescent>emHeightDescent</a>;
  readonly attribute double <a href=#dom-textmetrics-hangingbaseline title=dom-textmetrics-hangingBaseline>hangingBaseline</a>;
  readonly attribute double <a href=#dom-textmetrics-alphabeticbaseline title=dom-textmetrics-alphabeticBaseline>alphabeticBaseline</a>;
  readonly attribute double <a href=#dom-textmetrics-ideographicbaseline title=dom-textmetrics-ideographicBaseline>ideographicBaseline</a>;
};

dictionary <dfn id=hitregionoptions>HitRegionOptions</dfn> {
  <a href=#path>Path</a>? <span title=dom-HitRegionOptions-path>path</span> = null;
  <a href=#canvasfillrule>CanvasFillRule</a> <span title=dom-HitRegionOptions-fillRule>fillRule</span> = "<a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>nonzero</a>";
<!--  <span>SVGMatrix</span>? <span title="dom-HitRegionOptions-transform">transform</span> = null;
-->  DOMString <span title=dom-HitRegionOptions-id>id</span> = ""; <!-- "" is converted to null internally by addHitRegion() -->
  DOMString? <span title=dom-HitRegionOptions-parentID>parentID</span> = null;
  DOMString <span title=dom-HitRegionOptions-cursor>cursor</span> = "inherit";
  // for control-backed regions:
  <a href=#element>Element</a>? <span title=dom-HitRegionOptions-control>control</span> = null;
  // for unbacked regions:
  DOMString? <span title=dom-HitRegionOptions-label>label</span> = null;
  DOMString? <span title=dom-HitRegionOptions-role>role</span> = null;
};

interface <dfn id=imagedata>ImageData</dfn> {
  readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
  readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
  readonly attribute double <a href=#dom-imagedata-resolution title=dom-imagedata-resolution>resolution</a>;
  readonly attribute <a href=#uint8clampedarray>Uint8ClampedArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};

[<a href=#dom-drawingstyle title=dom-DrawingStyle>Constructor</a>(optional <a href=#element>Element</a> scope)]
interface <dfn id=drawingstyle>DrawingStyle</dfn> { };
<a href=#drawingstyle>DrawingStyle</a> implements <a href=#canvasdrawingstyles>CanvasDrawingStyles</a>;

[<a href=#dom-path title=dom-Path>Constructor</a>,
 <a href=#dom-path-copy title=dom-Path-copy>Constructor</a>(<a href=#path>Path</a> path),
 <a href=#dom-path-withdata title=dom-Path-withdata>Constructor</a>(DOMString d)]
interface <dfn id=path>Path</dfn> {
  void <a href=#dom-path-addpath title=dom-path-addPath>addPath</a>(<a href=#path>Path</a> path, <a href=#svgmatrix>SVGMatrix</a>? transformation);
  void <a href=#dom-path-addpathbystrokingpath title=dom-path-addPathByStrokingPath>addPathByStrokingPath</a>(<a href=#path>Path</a> path, <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> styles, <a href=#svgmatrix>SVGMatrix</a>? transformation);
  void <a href=#dom-path-addtext title=dom-path-addText>addText</a>(DOMString text, <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> styles, <a href=#svgmatrix>SVGMatrix</a>? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
  void <a href=#dom-path-addpathbystrokingtext title=dom-path-addPathByStrokingText>addPathByStrokingText</a>(DOMString text, <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> styles, <a href=#svgmatrix>SVGMatrix</a>? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
  void <a href=#dom-path-addtext title=dom-path-addText>addText</a>(DOMString text, <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> styles, <a href=#svgmatrix>SVGMatrix</a>? transformation, <a href=#path>Path</a> path, optional unrestricted double maxWidth);
  void <a href=#dom-path-addpathbystrokingtext title=dom-path-addPathByStrokingText>addPathByStrokingText</a>(DOMString text, <a href=#canvasdrawingstyles>CanvasDrawingStyles</a> styles, <a href=#svgmatrix>SVGMatrix</a>? transformation, <a href=#path>Path</a> path, optional unrestricted double maxWidth);
};
<a href=#path>Path</a> implements <a href=#canvaspathmethods>CanvasPathMethods</a>;</pre>

 <!-- ARC-ORDER note (see above):
      some demos rely on the precise order of the arc() and arcTo()
      methods, see https://bugzilla.mozilla.org/show_bug.cgi?id=623437
      for an example, and its duplicates for more -->

  <dl class=domintro><dt><var title="">context</var> = <var title="">canvas</var> . <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext</a></code>('2d')</dt>

   <dd>

    <p>Returns a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object that is permanently bound to a particular <code><a href=#the-canvas-element>canvas</a></code> element.</p>

   </dd>

   <dt><var title="">context</var> = new <code title=dom-context-2d><a href=#dom-context-2d>CanvasRenderingContext2D</a></code>( [ <var title="">width</var>, <var title="">height</var> ] )</dt>

   <dd>

    <p>Returns an unbound <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object with an implied bitmap with
    the given dimensions in CSS pixels (300x150, if the arguments are omitted).</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-canvas><a href=#dom-context-2d-canvas>canvas</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#the-canvas-element>canvas</a></code> element, if the rendering context was obtained using the
    <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-width><a href=#dom-context-2d-width>width</a></code></dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-height><a href=#dom-context-2d-height>height</a></code></dt>

   <dd>

    <p>Return the dimensions of the bitmap, in CSS pixels.</p>

    <p>Can be set, to update the bitmap's dimensions. If the rendering context is bound to a canvas,
    this will also update the canvas' intrinsic dimensions.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-commit><a href=#dom-context-2d-commit>commit</a></code>()</dt>

   <dd>

    <p>If the rendering context is bound to a <code><a href=#the-canvas-element>canvas</a></code>, display the current frame.</p>

   </dd>

  </dl><div class=impl>

  <p>A <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object can be obtained in two ways: the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method on a <code><a href=#the-canvas-element>canvas</a></code> element (which
  invokes the <a href=#2d-context-creation-algorithm>2D context creation algorithm</a>), and the <code title=dom-context-2d><a href=#dom-context-2d>CanvasRenderingContext2D()</a></code> constructor.</p>

  <p>A <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object has a <dfn id=scratch-bitmap>scratch bitmap</dfn> and can be bound
  to an <dfn id=output-bitmap>output bitmap</dfn>. These are initialized when the object is created, and can be
  subsequently adjusted when the rendering context is <a href=#concept-canvas-binding-steps title=concept-canvas-binding-steps>bound</a> or <a href=#concept-canvas-unbinding-steps title=concept-canvas-unbinding-steps>unbound</a>. In some cases, these bitmaps are the same
  underlying bitmap. In general, the <a href=#scratch-bitmap>scratch bitmap</a> is what scripts interact with, and
  the <a href=#output-bitmap>output bitmap</a> is what is being displayed. These bitmaps always have the same
  dimensions.</p>

<!--ADD-TOPIC:Security-->
  <p>Each such bitmap has an <a href=#concept-canvas-origin-clean title=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 title=concept-canvas-origin-clean>origin-clean</a> flag must be set to true.</p>
<!--REMOVE-TOPIC:Security-->

  <p>These bitmaps also have a <a href=#hit-region-list>hit region list</a>, which is described in a later section.
  Initially, this list is empty. <a href=#scratch-bitmap title="scratch bitmap">Scratch bitmaps</a> also have a
  <dfn id=list-of-pending-interface-actions>list of pending interface actions</dfn>, which can contain instructions to draw the user's
  attention to a location on the bitmap, and instructions to scroll to a location on the bitmap.
  Initially, this list is also empty.</p>

  <p>The <code><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 title="">x</var> values increasing when going right, and <var title="">y</var> values
  increasing when going down. The <var title="">x</var>-coordinate of the right-most edge is equal to
  the width of the rendering context's <a href=#scratch-bitmap>scratch bitmap</a> in CSS pixels; similarly, the
  <var title="">y</var>-coordinate of the bottom-most edge is equal to the height of the rendering
  context's <a href=#scratch-bitmap>scratch bitmap</a> in CSS pixels.</p>

  <p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps
  that the user agent will use internally or during rendering. On high-definition displays, for
  instance, the user agent may internally use bitmaps with two device pixels per unit in the
  coordinate space, so that the rendering remains at high quality throughout. Anti-aliasing can
  similarly be implemented using over-sampling with bitmaps of a higher resolution than the final
  image on the display.</p>

  <hr><p>The <dfn id=2d-context-creation-algorithm>2D context creation algorithm</dfn>, which is passed a <var title="">target</var> (a
  <code><a href=#the-canvas-element>canvas</a></code> element), consists of running the following steps:</p>

  <ol><li><p>Create a new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</li>

   <li><p>Initialize its <code title=dom-context-2d-canvas><a href=#dom-context-2d-canvas>canvas</a></code> attribute to point to
   <var title="">target</var>.</li>

   <li><p>Let the new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap>output bitmap</a> and
   <a href=#scratch-bitmap>scratch bitmap</a> both be the same bitmap as <var title="">target</var>'s bitmap (so
   that they are shared).</li>

   <li><p><a href=#concept-canvas-set-bitmap-dimensions title=concept-canvas-set-bitmap-dimensions>Set bitmap dimensions</a> to the
   numeric values of <var title="">target</var>'s <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and
   <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.</li>

   <li><p>Return the new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</li>

  </ol><hr><p>The <dfn id=dom-context-2d title=dom-context-2d><code>CanvasRenderingContext2D()</code></dfn> constructor, when
  invoked, must run the following steps:</p>

  <ol><li><p>Create a new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</li>

   <li><p>Initialize its <code title=dom-context-2d-canvas><a href=#dom-context-2d-canvas>canvas</a></code> attribute to
   null.</li>

   <li><p>Let the new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a> be
   a new bitmap.</li>

   <li><p>If the constructor was called with arguments, let <var title="">width</var> and <var title="">height</var> be the first and second arguments, respectively. Otherwise, let <var title="">width</var> and <var title="">height</var> be 300 and 150, respectively.</li>

   <li><p><a href=#concept-canvas-set-bitmap-dimensions title=concept-canvas-set-bitmap-dimensions>Set bitmap dimensions</a> to <var title="">width</var> and <var title="">height</var>.</li>

   <li><p>Let the new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap>output
   bitmap</a>.</li>

<!--
   <li><p><span>Start autocommitting the scratch bitmap</span> for the new
   <code>CanvasRenderingContext2D</code> object.</p></li>
-->

   <li><p>Return the new <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</li>

  </ol><hr><p>When the user agent is required to <dfn id=commit-the-scratch-bitmap>commit the scratch bitmap</dfn> for a rendering
  context, it must run the following steps:

  <ol><li><p>Let <var title="">bitmap copy</var> be a copy of the rendering context's <a href=#scratch-bitmap>scratch
   bitmap</a>.</li>

<!--ADD-TOPIC:Security-->
   <li><p>Let <var title="">origin-clean flag copy</var> be a copy of the rendering context's
   <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a>
   flag.</li>
<!--REMOVE-TOPIC:Security-->

   <li><p>Let <var title="">hit region list copy</var> be a copy of the rendering context's
   <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#hit-region-list>hit region list</a>.</li>

   <li><p>Let <var title="">list of pending interface actions copy</var> be a copy of the rendering
   context's <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions>list of pending interface actions</a>.</li>

   <li><p>Empty the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions>list of pending interface actions</a>.</li>

   <li><p>If the rendering context has no <a href=#output-bitmap>output bitmap</a>, abort these steps.</li>

   <li><p>Let <var title="">output bitmap</var> be the rendering context's <a href=#output-bitmap>output
   bitmap</a>.</li>

   <li><p>Let <var title="">canvas</var> be the <code><a href=#the-canvas-element>canvas</a></code> element to which the rendering
   context was most recently <a href=#concept-canvas-binding-steps title=concept-canvas-binding-steps>bound</a>.</li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> associated with <var title="">canvas</var>' <code><a href=#document>Document</a></code>
    to perform the following substeps:</p>

    <ol><li><p>Overwrite <var title="">output bitmap</var> with <var title="">bitmap
     copy</var>.</li>

<!--ADD-TOPIC:Security-->
     <li><p>Overwrite <var title="">output bitmap</var>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag with <var title="">origin-clean
     flag copy</var>.</li>
<!--REMOVE-TOPIC:Security-->

     <li><p>Overwrite <var title="">output bitmap</var>'s <a href=#hit-region-list>hit region list</a> with <var title="">hit region list copy</var>.</li>

     <li><p>Follow the directions in the <var title="">list of pending interface actions
     copy</var>.</li>

    </ol></li>

  </ol><p>The algorithm above must use the <dfn id=canvas-updating-task-source>canvas updating task source</dfn> (which is just used by
  this algorithm).</p>

<!--(right now we're requiring commit())
  <p>When a user agent is to <dfn>start autocommitting the scratch bitmap</dfn> for a rendering
  context, it must asynchronously start running the following algorithm. This algorithm interacts
  closely with the <span>event loop</span> mechanism; in particular, it has a <span>synchronous
  section</span> (which is triggered as part of the <span>event loop</span> algorithm). The steps in
  that section are marked with &#x231B;.</p>

  <ol>

   <li><p><i>Top</i>: <span>Await a stable state</span>. The <span>synchronous section</span>
   consists of the following steps. (The steps in the <span>synchronous section</span> are marked
   with &#x231B;.)</p></li>

   <li><p>&#x231B; <span>Commit the scratch bitmap</span> for the rendering context.</p></li>

   <li><p>End the <span>synchronous section</span>, continuing the remaining steps
   asynchronously.</p></li>

   <li><p>Return to the step labeled <i>top</i>.</p></li>

  </ol>
-->

  <p>The <dfn id=dom-context-2d-commit title=dom-context-2d-commit><code>commit()</code></dfn> method must run the
  following steps:</p>

  <ol><li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap
   mode</a> is <a href=#concept-canvas-bound title=concept-canvas-bound>fixed</a>, throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p><a href=#commit-the-scratch-bitmap>Commit the scratch bitmap</a> for the rendering context.</li>

  </ol><p class=note>The <a href=#scratch-bitmap>scratch bitmap</a> is only <a href=#commit-the-scratch-bitmap title="commit the scratch
  bitmap">committed</a> when the <code title=dom-context-2d-commit><a href=#dom-context-2d-commit>commit()</a></code> method is
  called. (This doesn't matter for <code><a href=#the-canvas-element>canvas</a></code> elements in <a href=#concept-canvas-direct-2d title=concept-canvas-direct-2d>direct-2d</a> mode, since there the <a href=#scratch-bitmap>scratch
  bitmap</a> is also the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap so every drawing operation is
  immediately drawn.)</p>

  <hr><p>When the user agent is to <dfn id=concept-canvas-set-bitmap-dimensions title=concept-canvas-set-bitmap-dimensions>set bitmap
  dimensions</dfn> to <var title="">width</var> and <var title="">height</var>, it must run the
  following steps:</p>

  <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.</li>

   <li><p>Clear the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#hit-region-list>hit region list</a> and its <a href=#list-of-pending-interface-actions>list of
   pending interface actions</a>.</li>

   <li><p>Resize the <a href=#scratch-bitmap>scratch bitmap</a> to the new <var title="">width</var> and <var title="">height</var> and clear it to fully transparent black.</li>

   <li><p>If the rendering context has an <a href=#output-bitmap>output bitmap</a>, and the <a href=#scratch-bitmap>scratch
   bitmap</a> is a different bitmap than the <a href=#output-bitmap>output bitmap</a>, then resize the
   <a href=#output-bitmap>output bitmap</a> to the new <var title="">width</var> and <var title="">height</var>
   and clear it to fully transparent black.</li>

   <li>

    <p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap
    mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, then run these substeps:</p>

    <ol><li><p>Let <var title="">canvas</var> be the <code><a href=#the-canvas-element>canvas</a></code> element to which the rendering
     context's <code title=dom-context-2d-canvas><a href=#dom-context-2d-canvas>canvas</a></code> attribute was initialized.</li>

     <li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
     bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a> and the numeric value of
     the <var title="">canvas</var>' <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> content attribute
     differs from <var title="">width</var>, then set <var title="">canvas</var>' <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> content attribute to the shortest possible string
     representing <var title="">width</var> as a <a href=#valid-non-negative-integer>valid non-negative integer</a>.</li>

     <li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context
     bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a> and the numeric value of
     the <var title="">canvas</var>' <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attribute
     differs from <var title="">height</var>, then set <var title="">canvas</var>' <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attribute to the shortest possible string
     representing <var title="">height</var> as a <a href=#valid-non-negative-integer>valid non-negative integer</a>.</li>

    </ol></li>

  </ol><div class=example>
   <p>Only one square appears to be drawn in the following example:</p>
   <pre>// canvas is a reference to a &lt;canvas&gt; element
var context = canvas.getContext('2d');
context.fillRect(0,0,50,50);
canvas.setAttribute('width', '300'); // clears the canvas
context.fillRect(0,100,50,50);
canvas.width = canvas.width; // clears the canvas
context.fillRect(100,0,50,50); // only this square remains</pre>
  </div>

  <hr><p>When the user agent is to run the <dfn id=concept-canvas-unbinding-steps title=concept-canvas-unbinding-steps>unbinding
  steps</dfn> for a rendering context, it must run the following steps:</p>

  <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.</li>

   <li><p>Clear the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#hit-region-list>hit region list</a> and its <a href=#list-of-pending-interface-actions>list of
   pending interface actions</a>.</li>

   <li><p>Clear the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a> to a
   transparent black.</li>

<!--ADD-TOPIC:Security-->
   <li><p>Set the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag to true.</li>
<!--REMOVE-TOPIC:Security-->

   <li><p>Let the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap>output
   bitmap</a>.</li>

  </ol><p>When the user agent is to run the <dfn id=concept-canvas-binding-steps title=concept-canvas-binding-steps>binding steps</dfn>
  to bind the rendering context to the <code><a href=#the-canvas-element>canvas</a></code> element <var title="">target</var>, it
  must run the following steps:</p>

  <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.</li>

   <li><p>Clear the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#hit-region-list>hit region list</a> and its <a href=#list-of-pending-interface-actions>list of
   pending interface actions</a>.</li>

   <li><p>Resize the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a> to
   the dimensions of <var title="">target</var>'s bitmap and clear it to fully transparent
   black.</li>

<!--ADD-TOPIC:Security-->
   <li><p>Set the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag to true.</li>
<!--REMOVE-TOPIC:Security-->

   <li><p>Let the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap>output bitmap</a> be <var title="">target</var>'s bitmap.</li>

  </ol><hr><p>The <dfn id=dom-context-2d-canvas title=dom-context-2d-canvas><code>canvas</code></dfn> attribute must return the
  value it was initialized to when the object was created.</p>

  <p>The <dfn id=dom-context-2d-width title=dom-context-2d-width><code>width</code></dfn> attribute, on getting, must
  return the width of the rendering context's <a href=#scratch-bitmap>scratch bitmap</a>, in CSS pixels. On
  setting, it must <a href=#concept-canvas-set-bitmap-dimensions title=concept-canvas-set-bitmap-dimensions>set bitmap dimensions</a>
  to the new value and the current height of the rendering context's <a href=#scratch-bitmap>scratch bitmap</a> in
  CSS pixels, respectively.</p>

  <p>The <dfn id=dom-context-2d-height title=dom-context-2d-height><code>height</code></dfn> attribute, on getting, must
  return the height of the rendering context's <a href=#scratch-bitmap>scratch bitmap</a>, in CSS pixels. On
  setting, it must <a href=#concept-canvas-set-bitmap-dimensions title=concept-canvas-set-bitmap-dimensions>set bitmap dimensions</a>
  to the current width of the rendering context's <a href=#scratch-bitmap>scratch bitmap</a> in CSS pixels and the
  new value, respectively.</p>

  <hr><p>Except where otherwise specified, for the 2D context interface, <strong>any method call with a
  numeric argument whose value is infinite or a NaN value must be ignored</strong>.</p>

  <!--
   Philip Taylor wrote:
   > My experience with some 3d canvas code is that infinities come up in
   > naturally harmless places, e.g. having a function that scales by x then
   > translates by 1/x and wanting it to work when x=0 (which ought to draw
   > nothing, since anything it draws is zero pixels wide), and it's a bit
   > annoying to track down and fix those issues, so I'd probably like it if
   > they were harmless in canvas methods. Opera appears to silently not draw
   > anything if the transformation matrix is not finite, but Firefox throws
   > exceptions when passing in non-finite arguments.
  -->

  <p>Whenever the CSS value <code title="">currentColor</code> is used as a color in the
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> API, the "computed value of the 'color' property" for the
  purposes of determining the computed value of the <code title="">currentColor</code> keyword is
  the value described by the appropriate entry in the following list:</p>

  <dl><dt>If the rendering context's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap
   mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a> and the <code><a href=#the-canvas-element>canvas</a></code>
   element is <a href=#being-rendered>being rendered</a></dt>

   <dd><p>The "computed value of the 'color' property" for the purposes of determining the computed
   value of the <code title="">currentColor</code> keyword is the computed value of the 'color'
   property on the <code><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). <a href=#refsCSSCOLOR>[CSSCOLOR]</a></dd>

   <dt>In all other cases</dt>

   <dd><p>The "computed value of the 'color' property" for the purposes of determining the computed
   value of the <code title="">currentColor</code> keyword is fully opaque black. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></dd>

  </dl><p>In the case of <code title=dom-canvasgradient-addColorStop><a href=#dom-canvasgradient-addcolorstop>addColorStop()</a></code> on
  <code><a href=#canvasgradient>CanvasGradient</a></code>, the "computed value of the 'color' property" for the purposes of
  determining the computed value of the <code title="">currentColor</code> keyword is always fully
  opaque black (there is no associated element). <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>

  <p class=note>This is because <code><a href=#canvasgradient>CanvasGradient</a></code> objects are
  <code><a href=#the-canvas-element>canvas</a></code>-neutral &mdash; a <code><a href=#canvasgradient>CanvasGradient</a></code> object created by one
  <code><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 class=note>Similar concerns exist with font-related properties; the rules for those are
  described in detail in the relevant section below.</p>

  </div>

  <hr><p>The <code><a href=#canvasfillrule>CanvasFillRule</a></code> enumeration is used to select the <dfn id=fill-rule>fill rule</dfn>
  algorithm by which to determine if a point is inside or outside a path.</p>

  <p>The value "<dfn id=dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero><code>nonzero</code></dfn>" value
  indicates the non-zero winding rule, wherein

     a point is considered to be outside a shape if the number of times a half-infinite straight
     line drawn from that point crosses the shape's path going in one direction is equal to the
     number of times it crosses the path going in the other direction.

  </p>


  <p>The "<dfn id=dom-context-2d-fillrule-evenodd title=dom-context-2d-fillRule-evenodd><code>evenodd</code></dfn>" value indicates
  the even-odd rule, wherein

     a point is considered to be outside a shape if the number of times a half-infinite straight
     line drawn from that point crosses the shape's path is even.

  </p>

  <p>If a point is not outside a shape, it is inside the shape.</p>


  <h6 id=implementation-notes><span class=secno>4.8.11.2.1 </span>Implementation notes</h6>

  <p><i>This section is non-normative.</i></p>

  <p>Although the way the specification is written it might sound like an implementation needs to
  track up to four bitmaps per canvas or rendering context &mdash; one <a href=#scratch-bitmap>scratch bitmap</a>,
  one <a href=#output-bitmap>output bitmap</a> for the rendering context, one bitmap for the <code><a href=#the-canvas-element>canvas</a></code>,
  and one bitmap for the actually currently rendered image &mdash; user agents can in fact generally
  optimise this to only one or two.</p>

  <p>The <a href=#scratch-bitmap>scratch bitmap</a>, when it isn't the same bitmap as the <a href=#output-bitmap>output
  bitmap</a>, is only directly observable if it is read, and therefore implementations can,
  instead of updating this bitmap, merely remember the sequence of drawing operations that have been
  applied to it until such time as the bitmap's actual data is needed (for example because of a call
  to <code title=dom-context-2d-commit><a href=#dom-context-2d-commit>commit()</a></code>, <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code>, or the <code title=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><a href=#the-canvas-element>canvas</a></code> element is the one bitmap that's pretty much always going
  to be needed in practice. The <a href=#output-bitmap>output bitmap</a> of a rendering context, when it has one,
  is always just an alias to a <code><a href=#the-canvas-element>canvas</a></code> element's bitmap.</p>

  <p>Additional bitmaps are sometimes needed, e.g. to enable fast drawing when the canvas is being
  painted at a different size than its intrinsic size, or to enable double buffering so that the
  rendering commands from the <a href=#scratch-bitmap>scratch bitmap</a> can be applied without the rendering being
  updated midway.</p>




  <h6 id=the-canvas-state><span class=secno>4.8.11.2.2 </span>The canvas state</h6>

  <p>Each <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> rendering context maintains a stack of drawing
  states. <dfn id=drawing-state title="drawing state">Drawing states</dfn> consist of:</p>

  <ul class=brief><li>The current <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>.</li>
   <li>The current <a href=#clipping-region>clipping region</a>.</li>
   <li>The current values of the following attributes: <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>, <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>, <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code>, <code title=dom-context-2d-lineDashOffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code>, <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>, <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code>, <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>, <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>, <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>, <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code>, <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>, <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code>, <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>.</li>
   <li>The current <a href=#dash-list>dash list</a>.</li>
  </ul><p class=note>The <a href=#current-default-path>current default path</a> and the rendering context's bitmaps are not
  part of the drawing state. The <a href=#current-default-path>current default path</a> is persistent, and can only be
  reset using the <code title=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><a href=#the-canvas-element>canvas</a></code> element.</p>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-save><a href=#dom-context-2d-save>save</a></code>()</dt>

   <dd>

    <p>Pushes the current state onto the stack.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-restore><a href=#dom-context-2d-restore>restore</a></code>()</dt>

   <dd>

    <p>Pops the top state on the stack, restoring the context to that state.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-context-2d-save title=dom-context-2d-save><code>save()</code></dfn> method must push a copy of the
  current drawing state onto the drawing state stack.</p>

  <p>The <dfn id=dom-context-2d-restore title=dom-context-2d-restore><code>restore()</code></dfn> method must pop the top
  entry in the drawing state stack, and reset the drawing state it describes. If there is no saved
  state, the method must do nothing.</p>

  <p>When the user agent is to <dfn id=reset-the-rendering-context-to-its-default-state>reset the rendering context to its default state</dfn>, it must
  clear the drawing state stack and everything that <a href=#drawing-state>drawing state</a> consists of to
  initial values.</p>

  <!-- v7
idea from Mihai:
> 5. Drawing states should be saveable with IDs, and for easier restoring.
>
> save(id)
> restore(id)
>
> If id is not provided, then save() works as defined now. The same for
> restore().
>
> Currently, it's not trivial to save and restore a specific state.
...and from Philip:
> I think a more convenient syntax would be:
>   var state = ctx.save();
>   ctx.restore(state);
> But how would it interact with normal calls to ctx.restore()?
  -->

  </div>


  <h6 id=drawingstyle-objects><span class=secno>4.8.11.2.3 </span><code><a href=#drawingstyle>DrawingStyle</a></code> objects</h6>

  <p>All the line styles (line width, caps, joins, and dash patterns)
  and text styles (fonts) described in the next two sections apply to
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects and to
  <code><a href=#drawingstyle>DrawingStyle</a></code> objects. This section defines the
  constructor used to obtain a <code><a href=#drawingstyle>DrawingStyle</a></code> object. This
  object is then used by methods on <code><a href=#path>Path</a></code> objects to
  control how text and paths are rasterised and stroked.</p>

  <dl class=domintro><dt><var title="">styles</var> = new <code title=dom-DrawingStyle><a href=#dom-drawingstyle>DrawingStyle</a></code>( [ <var title="">element</var> ] )</dt>

   <dd>

    <p>Creates a new <code><a href=#drawingstyle>DrawingStyle</a></code> object, optionally
    using a specific element for resolving relative keywords and sizes
    in font specifications.</p>

   </dd>

  </dl><div class=impl>

  <p>Each <code><a href=#drawingstyle>DrawingStyle</a></code> object can have a <dfn id=styles-scope-object>styles scope object</dfn>.</p>

  <p>The <dfn id=dom-drawingstyle title=dom-DrawingStyle><code>DrawingStyle()</code></dfn> constructor, when invoked,
  must return a newly created <code><a href=#drawingstyle>DrawingStyle</a></code> object. If the constructor was passed an
  argument, then the <code><a href=#drawingstyle>DrawingStyle</a></code> object's <a href=#styles-scope-object>styles scope object</a> is that
  element. Otherwise, if the <a href=#javascript-global-environment>JavaScript global environment</a> is a <a href=#document-environment>document
  environment</a>, the object's <a href=#styles-scope-object>styles scope object</a> is the <code><a href=#document>Document</a></code>
  object of the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a> of the
  <code><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is found.
  Otherwise, the <a href=#javascript-global-environment>JavaScript global environment</a> is a <a href=#worker-environment>worker environment</a>,
  and the <a href=#styles-scope-object>styles scope object</a> is the worker.</p>

  </div>


  <h6 id=line-styles><span class=secno>4.8.11.2.4 </span>Line styles</h6>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-setLineDash><a href=#dom-context-2d-setlinedash>setLineDash</a></code>(<var title="">segments</var>)</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-setLineDash><a href=#dom-context-2d-setlinedash>setLineDash</a></code>(<var title="">segments</var>)</dt>

   <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>

   </dd>


   <dt><var title="">segments</var> = <var title="">context</var> . <code title=dom-context-2d-getLineDash><a href=#dom-context-2d-getlinedash>getLineDash</a></code>()</dt>
   <dt><var title="">segments</var> = <var title="">styles</var> . <code title=dom-context-2d-getLineDash><a href=#dom-context-2d-getlinedash>getLineDash</a></code>()</dt>

   <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>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-lineDashOffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code></dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-lineDashOffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code></dt>

   <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>

   </dd>

  </dl><!--CLEANUP--><div class=impl>

  <p>Objects that implement the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  interface have attributes and methods (defined in this section) that
  control how lines are treated by the object.</p>

  <p>The <dfn id=dom-context-2d-linewidth title=dom-context-2d-lineWidth><code>lineWidth</code></dfn>
  attribute gives the width of lines, in coordinate space units. On
  getting, it must return the current value. On setting, zero,
  negative, infinite, and NaN values must be ignored, leaving the
  value unchanged; other values must change the current value to the
  new value.</p>

  <p>When the object implementing the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  interface is created, the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> attribute must
  initially have the value <code>1.0</code>.</p>

  <hr><p>The <dfn id=dom-context-2d-linecap title=dom-context-2d-lineCap><code>lineCap</code></dfn> attribute
  defines the type of endings that UAs will place on the end of lines.
  The three valid values are <code>butt</code>, <code>round</code>,
  and <code>square</code>.</p>

  <p>On getting, it must return the current value. On setting, if the
  new value is one of the literal strings <code>butt</code>,
  <code>round</code>, and <code>square</code>, then the current value
  must be changed to the new value; other values must ignored, leaving
  the value unchanged.</p>

  <p>When the object implementing the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  interface is created, the <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code> attribute must
  initially have the value <code>butt</code>.</p>

  <hr><p>The <dfn id=dom-context-2d-linejoin title=dom-context-2d-lineJoin><code>lineJoin</code></dfn>
  attribute defines the type of corners that UAs will place where two
  lines meet. The three valid values are <code>bevel</code>,
  <code>round</code>, and <code>miter</code>.</p>

  <p>On getting, it must return the current value. On setting, if the
  new value is one of the literal strings <code>bevel</code>,
  <code>round</code>, and <code>miter</code>, then the current value
  must be changed to the new value; other values must be ignored,
  leaving the value unchanged.</p>

  <p>When the object implementing the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  interface is created, the <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute must
  initially have the value <code>miter</code>.</p>

  <hr><p>When the <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>
  attribute has the value <code>miter</code>, strokes use the miter
  limit ratio to decide how to render joins. The miter limit ratio can
  be explicitly set using the <dfn id=dom-context-2d-miterlimit title=dom-context-2d-miterLimit><code>miterLimit</code></dfn>
  attribute. On getting, it must return the current value. On setting,
  zero, negative, infinite, and NaN values must be ignored, leaving
  the value unchanged; other values must change the current value to
  the new value.</p>
  <!-- values less than 1.0 are equivalent to 1.0, since it's compared
       against a ratio that can't be less than 1.0 -->

  <p>When the object implementing the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  interface is created, the <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attribute must
  initially have the value <code>10.0</code>.</p>

  <hr><p>Each <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object has a <dfn id=dash-list>dash
  list</dfn>, which is either empty or consists of an even number of
  non-negative numbers. Initially, the <a href=#dash-list>dash list</a> must be
  empty.</p>

  <p>When the <dfn id=dom-context-2d-setlinedash title=dom-context-2d-setLineDash><code>setLineDash()</code></dfn>
  method is invoked, it must run the following steps:</p>

  <ol><li><p>Let <var title="">a</var> be the argument.</li>

   <li><p>If any value in <var title="">a</var> is not finite (e.g. an Infinity or a NaN value), or
   if any value is negative (less than zero), then abort these steps (without throwing an exception;
   user agents could show a message on a developer console, though, as that would be helpful for
   debugging).</li>

   <li><p>If the number of elements in <var title="">a</var> is odd,
   then let <var title="">a</var> be the concatentation of two copies
   of <var title="">a</var>.</li>

   <li><p>Let the object's <a href=#dash-list>dash list</a> be <var title="">a</var>.</li>

  </ol><p>When the <dfn id=dom-context-2d-getlinedash title=dom-context-2d-getLineDash><code>getLineDash()</code></dfn> method is
  invoked, it must return a sequence whose values are the values of the object's <a href=#dash-list>dash
  list</a>, in the same order.</p>

  <p>It is sometimes useful to change the "phase" of the dash pattern,
  e.g. to achieve a "marching ants" effect. The phase can be set using
  the <dfn id=dom-context-2d-linedashoffset title=dom-context-2d-lineDashOffset><code>lineDashOffset</code></dfn>
  attribute. On getting, it must return the current value. On setting,
  infinite and NaN values must be ignored, leaving the value
  unchanged; other values must change the current value to the new
  value.</p>

  <p>When the object implementing the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  interface is created, the <code title=dom-context-2d-lineDashOffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code>
  attribute must initially have the value <code>0.0</code>.</p>

  <hr><p>When a user agent is to <dfn id=trace-a-path>trace a <span title=concept-path>path</span></dfn>,
  given an object <var title="">style</var> that implements the
  <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface, it must run the following
  algorithm. This algorithm returns a new <a href=#concept-path title=concept-path>path</a>.</p>

  <ol><li><p>Let <var title="">path</var> be a copy of the path being
   traced.</li>

   <li><p>Remove from <var title="">path</var> any subpaths containing
   no lines (i.e. subpaths with
   just one point).</li>

   <li><p>Replace each point in each subpath of <var title="">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>

   <li><p>Add a straight closing line to each closed subpath in <var title="">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 title="">styles</var> <a href=#dash-list>dash list</a> is
   empty, jump to the step labeled <i>joins</i>.</li>

   <li><p>Let <var title="">width</var> be the aggregate length of all
   the lines of all the subpaths in <var title="">path</var>, in
   coordinate space units.</li>

   <li><p>Let <var title="">offset</var> be the value of the <var title="">styles</var> <code title=dom-context-2d-lineDashOffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code>, in
   coordinate space units.</li>

   <li>

    <p>While <var title="">offset</var> is greater than <var title="">width</var>, decrement it by <var title="">width</var>.</p>

    <p>While <var title="">offset</var> is less than <var title="">width</var>, increment it by <var title="">width</var>.</p>

   </li>

   <li><p><i>Offset subpath</i>: If <var title="">offset</var> is
   non-zero, add a new subpath at the start of <var title="">path</var> consisting of two points connected by a line
   whose length is <var title="">offset</var> coordinate space units.
   (This path is temporary and will be removed in the <i>joins</i>
   step below. Its purpose is to offset the dash pattern.)</p>

   <li><p>Define <var title="">L</var> to be a linear coordinate line
   defined along all lines in all the subpaths in <var title="">path</var>, such that the start of the first line in the
   first subpath is defined as coordinate 0, and the end of the last
   line in the last subpath is defined as coordinate <var title="">width</var>.</li>

   <li><p>Let <var title="">position</var> be 0.</li>

   <li><p>Let <var title="">index</var> be 0.</li>

   <li><p>Let <var title="">current state</var> be <i>off</i> (the
   other states being <i>on</i> and <i>zero-on</i>).</li>

   <li><p><i>Dash On</i>: Let <var title="">segment length</var> be
   the value of the <var title="">styles</var> <a href=#dash-list>dash
   list</a>'s <var title="">index</var>th entry.</li>

   <li><p>Increment <var title="">position</var> by <var title="">segment length</var>.</li>

   <li><p>If <var title="">position</var> is greater than <var title="">width</var>, then jump to the step labeled
   <i>joins</i>.</li>

   <li><p>If <var title="">segment length</var> is non-zero, let <var title="">current state</var> be <i>on</i>.</li>

   <li><p>Increment <var title="">index</var> by one.</li>

   <li><p><i>Dash Off<!-- labeled for consistency only --></i>: Let <var title="">segment length</var> be
   the value of the <var title="">styles</var> <a href=#dash-list>dash
   list</a>'s <var title="">index</var>th entry.</li>

   <li><p>Let <var title="">start</var> be the offset <var title="">position</var> on <var title="">L</var>.</li>

   <li><p>Increment <var title="">position</var> by <var title="">segment length</var>.</li>

   <li><p>If <var title="">position</var> is greater than <var title="">width</var>, then let <var title="">end</var> be the
   offset <var title="">width</var> on <var title="">L</var>.
   Otherwise, let <var title="">end</var> be the offset <var title="">position</var> on <var title="">L</var>.</li>

   <li>

    <p>Jump to the first appropriate step:</p>

    <dl class=switch><dt>If <var title="">segment length</var> is zero and <var title="">current state</var> is <i>off</i></dt>

     <dd>

      <p>Do nothing, just continue to the next step.</p>

     </dd>


     <dt>If <var title="">current state</var> is <i>off</i></dt>

     <dd>

      <p>Cut the line on which <var title="">end</var> finds itself
      short at <var title="">end</var> and place a point there,
      cutting the subpath that it was in in two; remove all line
      segments, joins, points, and subpaths that are between <var title="">start</var> and <var title="">end</var>; and finally
      place a single point at <var title="">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 title="">L</var> was defined above).</p>

     </dd>


     <dt>Otherwise</dt>

     <dd>

      <p>Cut the line on which <var title="">start</var> finds itself
      into two at <var title="">start</var> and place a point there,
      cutting the subpath that it was in in two, and similarly cut the
      line on which <var title="">end</var> finds itself short at <var title="">end</var> and place a point there, cutting the subpath
      that <em>it</em> was in in two, and then remove all line segments,
      joins, points, and subpaths that are between <var title="">start</var> and <var title="">end</var>.</p>

      <p>If <var title="">start</var> and <var title="">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>

     </dd>

    </dl></li>

   <li><p>If <var title="">position</var> is greater than <var title="">width</var>, then jump to the step labeled
   <i>joins</i>.</li>

   <li><p>If <var title="">segment length</var> is greater than zero,
   let <var title="">positioned-at-on-dash</var> be false.</li>

   <li><p>Increment <var title="">index</var> by one. If it is equal
   to the number of entries in the <var title="">styles</var>
   <a href=#dash-list>dash list</a>, then let <var title="">index</var> be
   0.</li>

   <li><p>Return to the step labeled <i>dash on</i>.</li>

   <li><p><i>Joins</i>: Remove from <var title="">path</var> any
   subpath that originally formed part of the subpath added in the
   <i>offset subpath</i> step above.</li>

   <li>

    <p>Create a new <a href=#concept-path title=concept-path>path</a> that describes the result of
    inflating the paths in <var title="">path</var> perpendicular to
    the direction of the path to the <var title="">styles</var> <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> width, replacing
    each point with the end cap necessary to satisfy the <var title="">styles</var> <code title=dom-context-2d-lineCap><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 title="">styles</var>
    <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> type, as
    defined below.</p>

    <p><strong>Caps</strong>: Each point has a flat edge perpendicular
    to the direction of the line coming out of it. This is them
    augmented according to the value of the <var title="">styles</var>
    <code title=dom-context-2d-lineCap><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 title="">styles</var> <code title=dom-context-2d-lineWidth><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 title="">styles</var> <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> width and the
    width of half the <var title="">styles</var> <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> width, placed
    flat against the edge perpendicular to the direction of the line
    coming out of the point, must be added at each point.</p>

    <p>Points with no lines coming out of them must have two caps
    placed back-to-back as if it was really two points connected to
    each other by an infinitesimally short straight line in the
    direction of the point's <i>directionality</i> (as defined
    above).</p>

    <p><strong>Joins</strong>: In addition to the point where a join
    occurs, two additional points are relevant to each join, one for
    each line: the two corners found half the line width away from the
    join point, one perpendicular to each line, each on the side
    furthest from the other line.</p>

    <p>A filled 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 title=dom-context-2d-lineJoin><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 a filled 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 filled
    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 title="">style</var> <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attribute) to
    be exceeded, this second triangle must not be added.</p>
    <!-- the actual ratio can't possibly be less than 1.0 -->

<!-- here's a nice demo of the miter:
  c.clearRect(0, 0, 640, 480);
  c.beginPath();

  c.moveTo((new Date()/100) % 600, 100);
  c.lineTo(300, 300);
  c.lineTo(500, 300);

  c.lineWidth = 50;
  c.miterLimit = 10000;
  c.strokeStyle = 'silver'
  c.stroke();

  c.miterLimit = 0.0001;
  c.strokeStyle = 'black'
  c.stroke();

  c.lineWidth = 1;
  c.strokeStyle = 'red'
  c.stroke();
-->


    <p>Subpaths in the newly created path must wind clockwise,
    regardless of the direction of paths in <var title="">path</var>.</p>
    <!--
     ...because both of these examples result in two lines (assuming non-zero winding rules,
     things are different under even/odd), there's no "hole" where the lines overlap:

            c.beginPath();
            c.lineWidth=30;
            c.moveTo(200,200); // subpath 1
            c.lineTo(400,200);
            c.moveTo(400,210); // subpath 2
            c.lineTo(200,190);
            c.stroke();

            c.beginPath();
            c.lineWidth=30;
            c.moveTo(200,200); // subpath 1
            c.lineTo(400,200);
            c.lineTo(300,300);
            c.closePath();
            c.moveTo(400,210); // subpath 2
            c.lineTo(200,190);
            c.lineTo(300,300);
            c.closePath();
            c.stroke();

     ...and we want the same result when you create the two subpaths in each example above as two
     Paths, stroke them onto a third Path, and then fill that Path on the context.
    -->

   </li>

   <li><p>Return the newly created path.</li>

  </ol><!--v6: Another request has been for hairline width lines, that remain
hairline width with transform. ack Shaun Morris.  --></div>


  <h6 id=text-styles><span class=secno>4.8.11.2.5 </span>Text styles</h6>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current font settings.</p>

    <p>Can be set, to change the font. The syntax is the same as for
    the CSS 'font' property; values that cannot be parsed as CSS font
    values are ignored.</p>

    <p>Relative keywords and lengths are computed relative to the font
    of the <code><a href=#the-canvas-element>canvas</a></code> element.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> [ = <var title="">value</var> ]</dt>

   <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 title="">start</code>.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> [ = <var title="">value</var> ]</dt>

   <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 title=dom-concept-2d-textAlign-alphabetic>alphabetic</code>.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">styles</var> . <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> [ = <var title="">value</var> ]</dt>

   <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 title=dom-concept-2d-textAlign-inherit>inherit</code>.</p>

   </dd>

  </dl><div class=impl>

  <p>Objects that implement the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</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 id=font-style-source-object>font style source object</dfn>. For
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects whose <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, this is their <code><a href=#the-canvas-element>canvas</a></code> element; for other
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects, if the <a href=#javascript-global-environment>JavaScript global environment</a>
  is a <a href=#document-environment>document environment</a>, the object's <a href=#font-style-source-object>font style source object</a> is the
  <code><a href=#document>Document</a></code> object of the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
  context</a> of the <code><a href=#window>Window</a></code> object on which the interface object of the
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is found; otherwise the <a href=#javascript-global-environment>JavaScript global
  environment</a> is a <a href=#worker-environment>worker environment</a> and the <a href=#font-style-source-object>font style source
  object</a> is the worker. For <code><a href=#drawingstyle>DrawingStyle</a></code> objects, it's the <a href=#styles-scope-object>styles scope
  object</a>.</p>

  <p>The <dfn id=dom-context-2d-font title=dom-context-2d-font><code>font</code></dfn> IDL
  attribute, on setting, must be parsed the same way as the 'font'
  property of CSS (but without supporting property-independent style
  sheet syntax like 'inherit'), and the resulting font must be
  assigned to the context, with the 'line-height' component forced to
  'normal', with the 'font-size' component converted to CSS pixels,
  and with system fonts being computed to explicit values. If the new
  value is syntactically incorrect (including using
  property-independent style sheet syntax like 'inherit' or
  'initial'), then it must be ignored, without assigning a new font
  value. <a href=#refsCSS>[CSS]</a></p>

  <p>Font family names must be interpreted in the context of the <a href=#font-style-source-object>font style source
  object</a> when the font is to be used; any fonts embedded using <code title="">@font-face</code> or loaded using the <code><a href=#fontloader>FontLoader</a></code> that are visible to the
  <a href=#font-style-source-object>font style source object</a> must therefore be available once they are loaded. If a font
  is used before it is fully loaded, or if the <a href=#font-style-source-object>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 title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>
  attribute must return the <a href=#serializing-a-css-value title="serializing a CSS
  value">serialized form</a> of the current font of the context
  (with no 'line-height' component). <a href=#refsCSSOM>[CSSOM]</a></p>

  <div class=example>

   <p>For example, after the following statement:</p>

   <pre>context.font = 'italic 400 12px/2 Unknown Font, sans-serif';</pre>

   <p>...the expression <code title="">context.font</code> would
   evaluate to the string "<code title="">italic&nbsp;12px&nbsp;"Unknown&nbsp;Font",&nbsp;sans-serif</code>". The
   "400" font-weight doesn't appear because that is the default
   value. The line-height doesn't appear because it is forced to
   "normal", the default value.</p>

  </div>

  <p>When the object implementing the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  font of the context must be set to 10px sans-serif. When the 'font-size' component is set to
  lengths using percentages, 'em' or 'ex' units, or the 'larger' or 'smaller' keywords, these must
  be interpreted relative to the computed value of the 'font-size' property of the <a href=#font-style-source-object>font style
  source object</a> at the time that the attribute is set, if it is an element. When the
  'font-weight' component is set to the relative values 'bolder' and 'lighter', these must be
  interpreted relative to the computed value of the 'font-weight' property of the <a href=#font-style-source-object>font style
  source object</a> at the time that the attribute is set, if it is an element. If the computed
  values are undefined for a particular case (e.g. because the <a href=#font-style-source-object>font style source object</a>
  is not an element or is not <a href=#being-rendered>being rendered</a>), then the relative keywords must be
  interpreted relative to the normal-weight 10px sans-serif default.</p>

  <p>The <dfn id=dom-context-2d-textalign title=dom-context-2d-textAlign><code>textAlign</code></dfn> IDL attribute, on
  getting, must return the current value. On setting, if the value is one of <code title=dom-concept-2d-textAlign-start><a href=#dom-concept-2d-textalign-start>start</a></code>, <code title=dom-concept-2d-textAlign-end><a href=#dom-concept-2d-textalign-end>end</a></code>, <code title=dom-concept-2d-textAlign-left><a href=#dom-concept-2d-textalign-left>left</a></code>, <code title=dom-concept-2d-textAlign-right><a href=#dom-concept-2d-textalign-right>right</a></code>, or <code title=dom-concept-2d-textAlign-center><a href=#dom-concept-2d-textalign-center>center</a></code>, then the value must be changed to the new
  value. Otherwise, the new value must be ignored. When the object implementing the
  <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> attribute must initially have the value <code title=dom-concept-2d-textAlign-start><a href=#dom-concept-2d-textalign-start>start</a></code>.</p>

  <p>The <dfn id=dom-context-2d-textbaseline title=dom-context-2d-textBaseline><code>textBaseline</code></dfn> IDL attribute, on
  getting, must return the current value. On setting, if the value is one of <code title=dom-context-2d-textBaseline-top><a href=#dom-context-2d-textbaseline-top>top</a></code>, <code title=dom-context-2d-textBaseline-hanging><a href=#dom-context-2d-textbaseline-hanging>hanging</a></code>, <code title=dom-context-2d-textBaseline-middle><a href=#dom-context-2d-textbaseline-middle>middle</a></code>, <code title=dom-context-2d-textBaseline-alphabetic><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>, <code title=dom-context-2d-textBaseline-ideographic><a href=#dom-context-2d-textbaseline-ideographic>ideographic</a></code>, or <code title=dom-context-2d-textBaseline-bottom><a href=#dom-context-2d-textbaseline-bottom>bottom</a></code>, then the value must be changed to the
  new value. Otherwise, the new value must be ignored. When the object implementing the
  <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute must initially have the value
  <code title=dom-context-2d-textBaseline-alphabetic><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>.</p>

  <p>The <dfn id=dom-context-2d-direction title=dom-context-2d-direction><code>direction</code></dfn> IDL attribute, on
  getting, must return the current value. On setting, if the value is one of <code title=dom-context-2d-direction-ltr>ltr</code>, <code title=dom-context-2d-direction-rtl>rtl</code>, <!--<code
  title="dom-context-2d-direction-auto">auto</code>,--> or <code title=dom-context-2d-direction-inherit>inherit</code>, then the value must be changed to the new
  value. Otherwise, the new value must be ignored. When the object implementing the
  <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> attribute must initially have the value <code title=dom-context-2d-direction-inherit>inherit</code>.</p>

  </div>

  <p>The <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> attribute's allowed keywords are
  as follows:</p>

  <dl><dt><dfn id=dom-concept-2d-textalign-start title=dom-concept-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).</dd>

   <dt><dfn id=dom-concept-2d-textalign-end title=dom-concept-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).</dd>

   <dt><dfn id=dom-concept-2d-textalign-left title=dom-concept-2d-textAlign-left><code>left</code></dfn>
   <dd><p>Align to the left.</dd>

   <dt><dfn id=dom-concept-2d-textalign-right title=dom-concept-2d-textAlign-right><code>right</code></dfn>
   <dd><p>Align to the right.</dd>

   <dt><dfn id=dom-concept-2d-textalign-center title=dom-concept-2d-textAlign-center><code>center</code></dfn>
   <dd><p>Align to the center.</dd>

  </dl><p>The <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>
  attribute's allowed keywords correspond to alignment points in the
  font:</p>

  <p><img src=http://images.whatwg.org/baselines.png width=738 alt="The top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like &#x906; 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 &Aacute;, &yuml;, f, and &ohm; are anchored, the ideographic baseline is where glyphs like &#x79c1; and &#x9054; are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square." height=300></p>

  <p>The keywords map to these alignment points as follows:</p>

  <dl><dt><dfn id=dom-context-2d-textbaseline-top title=dom-context-2d-textBaseline-top><code>top</code></dfn>
   <dd>The top of the em square</dd>

   <dt><dfn id=dom-context-2d-textbaseline-hanging title=dom-context-2d-textBaseline-hanging><code>hanging</code></dfn>
   <dd>The hanging baseline</dd>

   <dt><dfn id=dom-context-2d-textbaseline-middle title=dom-context-2d-textBaseline-middle><code>middle</code></dfn>
   <dd>The middle of the em square</dd>

   <dt><dfn id=dom-context-2d-textbaseline-alphabetic title=dom-context-2d-textBaseline-alphabetic><code>alphabetic</code></dfn>
   <dd>The alphabetic baseline</dd>

   <dt><dfn id=dom-context-2d-textbaseline-ideographic title=dom-context-2d-textBaseline-ideographic><code>ideographic</code></dfn>
   <dd>The ideographic baseline</dd>

   <dt><dfn id=dom-context-2d-textbaseline-bottom title=dom-context-2d-textBaseline-bottom><code>bottom</code></dfn>
   <dd>The bottom of the em square</dd>

  </dl><p>The <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> attribute's allowed keywords are
  as follows:</p>

  <dl><dt><dfn id=dom-concept-2d-direction-ltr title=dom-concept-2d-direction-ltr><code>ltr</code></dfn>

   <dd><p>Treat input to the <a href=#text-preparation-algorithm>text preparation algorithm</a> as left-to-right text.</dd>

   <dt><dfn id=dom-concept-2d-direction-rtl title=dom-concept-2d-direction-rtl><code>rtl</code></dfn>

   <dd><p>Treat input to the <a href=#text-preparation-algorithm>text preparation algorithm</a> as right-to-left text.</dd>

<!--
   <dt><dfn title="dom-concept-2d-direction-auto"><code>auto</code></dfn>

   <dd><p>Determine the direction from the input to the <span>text preparation algorithm</span>.</p></dd>
-->

   <dt><dfn id=dom-concept-2d-direction-inherit title=dom-concept-2d-direction-inherit><code>inherit</code></dfn>

   <dd><p>Default to the directionality of the <code><a href=#the-canvas-element>canvas</a></code> element or <code><a href=#document>Document</a></code>
   as appropriate.</dd>

  </dl><p>The <dfn id=text-preparation-algorithm>text preparation algorithm</dfn> is as follows. It takes as input a string <var title="">text</var>, a <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object <var title="">target</var>, and an
  optional length <var title="">maxWidth</var>. It returns an array of glyph shapes, each positioned
  on a common coordinate space, a <var title="">physical alignment</var> whose value is one of
  <i>left</i>, <i>right</i>, and <i title="">center</i>, and an inline box. (Most callers of this
  algorithm ignore the <var title="">physical alignment</var> and the inline box.)</p>

  <ol><li><p>If <var title="">maxWidth</var> was provided but is less
   than or equal to zero, return an empty array.</li>

   <li><p>Replace all the <a href=#space-character title="space character">space
   characters</a> in <var title="">text</var> with U+0020 SPACE
   characters.</li>

   <li><p>Let <var title="">font</var> be the current font of <var title="">target</var>, as given by that object's <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> attribute.</li>

   <li>

    <p>Apply the appropriate step from the following list to determine
    the value of <var title="">direction</var>:</p>

    <dl class=switch><dt>If the <var title="">target</var> object's <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> attribute has the value "<code title=dom-context-2d-direction-ltr>ltr</code>"</dt>
     <dd>Let <var title="">direction</var> be '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>

     <dt>If the <var title="">target</var> object's <code title=dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> attribute has the value "<code title=dom-context-2d-direction-rtl>rtl</code>"</dt>
     <dd>Let <var title="">direction</var> be '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</dd>

<!--
     <dt>If the <var title="">target</var> object's <code
     title="dom-context-2d-direction">direction</code> attribute has the value "<code
     title="dom-context-2d-direction-auto">auto</code>"</dt>
     <dd>
      Find the first character in <var title="">text</var> of bidirectional character type L, AL, or
      R, if any. If such a character is found and it is of bidirectional character type AL or R,
      then let <var title="">direction</var> be '<span title="concept-rtl">rtl</span>'; otherwise,
      let <var title="">direction</var> be '<span title="concept-rtl">rtl</span>'. <a
      href="#refsBIDI">[BIDI]</a>
     </dd>
-->

     <dt>If the <var title="">target</var> object's <a href=#font-style-source-object>font style source object</a> 
     is an element</dt>

     <dd>Let <var title="">direction</var> be <a href=#the-directionality>the directionality</a> of the <var title="">target</var> object's <a href=#font-style-source-object>font style source object</a>.</dd>

     <dt>If the <var title="">target</var> object's <a href=#font-style-source-object>font style source object</a> 
     is a <code><a href=#document>Document</a></code> and that <code><a href=#document>Document</a></code> has a root element child</dt>

     <dd>Let <var title="">direction</var> be <a href=#the-directionality>the directionality</a> of the <var title="">target</var> object's <a href=#font-style-source-object>font style source object</a>'s root element child.</dd>

     <dt>Otherwise</dt>

     <dd>Let <var title="">direction</var> be '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</dd>

    </dl></li>

   <li><p>Form a hypothetical infinitely-wide CSS line box containing
   a single inline box containing the text <var title="">text</var>,
   with all the properties at their initial values except the 'font'
   property of the inline box set to <var title="">font</var>, the
   'direction' property of the inline box set to <var title="">direction</var>, and the 'white-space' property set to
   'pre'. <a href=#refsCSS>[CSS]</a></li>

   <!-- if you insert a step here, make sure to adjust the next step's
   final words -->

   <li><p>If <var title="">maxWidth</var> was provided and the
   hypothetical width of the inline box in the hypothetical line box
   is greater than <var title="">maxWidth</var> CSS pixels, then
   change <var title="">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>

   <li>

    <p>The <var title="">anchor point</var> is a point on the inline
    box, and the <var title="">physical alignment</var> is one of the
    values <i>left</i>, <i>right</i>, and <i title="">center</i>. These
    variables are determined by the <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> and <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> values as
    follows:</p>

    <p>Horizontal position:</p>

    <dl><dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-left><a href=#dom-concept-2d-textalign-left>left</a></code></dt>

     <dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-start><a href=#dom-concept-2d-textalign-start>start</a></code> and <var title="">direction</var> is
     'ltr'</dt>

     <dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-end><a href=#dom-concept-2d-textalign-end>end</a></code> and <var title="">direction</var> is
     'rtl'</dt>

     <dd>Let the <var title="">anchor point</var>'s horizontal
     position be the left edge of the inline box, and let <var title="">physical alignment</var> be <i>left</i>.</dd>


     <dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-right><a href=#dom-concept-2d-textalign-right>right</a></code></dt>

     <dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-end><a href=#dom-concept-2d-textalign-end>end</a></code> and <var title="">direction</var> is
     'ltr'</dt>

     <dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-start><a href=#dom-concept-2d-textalign-start>start</a></code> and <var title="">direction</var> is
     'rtl'</dt>

     <dd>Let the <var title="">anchor point</var>'s horizontal
     position be the right edge of the inline box, and let <var title="">physical alignment</var> be <i>right</i>.</dd>


     <dt>If <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> is
     <code title=dom-concept-2d-textAlign-center><a href=#dom-concept-2d-textalign-center>center</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s horizontal
     position be half way between the left and right edges of the
     inline box, and let <var title="">physical alignment</var> be
     <i title="">center</i>.</dd>

    </dl><p>Vertical position:</p>

    <dl><dt>If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-top><a href=#dom-context-2d-textbaseline-top>top</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be the top of the em box of the first available font of the
     inline box.</dd>


     <dt>If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-hanging><a href=#dom-context-2d-textbaseline-hanging>hanging</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be the hanging baseline of the first available font of the inline
     box.</dd>


     <dt>If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-middle><a href=#dom-context-2d-textbaseline-middle>middle</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be half way between the bottom and the top of the em box of the
     first available font of the inline box.</dd>


     <dt>If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-alphabetic><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be the alphabetic baseline of the first available font of the inline
     box.</dd>


     <dt>If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-ideographic><a href=#dom-context-2d-textbaseline-ideographic>ideographic</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be the ideographic baseline of the first available font of the inline
     box.</dd>


     <dt>If <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code title=dom-context-2d-textBaseline-bottom><a href=#dom-context-2d-textbaseline-bottom>bottom</a></code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be the bottom of the em box of the first available font of the
     inline box.</dd>

    </dl></li>

   <li>

    <p>Let <var title="">result</var> be an array constructed by
    iterating over each glyph in the inline box from left to right (if
    any), adding to the array, for each glyph, the shape of the glyph
    as it is in the inline box, positioned on a coordinate space using
    CSS pixels with its origin is at the <var title="">anchor
    point</var>.</p>

   </li>

   <li><p>Return <var title="">result</var>, <var title="">physical alignment</var>, and the inline
   box.</li>

  </ol><h6 id=building-paths><span class=secno>4.8.11.2.6 </span>Building paths</h6>

<!--CLEANUP-->
  <p>Each object implementing the <code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
  interface has a <a href=#concept-path title=concept-path>path</a>. A <dfn id=concept-path title=concept-path>path</dfn> has a list of zero or more subpaths.
  Each subpath consists of a list of one or more points, connected by
  straight or curved lines, 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>When an object implementing the <code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
  interface is created, its <a href=#concept-path title=concept-path>path</a>
  must be initialized to zero subpaths.</p>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Creates a new subpath with the given point.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-closePath><a href=#dom-context-2d-closepath>closePath</a></code>()</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-closePath><a href=#dom-context-2d-closepath>closePath</a></code>()</dt>

   <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>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-lineTo><a href=#dom-context-2d-lineto>lineTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-lineTo><a href=#dom-context-2d-lineto>lineTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Adds the given point to the current subpath, connected to the previous one by a straight line.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-quadraticCurveTo><a href=#dom-context-2d-quadraticcurveto>quadraticCurveTo</a></code>(<var title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>, <var title="">y</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-quadraticCurveTo><a href=#dom-context-2d-quadraticcurveto>quadraticCurveTo</a></code>(<var title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Adds the given point to the current subpath, connected to the previous one by a quadratic B&eacute;zier curve with the given control point.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-bezierCurveTo><a href=#dom-context-2d-beziercurveto>bezierCurveTo</a></code>(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-bezierCurveTo><a href=#dom-context-2d-beziercurveto>bezierCurveTo</a></code>(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Adds the given point to the current subpath, connected to the previous one by a cubic B&eacute;zier curve with the given control points.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-arcTo><a href=#dom-context-2d-arcto>arcTo</a></code>(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>, <var title="">y2</var>, <var title="">radiusX</var> [, <var title="">radiusY</var>, <var title="">rotation</var> ])</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-arcTo><a href=#dom-context-2d-arcto>arcTo</a></code>(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>, <var title="">y2</var>, <var title="">radiusX</var> [, <var title="">radiusY</var>, <var title="">rotation</var> ])</dt>

   <dd>

    <p>Adds an arc with the given control points and radius to the
    current subpath, connected to the previous point by a straight
    line.</p>

    <p>If two radii are provided, the first controls the width of the
    arc's ellipse, and the second controls the height. If only one is
    provided, or if they are the same, the arc is from a circle. In
    the case of an ellipse, the rotation argument controls the
    clockwise inclination of the ellipse relative to the x-axis.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given
    radius is negative.</p>

    <figure class=diagrams><!-- if anyone wants to try writing alternative text for these,
     be my guest. I can't work out how to describe them. --><img src=http://images.whatwg.org/arcTo1.png width=357 alt="" height=254><img src=http://images.whatwg.org/arcTo2.png width=468 alt="" height=310><img src=http://images.whatwg.org/arcTo3.png width=513 alt="" height=233></figure><!--

c.clearRect(0, 0, 640, 480);
c.save();
try {
  var x0 = 150;
  var y0 = 100;
  var x1 = 375;
  var y1 = 100;
  var x2 = x1;
  var y2 = 250;
  var r = 50;

  var bottom = 210;
  var center = 100;

  var fontSize = 16;
  var margin = 50;
  var dotHalfSize = 5;

  // (also update the label positions at the bottom)


  // ========

  function extendLine(xa,ya,xb,yb) {
    var dx = xb-xa;
    var dy = yb-ya;
    var theta = Math.atan2(dx,dy);
    var extX = margin * Math.sin(theta);
    var extY = margin * Math.cos(theta);
    c.beginPath();
    c.moveTo(xa-extX,ya-extY);
    c.lineTo(xb+extX,yb+extY);
    c.stroke();
  }

  function dot(x,y,s) {
    c.beginPath();
    c.arc(x,y,dotHalfSize,0,Math.PI*2);
    c.fill();
    c.textAlign = 'left';
    c.textBaseline = 'top';
    c.fillText(s,x+dotHalfSize,y);
  }

  c.font = fontSize + 'px Gill Sans';
  c.fillStyle = 'black';
  c.lineWidth = 1;
  c.strokeStyle = 'red';
  extendLine(x0,y0,x1,y1);
  extendLine(x1,y1,x2,y2);

  c.lineWidth = 1;
  c.strokeStyle = 'silver';
  c.beginPath();
  c.moveTo(x0,y0);

  // based on http://lists.freedesktop.org/archives/cairo/2005-August/004801.html
  var angle0, angle1, angle2, angled;
  var xc, yc, dc;
  angle0 = Math.atan2(y0 - y1, x0 - x1);
  angle2 = Math.atan2(y2 - y1, x2 - x1);
  angle1 = (angle0 + angle2) / 2;
  angled = angle2 - angle0;
  if (angled > Math.PI || (angled < 0 && angled > -Math.PI)) {
    angle1 += Math.PI;
    angled = 2 * Math.PI - angled;
    angle0 += Math.PI*2;
    angle2 -= Math.PI*2;
  } else {
    angle0 -= Math.PI*2;
    angle2 += Math.PI*2;
  }
  dc = r / Math.sin (angled / 2);
  yc = Math.sin(angle1);
  xc = Math.cos(angle1);
  xc = x1 + xc * dc;
  yc = y1 + yc * dc;

  c.lineWidth = 1;
  c.strokeStyle = 'blue';
  c.beginPath();
  c.moveTo(xc,yc);
  c.arc(xc,yc,r, Math.PI*3/4, Math.PI*(3/4));
  c.stroke();
  c.beginPath();
  c.strokeStyle = 'silver';
  c.arc(xc,yc,r, Math.PI*3/4,Math.PI*(2+3/4));
  c.stroke();
  c.save();
  try {
    c.translate(xc, yc);
    c.rotate(-Math.PI/4);
    c.textAlign = 'center';
    c.textBaseline = 'top';
    c.fillText("radius", -r/2, 0);
  } finally {
    c.restore();
  }

  c.lineWidth = 15;
  c.lineCap = 'round';
  c.strokeStyle = 'rgba(20,200,40,0.8)';
  c.beginPath();
  c.moveTo(x0,y0);
  c.arcTo(x1,y1,x2,y2,r);
  c.stroke();

  dot(x0,y0, "x\u2080,y\u2080");
  dot(x1,y1, "x\u2081,y\u2081");
  dot(x2,y2, "x\u2082,y\u2082");
  dot(xc,yc, '');

  c.textAlign = 'left';
  c.textBaseline = 'alphabetic';
  var L = 0;

  function print(s) {
    c.fillText(s, center, bottom+L*fontSize*1.3);
    L += 1;
  }
  print('// the thick line corresponds to:');
  print('context.moveTo(x\u2080, y\u2080)');
  print('context.arcTo(x\u2081, y\u2081, x\u2082, y\u2082, radius)');
  print('context.stroke()');

  c.fillStyle = 'green';
  c.fillText("\u25be initial line", 160, 70);
  c.textAlign = 'right';
  c.fillText("arc \u25b8", x1-25, 115);

} finally {
  c.restore();
}

--></dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-arc><a href=#dom-context-2d-arc>arc</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>, <var title="">startAngle</var>, <var title="">endAngle</var> [, <var title="">anticlockwise</var> ] )</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-arc><a href=#dom-context-2d-arc>arc</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>, <var title="">startAngle</var>, <var title="">endAngle</var> [, <var title="">anticlockwise</var> ] )</dt>

   <dd>

    <p>Adds points to the subpath such that the arc described by the
    circumference of the circle described by the arguments, starting
    at the given start angle and ending at the given end angle, going
    in the given direction (defaulting to clockwise), is added to the
    path, connected to the previous point by a straight line.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given
    radius is negative.</p>

    <figure class=diagrams><!-- if anyone wants to try writing alternative text for this, be my guest. I can't work out how to describe it. --><img src=http://images.whatwg.org/arc1.png width=590 alt="" height=255></figure><!--

c.clearRect(0, 0, 640, 480);
c.save();
try {
  var x0 = 50;
  var y0 = 200;
  var x = 255;
  var y = 150;
  var radius = 100;
  var startAngle = 2.0;
  var endAngle = 5.7;
  var direction = false;

  var bottom = 110;
  var center = 380;

  var fontSize = 16;
  var margin = 50;
  var dotHalfSize = 5;
  var arrowHead = 5;

  // (also update the label positions at the bottom)

  // ========

  function dot(x,y,s) {
    c.beginPath();
    c.arc(x,y,dotHalfSize,0,Math.PI*2);
    c.fill();
    c.textAlign = 'center';
    c.textBaseline = 'top';
    c.fillText(s,x,y+dotHalfSize);
  }

  function arc(x, y, r, sA, eA, d, fr, s) {
    c.lineWidth = 1;
    c.strokeStyle = 'red';
    c.beginPath();
    c.arc(x, y, r, sA, eA, d);
    c.stroke();

    c.save();
    c.translate(x, y);
    c.rotate(eA);
    c.beginPath();
    c.moveTo(r-arrowHead, d?arrowHead:-arrowHead);
    c.lineTo(r, 0);
    c.lineTo(r+arrowHead, d?arrowHead:-arrowHead);
    c.stroke();
    c.strokeStyle = 'silver';
    c.beginPath();
    c.moveTo(0, 0);
    c.lineTo(fr, 0);
    c.stroke();
    c.restore();

    c.fillStyle = 'black';
    if (eA<Math.PI) {
      c.save();
      c.translate(x, y);
      c.rotate(sA+(eA-sA)/2-Math.PI/2);
      c.translate(0, r);
      c.rotate(-(sA+(eA-sA)/2-Math.PI/2));
      c.beginPath();
      c.textAlign = 'center';
      c.textBaseline = 'bottom';
      c.fillText(s + '  ',0,0);
      c.restore();
    } else {
      c.save();
      c.beginPath();
      c.textAlign = 'left';
      c.textBaseline = 'middle';
      c.fillText(' ' + s,x-r,y);
      c.restore();
    }
  }

  function radial(x, y, length, rotation, s) {
    c.lineWidth = 1;
    c.strokeStyle = 'blue';
    c.save();
    c.translate(x, y);
    c.rotate(rotation);
    c.beginPath();
    c.moveTo(0, 0);
    c.lineTo(length, 0);
    c.stroke();
    c.textAlign = 'center';
    c.textBaseline = 'bottom';
    c.fillStyle = 'black';
    c.fillText(s,length/2,0);
    c.restore();
  }

  c.font = fontSize + 'px Gill Sans';

  // construction lines
  c.lineWidth = 1;
  c.strokeStyle = 'silver';
  // circle
  c.beginPath();
  c.arc(x, y, radius, 0, 2*Math.PI);
  c.stroke();
  // angles
  arc(x, y, radius/10+2*radius/3, 0, startAngle, false, radius, '\u03B1');
  arc(x, y, radius/10+radius/3, 0, endAngle, false, radius, '\u03B2');
  // radii
  radial(x, y, radius, 0, 'radius');

  // the line
  c.lineWidth = 15;
  c.lineCap = 'round';
  c.strokeStyle = 'rgba(20,200,40,0.8)';
  c.beginPath();
  c.moveTo(x0,y0);
  c.arc(x,y,radius,startAngle,endAngle,direction);
  c.stroke();

  dot(x0,y0, "x\u2080,y\u2080");
  dot(x,y, "x,y");

  c.textAlign = 'left';
  c.textBaseline = 'alphabetic';
  var L = 0;

  function print(s) {
    c.fillText(s, center, bottom+L*fontSize*1.3);
    L += 1;
  }
  print('// the thick line corresponds to:');
  print('context.moveTo(x\u2080, y\u2080)');
  print('context.arc(x, y, radius, \u03B1, \u03B2)');
  print('context.stroke()');

  c.fillStyle = 'green';

  c.textBaseline = 'top';
  c.fillText("initial line \u25b4", x0+20, y0+fontSize*2);

  c.textAlign = 'right';
  c.textBaseline = 'middle';
  c.fillText("arc \u25b8", x-radius-15, y);

} finally {
  c.restore();
}
--></dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-ellipse><a href=#dom-context-2d-ellipse>ellipse</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">radiusX</var>, <var title="">radiusY</var>, <var title="">rotation</var>, <var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-ellipse><a href=#dom-context-2d-ellipse>ellipse</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">radiusX</var>, <var title="">radiusY</var>, <var title="">rotation</var>, <var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</dt>

   <dd>

    <p>Adds points to the subpath such that the arc described by the
    circumference of the ellipse described by the arguments, starting
    at the given start angle and ending at the given end angle, going
    in the given direction (defaulting to clockwise), is added to the
    path, connected to the previous point by a straight line.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given
    radius is negative.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-rect><a href=#dom-context-2d-rect>rect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-context-2d-rect><a href=#dom-context-2d-rect>rect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>

   <dd>

    <p>Adds a new closed subpath to the path, representing the given rectangle.</p>

   </dd>

  </dl><div class=impl>

  <p>The following methods allow authors to manipulate the <a href=#concept-path title=concept-path>paths</a> of objects implementing the
  <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface.</p>

  <p>For <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects, the points passed to the methods, and the
  resulting lines added to <a href=#current-default-path>current default path</a> by these methods, must be transformed
  according to the <a href=#transformations title=dom-context-2d-transformation>current transformation matrix</a>
  before being added to the path.</p>


  <p>The <dfn id=dom-context-2d-moveto title=dom-context-2d-moveTo><code>moveTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
  create a new subpath with the specified point as its first (and
  only) point.</p>

  <p>When the user agent is to <dfn id=ensure-there-is-a-subpath>ensure there is a subpath</dfn>
  for a coordinate (<var title="">x</var>, <var title="">y</var>) on a
  <a href=#concept-path title=concept-path>path</a>, the user agent must check to
  see if the <a href=#concept-path title=concept-path>path</a> has any subpaths,
  and if it does not, then the user agent must create a new subpath
  with the point (<var title="">x</var>, <var title="">y</var>) as its
  first (and only) point, as if the <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> method had been
  called.</p>


  <p>The <dfn id=dom-context-2d-closepath title=dom-context-2d-closePath><code>closePath()</code></dfn>
  method must do nothing if the object's path has no subpaths.
  Otherwise, it must mark the last subpath as closed, create a new
  subpath whose first point is the same as the previous subpath's
  first point, and finally add this new subpath to the path.</p>

  <p class=note>If the last subpath had more than one point in its
  list of points, then this is equivalent to adding a straight line
  connecting the last point back to the first point, thus "closing"
  the shape, and then repeating the last (possibly implied) <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> call.</p>


  <p>New points and the lines connecting them are added to subpaths
  using the methods described below. In all cases, the methods only
  modify the last subpath in the object's path.</p>


  <p>The <dfn id=dom-context-2d-lineto title=dom-context-2d-lineTo><code>lineTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
  <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">x</var>, <var title="">y</var>)</span> if the object's path
  has no subpaths. Otherwise, it must connect the last point in the
  subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a straight line, and must then add the given
  point (<var title="">x</var>, <var title="">y</var>) to the
  subpath.</p>


  <p>The <dfn id=dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo><code>quadraticCurveTo(<var title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>,
  <var title="">y</var>)</code></dfn> method must <a href=#ensure-there-is-a-subpath>ensure there
  is a subpath</a> for <span title="">(<var title="">cpx</var>,
  <var title="">cpy</var>)</span>, and then must connect the last
  point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a quadratic B&eacute;zier curve with control
  point (<var title="">cpx</var>, <var title="">cpy</var>), and must
  then add the given point (<var title="">x</var>, <var title="">y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>


  <p>The <dfn id=dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo><code>bezierCurveTo(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method must
  <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">cp1x</var>, <var title="">cp1y</var>)</span>, and then must
  connect the last point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a cubic B&eacute;zier
  curve with control points (<var title="">cp1x</var>, <var title="">cp1y</var>) and (<var title="">cp2x</var>, <var title="">cp2y</var>). Then, it must add the point (<var title="">x</var>, <var title="">y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>

  <hr><p>The <dfn id=dom-context-2d-arcto title=dom-context-2d-arcTo><code>arcTo(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>,
  <var title="">y2</var>, <var title="">radiusX</var>, <var title="">radiusY</var>, <var title="">rotation</var>)</code></dfn>
  method must first <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">x1</var>, <var title="">y1</var>)</span>.
  Then, the behavior depends on the arguments and the last point in
  the subpath, as described below.</p>

  <p>Negative values for <var title="">radiusX</var> or <var title="">radiusY</var> must cause the implementation to throw an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception. If <var title="">radiusY</var> is omitted, user agents must act as if it had
  the same value as <var title="">radiusX</var>.</p>

  <p>Let the point (<var title="">x0</var>, <var title="">y0</var>) be the last point in the
  subpath, transformed by the inverse of the <a href=#transformations title=dom-context-2d-transformation>current
  transformation matrix</a> (so that it is in the same coordinate system as the points passed to
  the method).</p>

  <p>If the point (<var title="">x0</var>, <var title="">y0</var>) is
  equal to the point (<var title="">x1</var>, <var title="">y1</var>),
  or if the point (<var title="">x1</var>, <var title="">y1</var>) is
  equal to the point (<var title="">x2</var>, <var title="">y2</var>),
  or if both <var title="">radiusX</var> and <var title="">radiusY</var> are zero, then the method must add the point
  (<var title="">x1</var>, <var title="">y1</var>) to the subpath, and
  connect that point to the previous point (<var title="">x0</var>,
  <var title="">y0</var>) by a straight line.</p>

  <p>Otherwise, if the points (<var title="">x0</var>, <var title="">y0</var>), (<var title="">x1</var>, <var title="">y1</var>), and (<var title="">x2</var>, <var title="">y2</var>) all lie on a single straight line, then the
  method must add the point (<var title="">x1</var>, <var title="">y1</var>) to the subpath, and connect that point to the
  previous point (<var title="">x0</var>, <var title="">y0</var>) by a
  straight line.</p>

  <p>Otherwise, let <var title="">The Arc</var> be the shortest arc
  given by circumference of the ellipse that has radius <var title="">radiusX</var> on the major axis and radius <var title="">radiusY</var> on the minor axis, and whose semi-major axis
  is rotated <var title="">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 title="">x0</var>, <var title="">y0</var>) and ends at the point (<var title="">x1</var>,
  <var title="">y1</var>), and that has a different point tangent to
  the half-infinite line that ends at the point (<var title="">x1</var>, <var title="">y1</var>) and crosses the point
  (<var title="">x2</var>, <var title="">y2</var>). The points at
  which this ellipse touches these two lines are called the start and
  end tangent points respectively. The method must connect the point
  (<var title="">x0</var>, <var title="">y0</var>) to the start
  tangent point by a straight line, adding the start tangent point to
  the subpath, and then must connect the start tangent point to the
  end tangent point by <var title="">The Arc</var>, adding the end
  tangent point to the subpath.</p>

  <hr><p>The <dfn id=dom-context-2d-arc title=dom-context-2d-arc><code>arc(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>,
  <var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</code></dfn> and <dfn id=dom-context-2d-ellipse title=dom-context-2d-ellipse><code>ellipse(<var title="">x</var>,
  <var title="">y</var>, <var title="">radiusX</var>, <var title="">radiusY</var>, <var title="">rotation</var>, <var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</code></dfn> methods draw arcs.</p>

  <p>The <code title=dom-context-2d-arc><a href=#dom-context-2d-arc>arc()</a></code> method is
  equivalent to the <code title=dom-context-2d-ellipse><a href=#dom-context-2d-ellipse>ellipse()</a></code> method in the case
  where the two radii are equal. When the <code title=dom-context-2d-arc><a href=#dom-context-2d-arc>arc()</a></code> method is invoked, it must
  act as if the <code title=dom-context-2d-ellipse><a href=#dom-context-2d-ellipse>ellipse()</a></code>
  method had been invoked with the <var title="">radiusX</var> and
  <var title="">radiusY</var> arguments set to the value of the <var title="">radius</var> argument, the <var title="">rotation</var>
  argument set to zero, and the other arguments set to the same values
  as their identically named arguments on the <code title=dom-context-2d-arc><a href=#dom-context-2d-arc>arc()</a></code> method.</p>

  <p>When the <code title=dom-context-2d-ellipse><a href=#dom-context-2d-ellipse>ellipse()</a></code>
  method is invoked, it must proceed as follows. First, if the
  object's path has any subpaths, then the method must add a straight
  line from the last point in the subpath to the start point of the
  arc. Then, it must add the start and end points of the arc to the
  subpath, and connect them with an arc. The arc and its start and end
  points are defined as follows:</p>

  <p>Consider an ellipse that has its origin at (<var title="">x</var>, <var title="">y</var>), that has a major-axis
  radius <var title="">radiusX</var> and a minor-axis radius <var title="">radiusY</var>, and that is rotated about its origin such
  that its semi-major axis is inclined <var title="">rotation</var>
  radians clockwise from the x-axis. The points at <var title="">startAngle</var> and <var title="">endAngle</var> along
  this circle's circumference, measured in radians clockwise from the
  ellipse's semi-major axis, are the start and end points
  respectively.</p>

  <p>If the <var title="">anticlockwise</var> argument is false and <span title=""><var title="">endAngle</var>-<var title="">startAngle</var></span> is equal to or greater than <span title="">2&pi;</span>, or, if the <var title="">anticlockwise</var>
  argument is <em>true</em> and <span title=""><var title="">startAngle</var>-<var title="">endAngle</var></span> is
  equal to or greater than <span title="">2&pi;</span>, then the arc
  is the whole circumference of this ellipse.</p>

  <p>Otherwise, the arc is the path along the circumference of this
  ellipse from the start point to the end point, going anti-clockwise
  if the <var title="">anticlockwise</var> argument is true, and
  clockwise otherwise. Since the points are on the ellipse, as opposed
  to being simply angles from zero, the arc can never cover an angle
  greater than <span title="">2&pi;</span> radians.</p>

  <p>Negative values for <var title="">radiusX</var> or <var title="">radiusY</var> must cause the implementation to throw an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

  <hr><p>The <dfn id=dom-context-2d-rect title=dom-context-2d-rect><code>rect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must create a new subpath
  containing just the four points (<var title="">x</var>, <var title="">y</var>), (<var title="">x</var>+<var title="">w</var>,
  <var title="">y</var>), (<var title="">x</var>+<var title="">w</var>, <var title="">y</var>+<var title="">h</var>),
  (<var title="">x</var>, <var title="">y</var>+<var title="">h</var>), with those four points connected by straight
  lines, and must then mark the subpath as closed. It must then create
  a new subpath with the point (<var title="">x</var>, <var title="">y</var>) as the only point in the subpath.</p>


  <!-- v6 feature request:
        * points as a primitive shape
          http://home.comcast.net/~urbanjost/canvas/vogle4.html
  -->

  </div>



  <h6 id=path-objects><span class=secno>4.8.11.2.7 </span><code><a href=#path>Path</a></code> objects</h6>

  <p><code><a href=#path>Path</a></code> objects can be used to declare paths that are
  then later used on <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects. In
  addition to many of the APIs described in earlier sections,
  <code><a href=#path>Path</a></code> objects have methods to combine paths, and to add
  text to paths.</p>

  <dl class=domintro><dt><var title="">path</var> = new <code title=dom-Path><a href=#dom-path>Path</a></code>()</dt>

   <dd>

    <p>Creates a new empty <code><a href=#path>Path</a></code> object.</p>

   </dd>

   <dt><var title="">path</var> = new <code title=dom-Path-copy><a href=#dom-path-copy>Path</a></code>(<var title="">path</var>)</dt>

   <dd>

    <p>Creates a new <code><a href=#path>Path</a></code> object that is a copy of the argument.</p>

   </dd>

   <dt><var title="">path</var> = new <code title=dom-Path-withdata><a href=#dom-path-withdata>Path</a></code>(<var title="">d</var>)</dt>

   <dd>

    <p>Creates a new path with the path described by the argument, interpreted as SVG path data. <a href=#refsSVG>[SVG]</a></p>

   </dd>

   <dt><var title="">path</var> . <code title=dom-path-addPath><a href=#dom-path-addpath>addPath</a></code>(<var title="">path</var>, <var title="">transform</var>)</dt>
   <dt><var title="">path</var> . <code title=dom-path-addPathByStrokingPath><a href=#dom-path-addpathbystrokingpath>addPathByStrokingPath</a></code>(<var title="">path</var>, <var title="">styles</var>, <var title="">transform</var>)</dt>

   <dd>

    <p>Adds to the path the path given by the argument.</p>

    <p>In the case of the stroking variants, the line styles are taken from the <var title="">styles</var> argument, which can be either a <code><a href=#drawingstyle>DrawingStyle</a></code> object or a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</p>

   </dd>

   <dt><var title="">path</var> . <code title=dom-path-addText><a href=#dom-path-addtext>addText</a></code>(<var title="">text</var>, <var title="">styles</var>, <var title="">transform</var>, <var title="">x</var>, <var title="">y</var> [, <var title="">maxWidth</var> ])</dt>
   <dt><var title="">path</var> . <code title=dom-path-addText><a href=#dom-path-addtext>addText</a></code>(<var title="">text</var>, <var title="">styles</var>, <var title="">transform</var>, <var title="">path</var> [, <var title="">maxWidth</var> ])</dt>
   <dt><var title="">path</var> . <code title=dom-path-addPathByStrokingText><a href=#dom-path-addpathbystrokingtext>addPathByStrokingText</a></code>(<var title="">text</var>, <var title="">styles</var>, <var title="">transform</var>, <var title="">x</var>, <var title="">y</var> [, <var title="">maxWidth</var> ])</dt>
   <dt><var title="">path</var> . <code title=dom-path-addPathByStrokingText><a href=#dom-path-addpathbystrokingtext>addPathByStrokingText</a></code>(<var title="">text</var>, <var title="">styles</var>, <var title="">transform</var>, <var title="">path</var> [, <var title="">maxWidth</var> ])</dt>

   <dd>

    <p>Adds to the path a series of subpaths corresponding to the given text. If the arguments give a coordinate, the text is drawn horizontally at the given coordinates. If the arguments give a path, the text is drawn along the path. If a maximum width is provided, the text will be scaled to fit that width if necessary.</p>

    <p>The font, and in the case of the stroking variants, the line styles, are taken from the <var title="">styles</var> argument, which can be either a <code><a href=#drawingstyle>DrawingStyle</a></code> object or a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-path title=dom-Path><code>Path()</code></dfn> constructor,
  when invoked, must return a newly created <code><a href=#path>Path</a></code>
  object.</p>

  <hr><p>The <dfn id=dom-path-copy title=dom-Path-copy><code>Path(<var title="">path</var>)</code></dfn> constructor,
  when invoked, must return a newly created <code><a href=#path>Path</a></code> object, to which the subpaths of the
  argument are added. (In other words, it returns a copy of the argument.)</p>

  <hr><p>The <dfn id=dom-path-withdata title=dom-Path-withdata><code>Path(<var title="">d</var>)</code></dfn> constructor must run the following
  steps:</p>

  <ol><li>

    <p>Parse and interpret the <var title="">d</var> argument
    according to the SVG specification's rules for path data, thus
    obtaining an SVG path. <a href=#refsSVG>[SVG]</a></p>

    <p class=note>The resulting path could be empty. SVG defines
    error handling rules for parsing and applying path data.</p>

   </li>

   <li><p>Let (<var title="">x</var>, <var title="">y</var>) be the
   last point in the SVG path.</li>

   <li><p>Create a new <code><a href=#path>Path</a></code> object and add all the
   subpaths in the SVG path, if any, to that <code><a href=#path>Path</a></code> object.
   </p>

   <li><p>Create a new subpath in the <code><a href=#path>Path</a></code> object with
   (<var title="">x</var>, <var title="">y</var>) as the only point in
   the subpath.</li>

   <li><p>Return the <code><a href=#path>Path</a></code> object as the constructed
   object.</li>

  </ol><hr><p>The <dfn id=dom-path-addpath title=dom-path-addPath><code>addPath(<var title="">b</var>, <var title="">transform</var>)</code></dfn> method, when invoked on a <code><a href=#path>Path</a></code> object <var title="">a</var>, must run the following steps:</p>

  <ol><li><p>If the <code><a href=#path>Path</a></code> object <var title="">b</var> has no subpaths, abort these
   steps.</li>

   <li><p>Create a copy of all the subpaths in <var title="">b</var>. Let this copy be known as <var title="">c</var>.</li>

   <li><p>Transform all the coordinates and lines in <var title="">c</var> by the transform matrix
   <var title="">transform</var>, if it is not null.</li>

   <li><p>Let (<var title="">x</var>, <var title="">y</var>) be the last point in the last subpath
   of <var title="">c</var>.</li>

   <li><p>Add all the subpaths in <var title="">c</var> to <var title="">a</var>.</li>

   <li><p>Create a new subpath in <var title="">a</var> with (<var title="">x</var>, <var title="">y</var>) as the only point in the subpath.</li>

  </ol><hr><p>The <dfn id=dom-path-addpathbystrokingpath title=dom-path-addPathByStrokingPath><code>addPathByStrokingPath(<var title="">b</var>, <var title="">styles</var>, <var title="">transform</var>)</code></dfn> method,
  when invoked on a <code><a href=#path>Path</a></code> object <var title="">a</var>, must run the following
  steps:</p>

  <ol><li><p>If the <code><a href=#path>Path</a></code> object <var title="">b</var> has no subpaths, abort these
   steps.</li>

   <li><p>Create a copy of all the subpaths in <var title="">b</var>. Let this copy be known as <var title="">c</var>.</li>

   <li><p>Transform all the coordinates and lines in <var title="">c</var> by transformation matrix
   <var title="">transform</var>, if it is not null.</li>

   <li><p>Let a new list of subpaths <var title="">d</var> be the result of <a href=#trace-a-path title="trace a
   path">tracing</a> <var title="">c</var>, using the <var title="">styles</var> argument for the
   line styles.</p>

   <li><p>Let (<var title="">x</var>, <var title="">y</var>) be the last point in the last subpath
   of <var title="">d</var>.</li>

   <li><p>Add all the subpaths in <var title="">d</var> to <var title="">a</var>.</li>

   <li><p>Create a new subpath in <var title="">a</var> with (<var title="">x</var>, <var title="">y</var>) as the only point in the subpath.</li>

  </ol><hr><p>The <dfn id=dom-path-addtext title=dom-path-addText><code>addText()</code></dfn> and <dfn id=dom-path-addpathbystrokingtext title=dom-path-addPathByStrokingText><code>addPathByStrokingText()</code></dfn> methods each
  come in two variants: one rendering text at a given coordinate, and one rendering text along a
  given path. In both cases, the methods take a <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for
  the text and (if appropriate) line styles to use, an <code><a href=#svgmatrix>SVGMatrix</a></code> object <var title="">transform</var> (which can be null), and a maximum width can optionally be provided.</p>

  <p>When one of the <code title=dom-path-addText><a href=#dom-path-addtext>addText()</a></code> and <code title=dom-path-addPathByStrokingText><a href=#dom-path-addpathbystrokingtext>addPathByStrokingText()</a></code> variants that take as
  argument an (<var title="">x</var>, <var title="">y</var>) coordinate is invoked, the method must
  run the following algorithm:</p>

  <ol><li><p>Run the <a href=#text-preparation-algorithm>text preparation algorithm</a>, passing it <var title="">text</var>, the
   <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument, and, if the <var title="">maxWidth</var>
   argument was provided, that argument. Let <var title="">glyphs</var> be the result.</p>

   <li><p>Move all the shapes in <var title="">glyphs</var> to the right by <var title="">x</var>
   CSS pixels and down by <var title="">y</var> CSS pixels.</li>

   <li><p>Let <var title="">glyph subpaths</var> be a <a href=#concept-path title=concept-path>path</a> describing the shapes given
   in <var title="">glyphs</var>, with each CSS pixel in the coordinate space of <var title="">glyphs</var> mapped to one coordinate space unit in <var title="">glyph subpaths</var>.
   Subpaths in <var title="">glyph subpaths</var> must wind clockwise, regardless of how the user
   agent's font subsystem renders fonts and regardless of how the fonts themselves are defined.</p>

   <li><p>Transform all the coordinates and lines in <var title="">glyph subpaths</var> by the
   transformation matrix <var title="">transform</var>, if it is not null.</li>

   <li><p>If the method is <code title=dom-path-addPathByStrokingText><a href=#dom-path-addpathbystrokingtext>addPathByStrokingText()</a></code>, replace <var title="">glyph subpaths</var> by the result of <a href=#trace-a-path title="trace a path">tracing</a> <var title="">glyph subpaths</var>, using the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for the
   line styles.</p>

   <li><p>Let (<var title="">x<sub title="">final</sub></var>, <var title="">y<sub title="">final</sub></var>) be the last point in the last subpath of <var title="">glyph
   subpaths</var>.</li>

   <li><p>Add all the subpaths in <var title="">glyph subpaths</var> to the <code><a href=#path>Path</a></code>
   object.</li>

   <li><p>Create a new subpath in the <code><a href=#path>Path</a></code> object with (<var title="">x<sub title="">final</sub></var>, <var title="">y<sub title="">final</sub></var>) as the only point in
   the subpath.</li>

  </ol><p>When one of the <code title=dom-path-addText><a href=#dom-path-addtext>addText()</a></code> and <code title=dom-path-addPathByStrokingText><a href=#dom-path-addpathbystrokingtext>addPathByStrokingText()</a></code> variants that take as
  argument a <code><a href=#path>Path</a></code> object is invoked, the method must run the following algorithm:</p>

  <ol><li><p>Let <var title="">target</var> be the <code><a href=#path>Path</a></code> object on which the method was
   invoked.</li>

   <li><p>Let <var title="">path</var> be the <code><a href=#path>Path</a></code> object that was provided in the
   method's arguments.</li>

   <li><p>Run the <a href=#text-preparation-algorithm>text preparation algorithm</a>, passing it <var title="">text</var>, the
   <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument, and, if the <var title="">maxWidth</var>
   argument was provided, that argument. Let <var title="">glyphs</var> be the resulting array, and
   <var title="">physical alignment</var> be the resulting alignment value.</p>

   <li><p>Let <var title="">width</var> be the aggregate length of all the subpaths in <var title="">path</var>, including the distances from the last point of each closed subpath to the
   first point of that subpath.</li>

   <li><p>Define <var title="">L</var> to be a linear coordinate line for of all the subpaths in
   <var title="">path</var>, with additional lines drawn between the last point and the first point
   of each closed subpath, such that the first point of the first subpath is defined as point 0, and
   the last point of the last subpath, if the last subpath is not closed, or the second occurrence
   first point of that subpath, if it is closed, is defined as point <var title="">width</var>.</li>

   <li>

    <p>Let <var title="">offset</var> be determined according to the appropriate step below:</p>

    <dl class=switch><dt>If <var title="">physical alignment</var> is <i>left</i></dt> <dd>Let <var title="">offset</var> be zero.</dd>

     <dt>If <var title="">physical alignment</var> is <i>right</i></dt> <dd>Let <var title="">offset</var> be <var title="">width</var>.</dd>

     <dt>If <var title="">physical alignment</var> is <i title="">center</i></dt> <dd>Let <var title="">offset</var> be half of <var title="">width</var>.</dd>

    </dl></li>

   <li><p>Move all the shapes in <var title="">glyphs</var> to the right by <var title="">offset</var> CSS pixels.</li>

   <li>

    <p>For each glyph <var title="">glyph</var> in the <var title="">glyphs</var> array, run these
    substeps:</p>

    <ol><li><p>Let <var title="">dx</var> be the <var title="">x</var>-coordinate of the horizontal
     center of the bounding box of the shape described by <var title="">glyph</var>, in CSS
     pixels.</li>

     <li><p>If <var title="">dx</var> is negative or greater than <var title="">width</var>, skip
     the remainder of these substeps for this glyph.</li>

     <li><p>Recast <var title="">dx</var> to coordinate spaces units in <var title="">path</var>.
     (This just changes the dimensionality of <var title="">dx</var>, not its numeric value.)</p>
     <!-- hide this step if people get confused by the pedancy -->

     <li><p>Find the point <var title="">p</var> on <var title="">path</var> (or implied closing
     lines in <var title="">path</var>) that corresponds to the position <var title="">dx</var> on
     the coordinate line <var title="">L</var>.</p>

     <li><p>Let <var title="">&theta;</var> be the clockwise angle from the positive x-axis to the
     side of the line that is tangential to <var title="">path</var> at the point <var title="">p</var> that is going in the same direction as the line at point <var title="">p</var>.</li>

     <li><p>Rotate the shape described by <var title="">glyph</var> clockwise by <var title="">&theta;</var> about the point that is at the <var title="">dx</var> coordinate
     horizontally and the zero coordinate vertically.</li>

     <li><p>Let (<var title="">x</var>, <var title="">y</var>) be the coordinate of the point <var title="">p</var>.</li>

     <li><p>Move the shape described by <var title="">glyph</var> to the right by <var title="">x</var> and down by <var title="">y</var>.</li>

     <li><p>Let <var title="">glyph subpaths</var> be a list of subpaths describing the shape given
     in <var title="">glyph</var>, with each CSS pixel in the coordinate space of <var title="">glyph</var> mapped to one coordinate space unit in <var title="">glyph subpaths</var>.
     Subpaths in <var title="">glyph subpaths</var> must wind clockwise, regardless of how the user
     agent's font subsystem renders fonts and regardless of how the fonts themselves are
     defined.</p>

     <li><p>Transform all the coordinates and lines in <var title="">glyph subpaths</var> by the
     transformation matrix <var title="">transform</var>, if it is not null.</li>

     <li><p>If the method is <code title=dom-path-addPathByStrokingText><a href=#dom-path-addpathbystrokingtext>addPathByStrokingText()</a></code>, replace <var title="">glyph subpaths</var> by the result of <a href=#trace-a-path title="trace a path">tracing</a> <var title="">glyph subpaths</var>, using the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for
     the line styles.</p>

     <li><p>Let (<var title="">x<sub title="">final</sub></var>, <var title="">y<sub title="">final</sub></var>) be the last point in the last subpath of <var title="">glyph
     subpaths</var>. (This coordinate is only used if this is the last glyph processed.)</li>

     <li><p>Add all the subpaths in <var title="">glyph subpaths</var> to <var title="">target</var>.</li>

    </ol></li>

   <li><p>Create a new subpath in the <code><a href=#path>Path</a></code> object with (<var title="">x<sub title="">final</sub></var>, <var title="">y<sub title="">final</sub></var>) as the only point in
   the subpath.</li>

  </ol></div>


  <h6 id=transformations><span class=secno>4.8.11.2.8 </span><dfn title=dom-context-2d-transformation>Transformations</dfn></h6>

  <p>Each <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object has a <i>current transformation matrix</i>,
  as well as methods (described in this section) to manipulate it. When a
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, its transformation matrix must be
  initialized to the identity transform.</p>

  <p>The transformation matrix is applied to coordinates when creating the <a href=#current-default-path>current default
  path</a>, and when painting text, shapes, and <code><a href=#path>Path</a></code> objects, on
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects.</p> <!-- conformance criteria for actual drawing
  are described in the various sections below -->

  <p class=note>Most of the API uses <code><a href=#svgmatrix>SVGMatrix</a></code> objects rather than this API. This API
  remains mostly for historical reasons.</p>

  <div class=impl>

  <p>The transformations must be performed in reverse order.</p>

  <p class=note>For instance, if a scale transformation that doubles the width is applied to the
  canvas, followed by a rotation transformation that rotates drawing operations by a quarter turn,
  and a rectangle twice as wide as it is tall is then drawn on the canvas, the actual result will be
  a square.</p> <!-- q.v. http://goo.gl/5RLrN -->

  </div>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-currentTransform><a href=#dom-context-2d-currenttransform>currentTransform</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the transformation matrix, as an <code><a href=#svgmatrix>SVGMatrix</a></code> object.</p>

    <p>Can be set, to change the transformation matrix.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-scale><a href=#dom-context-2d-scale>scale</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Changes the transformation matrix to apply a scaling transformation with the given characteristics.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-rotate><a href=#dom-context-2d-rotate>rotate</a></code>(<var title="">angle</var>)</dt>

   <dd>

    <p>Changes the transformation matrix to apply a rotation transformation with the given characteristics. The angle is in radians.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-translate><a href=#dom-context-2d-translate>translate</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Changes the transformation matrix to apply a translation transformation with the given characteristics.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-transform><a href=#dom-context-2d-transform>transform</a></code>(<var title="">a</var>, <var title="">b</var>, <var title="">c</var>, <var title="">d</var>, <var title="">e</var>, <var title="">f</var>)</dt>

   <dd>

    <p>Changes the transformation matrix to apply the matrix given by the arguments as described below.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-setTransform><a href=#dom-context-2d-settransform>setTransform</a></code>(<var title="">a</var>, <var title="">b</var>, <var title="">c</var>, <var title="">d</var>, <var title="">e</var>, <var title="">f</var>)</dt>

   <dd>

    <p>Changes the transformation matrix <em>to</em> the matrix given by the arguments as described below.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-resetTransform><a href=#dom-context-2d-resettransform>resetTransform</a></code>()</dt>

   <dd>

    <p>Changes the transformation matrix to the identity transform.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-context-2d-currenttransform title=dom-context-2d-currentTransform><code>currentTransform</code></dfn>, on
  getting, must return the last object that it was set to. On setting, its value must be changed to
  the new value, and the transformation matrix must be updated to match the matrix described by the
  new value. When the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, the <code title=dom-context-2d-currentTransform><a href=#dom-context-2d-currenttransform>currentTransform</a></code> attribute must be set a newly
  created <code><a href=#svgmatrix>SVGMatrix</a></code> object. When the transformation matrix is mutated by the methods
  described in this section, the last <code><a href=#svgmatrix>SVGMatrix</a></code> object to which the attribute has been
  set must be mutated in a corresponding fashion.</p>

  <p>The <dfn id=dom-context-2d-scale title=dom-context-2d-scale><code>scale(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must add the scaling transformation described by the
  arguments to the transformation matrix. The <var title="">x</var> argument represents the scale
  factor in the horizontal direction and the <var title="">y</var> argument represents the scale
  factor in the vertical direction. The factors are multiples.</p>

  <p>The <dfn id=dom-context-2d-rotate title=dom-context-2d-rotate><code>rotate(<var title="">angle</var>)</code></dfn>
  method must add the rotation transformation described by the argument to the transformation
  matrix. The <var title="">angle</var> argument represents a clockwise rotation angle expressed in
  radians.</p>

  <p>The <dfn id=dom-context-2d-translate title=dom-context-2d-translate><code>translate(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must add the translation transformation described by the
  arguments to the transformation matrix. The <var title="">x</var> argument represents the
  translation distance in the horizontal direction and the <var title="">y</var> argument represents
  the translation distance in the vertical direction. The arguments are in coordinate space
  units.</p>

  <p>The <dfn id=dom-context-2d-transform title=dom-context-2d-transform><code>transform(<var title="">a</var>, <var title="">b</var>, <var title="">c</var>, <var title="">d</var>, <var title="">e</var>, <var title="">f</var>)</code></dfn> method must replace the current transformation matrix with the
  result of multiplying the current transformation matrix with the matrix described by:</p>

  </div>

  <table class=matrix><tr><td><var title="">a</var></td>
    <td><var title="">c</var></td>
    <td><var title="">e</var></td>
   <tr><td><var title="">b</var></td>
    <td><var title="">d</var></td>
    <td><var title="">f</var></td>
   <tr><td>0</td>
    <td>0</td>
    <td>1</td>
   </table><p class=note>The arguments <var title="">a</var>, <var title="">b</var>, <var title="">c</var>,
  <var title="">d</var>, <var title="">e</var>, and <var title="">f</var> are sometimes called <var title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>,
  <var title="">dx</var>, and <var title="">dy</var> or <var title="">m11</var>, <var title="">m21</var>, <var title="">m12</var>, <var title="">m22</var>, <var title="">dx</var>, and
  <var title="">dy</var>. Care should be taken in particular with the order of the second and third
  arguments (<var title="">b</var> and <var title="">c</var>) as their order varies from API to API
  and APIs sometimes use the notation <var title="">m12</var>/<var title="">m21</var> and sometimes
  <var title="">m21</var>/<var title="">m12</var> for those positions.</p>

  <div class=impl>

  <p>The <dfn id=dom-context-2d-settransform title=dom-context-2d-setTransform><code>setTransform(<var title="">a</var>, <var title="">b</var>, <var title="">c</var>, <var title="">d</var>, <var title="">e</var>, <var title="">f</var>)</code></dfn> method must reset the current transform to the identity matrix, and
  then invoke the <code><a href=#dom-context-2d-transform title=dom-context-2d-transform>transform</a>(<var title="">a</var>, <var title="">b</var>, <var title="">c</var>, <var title="">d</var>, <var title="">e</var>, <var title="">f</var>)</code> method with the same arguments.</p>

  <p>The <dfn id=dom-context-2d-resettransform title=dom-context-2d-resetTransform><code>resetTransform()</code></dfn> method must
  reset the current transform to the identity matrix.</p>

  </div>



  <h6 id=image-sources-for-2d-rendering-contexts><span class=secno>4.8.11.2.9 </span>Image sources for 2D rendering contexts</h6>

  <p>Several methods in the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> API take the union type
  <code><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><a href=#htmlimageelement>HTMLImageElement</a></code> (<code><a href=#the-img-element>img</a></code> elements)</li>

   <li><code><a href=#htmlvideoelement>HTMLVideoElement</a></code> (<code><a href=#the-video-element>video</a></code> elements)</li>

   <li><code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> (<code><a href=#the-canvas-element>canvas</a></code> elements)</li>

   <li><code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code></li>

   <li><code><a href=#imagebitmap>ImageBitmap</a></code></li>

  </ul><p class=note>The <code><a href=#imagebitmap>ImageBitmap</a></code> interface can be created from a number of other
  image-representing types, including <code><a href=#imagedata>ImageData</a></code>.</p>

  <p>When a user agent is required to <dfn id=check-the-usability-of-the-image-argument>check the usability of the <var title="">image</var>
  argument</dfn>, where <var title="">image</var> is a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object, the
  user agent must run these steps, which return either <i>good</i>, <i>bad</i>, or
  <i>aborted</i>:</p>

  <ol><li><p>If the <var title="">image</var> argument is an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object that
   is in the <a href=#img-error title=img-error>broken</a> state, then throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception, return <i>aborted</i>, and abort these steps.</p>

   <li><p>If the <var title="">image</var> argument is an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object that
   is not <a href=#img-good title=img-good>fully decodable</a>, or if the <var title="">image</var>
   argument is an <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> object whose <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is either <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, then return <i>bad</i> and abort these
   steps.</li>

   <li><p>If the <var title="">image</var> argument is an <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> object with
   either a horizontal dimension or a vertical dimension equal to zero, then throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception, return <i>aborted</i>, and abort these steps.</p>

   <li><p>Return <i>good</i>.</li>

  </ol><p>When a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code><a href=#htmlimageelement>HTMLImageElement</a></code>, the
  element's image must be used as the source image.</p>

  <p>Specifically, when a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an animated image in an
  <code><a href=#htmlimageelement>HTMLImageElement</a></code>, the user agent must use the default image of the animation (the
  one that the format defines is to be used when animation is not supported or is disabled), or, if
  there is no such image, the first frame of the animation, when rendering the image for
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> APIs.</p>

  <p>When a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code><a href=#htmlvideoelement>HTMLVideoElement</a></code>, then
  the frame at the <a href=#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><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> APIs, and the source image's dimensions must be the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> and <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a> of the <a href=#media-resource>media resource</a>
  (i.e. after any aspect-ratio correction has been applied).</p>

  <p>When a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>, the
  element's bitmap must be used as the source image.</p>

  <p>When a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>, the
  object's <a href=#scratch-bitmap>scratch bitmap</a> must be used as the source image.</p>

  <p>When a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an element that is <a href=#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 title=attr-dim-width><a href=#attr-dim-width>width</a></code> and
  <code title=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><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
  APIs).</p>

  <p>When a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code><a href=#imagebitmap>ImageBitmap</a></code>, the
  object's bitmap image data must be used as the source image.</p>

<!--ADD-TOPIC:Security-->
  <p><dfn id=the-image-argument-is-not-origin-clean>The <var title="">image argument</var> is not origin-clean</dfn> if it is an
  <code><a href=#htmlimageelement>HTMLImageElement</a></code> or <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> whose <a href=#origin>origin</a> is not
  the <a href=#same-origin title="same origin">same</a> as the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a>,
  or if it is an <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> whose bitmap's <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag is false, or if it is a
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag is false.</p>
<!--REMOVE-TOPIC:Security-->



  <h6 id=fill-and-stroke-styles><span class=secno>4.8.11.2.10 </span>Fill and stroke styles</h6>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> [ = <var title="">value</var> ]</dt>

   <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><a href=#canvasgradient>CanvasGradient</a></code> or <code><a href=#canvaspattern>CanvasPattern</a></code>
    object. Invalid values are ignored.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> [ = <var title="">value</var> ]</dt>

   <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><a href=#canvasgradient>CanvasGradient</a></code> or <code><a href=#canvaspattern>CanvasPattern</a></code>
    object. Invalid values are ignored.</p>

   </dd>

  </dl><div class=impl>

  <!-- v6 feature requests:

   * Getting and setting colours by component to bypass the CSS value parsing.

     Either:
        context.fillStyle.red += 1;

     Or:
        var array = context.fillStyle;
        array[1] += 1;
        context.fillStyle = array;

   * A more performant way of setting colours in general, e.g.:

       context.setFillColor(r,g,b,a) // already supported by webkit

     Or:

       context.fillStyle = 0xRRGGBBAA; // set a 32bit int directly

  -->

  <p>The <dfn id=dom-context-2d-fillstyle title=dom-context-2d-fillStyle><code>fillStyle</code></dfn>
  attribute represents the color or style to use inside shapes, and
  the <dfn id=dom-context-2d-strokestyle title=dom-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><a href=#canvasgradient>CanvasGradient</a></code>s, or
  <code><a href=#canvaspattern>CanvasPattern</a></code>s. On setting, strings must be <a href=#parsed-as-a-css-color-value title="parsed as a CSS
  <color> value">parsed as CSS &lt;color&gt; values</a> and the color assigned, and
  <code><a href=#canvasgradient>CanvasGradient</a></code> and <code><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>parsed as a CSS
  &lt;color&gt; value</a>, then it must be ignored, and the attribute must retain its previous
  value.
<!--ADD-TOPIC:Security-->
  If the new value is a <code><a href=#canvaspattern>CanvasPattern</a></code> object that is marked as <a href=#concept-canvas-pattern-not-origin-clean title=concept-canvas-pattern-not-origin-clean>not origin-clean</a>, then the <a href=#scratch-bitmap>scratch
  bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag must be set to
  false.
<!--REMOVE-TOPIC:Security-->
  </p>

  <p>When set to a <code><a href=#canvaspattern>CanvasPattern</a></code> or
  <code><a href=#canvasgradient>CanvasGradient</a></code> object, the assignment is
  <a href=#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=#serialization-of-a-color title="serialization of a color">serialization of the color</a>
  must be returned. Otherwise, if it is not a color but a
  <code><a href=#canvasgradient>CanvasGradient</a></code> or <code><a href=#canvaspattern>CanvasPattern</a></code>, then the
  respective object must be returned. (Such objects are opaque and
  therefore only useful for assigning to other attributes or for
  comparison to other gradients or patterns.)</p>

  <p>The <dfn id=serialization-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 href=#lowercase-ascii-hex-digits>lowercase ASCII hex digits</a>. Otherwise, the color value
  has alpha less than 1.0, and the string is the color value in the CSS <code title="">rgba()</code>
  functional-notation format: the literal string <code title="">rgba</code> (U+0072 U+0067 U+0062
  U+0061) followed by a U+0028 LEFT PARENTHESIS, a base-ten integer in the range 0-255 representing
  the red component (using <a href=#ascii-digits>ASCII digits</a> in the shortest form possible), a literal
  U+002C COMMA and U+0020 SPACE, an integer for the green component, a comma and a space, an integer
  for the blue component, another comma and space, a U+0030 DIGIT ZERO, if the alpha value is
  greater than zero then a U+002E FULL STOP (representing the decimal point), if the alpha value is
  greater than zero then one or more <a href=#ascii-digits>ASCII digits</a> representing the fractional part of
  the alpha<!-- value with no trailing zeros (implied by next sentence)-->, 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> <!-- if people complain this is unreadable, expand it into a <dl> with two nested
  <ol>s -->

  <p>When the context is created, the <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> and <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attributes
  must initially have the string value <code title="">#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> <!-- so singular matrices don't affect solid color fillStyles -->

  </div>

  <hr><p>There are two types of gradients, linear gradients and radial
  gradients, both represented by objects implementing the opaque
  <code><a href=#canvasgradient>CanvasGradient</a></code> interface.</p>

  <p id=interpolation>Once a gradient has been created (see below),
  stops are placed along it to define how the colors are distributed
  along the gradient. <span class=impl>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 transparent black.</span></p>

  <dl class=domintro><dt><var title="">gradient</var> . <code title=dom-canvasgradient-addColorStop><a href=#dom-canvasgradient-addcolorstop>addColorStop</a></code>(<var title="">offset</var>, <var title="">color</var>)</dt>

   <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 <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the offset is out of range. Throws a
    <code><a href=#syntaxerror>SyntaxError</a></code> exception if the color cannot be parsed.</p>

   </dd>

   <dt><var title="">gradient</var> = <var title="">context</var> . <code title=dom-context-2d-createLinearGradient><a href=#dom-context-2d-createlineargradient>createLinearGradient</a></code>(<var title="">x0</var>, <var title="">y0</var>, <var title="">x1</var>, <var title="">y1</var>)</dt>

   <dd>

    <p>Returns a <code><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>

   </dd>

   <dt><var title="">gradient</var> = <var title="">context</var> . <code title=dom-context-2d-createRadialGradient><a href=#dom-context-2d-createradialgradient>createRadialGradient</a></code>(<var title="">x0</var>, <var title="">y0</var>, <var title="">r0</var>, <var title="">x1</var>, <var title="">y1</var>, <var title="">r1</var>)</dt>

   <dd>

    <p>Returns a <code><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
    radial gradient that paints along the cone given by the circles
    represented by the arguments.</p>

    <p>If either of the radii are negative, throws an
    <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-canvasgradient-addcolorstop title=dom-canvasgradient-addColorStop><code>addColorStop(<var title="">offset</var>,
  <var title="">color</var>)</code></dfn> method on the <code><a href=#canvasgradient>CanvasGradient</a></code> interface adds a
  new stop to a gradient. If the <var title="">offset</var> is less than 0 or greater than 1 then an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown. If the <var title="">color</var> cannot be
  <a href=#parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt; value</a>, then a <code><a href=#syntaxerror>SyntaxError</a></code> exception must
  be thrown. Otherwise, the gradient must have a new stop placed, at offset <var title="">offset</var> relative to the whole gradient, and with the color obtained by parsing <var title="">color</var> as a CSS &lt;color&gt; value. If multiple stops are added at the same offset
  on a gradient, they must be placed in the order added, with the first one closest to the start of
  the gradient, and each subsequent one infinitesimally further along towards the end point (in
  effect causing all but the first and last stop added at each point to be ignored).</p>

  <p>The <dfn id=dom-context-2d-createlineargradient title=dom-context-2d-createLinearGradient><code>createLinearGradient(<var title="">x0</var>, <var title="">y0</var>, <var title="">x1</var>, <var title="">y1</var>)</code></dfn> method takes four arguments that represent the start point (<var title="">x0</var>, <var title="">y0</var>) and end point (<var title="">x1</var>, <var title="">y1</var>) of the gradient. The method must return a linear <code><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 title=dom-context-2d-transformation>current transformation matrix</a> when rendering.</p>

  <p>If <span title=""><var title="">x0</var>&nbsp;=&nbsp;<var title="">x1</var></span> and <span title=""><var title="">y0</var>&nbsp;=&nbsp;<var title="">y1</var></span>, then the linear
  gradient must paint nothing.</p>

  <p>The <dfn id=dom-context-2d-createradialgradient title=dom-context-2d-createRadialGradient><code>createRadialGradient(<var title="">x0</var>, <var title="">y0</var>, <var title="">r0</var>,
  <var title="">x1</var>, <var title="">y1</var>, <var title="">r1</var>)</code></dfn> method takes six arguments, the
  first three representing the start circle with origin (<var title="">x0</var>, <var title="">y0</var>) and radius <var title="">r0</var>, and the last three representing the end circle
  with origin (<var title="">x1</var>, <var title="">y1</var>) and
  radius <var title="">r1</var>. The values are in coordinate space
  units. If either of <var title="">r0</var> or <var title="">r1</var>
  are negative, an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception must be
  thrown. Otherwise, the method must return a radial
  <code><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 <span title=""><var title="">x<sub title="">0</sub></var>&nbsp;=&nbsp;<var title="">x<sub title="">1</sub></var></span> and <span title=""><var title="">y<sub title="">0</sub></var>&nbsp;=&nbsp;<var title="">y<sub title="">1</sub></var></span> and <span title=""><var title="">r<sub title="">0</sub></var>&nbsp;=&nbsp;<var title="">r<sub title="">1</sub></var></span>, then the radial gradient must
   paint nothing. Abort these steps.</li>

   <li>

    <p>Let <span title="">x(<var title="">&omega;</var>)&nbsp;=&nbsp;(<var title="">x<sub title="">1</sub></var>-<var title="">x<sub title="">0</sub></var>)<var title="">&omega;</var>&nbsp;+&nbsp;<var title="">x<sub title="">0</sub></var></span></p>

    <p>Let <span title="">y(<var title="">&omega;</var>)&nbsp;=&nbsp;(<var title="">y<sub title="">1</sub></var>-<var title="">y<sub title="">0</sub></var>)<var title="">&omega;</var>&nbsp;+&nbsp;<var title="">y<sub title="">0</sub></var></span></p>

    <p>Let <span title="">r(<var title="">&omega;</var>)&nbsp;=&nbsp;(<var title="">r<sub title="">1</sub></var>-<var title="">r<sub title="">0</sub></var>)<var title="">&omega;</var>&nbsp;+&nbsp;<var title="">r<sub title="">0</sub></var></span></p>

    <p>Let the color at <var title="">&omega;</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>

   <li><p>For all values of <var title="">&omega;</var> where <span title="">r(<var title="">&omega;</var>)&nbsp;&gt;&nbsp;0</span>,
   starting with the value of <var title="">&omega;</var> nearest to
   positive infinity and ending with the value of <var title="">&omega;</var> nearest to negative infinity, draw the
   circumference of the circle with radius <span title="">r(<var title="">&omega;</var>)</span> at position (<span title="">x(<var title="">&omega;</var>)</span>, <span title="">y(<var title="">&omega;</var>)</span>), with the color at <var title="">&omega;</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.</li>

  </ol><p class=note>This effectively creates a cone, touched by the two
  circles defined in the creation of the gradient, with the part of
  the cone before the start circle (0.0) using the 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 (transparent black).</p>

  <p>The resulting radial gradient must then be transformed as
  described by the <a href=#transformations title=dom-context-2d-transformation>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>

  </div>

  <hr><p>Patterns are represented by objects implementing the opaque
  <code><a href=#canvaspattern>CanvasPattern</a></code> interface.</p>

  <dl class=domintro><dt><var title="">pattern</var> = <var title="">context</var> . <code title=dom-context-2d-createPattern><a href=#dom-context-2d-createpattern>createPattern</a></code>(<var title="">image</var>, <var title="">repetition</var>)</dt>

   <dd>

    <p>Returns a <code><a href=#canvaspattern>CanvasPattern</a></code> object that uses the given image
    and repeats in the direction(s) given by the <var title="">repetition</var> argument.</p>

    <p>The allowed values for <var title="">repetition</var> are <code title="">repeat</code> (both directions), <code title="">repeat-x</code> (horizontal only), <code title="">repeat-y</code> (vertical only), and <code title="">no-repeat</code> (neither). If the <var title="">repetition</var> argument is empty, the value <code title="">repeat</code> is used.</p>

    <p>If the image isn't yet fully decoded, then nothing is drawn. If the image is a canvas with no data, throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>

   </dd>

   <dt><var title="">pattern</var> . <code title=dom-canvaspattern-setTransform><a href=#dom-canvaspattern-settransform>setTransform</a></code>(<var title="">transform</var>)</dt>

   <dd>

    <p>Sets the transformation matrix that will be used when rendering the pattern during a fill or
    stroke painting operation.</p>

   </dd>

  </dl><div class=impl>

  <p>To create objects of this type, the <dfn id=dom-context-2d-createpattern title=dom-context-2d-createPattern><code>createPattern(<var title="">image</var>, <var title="">repetition</var>)</code></dfn> method is used. When the method is invoked, the user agent
  must run the following steps:</p>

  <ol><li><p>Let <var title="">image</var> be the first argument and <var title="">repetition</var> be
   the second argument.</li>

   <li><p><a href=#check-the-usability-of-the-image-argument>Check the usability of the <var title="">image</var> argument</a>. If this
   returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;
   abort these steps. If it returns <i>bad</i>, then return null and abort these steps. Otherwise it
   returns <i>good</i>; continue with these steps.</li>

   <li><p>If <var title="">repetition</var> is the empty string, let it be "<code title="">repeat</code>".</p>

   <li><p>If <var title="">repetition</var> is not a <a href=#case-sensitive>case-sensitive</a> match for one of
   "<code title="">repeat</code>", "<code title="">repeat-x</code>", "<code title="">repeat-y</code>", or "<code title="">no-repeat</code>", throw a <code><a href=#syntaxerror>SyntaxError</a></code>
   exception and abort these steps.</li>

   <li><p>Create a new <code><a href=#canvaspattern>CanvasPattern</a></code> object with the image <var title="">image</var>
   and the repetition behavior given by <var title="">repetition</var>.</li>

<!--ADD-TOPIC:Security-->
   <li><p>If <a href=#the-image-argument-is-not-origin-clean>the <var title="">image argument</var> is not origin-clean</a>, then mark the
   <code><a href=#canvaspattern>CanvasPattern</a></code> object as <dfn id=concept-canvas-pattern-not-origin-clean title=concept-canvas-pattern-not-origin-clean>not
   origin-clean</dfn>.</li>
<!--REMOVE-TOPIC:Security-->

   <li><p>Return the <code><a href=#canvaspattern>CanvasPattern</a></code> object.</li>

  </ol><p>Modifying the <var title="">image</var> used when creating a <code><a href=#canvaspattern>CanvasPattern</a></code> object
  after calling the <code title=dom-context-2d-createPattern><a href=#dom-context-2d-createpattern>createPattern()</a></code> method must
  not affect the pattern(s) rendered by the <code><a href=#canvaspattern>CanvasPattern</a></code> object.</p>

  <p>Patterns have a transformation matrix, which controls how the pattern is used when it is
  painted. Initially, a pattern's transformation matrix must be the identity transform.</p>

  <p>When the <dfn id=dom-canvaspattern-settransform title=dom-canvaspattern-setTransform><code>setTransform()</code></dfn> method
  is invoked on the pattern, the user agent must replace the pattern's transformation matrix with
  the one described by the <code><a href=#svgmatrix>SVGMatrix</a></code> object provided as an argument to the method.</p>

  <p>When a pattern is to be rendered within an area, the user agent
  must run the following steps to determine what is rendered:</p>

  <ol><li><p>Create an infinite transparent black bitmap.</li>

   <li>

    <p>Place a copy of the image on the bitmap, anchored such that its top left corner is at the
    origin of the coordinate space, with one coordinate space unit per CSS pixel of the image, then
    place repeated copies of this image horizontally to the left and right, if the repetition
    behavior is "<code title="">repeat-x</code>", or vertically up and down, if the repetition
    behavior is "<code title="">repeat-y</code>", or in all four directions all over the bitmap, if
    the repetition behavior is "<code title="">repeat</code>".</p>

<!--CLEANUP-->
    <p>If the original image data is a bitmap image, the value painted at a point in the area of the
    repetitions is computed by filtering the original image data. When scaling up, if the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> attribute is set to
    true, the image must be rendered using nearest-neighbor interpolation. Otherwise, the user agent
    may use any filtering algorithm (for example bilinear interpolation or nearest-neighbor). When
    such a filtering
    algorithm requires a pixel value from outside the original image data, it must instead use the
    value from wrapping the pixel's coordinates to the original image's dimensions. (That is, the
    filter uses 'repeat' behavior, regardless of the value of the pattern's repetition behavior.)</p>
    <!-- drawImage() has similar paragraphs with different rules -->

   </li>

   <li><p>Transform the resulting bitmap according to the pattern's
   transformation matrix.</li>

   <li><p>Transform the resulting bitmap again, this time according to
   the <a href=#transformations title=dom-context-2d-transformation>current
   transformation matrix</a>.</li>

   <li><p>Replace any part of the image outside the area in which the
   pattern is to be rendered with transparent black.</li>

   <li><p>The resulting bitmap is what is to be rendered, with the
   same origin and same scale.</li>

  </ol><hr><p>If a radial gradient or repeated pattern is used when the
  transformation matrix is singular, the resulting style must be
  transparent black (otherwise the gradient or pattern would be
  collapsed to a point or line, leaving the other pixels undefined).
  Linear gradients and solid colors always define all points even with
  singular tranformation matrices.</p>

  </div>




  <h6 id=drawing-rectangles-to-the-bitmap><span class=secno>4.8.11.2.11 </span>Drawing rectangles to the bitmap</h6>

  <p>There are three methods that immediately draw rectangles to the
  bitmap. They each take four arguments; the first two give the <var title="">x</var> and <var title="">y</var> coordinates of the top
  left of the rectangle, and the second two give the width <var title="">w</var> and height <var title="">h</var> of the rectangle,
  respectively.</p>

  <div class=impl>

  <p>The <a href=#transformations title=dom-context-2d-transformation>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 title="">(<var title="">x</var>, <var title="">y</var>)</span>, <span title="">(<span title=""><var title="">x</var>+<var title="">w</var></span>, <var title="">y</var>)</span>,
  <span title="">(<span title=""><var title="">x</var>+<var title="">w</var></span>,
  <span title=""><var title="">y</var>+<var title="">h</var></span>)</span>,
  <span title="">(<var title="">x</var>, <span title=""><var title="">y</var>+<var title="">h</var></span>)</span>.</p>

  <p>Shapes are painted without affecting the <a href=#current-default-path>current default
  path</a>, and are subject to the <a href=#clipping-region>clipping region</a>,
  and, with the exception of <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
  operators</a>.</p>

  </div>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>

   <dd>

    <p>Clears all pixels on the bitmap in the given rectangle to transparent black.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-fillRect><a href=#dom-context-2d-fillrect>fillRect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>

   <dd>

    <p>Paints the given rectangle onto the bitmap, using the current fill style.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-strokeRect><a href=#dom-context-2d-strokerect>strokeRect</a></code>(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</dt>

   <dd>

    <p>Paints the box that outlines the given rectangle onto the bitmap, using the current stroke style.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-context-2d-clearrect title=dom-context-2d-clearRect><code>clearRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must run the following steps:</p>

  <ol><li><p>Let <var title="">pixels</var> be the set of pixels in
   the specified rectangle that also intersect the current
   <a href=#clipping-region>clipping region</a>.</li>

   <li><p>Clear the pixels in <var title="">pixels</var> to a fully
   transparent black, erasing any previous image.</li>

   <li><p><a href=#clear-regions-that-cover-the-pixels>Clear regions that cover the pixels</a> in <var title="">pixels</var> on the <a href=#scratch-bitmap>scratch bitmap</a>.</li>

  </ol><p class=note>If either height or width are zero, this method has
  no effect, since the set of pixels would be empty.</p>

  <p>The <dfn id=dom-context-2d-fillrect title=dom-context-2d-fillRect><code>fillRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must paint the specified
  rectangular area using the <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>. If either height
  or width are zero, this method has no effect.</p>

  <p>The <dfn id=dom-context-2d-strokerect title=dom-context-2d-strokeRect><code>strokeRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must take the result of <a href=#trace-a-path title="trace a path">tracing the path</a> described below, using
  the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's line styles, and
  fill it with the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>.</p>

  <p>If both <var title="">w</var> and <var title="">h</var> are zero,
  the path has a single subpath with just one point (<var title="">x</var>, <var title="">y</var>), and no lines, and this
  method thus has no effect (the <a href=#trace-a-path>trace a path</a> algorithm
  returns an empty path in that case).</p>

  <p>If just one of either <var title="">w</var> or <var title="">h</var> is zero, then the path has a single subpath
  consisting of two points, with coordinates (<span title=""><var title="">x</var></span>, <span title=""><var title="">y</var></span>) and (<span title=""><var title="">x</var>+<var title="">w</var></span>, <span title=""><var title="">y</var></span>+<var title="">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 title=""><var title="">x</var></span>, <span title=""><var title="">y</var></span>), (<span title=""><var title="">x</var>+<var title="">w</var></span>, <span title=""><var title="">y</var></span>), (<span title=""><var title="">x</var>+<var title="">w</var></span>, <span title=""><var title="">y</var></span>+<var title="">h</var>), and (<span title=""><var title="">x</var></span>, <span title=""><var title="">y</var>+<var title="">h</var></span>), connected to each
  other in that order by straight lines.</p>

  </div>



  <h6 id=drawing-text-to-the-bitmap><span class=secno>4.8.11.2.12 </span>Drawing text to the bitmap</h6>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-fillText><a href=#dom-context-2d-filltext>fillText</a></code>(<var title="">text</var>, <var title="">x</var>, <var title="">y</var> [, <var title="">maxWidth</var> ] )</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-strokeText><a href=#dom-context-2d-stroketext>strokeText</a></code>(<var title="">text</var>, <var title="">x</var>, <var title="">y</var> [, <var title="">maxWidth</var> ] )</dt>

   <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>

   </dd>

   <dt><var title="">metrics</var> = <var title="">context</var> . <code title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText</a></code>(<var title="">text</var>)</dt>

   <dd>

    <p>Returns a <code><a href=#textmetrics>TextMetrics</a></code> object with the metrics of the given text in the current font.</p>

   </dd>

   <dt><var title="">metrics</var> . <code title=dom-textmetrics-width><a href=#dom-textmetrics-width>width</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-actualBoundingBoxLeft><a href=#dom-textmetrics-actualboundingboxleft>actualBoundingBoxLeft</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-actualBoundingBoxRight><a href=#dom-textmetrics-actualboundingboxright>actualBoundingBoxRight</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-fontBoundingBoxAscent><a href=#dom-textmetrics-fontboundingboxascent>fontBoundingBoxAscent</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-fontBoundingBoxDescent><a href=#dom-textmetrics-fontboundingboxdescent>fontBoundingBoxDescent</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-actualBoundingBoxAscent><a href=#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-actualBoundingBoxDescent><a href=#dom-textmetrics-actualboundingboxdescent>actualBoundingBoxDescent</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-emHeightAscent><a href=#dom-textmetrics-emheightascent>emHeightAscent</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-emHeightDescent><a href=#dom-textmetrics-emheightdescent>emHeightDescent</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-hangingBaseline><a href=#dom-textmetrics-hangingbaseline>hangingBaseline</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-alphabeticBaseline><a href=#dom-textmetrics-alphabeticbaseline>alphabeticBaseline</a></code></dt>
   <dt><var title="">metrics</var> . <code title=dom-textmetrics-ideographicBaseline><a href=#dom-textmetrics-ideographicbaseline>ideographicBaseline</a></code></dt>

   <dd>

    <p>Returns the measurement described below.</p>

   </dd>

  </dl><div class=impl>

  <p>The <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> interface provides the following methods for
  rendering text.</p>

  <p>The <dfn id=dom-context-2d-filltext title=dom-context-2d-fillText><code>fillText()</code></dfn> and
  <dfn id=dom-context-2d-stroketext title=dom-context-2d-strokeText><code>strokeText()</code></dfn>
  methods take three or four arguments, <var title="">text</var>, <var title="">x</var>, <var title="">y</var>, and optionally <var title="">maxWidth</var>, and render the given <var title="">text</var> at the given (<var title="">x</var>, <var title="">y</var>) coordinates ensuring that the text isn't wider
  than <var title="">maxWidth</var> if specified, using the current
  <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code>, and <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>
  values. Specifically, when the methods are called, the user agent
  must run the following steps:</p>

  <ol><li><p>Run the <a href=#text-preparation-algorithm>text preparation algorithm</a>, passing it
   <var title="">text</var>, the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
   object, and, if the <var title="">maxWidth</var> argument was
   provided, that argument. Let <var title="">glyphs</var> be the
   result.</p>

   <li><p>Move all the shapes in <var title="">glyphs</var> to the
   right by <var title="">x</var> CSS pixels and down by <var title="">y</var> CSS pixels.</li>

   <li>

    <p>Paint the shapes given in <var title="">glyphs</var>, as
    transformed by the <a href=#transformations title=dom-context-2d-transformation>current transformation
    matrix</a>, with each CSS pixel in the coordinate space of <var title="">glyphs</var> mapped to one coordinate space unit.</p>

    <p>For <code title=dom-context-2d-fillText><a href=#dom-context-2d-filltext>fillText()</a></code>,
    <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> must be
    applied to the shapes and <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> must be
    ignored. For <code title=dom-context-2d-strokeText><a href=#dom-context-2d-stroketext>strokeText()</a></code>, the reverse
    holds: <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>
    must be applied to the result of <a href=#trace-a-path title="trace a
    path">tracing</a> the shapes using the
    <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object for the line styles,
    and <code title=dom-context-2d-fillStyle><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 title=shadows>shadow effects</a>,
    <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the
    <a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
    operators</a>.</p>

   </li>

<!--ADD-TOPIC:Security-->
   <li><p>If the <a href=#text-preparation-algorithm>text preparation algorithm</a> used a font that has an <a href=#origin>origin</a>
   that is not the <a href=#same-origin title="same origin">same</a> as the <a href=#entry-script>entry script</a>'s
   <a href=#origin>origin</a> (even if "using a font" means just checking if that font has a particular
   glyph in it before falling back to another font), then set the <a href=#scratch-bitmap>scratch bitmap</a>'s
   <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag to false.</li> <!--
   because fonts could consider sensitive material, I guess; and because that sensitivity could
   extend to whether or not a particular glyph is in the font in the first place. -->
<!--REMOVE-TOPIC:Security-->

  </ol><!--v6DVT - this is commented out until CSS can get its act together
enough to actual specify vertical text rendering (how long have we
been waiting now?)

WHEN EDITING THIS, FIX THE PARTS MARKED "&#x0058;&#x0058;&#x0058;" BELOW

ALSO NOTE THAT THIS PROBABLY NEEDS ENTIRELY REVISITING NOW THAT WE
HAVE REJIGGED HOW TEXT WORKS IN v5 (e.g. remember security)

  <p>The <dfn
  title="dom-context-2d-fillVerticalText"><code>fillVerticalText()</code></dfn>
  and <dfn
  title="dom-context-2d-strokeVerticalText"><code>strokeVerticalText()</code></dfn>
  methods take three or four arguments, <var title="">text</var>, <var
  title="">x</var>, <var title="">y</var>, and optionally <var
  title="">maxHeight</var>, and render the given <var
  title="">text</var> as vertical text at the given (<var
  title="">x</var>, <var title="">y</var>) coordinates ensuring that
  the text isn't taller than <var title="">maxHeight</var> if
  specified, using the current <code
  title="dom-context-2d-font">font</code> and <code
  title="dom-context-2d-textAlign">textAlign</code>
  values. Specifically, when the methods are called, the user agent
  must run the following steps:</p>

  <ol>

   <li><p>If <var title="">maxHeight</var> is present but less than or
   equal to zero, return without doing anything; abort these
   steps.</p></li>

   <li><p>Let <var title="">font</var> be the current font of the
   context, as given by the <code
   title="dom-context-2d-font">font</code> attribute.</p></li>

   <li><p>Replace all the <span title="space character">space
   characters</span> in <var title="">text</var> with U+0020 SPACE
   characters.</p></li>

   <li><p>Form a <em class="&#x0058;&#x0058;&#x0058;">whatever CSS ends up calling
   vertical line boxes and inline boxes</em> containing the text <var
   title="">text</var>, with all the properties at their initial
   values except the 'font' property of the inline box set to <var
   title="">font</var> and the 'direction' property of the inline
   box set to <span>the directionality</span> of the <code>canvas</code>
   element.</p></li>

   <!- - if you insert a step here, make sure to adjust the next step's
   final words - ->

   <li><p>If the <var title="">maxHeight</var> argument was specified
   and the hypothetical height of the <em class="&#x0058;&#x0058;&#x0058;">box</em>
   in the hypothetical line box is greater than <var
   title="">maxHeight</var> CSS pixels, then change <var
   title="">font</var> to have a more condensed font (if one is
   available or if a reasonably readable one can be synthesized by
   applying an appropriate scale factor to the font) or a smaller
   font, and return to the previous step.</p></li>

   <li>

    <p>Let the <var title="">anchor point</var> be a point on the <em
    class="&#x0058;&#x0058;&#x0058;">inline box</var>, determined by the <code
    title="dom-context-2d-textAlign">textAlign</code>, as follows:</p>

    <p>Vertical position:</p>

    <dl>

     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">start</code></dt>
     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">left</code> and <span>the directionality</span> of the
     <code>canvas</code> element is 'ltr'</dt>
     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">right</code> and <span>the directionality</span> of the
     <code>canvas</code> element is 'rtl'</dt>

     <dd>Let the <var title="">anchor point</var>'s vertical
     position be the top edge of the <em class="&#x0058;&#x0058;&#x0058;">inline
     box</em>.</dd>

     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">end</code></dt>
     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">right</code> and <span>the directionality</span> of the
     <code>canvas</code> element is 'ltr'</dt>
     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">left</code> and <span>the directionality</span> of the
     <code>canvas</code> element is 'rtl'</dt>

     <dd>Let the <var title="">anchor point</var>'s vertical
     position be the bottom edge of the <em class="&#x0058;&#x0058;&#x0058;">inline
     box</em>.</dd>


     <dt>If <code
     title="dom-context-2d-textAlign">textAlign</code> is <code
     title="">center</code></dt>

     <dd>Let the <var title="">anchor point</var>'s vertical position
     be half way between the top and bottom edges of the <em
     class="&#x0058;&#x0058;&#x0058;">inline box</em>.</dd>

    </dl>

    <p>Let the horizontal position be half way between the left and
    right edges of the em box of the first available font of the <em
    class="&#x0058;&#x0058;&#x0058;">inline box</em>.</p>

   </li>

   <li>

    <p>Paint the hypothetical inline box as the shape given by the
    text's glyphs, as transformed by the <span
    title="dom-context-2d-transformation">current transformation
    matrix</span>, and anchored and sized so that before applying the
    <span title="dom-context-2d-transformation">current transformation
    matrix</span>, the <var title="">anchor point</var> is at (<var
    title="">x</var>, <var title="">y</var>) and each CSS pixel is
    mapped to one coordinate space unit.</p>

    <p>For <code
    title="dom-context-2d-fillVerticalText">fillVerticalText()</code>
    <code title="dom-context-2d-fillStyle">fillStyle</code> must be
    applied and <code
    title="dom-context-2d-strokeStyle">strokeStyle</code> must be
    ignored. For <code
    title="dom-context-2d-strokeVerticalText">strokeVerticalText()</code>
    the reverse holds and <code
    title="dom-context-2d-strokeStyle">strokeStyle</code> must be
    applied and <code
    title="dom-context-2d-fillStyle">fillStyle</code> must be
    ignored.</p>

    <p>Text is painted without affecting the current path, and is
    subject to <span title="shadows">shadow effects</span>, <span
    title="dom-context-2d-globalAlpha">global alpha</span>, the
    <span>clipping region</span>, and <span
    title="dom-context-2d-globalCompositeOperation">global composition
    operators</span>.</p>

   </li>

  </ol>

v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-context-2d-measuretext title=dom-context-2d-measureText><code>measureText()</code></dfn> method takes one
  argument, <var title="">text</var>. When the method is invoked, the user agent must run the
  <a href=#text-preparation-algorithm>text preparation algorithm</a>, passing it <var title="">text</var> and the
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object, and then using the returned inline box must create a
  new <code><a href=#textmetrics>TextMetrics</a></code> object with its attributes set as described in the following list.
<!--ADD-TOPIC:Security-->
  If doing these measurements requires using a font that has an
  <a href=#origin>origin</a> that is not the <a href=#same-origin title="same
  origin">same</a> as that of the <code><a href=#document>Document</a></code> object that
  owns the <code><a href=#the-canvas-element>canvas</a></code> element (even if "using a font" means
  just checking if that font has a particular glyph in it before
  falling back to another font), then the method must throw a
  <code><a href=#securityerror>SecurityError</a></code> exception.
<!--REMOVE-TOPIC:Security-->
  Otherwise, it must return the new <code><a href=#textmetrics>TextMetrics</a></code> object.
  <a href=#refsCSS>[CSS]</a>
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  </div>

  <dl><dt><dfn id=dom-textmetrics-width title=dom-textmetrics-width><code>width</code></dfn> attribute</dt>

   <dd><p>The width of that inline box, in CSS pixels. (The text's advance width.)</dd>

   <dt><dfn id=dom-textmetrics-actualboundingboxleft title=dom-textmetrics-actualBoundingBoxLeft><code>actualBoundingBoxLeft</code></dfn> attribute</dt>

   <dd>
    <p>The distance parallel to the baseline from the alignment point given by the <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> attribute to the left side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going left from the given alignment point.
    <p class=note>The sum of this value and the next (<code title=dom-textmetrics-actualBoundingBoxRight><a href=#dom-textmetrics-actualboundingboxright>actualBoundingBoxRight</a></code>) can be wider than the width of the inline box (<code title=dom-textmetrics-width><a href=#dom-textmetrics-width>width</a></code>), in particular with slanted fonts where characters overhang their advance width.</p>

   </dd>

   <dt><dfn id=dom-textmetrics-actualboundingboxright title=dom-textmetrics-actualBoundingBoxRight><code>actualBoundingBoxRight</code></dfn> attribute</dt>

   <dd>
    <p>The distance parallel to the baseline from the alignment point given by the <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code> attribute to the right side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going right from the given alignment point.</p>
   </dd>

   <dt><dfn id=dom-textmetrics-fontboundingboxascent title=dom-textmetrics-fontBoundingBoxAscent><code>fontBoundingBoxAscent</code></dfn> attribute</dt>

   <dd>
    <p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers indicating a distance going up from the given baseline.</p>
    <p class=note>This value and the next are useful when rendering a background that must have a consistent height even if the exact text being rendered changes. The <code title=dom-textmetrics-actualBoundingBoxAscent><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>
   </dd>

   <dt><dfn id=dom-textmetrics-fontboundingboxdescent title=dom-textmetrics-fontBoundingBoxDescent><code>fontBoundingBoxDescent</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the bottom of the lowest bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers indicating a distance going down from the given baseline.</dd>

   <dt><dfn id=dom-textmetrics-actualboundingboxascent title=dom-textmetrics-actualBoundingBoxAscent><code>actualBoundingBoxAscent</code></dfn> attribute</dt>

   <dd>
    <p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the top of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going up from the given baseline.
    <p class=note>This number can vary greatly based on the input text, even if the first font specified covers all the characters in the input. For example, the <code title=dom-textmetrics-actualBoundingBoxAscent><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 title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> value "<code title=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 title="">,</code>" would likely (unless the font is quite unusual) be negative.</p>
   </dd>

   <dt><dfn id=dom-textmetrics-actualboundingboxdescent title=dom-textmetrics-actualBoundingBoxDescent><code>actualBoundingBoxDescent</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the bottom of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going down from the given baseline.</dd>

   <dt><dfn id=dom-textmetrics-emheightascent title=dom-textmetrics-emHeightAscent><code>emHeightAscent</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the top of the em square in the line box, in CSS pixels; positive numbers indicating that the given baseline is below the top of the em square (so this value will usually be positive). Zero if the given baseline is the top of the em square; half the font size if the given baseline is the middle of the em square.</dd>

   <dt><dfn id=dom-textmetrics-emheightdescent title=dom-textmetrics-emHeightDescent><code>emHeightDescent</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the bottom of the em square in the line box, in CSS pixels; positive numbers indicating that the given baseline is below the bottom of the em square (so this value will usually be negative). (Zero if the given baseline is the top of the em square.)</dd>

   <dt><dfn id=dom-textmetrics-hangingbaseline title=dom-textmetrics-hangingBaseline><code>hangingBaseline</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the hanging baseline of the line box, in CSS pixels; positive numbers indicating that the given baseline is below the hanging baseline. (Zero if the given baseline is the hanging baseline.)</dd>

   <dt><dfn id=dom-textmetrics-alphabeticbaseline title=dom-textmetrics-alphabeticBaseline><code>alphabeticBaseline</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the alphabetic baseline of the line box, in CSS pixels; positive numbers indicating that the given baseline is below the alphabetic baseline. (Zero if the given baseline is the alphabetic baseline.)</dd>

   <dt><dfn id=dom-textmetrics-ideographicbaseline title=dom-textmetrics-ideographicBaseline><code>ideographicBaseline</code></dfn> attribute</dt>

   <dd><p>The distance from the horizontal line indicated by the <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the ideographic baseline of the line box, in CSS pixels; positive numbers indicating that the given baseline is below the ideographic baseline. (Zero if the given baseline is the ideographic baseline.)</dd>

  </dl><p class=note>Glyphs rendered using <code title=dom-context-2d-fillText><a href=#dom-context-2d-filltext>fillText()</a></code> and <code title=dom-context-2d-strokeText><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 title=dom-context-2d-measureText><a href=#dom-context-2d-measuretext>measureText()</a></code> (the text
  width). Authors are encouraged to use the bounding box values
  described above if this is an issue.</p>

  <p class=note>A future version of the 2D context API may provide a
  way to render fragments of documents, rendered using CSS, straight
  to the canvas. This would be provided in preference to a dedicated
  way of doing multiline layout.</p>



  <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.2.13 </span>Drawing paths to the canvas</h6>

  <p>The context always has a <dfn id=current-default-path>current default path</dfn>. There
  is only one <a href=#current-default-path>current default path</a>, it is not part of the
  <a href=#drawing-state>drawing state</a>. The <a href=#current-default-path>current default path</a> is
  a <a href=#concept-path title=concept-path>path</a>, as described above.</p>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath</a></code>()</dt>

   <dd>

    <p>Resets the <a href=#current-default-path>current default path</a>.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>()</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>(<var title="">path</var>)</dt>

   <dd>

    <p>Fills the subpaths of the <a href=#current-default-path>current default path</a> or the given path with the current fill style.</p>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>(<var title="">path</var>)</dt>

   <dd>

    <p>Strokes the subpaths of the <a href=#current-default-path>current default path</a> or the given path with the current stroke style.</p>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var title="">element</var>)</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var title="">path</var>, <var title="">element</var>)</dt>

   <dd>

    <p>If the given element is focused, draws a focus ring around the
    <a href=#current-default-path>current default path</a> or the given path, following the platform
    conventions for focus rings.</p>

   </dd>


   <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawCustomFocusRing><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var title="">element</var>)</dt>
   <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawCustomFocusRing><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var title="">path</var>, <var title="">element</var>)</dt>

   <dd>

    <p>If the given element is focused, and the user has configured
    his system to draw focus rings in a particular manner (for
    example, high contrast focus rings), draws a focus ring around the
    <a href=#current-default-path>current default path</a> or the given path and returns
    false.</p>

    <p>Otherwise, returns true if the given element is focused, and
    false otherwise. This can thus be used to determine when to draw a
    focus ring (see <a href=#drawCustomFocusRingExample>the
    example</a> below).</p>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-scrollPathIntoView><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>()</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-scrollPathIntoView><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>(<var title="">path</var>)</dt>

   <dd>

    <p>Scrolls the <a href=#current-default-path>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>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>()</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>(<var title="">path</var>)</dt>

   <dd>

    <p>Further constrains the clipping region to the <a href=#current-default-path>current
    default path</a> or the given path.</p>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-resetClip><a href=#dom-context-2d-resetclip>resetClip</a></code>()</dt>

   <dd>

    <p>Unconstrains the clipping region.</p>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">path</var>, <var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Returns true if the given point is in the <a href=#current-default-path>current default path</a> or the given path.</p>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-isPointInStroke><a href=#dom-context-2d-ispointinstroke>isPointInStroke</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-isPointInStroke><a href=#dom-context-2d-ispointinstroke>isPointInStroke</a></code>(<var title="">path</var>, <var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Returns true if the given point would be in the region covered by the stroke of the
    <a href=#current-default-path>current default path</a> or the given path, given the current stroke style.</p>

   </dd>

  </dl><div class=impl>

<!--CLEANUP-->
  <p>The <dfn id=dom-context-2d-beginpath title=dom-context-2d-beginPath><code>beginPath()</code></dfn>
  method must empty the list of subpaths in the context's
  <a href=#current-default-path>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><a href=#path>Path</a></code> argument, if one was
  provided, or the <a href=#current-default-path>current default path</a> otherwise.</p>

  <p>When the intended path is a <code><a href=#path>Path</a></code> object, the
  coordinates and lines of its subpaths must be transformed according
  to the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#transformations title=dom-context-2d-transformation>current transformation
  matrix</a> when used by these methods (without affecting the
  <code><a href=#path>Path</a></code> object itself). When the intended path is the
  <a href=#current-default-path>current default path</a>, it is not affected by the
  transform. (This is because transformations already affect the
  <a href=#current-default-path>current default path</a> when it is constructed, so
  applying it when it is painted as well would result in a double
  transformation.)</p>

  <p>The <dfn id=dom-context-2d-fill title=dom-context-2d-fill><code>fill()</code></dfn>
  method must fill all the subpaths of the intended path, using <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, and using the
  <a href=#fill-rule>fill rule</a> indicated by the <var title="">fillRule</var> argument. Open subpaths must be implicitly
  closed when being filled (without affecting the actual
  subpaths).</p>

  <p>The <dfn id=dom-context-2d-stroke title=dom-context-2d-stroke><code>stroke()</code></dfn> method
  must <a href=#trace-a-path title="trace a path">trace</a> the intended path,
  using the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object for the line
  styles, and then fill the resulting path using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute,
  using the <a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>non-zero winding rule</a>.</p>

  <p class=note>As a result of how the algorithm to <a href=#trace-a-path>trace a
  path</a> is defined, overlapping parts of the paths in one stroke
  operation are treated as if their union was what was painted.</p>

  <p class=note>The stroke <em><a href=#the-style-element>style</a></em> is affected by the
  transformation during painting, even if the intended path is the
  <a href=#current-default-path>current default path</a>.</p>

  <p>Paths, when filled or stroked, must be painted without affecting
  the <a href=#current-default-path>current default path</a> or any <code><a href=#path>Path</a></code>
  objects, and must be subject to <a href=#shadows title=shadows>shadow
  effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global
  alpha</a>, the <a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=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>

  <p>Zero-length line segments must be pruned before stroking a path.
  Subpaths with just one point must be ignored.</p>

  <hr><p id=dom-context-2d-drawosfocusring>The <dfn id=dom-context-2d-drawsystemfocusring title=dom-context-2d-drawSystemFocusRing><code>drawSystemFocusRing(<var title="">element</var>)</code></dfn> method, when invoked, must run
  the following steps:</p>

  <ol><li><p>If <var title="">element</var> is not focused or is not a
   descendant of the element with whose context the method is
   associated, then abort these steps.</li>

   <li>

    <p>If the user has requested the use of particular focus rings
    (e.g. high-contrast focus rings), or if the <var title="">element</var> would have a focus ring drawn around it,
    then draw a focus ring of the appropriate style along the intended
    path, following platform conventions.</p>

    <p class=note>Some platforms only draw focus rings around
    elements that have been focused from the keyboard, and not those
    focused from the mouse. Other platforms simply don't draw focus
    rings around some elements at all unless relevant accessibility
    features are enabled. This API is intended to follow these
    conventions. User agents that implement distinctions based on the
    manner in which the element was focused are encouraged to classify
    focus driven by the <code title=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 title=shadows>shadow effects</a>, the <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the
    <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global
    composition operators</a>, the <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attribute, the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute, or any of the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> members,
    but <em>should</em> be subject to
    the <a href=#clipping-region>clipping region</a>. (The effect of transformations
    is described above and varies based on which path is being
    used.)</p>

   </li>

   <li>

    <p>Optionally, run the appropriate step from the following list:</p>

    <dl><dt>If the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a></dt>

     <dd><p><a href=#inform>Inform the user</a> that the focus is at the location given by the
     intended path. User agents may wait until the next time the <a href=#event-loop>event loop</a> reaches its
     "update the rendering" step to optionally inform the user.</dd>

     <dt>Otherwise</dt>

     <dd><p>Add instructions to the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions>list of pending interface
     actions</a> that <a href=#inform>inform the user</a> that the focus is at the location of
     the bitmap given by the intended path.</dd>

    </dl></li>

  </ol><p>The <dfn id=dom-context-2d-drawcustomfocusring title=dom-context-2d-drawCustomFocusRing><code>drawCustomFocusRing(<var title="">element</var>)</code></dfn> method, when invoked, must run
  the following steps:</p>

  <ol><li><p>If <var title="">element</var> is not focused or is not a
   descendant of the element with whose context the method is
   associated, then return false and abort these steps.</li>

   <li><p>Let <var title="">result</var> be true.</li>

   <li>

    <p>If the user has requested the use of particular focus rings
    (e.g. high-contrast focus rings), then draw a focus ring of the
    appropriate style along the intended path, and set <var title="">result</var> to false.</p>

    <p>The focus ring should not be subject to the <a href=#shadows title=shadows>shadow effects</a>, the <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the
    <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global
    composition operators</a>, the <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attribute, the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute, or any of the <code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> members,
    but <em>should</em> be subject to
    the <a href=#clipping-region>clipping region</a>. (The effect of transformations
    is described above and varies based on which path is being
    used.)</p>

   </li>

   <li>

    <p>Optionally, run the appropriate step from the following list:</p>

    <dl><dt>If the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a></dt>

     <dd><p><a href=#inform>Inform the user</a> that the focus is at the location given by the
     intended path. The user agent may wait until the next time the <a href=#event-loop>event loop</a> reaches
     its "update the rendering" step to optionally inform the user.</dd>

     <dt>Otherwise</dt>

     <dd><p>Add instructions to the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions>list of pending interface
     actions</a> that <a href=#inform>inform the user</a> that the focus is at the location of
     the bitmap given by the intended path.</dd>

    </dl></li>

   <li><p>Return <var title="">result</var>.</li>

  </ol><p>The <dfn id=dom-context-2d-scrollpathintoview title=dom-context-2d-scrollPathIntoView><code>scrollPathIntoView()</code></dfn>
  method, when invoked, if the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> is <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a>, must run the following steps; and otherwise, must add
  instructions to the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions>list of pending interface actions</a>
  that run the following steps:</p>

  <ol><li><p>Let <var title="">the specified rectangle</var> be the rectangle of the bounding box of
   the intended path.</li>

   <li><p>Let <var title="">notional child</var> be a hypothetical element that is a rendered child
   of the <code><a href=#the-canvas-element>canvas</a></code> element whose dimensions are those of <var title="">the specified
   rectangle</var>.</li>

   <li><p><a href=#scroll-an-element-into-view title="scroll an element into view">Scroll <var title="">notional child</var> into
   view</a> with the <var title="">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 title="">the specified rectangle</var> of the canvas. If the
   <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode title=concept-canvas-context-bitmap-mode>context bitmap mode</a> was <a href=#concept-canvas-fixed title=concept-canvas-fixed>fixed</a> when the method was invoked, the user agent may wait
   until the next time the <a href=#event-loop>event loop</a> reaches its "update the rendering" step to
   optionally inform the user.</li>

  </ol><p class=note id=inform>"Inform the user", as used in this section, could mean calling a
  system accessibility API, which would notify assistive technologies such as magnification tools.
  To properly drive magnification based on a focus change, a system accessibility API driving a
  screen magnifier needs the bounds for the newly focused object. The methods above are intended to
  enable this by allowing the user agent to report the bounding box of the path used to render the
  focus ring as the bounds of the <var title="">element</var> element passed as an argument, if that
  element is focused, and the bounding box of the area to which the user agent is scrolling as the
  bounding box of the current selection.</p>

  <hr><!--CLEANUP--><p>The <dfn id=dom-context-2d-clip title=dom-context-2d-clip><code>clip()</code></dfn> method must create a new
  <dfn id=clipping-region>clipping region</dfn> by calculating the intersection of the current clipping region and the
  area described by the intended path, using the <a href=#fill-rule>fill rule</a> indicated by the <var title="">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>

  <!-- v6
   Jordan OSETE suggests:
    * support ways of extending the clipping region (union instead of intersection)
       - also "add", "subtract", "replace", "intersect" and "xor"
       - maybe just support creating unions, intersections, and other -ions of paths
  -->

  <p>The <dfn id=dom-context-2d-resetclip title=dom-context-2d-resetClip><code>resetClip()</code></dfn>
  method must create a new <a href=#clipping-region>clipping region</a> that is the largest infinite surface. The new clipping region replaces the
  current clipping region.</p>

  <hr><p>The <dfn id=dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath><code>isPointInPath()</code></dfn>
  method must return true if the point given by the <var title="">x</var> and <var title="">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>fill rule</a> indicated by the <var title="">fillRule</var> argument; and must
  return false otherwise. Points on the path itself must be considered
  to be inside the path. If either of the arguments is infinite or
  NaN, then the method must return false.</p>

  <hr><p>The <dfn id=dom-context-2d-ispointinstroke title=dom-context-2d-isPointInStroke><code>isPointInStroke()</code></dfn> method
  must return true if the point given by the <var title="">x</var> and <var title="">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 title="trace
  a path">tracing</a> the intended path, using the <a href=#dom-context-2d-fillrule-nonzero title=dom-context-2d-fillRule-nonzero>non-zero winding rule</a>, and using the
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object for the line styles; and must return false otherwise.
  Points on the resulting path must be considered to be inside the path. If either of the arguments
  is infinite or NaN, then the method must return false.</p>

  <hr></div>

  <div class=example id=drawCustomFocusRingExample>

   <p>This <code><a href=#the-canvas-element>canvas</a></code> element has a couple of checkboxes. The
   path-related commands are highlighted:</p>

   <pre>&lt;canvas height=400 width=750&gt;
 &lt;label&gt;&lt;input type=checkbox id=showA&gt; Show As&lt;/label&gt;
 &lt;label&gt;&lt;input type=checkbox id=showB&gt; Show Bs&lt;/label&gt;
 &lt;!-- ... --&gt;
&lt;/canvas&gt;
&lt;script&gt;
 function drawCheckbox(context, element, x, y, paint) {
   context.save();
   context.font = '10px sans-serif';
   context.textAlign = 'left';
   context.textBaseline = 'middle';
   var metrics = context.measureText(element.labels[0].textContent);
   if (paint) {
<strong>     context.beginPath();
     context.strokeStyle = 'black';
     context.rect(x-5, y-5, 10, 10);
     context.stroke();
</strong>     if (element.checked) {
<strong>       context.fillStyle = 'black';
       context.fill();
</strong>     }
     context.fillText(element.labels[0].textContent, x+5, y);
   }
<strong>   context.beginPath();
   context.rect(x-7, y-7, 12 + metrics.width+2, 14);
   if (paint &amp;&amp; context.drawCustomFocusRing(element)) {
     context.strokeStyle = 'silver';
     context.stroke();
   }
</strong>   context.restore();
 }
 function drawBase() { /* ... */ }
 function drawAs() { /* ... */ }
 function drawBs() { /* ... */ }
 function redraw() {
   var canvas = document.getElementsByTagName('canvas')[0];
   var context = canvas.getContext('2d');
   context.clearRect(0, 0, canvas.width, canvas.height);
   drawCheckbox(context, document.getElementById('showA'), 20, 40, true);
   drawCheckbox(context, document.getElementById('showB'), 20, 60, true);
   drawBase();
   if (document.getElementById('showA').checked)
     drawAs();
   if (document.getElementById('showB').checked)
     drawBs();
 }
 function processClick(event) {
   var canvas = document.getElementsByTagName('canvas')[0];
   var context = canvas.getContext('2d');
   var x = event.clientX;
   var y = event.clientY;
   var node = event.target;
   while (node) {
     x -= node.offsetLeft - node.scrollLeft;
     y -= node.offsetTop - node.scrollTop;
     node = node.offsetParent;
   }
   drawCheckbox(context, document.getElementById('showA'), 20, 40, false);
   if (<strong>context.isPointInPath(x, y)</strong>)
     document.getElementById('showA').checked = !(document.getElementById('showA').checked);
   drawCheckbox(context, document.getElementById('showB'), 20, 60, false);
   if (<strong>context.isPointInPath(x, y)</strong>)
     document.getElementById('showB').checked = !(document.getElementById('showB').checked);
   redraw();
 }
 document.getElementsByTagName('canvas')[0].addEventListener('focus', redraw, true);
 document.getElementsByTagName('canvas')[0].addEventListener('blur', redraw, true);
 document.getElementsByTagName('canvas')[0].addEventListener('change', redraw, true);
 document.getElementsByTagName('canvas')[0].addEventListener('click', processClick, false);
 redraw();
&lt;/script&gt;</pre>
<!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/340 -->

  </div>



  <h6 id=drawing-images><span class=secno>4.8.11.2.14 </span>Drawing images</h6>

  <p>To draw images, the <dfn id=dom-context-2d-drawimage title=dom-context-2d-drawImage><code>drawImage</code></dfn> method
  can be used.</p>

  <div class=impl>

  <p>This method can be invoked with three different sets of arguments:</p>

  <ul class=brief><li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>)</code>
   <li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
   <li><code title="">drawImage(<var title="">image</var>, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
  </ul></div>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>)</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var title="">image</var>, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</dt>

   <dd>

    <p>Draws the given image onto the canvas. The arguments are
    interpreted as follows:</p>

    <p><img src=http://images.whatwg.org/drawImage.png width=356 alt="The sx and sy parameters give the x and y coordinates of the source rectangle; the sw and sh arguments give the width and height of the source rectangle; the dx and dy give the x and y coordinates of the destination rectangle; and the dw and dh arguments give the width and height of the destination rectangle." height=356></p>

    <p>If the image isn't yet fully decoded, then nothing is drawn. If the image is a canvas with no data, throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>

   </dd>

  </dl><div class=impl>

  <p>When the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method is invoked, the user
  agent must run the following steps:</p>

  <ol><li><p><a href=#check-the-usability-of-the-image-argument>Check the usability of the <var title="">image</var> argument</a>. If this
   returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;
   abort these steps. If it returns <i>bad</i>, then abort these steps without drawing anything.
   Otherwise it returns <i>good</i>; continue with these steps.</li>

   <li>

    <p>Establish the source and destination rectangles as follows:</p>

    <p>If not specified, the <var title="">dw</var> and <var title="">dh</var> arguments must
    default to the values of <var title="">sw</var> and <var title="">sh</var>, interpreted such
    that one CSS pixel in the image is treated as one unit in the <a href=#scratch-bitmap>scratch bitmap</a>'s
    coordinate space. If the <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>,
    and <var title="">sh</var> arguments are omitted, they must default to 0, 0, the image's
    intrinsic width in image pixels, and the image's intrinsic height in image pixels, respectively.
    If the image has no intrinsic dimensions, the <i>concrete object size</i> must be used instead,
    as determined using the CSS "<a href=http://dev.w3.org/csswg/css3-images/#default-sizing>Concrete Object Size Resolution</a>"
    algorithm, with the <i>specified size</i> having neither a definite width nor height, nor any
    additional contraints, the object's intrinsic properties being those of the <var title="">image</var> argument, and the <i><a href=#default-object-size>default object size</a></i> being the size of the
    <a href=#scratch-bitmap>scratch bitmap</a>. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

    <p>The source rectangle is the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>),
    (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>).</p>

    <p>The destination rectangle is the rectangle whose corners are the four points (<var title="">dx</var>, <var title="">dy</var>), (<span title=""><var title="">dx</var>+<var title="">dw</var></span>, <var title="">dy</var>), (<span title=""><var title="">dx</var>+<var title="">dw</var></span>, <span title=""><var title="">dy</var>+<var title="">dh</var></span>),
    (<var title="">dx</var>, <span title=""><var title="">dy</var>+<var title="">dh</var></span>).</p>

    <p>When the source rectangle is outside the source image, the source rectangle must be clipped
    to the source image and the destination rectangle must be clipped in the same proportion.</p>

    <p class=note>When the destination rectangle is outside the destination image (the
    <a href=#scratch-bitmap>scratch bitmap</a>), the pixels that land outside the <a href=#scratch-bitmap>scratch bitmap</a> are
    discarded, as if the destination was an infinite canvas whose rendering was clipped to the
    dimensions of the <a href=#scratch-bitmap>scratch bitmap</a>.</p>

   </li>

   <li><p>If one of the <var title="">sw</var> or <var title="">sh</var> arguments is zero, abort
   these steps. Nothing is painted.</li>

   <li>

    <p>Paint the region of the <var title="">image</var> argument specified by the source rectangle
    on the region of the rendering context's <a href=#scratch-bitmap>scratch bitmap</a> specified by the
    destination rectangle, after applying the <a href=#transformations title=dom-context-2d-transformation>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. <!-- note: that last sentence has several times been needed to correct people who
    suggested that 5,5,-2,-2 was different than 3,3,2,2 --></p>

    <p>When scaling up, if the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
    attribute is set to true, the user agent should attempt to apply a smoothing algorithm to
    the image data when it is scaled. Otherwise, the image must be rendered using nearest-neighbor
    interpolation.</p>

    <p class=note>This specification does not define the precise algorithm to use when scaling an
    image down, or when scaling an image up when the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
    attribute is set to true.</p>

    <p class=note>When a <code><a href=#the-canvas-element>canvas</a></code> or <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is
    drawn onto itself, the <a href=#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><a href=#the-canvas-element>canvas</a></code> or <a href=#scratch-bitmap>scratch
    bitmap</a> onto overlapping parts of itself.</p>

    <p>If the original image data is a bitmap image, the value painted at a point in the destination
    rectangle is computed by filtering the original image data. The user agent may use any filtering
    algorithm (for example bilinear interpolation or nearest-neighbor). When the filtering algorithm
    requires a pixel value from outside the original image data, it must instead use the value from
    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.) When the filtering
    algorithm requires a pixel value from outside the source rectangle but inside the original image
    data, then the value from the original image data must be used.</p>
    <!-- see CORE-32111 and:
         http://krijnhoetmer.nl/irc-logs/whatwg/20100818#l-737
         http://www.w3.org/Bugs/Public/show_bug.cgi?id=10799#c11
    -->
    <!-- createPattern() has a similar paragraph with different rules -->

    <p class=note>Thus, scaling an image in parts or in whole will have the same effect. This does
    mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in
    the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is
    surrounded by a border of transparent black, or by copying sprites to be scaled into temporary
    <code><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 title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global
    alpha</a>, the <a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition operators</a>.</p>

   </li>

<!--ADD-TOPIC:Security-->
   <li><p>If <a href=#the-image-argument-is-not-origin-clean>the <var title="">image argument</var> is not origin-clean</a>, set the
   <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag
   to false.</li>
<!--REMOVE-TOPIC:Security-->

  </ol></div>


  <h6 id=hit-regions><span class=secno>4.8.11.2.15 </span>Hit regions</h6>

  <p>A <dfn id=hit-region-list>hit region list</dfn> is a list of <a href=#hit-region title="hit region">hit regions</a> for a
  bitmap.</p>

  <p>Each <dfn id=hit-region>hit region</dfn> consists of the following information:</p>

  <ul><li><p>A <dfn id="hit-region's-set-of-pixels" title="hit region's set of pixels">set of pixels</dfn> on the bitmap for which this
   region is responsible.</li>

   <li><p>A <dfn id="hit-region's-bounding-circumference" title="hit region's bounding circumference">bounding circumference</dfn> on the
   bitmap that surrounds the <a href="#hit-region's-set-of-pixels">hit region's set of pixels</a> as they stood when it was
   created.</li>

   <li><p>Optionally, a non-empty string representing an <dfn id="hit-region's-id" title="hit region's ID">ID</dfn> for
   distinguishing the region from others.</li> <!-- cannot be the empty string -->

   <li><p>Optionally, a reference to another region that acts as the <dfn id="hit-region's-parent" title="hit region's
   parent">parent</dfn> for this one.</li>

   <li><p>A count of regions that have this one as their <a href="#hit-region's-parent" title="hit region's
   parent">parent</a>, known as the <dfn id="hit-region's-child-count">hit region's child count</dfn>.</li>

   <li><p>A <dfn id="hit-region's-cursor-specification" title="hit region's cursor specification">cursor specification</dfn>, in the form
   of either a CSS cursor value, or the string "<code title="">inherit</code>" meaning that the
   cursor of the <a href="#hit-region's-parent">hit region's parent</a>, if any, or of the <code><a href=#the-canvas-element>canvas</a></code> element, if
   not, is to be used instead.</li>

   <li>

    <p>Optionally, either a <a href="#hit-region's-control" title="hit region's control">control</a>, or an <a href="#hit-region's-unbacked-region-description" title="hit region's unbacked region description">unbacked region description</a>.</p>

    <p>A <dfn id="hit-region's-control" title="hit region's control">control</dfn> is just a reference to an
    <code><a href=#element>Element</a></code> node, to which, in certain conditions, the user agent will route events,
    and from which the user agent will determine the state of the hit region for the purposes of
    accessibility tools. (The control is ignored when it is not a descendant of the
    <code><a href=#the-canvas-element>canvas</a></code> element.)</p>

    <p>An <dfn id="hit-region's-unbacked-region-description" title="hit region's unbacked region description">unbacked region description</dfn>
    consists of the following:</p>

    <ul class=brief><li><p>Optionally, a <dfn id="hit-region's-label" title="hit region's label">label</dfn>.</p>

     <li><p>An <dfn id="hit-region's-aria-role" title="hit region's ARIA role">ARIA role</dfn>, which, if the <a href="#hit-region's-unbacked-region-description" title="hit
     region's unbacked region description">unbacked region description</a> also has a label,
     could be the empty string.</li>

    </ul></li>

  </ul><dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-addHitRegion><a href=#dom-context-2d-addhitregion>addHitRegion</a></code>(<var title="">options</var>)</dt>

   <dd>

    <p>Adds a hit region to the bitmap. The argument is an object with the following members:</p>

    <dl><dt><code title=dom-HitRegionOptions-path>path</code> (default null)

     <dd>A <code><a href=#path>Path</a></code> object that describes the pixels that form part of the region. If this
     member is not provided or is set to null, the <a href=#current-default-path>current default path</a> is used
     instead.</dd>

     <dt><code title=dom-HitRegionOptions-fillRule>fillRule</code> (default "<code title=dom-context-2d-fillRule-nonzero><a href=#dom-context-2d-fillrule-nonzero>nonzero</a></code>")

     <dd>The <a href=#fill-rule>fill rule</a> to use when determining which pixels are inside the path.</dd>

<!--
     <dt><code title="dom-HitRegionOptions-transform">transform</code> (default null)

     <dd>An <code>SVGMatrix</code> object that describes a
     transformation to apply to the path described by the <code
     title="dom-HitRegionOptions-path">path</code> member.</dd>
-->

     <dt><code title=dom-HitRegionOptions-id>id</code> (default empty string) <!-- empty string is treated as null internally -->

     <dd>The ID to use for this region. This is used in <code><a href=#mouseevent>MouseEvent</a></code> events on the
     <code><a href=#the-canvas-element>canvas</a></code> (<code title=dom-MouseEvent-region><a href=#dom-mouseevent-region>event.region</a></code>) and as a way to
     reference this region in later calls to <code title=dom-context-2d-addHitRegion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.</dd>

     <dt><code title=dom-HitRegionOptions-parentID>parentID</code> (default null)

     <dd>The ID of the parent region, for purposes of navigation by accessibility tools and for
     cursor fallback.</dd>

     <dt><code title=dom-HitRegionOptions-cursor>cursor</code> (default "<code title="">inherit</code>")

     <dd>The cursor to use when the mouse is over this region. The value "<code title="">inherit</code>" means to use the cursor for the parent region (as specified by the
     <code title=dom-HitRegionOptions-parentID>parentID</code> member), if any, or to use the
     <code><a href=#the-canvas-element>canvas</a></code> element's cursor if the region has no parent.</dd>

     <dt><code title=dom-HitRegionOptions-control>control</code> (default null)

     <dd>An element (that is a descendant of the <code><a href=#the-canvas-element>canvas</a></code>) to which events are to be
     routed, and which accessibility tools are to use as a surrogate for describing and interacting
     with this region.</dd>

     <dt><code title=dom-HitRegionOptions-label>label</code> (default null)

     <dd>A text label for accessibility tools to use as a description of this region, if there is no
     control.</dd>

     <dt><code title=dom-HitRegionOptions-role>role</code> (default null)

     <dd>An ARIA role for accessibility tools to use to determine how to represent this region, if
     there is no control.</dd>

    </dl><p>Hit regions can be used for a variety of purposes:</p>

    <ul><li>With an ID, they can make hit detection easier by having the user agent check which region
     the mouse is over and include the ID in the mouse events.</li>

     <li>With a control, they can make routing events to DOM elements automatic, allowing e.g.
     clicks on a <code><a href=#the-canvas-element>canvas</a></code> to automatically submit a form via a <code><a href=#the-button-element>button</a></code>
     element.</li>

     <li>With a label, they can make it easier for users to explore a <code><a href=#the-canvas-element>canvas</a></code> without
     seeing it, e.g. by touch on a mobile device.</li>

     <li>With a cursor, they can make it easier for different regions of the <code><a href=#the-canvas-element>canvas</a></code> to
     have different cursors, with the user agent automatically switching between them.</li>

    </ul></dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-removeHitRegion><a href=#dom-context-2d-removehitregion>removeHitRegion</a></code>(<var title="">id</var>)</dt>

   <dd>

    <p>Removes a hit region (and all its descendants) from the canvas bitmap. The argument is the ID
    of a region added using <code title=dom-context-2d-addHitRegion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.</p>

    <p>The pixels that were covered by this region and its descendants are effectively cleared by
    this operation, leaving the regions non-interactive. In particular, regions that occupied the
    same pixels before the removed regions were added, overlapping them, do not resume their
    previous role.</p>

   </dd>

  </dl><div class=impl>

  <p>A <a href=#hit-region>hit region</a> <var title="">A</var> is an <dfn id=ancestor-region>ancestor region</dfn> of a <a href=#hit-region>hit
  region</a> <var title="">B</var> if <var title="">B</var> has a <a href="#hit-region's-parent" title="hit region's
  parent">parent</a> and its <a href="#hit-region's-parent" title="hit region's parent">parent</a> is either <var title="">A</var> or another <a href=#hit-region>hit region</a> for which <var title="">A</var> is an
  <a href=#ancestor-region>ancestor region</a>.</p>

  <p><dfn id=the-region-identified-by-the-id>The region identified by the ID</dfn> <var title="">ID</var> in a bitmap <var title="">bitmap</var> is the value returned by the following algorithm (which can return a
  <a href=#hit-region>hit region</a> or nothing):</p>

  <ol><li><p>If <var title="">ID</var> is null, return nothing and abort these steps.</li> <!-- this step is redundant but makes sure people don't confuse 'null' for 'not having an ID' -->

   <li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region list</a> associated with <var title="">bitmap</var>.</li>

   <li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-id" title="hit
   region's ID">ID</a> is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">ID</var>, then
   return that <a href=#hit-region>hit region</a> and abort these steps.</li>

   <li><p>Otherwise, return nothing.</li>

  </ol><p><dfn id=the-region-representing-the-control>The region representing the control</dfn> <var title="">control</var> for a bitmap <var title="">bitmap</var> is the value returned by the following algorithm (which can return a
  <a href=#hit-region>hit region</a> or nothing):</p>

  <ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region list</a> associated with <var title="">bitmap</var>.</li>

   <li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-control" title="hit
   region's control">control</a> is <var title="">control</var>, then return that <a href=#hit-region>hit
   region</a> and abort these steps.</li>

   <li><p>Otherwise, return nothing.</li>

  </ol><p><dfn id=the-control-represented-by-a-region>The control represented by a region</dfn> <var title="">region</var> for a
  <code><a href=#the-canvas-element>canvas</a></code> element <var title="">ancestor</var> is the value returned by the following
  algorithm (which can return an element or nothing):</p>

  <ol><li><p>If <var title="">region</var> has no <a href="#hit-region's-control" title="hit region's control">control</a>,
   return nothing and abort these steps.</li>

   <li><p>Let <var title="">control</var> be <var title="">region</var>'s <a href="#hit-region's-control" title="hit region's
   control">control</a>.</li>

   <li><p>If <var title="">control</var> is not a descendant of <var title="">ancestor</var>, then
   return nothing and abort these steps.</li>

   <li><p>Otherwise, return <var title="">control</var>.</li>

  </ol><p><dfn id=the-cursor-for-a-hit-region>The cursor for a hit region</dfn> <var title="">region</var> of a <code><a href=#the-canvas-element>canvas</a></code>
  element <var title="">ancestor</var> is the value returned by the following algorithm:</p>

  <ol><li><p><i>Loop</i>: If <var title="">region</var> has a <a href="#hit-region's-cursor-specification" title="hit region's cursor
   specification">cursor specification</a> other than "<code title="">inherit</code>", then
   return that <a href="#hit-region's-cursor-specification">hit region's cursor specification</a> and abort these steps.</li>

   <li><p>If <var title="">region</var> has a <a href="#hit-region's-parent" title="hit region's parent">parent</a>, then
   let <var title="">region</var> be that <a href="#hit-region's-parent">hit region's parent</a>, and return to the step
   labeled <i>loop</i>.</li>

   <li><p>Otherwise, return the used value of the 'cursor' property for the <code><a href=#the-canvas-element>canvas</a></code>
   element, if any; if there isn't one, return 'auto'. <a href=#refsCSSUI>[CSSUI]</a></li>

  </ol><p><dfn id=the-region-for-a-pixel>The region for a pixel</dfn> <var title="">pixel</var> on a bitmap <var title="">bitmap</var> is the value returned by the following algorithm (which can return a
  <a href=#hit-region>hit region</a> or nothing):</p>

  <ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region list</a> associated with <var title="">bitmap</var>.</li>

   <li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-set-of-pixels" title="hit
   region's set of pixels">set of pixels</a> contains <var title="">pixel</var>, then return that
   <a href=#hit-region>hit region</a> and abort these steps.</li>

   <li><p>Otherwise, return nothing.</li>

  </ol><p>To <dfn id=clear-regions-that-cover-the-pixels>clear regions that cover the pixels</dfn> <var title="">pixels</var> on a bitmap <var title="">bitmap</var>, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region list</a> associated with <var title="">bitmap</var>.</li>

   <li><p>Remove all pixels in <var title="">pixels</var> from the <a href="#hit-region's-set-of-pixels" title="hit region's set of
   pixels">set of pixels</a> of each <a href=#hit-region>hit region</a> in <var title="">list</var>.</li>

   <li><p><a href=#garbage-collect-the-regions>Garbage-collect the regions</a> of <var title="">bitmap</var>.</li>

  </ol><p>To <dfn id=garbage-collect-the-regions>garbage-collect the regions</dfn> of a bitmap <var title="">bitmap</var>, the user
  agent must run the following steps:</p>

  <ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region list</a> associated with <var title="">bitmap</var>.</li>

   <li><p><i>Loop</i>: Let <var title="">victim</var> be the first <a href=#hit-region>hit region</a> in <var title="">list</var> to have an empty <a href="#hit-region's-set-of-pixels" title="hit region's set of pixels">set of
   pixels</a> and a zero <a href="#hit-region's-child-count" title="hit region's child count">child count</a>, if any. If
   there is no such <a href=#hit-region>hit region</a>, abort these steps.</li>

   <li><p>If <var title="">victim</var> has a <a href="#hit-region's-parent" title="hit region's parent">parent</a>, then
   decrement that <a href="#hit-region's-child-count">hit region's child count</a> by one.</li>

   <li><p>Remove <var title="">victim</var> from <var title="">list</var>.</li>

   <li><p>Jump back to the step labeled <i>loop</i>.</li>

  </ol><p class=note>Adding a new region and calling <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code> are the two ways this clearing algorithm can
  be invoked. The <a href=#hit-region-list>hit region list</a> itself is also reset when the rendering context is
  reset, e.g. when a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is bound to or unbound from a
  <code><a href=#the-canvas-element>canvas</a></code>, or when the dimensions of the bitmap are changed.</p>

  <hr><p>When the <dfn id=dom-context-2d-addhitregion title=dom-context-2d-addHitRegion><code>addHitRegion()</code></dfn> method is
  invoked, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">arguments</var> be the dictionary object provided as the method's
   argument.</li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-path>path</code> member is not null, let <var title="">source
   path</var> be the <code title=dom-HitRegionOptions-path>path</code> member's value. Otherwise,
   let it be the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#current-default-path>current default
   path</a>.</li>

<!--
   <li><p>If the <var title="">arguments</var> object's <code
   title="dom-HitRegionOptions-path">path</code> member is null, but
   the <code title="dom-HitRegionOptions-transform">transform</code>
   member is not, then throw a <code>NotSupportedError</code>
   exception and abort these steps.</p></li>

   <li><p>Transform all the coordinates and lines in <var
   title="">source path</var> by the transform matrix given by the
   <var title="">arguments</var> object's <code
   title="dom-HitRegionOptions-transform">transform</code> member, if
   it is not null.</p></li>
-->

   <li><p>Transform all the coordinates and lines in <var title="">source path</var> by the current
   transform matrix, if the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-path>path</code> member is not null.</li>

   <li><p>Let <var title="">specified pixels</var> be the pixels contained in <var title="">source
   path</var>, using the <a href=#fill-rule>fill rule</a> indicated by the <code title=dom-HitRegionOptions-fillRule>fillRule</code> member.</li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-id>id</code> member is the empty string, let it be null
   instead.</li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-id>id</code> member is not null, then let <var title="">previous
   region for this ID</var> be <a href=#the-region-identified-by-the-id>the region identified by the ID</a> given by the <code title=dom-HitRegionOptions-id>id</code> member's value in this <a href=#scratch-bitmap>scratch bitmap</a>, if
   any. If the <code title=dom-HitRegionOptions-id>id</code> member is null or no such region
   currently exists, let <var title="">previous region for this ID</var> be null.</li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-parent>parent</code> member is the empty string, let it be null
   instead.</li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-parent>parent</code> member is not null, then let <var title="">parent region</var> be <a href=#the-region-identified-by-the-id>the region identified by the ID</a> given by the <code title=dom-HitRegionOptions-parent>parent</code> member's value in the <a href=#scratch-bitmap>scratch
   bitmap</a>, if any. If the <code title=dom-HitRegionOptions-parent>parent</code> member is
   null or no such region currently exists, let <var title="">parent region</var> be null.</li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-label>label</code> member is the empty string, let it be null
   instead.</li>

   <li>

    <p>If any of the following conditions are met, throw a <code><a href=#notsupportederror>NotSupportedError</a></code> exception
    and abort these steps.</p>

    <ul class=brief><!--
     <li>The <var title="">arguments</var> object's <code
     title="dom-HitRegionOptions-path">path</code> member is null, but
     its <code title="dom-HitRegionOptions-transform">transform</code>
     member is not.</li>
--><li>The <var title="">arguments</var> object's <code title=dom-HitRegionOptions-control>control</code> and <code title=dom-HitRegionOptions-label>label</code> members are both non-null.</li>

     <li>The <var title="">arguments</var> object's <code title=dom-HitRegionOptions-control>control</code> and <code title=dom-HitRegionOptions-role>role</code> members are both non-null.</li>

     <li>The <var title="">arguments</var> object's <code title=dom-HitRegionOptions-role>role</code> member's value is the empty string, and the <code title=dom-HitRegionOptions-label>label</code> member's value is either null or the empty
     string.</li>

     <li>The <var title="">specified pixels</var> has no pixels.</li>

     <li>The <var title="">arguments</var> object's <code title=dom-HitRegionOptions-control>control</code> member is not null but is neither an
     <code><a href=#the-a-element>a</a></code> element that <a href=#represents>represents</a> a <a href=#hyperlink>hyperlink</a>, a
     <code><a href=#the-button-element>button</a></code> element, an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> or <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio
     Button</a> states, nor an <code><a href=#the-input-element>input</a></code> element that is a <a href=#concept-button title=concept-button>button</a>.</li>

     <li>The <var title="">parent region</var> is not null but has a <a href="#hit-region's-control" title="hit region's
     control">control</a>.</li>

     <li>The <var title="">previous region for this ID</var> is the same <a href=#hit-region>hit region</a> as
     the <var title="">parent region</var>.</li>

     <li>The <var title="">previous region for this ID</var> is an <a href=#ancestor-region>ancestor region</a> of
     the <var title="">parent region</var>.</li>

    </ul></li>

   <li><p>If the <code title=dom-HitRegionOptions-parent>parent</code> member is not null but <var title="">parent region</var> is null, then throw a <code><a href=#notfounderror>NotFoundError</a></code> exception and abort
   these steps.</li>

   <li>

    <p>If any of the following conditions are met, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and
    abort these steps.</p>

    <ul class=brief><li>The <var title="">arguments</var> object's <code title=dom-HitRegionOptions-cursor>cursor</code> member is not null but is neither an
     <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">inherit</code>", nor a
     valid CSS 'cursor' property value. <a href=#refsCSSUI>[CSSUI]</a></li>

     <li>The <var title="">arguments</var> object's <code title=dom-HitRegionOptions-role>role</code> member is not null but its value is not an
     <a href=#ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</a> whose tokens are all
     <a href=#case-sensitive>case-sensitive</a> matches for names of non-abstract WAI-ARIA roles. <a href=#refsARIA>[ARIA]</a></li>

    </ul></li>

   <li>

    <p>Let <var title="">region</var> be a newly created <a href=#hit-region>hit region</a>, with its
    information configured as follows:</p>

    <dl><dt><a href="#hit-region's-set-of-pixels">Hit region's set of pixels</a>

     <dd><p>The <var title="">specified pixels</var>


     <dt><a href="#hit-region's-bounding-circumference">Hit region's bounding circumference</a>

     <dd><p>A user-agent-defined shape that wraps the pixels contained in <var title="">source
     path</var>. (In the simplest case, this can just be the bounding rectangle; this specification
     allows it to be any shape in order to allow other interfaces.)


     <dt><a href="#hit-region's-id">Hit region's ID</a>

     <dd><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-id>id</code> member is not null: the value of the <code title=dom-HitRegionOptions-id>id</code> member. Otherwise, <var title="">region</var> has no
     <a href="#hit-region's-id" title="hit region's id">id</a>.


     <dt><a href="#hit-region's-parent">Hit region's parent</a>

     <dd><p>If <var title="">parent region</var> is not null: <var title="">parent region</var>.
     Otherwise, <var title="">region</var> has no <a href="#hit-region's-parent" title="hit region's parent">parent</a>.


     <dt><a href="#hit-region's-child-count">Hit region's child count</a>

     <dd><p>Initially zero.


     <dt><a href="#hit-region's-cursor-specification">Hit region's cursor specification</a>

     <dd><p>If <var title="">parent region</var> is not null: <var title="">parent region</var>.
     Otherwise, <var title="">region</var> has no <a href="#hit-region's-parent" title="hit region's parent">parent</a>.


     <dt><a href="#hit-region's-control">Hit region's control</a>

     <dd><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-control>control</code> member is not null: the value of the <code title=dom-HitRegionOptions-control>control</code> member. Otherwise, <var title="">region</var> has no <a href="#hit-region's-control" title="hit region's control">control</a>.


     <dt><a href="#hit-region's-label">Hit region's label</a>

     <dd><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-label>label</code> member is not null: the value of the <code title=dom-HitRegionOptions-label>label</code> member. Otherwise, <var title="">region</var>
     has no <a href="#hit-region's-label" title="hit region's label">label</a>.


     <dt><a href="#hit-region's-aria-role">Hit region's ARIA role</a>

     <dd><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-role>role</code> member is not null: the value of the <code title=dom-HitRegionOptions-role>role</code> member (which might be the empty string).
     Otherwise, if the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-label>label</code> member is not null: the empty string.
     Otherwise, <var title="">region</var> has no <a href="#hit-region's-aria-role" title="hit region's ARIA role">ARIA
     role</a>.


    </dl></li>

   <li>

    <p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-cursor>cursor</code> member is not null, then act as if a CSS rule
    for the <code><a href=#the-canvas-element>canvas</a></code> element setting its 'cursor' property had been seen, whose value was
    the <a href="#hit-region's-cursor-specification">hit region's cursor specification</a>.</p>

    <p class=note>For example, if the user agent prefetches cursor values, this would cause that
    to happen in response to an appropriately-formed <code title=dom-context-2d-addHitRegion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code> call.</p>

   </li>

   <li><p>If the <var title="">arguments</var> object's <code title=dom-HitRegionOptions-control>control</code> member is not null, then let <var title="">previous region for the control</var> be <a href=#the-region-representing-the-control>the region representing the
   control</a> given by the <code title=dom-HitRegionOptions-control>control</code> member's
   value for this <a href=#scratch-bitmap>scratch bitmap</a>, if any. If the <code title=dom-HitRegionOptions-control>control</code> member is null or no such region currently
   exists, let <var title="">previous region for the control</var> be null.</li>

   <!-- the parent region can't have a control, because no region with a control can be a parent -
   we check for that above. Thus, it is safe to remove the previous region for the control without
   worrying that our parent is going to be affected.

   It's also safe to remove the previous region with this ID and all its descendants, as we know
   that our parent isn't part of that subtree. -->

   <li><p>If there is a <var title="">previous region with this control</var>, remove it from the
   <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#hit-region-list>hit region list</a>; then, if it had a <a href="#hit-region's-parent" title="hit
   region's parent">parent</a> region, decrement that <a href="#hit-region's-child-count">hit region's child count</a> by
   one.</li> <!-- we garbage collect the regions below -->

   <li><p>If there is a <var title="">previous region with this ID</var>, remove it, and all <a href=#hit-region title="hit region">hit regions</a> for which it is an <a href=#ancestor-region>ancestor region</a>, from the
   <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#hit-region-list>hit region list</a>; then, if it had a <a href="#hit-region's-parent" title="hit
   region's parent">parent</a> region, decrement that <a href="#hit-region's-child-count">hit region's child count</a> by
   one.</li> <!-- we garbage collect the regions below -->

   <li><p>If there is a <var title="">parent region</var>, increment its <a href="#hit-region's-child-count">hit region's child
   count</a> by one.</li>

   <li><p><a href=#clear-regions-that-cover-the-pixels>Clear regions that cover the pixels</a> in <var title="">region</var>'s <a href="#hit-region's-set-of-pixels" title="hit region's set of pixels">set of pixels</a> on this <a href=#scratch-bitmap>scratch
   bitmap</a>.</li> <!-- this is what garbage collects the earlier regions -->

   <li><p>Add <var title="">region</var> to the <a href=#scratch-bitmap>scratch bitmap</a>'s element's <a href=#hit-region-list>hit
   region list</a>.</li>

  </ol><p>When the <dfn id=dom-context-2d-removehitregion title=dom-context-2d-removeHitRegion><code>removeHitRegion()</code></dfn>
  method is invoked, the user agent must run the following steps:</p>

  <ol><li>

    <p>Let <var title="">region</var> be <a href=#the-region-identified-by-the-id>the region identified by the ID</a> given by the
    method's argument in the rendering context's <a href=#scratch-bitmap>scratch bitmap</a>. If no such region
    currently exists, abort these steps.</p>

    <p class=note>If the method's argument is the empty string, then no region will match.</p>

   </li>

   <li><p>Remove <var title="">region</var>, and all <a href=#hit-region title="hit region">hit regions</a> for
   which it is an <a href=#ancestor-region>ancestor region</a>, from the rendering context's <a href=#scratch-bitmap>scratch
   bitmap</a>'s <a href=#hit-region-list>hit region list</a>; then, if it had a <a href="#hit-region's-parent" title="hit region's
   parent">parent</a> region, decrement that <a href="#hit-region's-child-count">hit region's child count</a> by
   one.</li> <!-- we garbage collect the regions below -->

   <li><p><a href=#garbage-collect-the-regions>Garbage-collect the regions</a> of the rendering context's <a href=#scratch-bitmap>scratch
   bitmap</a>.</li>

  </ol></div>

  <hr><p>The <code><a href=#mouseevent>MouseEvent</a></code> interface is extended to support hit
  regions:</p>

  <pre class=idl>partial interface <a href=#mouseevent id=MouseEvent-partial>MouseEvent</a> {
  readonly attribute DOMString? <a href=#dom-mouseevent-region title=dom-MouseEvent-region>region</a>;
};

partial dictionary <a href=#mouseeventinit>MouseEventInit</a> {
  DOMString? region;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-MouseEvent-region><a href=#dom-mouseevent-region>region</a></code></dt>

   <dd>

    <p>If the mouse was over a <a href=#hit-region>hit region</a>, then this returns the <a href="#hit-region's-id">hit region's ID</a>, if it has one.</p>

    <p>Otherwise, returns null.</p>

   </dd>

  </dl><div class=impl>

<!--CLEANUP-->
  <p>The <dfn id=dom-mouseevent-region title=dom-MouseEvent-region><code>region</code></dfn>
  attribute on <code><a href=#mouseevent>MouseEvent</a></code> objects must return the value
  it was initialized to. When the object is created, this attribute
  must be initialized to null. It represents the <a href="#hit-region's-id">hit region's
  ID</a> if the mouse was over a hit region when the event was
  fired.</p>

  <p>When a <code><a href=#mouseevent>MouseEvent</a></code> is to be fired at a <code><a href=#the-canvas-element>canvas</a></code> element by the user
  agent in response to a pointing device action, if the <code><a href=#the-canvas-element>canvas</a></code> element has a <a href=#hit-region-list>hit
  region list</a>, the user agent must instead follow these steps. If these steps say to <i>act
  as normal</i>, that means that the event must be fired as it would have had these requirements not
  been applied.</p>

  <ol><li><p>If the pointing device is not indicating a pixel on the
   <code><a href=#the-canvas-element>canvas</a></code>, act as normal and abort these steps.</li>

   <li><p>Let <var title="">pixel</var> be the pixel indicated by the
   pointing device.</li>

   <li><p>Let <var title="">region</var> be the <a href=#hit-region>hit
   region</a> that is <a href=#the-region-for-a-pixel title="the region for a pixel">the
   region for the pixel</a> <var title="">pixel</var> on this
   <code><a href=#the-canvas-element>canvas</a></code> element's bitmap, if any.</li>

   <li><p>If there is no <var title="">region</var>, then act as
   normal and abort these steps.</li>

   <li><p>Let <var title="">id</var> be the <var title="">region</var>'s <a href="#hit-region's-id" title="hit region's ID">ID</a>, if
   any.</li>

   <li><p>If there is an <var title="">id</var>, then initialize the
   event object's <code title=dom-MouseEvent-region><a href=#dom-mouseevent-region>region</a></code>
   attribute to <var title="">id</var>.</li>

   <li><p>Let <var title="">control</var> be the <a href=#the-control-represented-by-a-region title="the control represented by a
   region">control represented by</a> <var title="">region</var> for this <code><a href=#the-canvas-element>canvas</a></code>
   element, if any.</li>

   <li><p>If there is a <var title="">control</var>, then target the
   event object at <var title="">control</var> instead of the
   <code><a href=#the-canvas-element>canvas</a></code> element.</li>

   <li><p>Continue dispatching the event, but with the updated event
   object and target as given in the above steps.</li>

  </ol><hr><p>When a user's pointing device cursor is positioned over a <code><a href=#the-canvas-element>canvas</a></code> element, user
  agents should render the pointing device cursor according to the cursor specification described by
  <a href=#the-cursor-for-a-hit-region title="the cursor for a hit region">the cursor for the hit region</a> that is <a href=#the-region-for-a-pixel title="the region for a pixel">the region for the pixel</a> that the pointing device designates
  on the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap.</p>

  <hr><p>User agents are encouraged to make use of the information present
  in a <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#hit-region-list>hit region list</a> to
  improve the accessibility of <code><a href=#the-canvas-element>canvas</a></code> elements.</p>

  <p>Each <a href=#hit-region>hit region</a> should be handled in a fashion
  equivalent to a node in a virtual DOM tree rooted at the
  <code><a href=#the-canvas-element>canvas</a></code> element. The hierarchy of this virtual DOM tree
  must match the hierarchy of the <a href=#hit-region title="hit region">hit
  regions</a>, as described by the <a href="#hit-region's-parent" title="hit region's
  parent">parent</a> of each region. Regions without a <a href="#hit-region's-parent" title="hit region's parent">parent</a> must be treated as
  children of the <code><a href=#the-canvas-element>canvas</a></code> element for the purpose of this
  virtual DOM tree. For each node in such a DOM tree, the <a href="#hit-region's-bounding-circumference">hit
  region's bounding circumference</a> gives the region of the
  screen to use when representing the node (if appropriate).</p>

  <p>The semantics of a <a href=#hit-region>hit region</a> for the purposes of this virtual DOM tree are those
  of the <a href=#the-control-represented-by-a-region title="the control represented by a region">the control represented by the
  region</a>, if it has one, or else of a non-interactive element whose ARIA role, if any, is
  that given by the <a href="#hit-region's-aria-role">hit region's ARIA role</a>, and whose textual representation, if any,
  is given by the <a href="#hit-region's-label">hit region's label</a>.</p>

  <p>For the purposes of accessibility tools, when an element <var title="">C</var> is a descendant
  of a <code><a href=#the-canvas-element>canvas</a></code> element and there is <a href=#the-region-representing-the-control title="the region representing the control">a
  region representing the control</a> <var title="">C</var> for that <code><a href=#the-canvas-element>canvas</a></code>
  element's bitmap, then the element's position relative to the document should be presented as if
  it was that region in the <code><a href=#the-canvas-element>canvas</a></code> element's virtual DOM tree.</p>

  <p>The semantics of a <a href=#hit-region>hit region</a> for the purposes of this virtual DOM tree are those
  of the <a href=#the-control-represented-by-a-region title="the control represented by a region">the control represented by the
  region</a>, if it has one, or else of a non-interactive element whose ARIA role, if any, is
  that given by the <a href="#hit-region's-aria-role">hit region's ARIA role</a>, and whose textual representation, if any,
  is given by the <a href="#hit-region's-label">hit region's label</a>.</p>

  <p class=note>Thus, for instance, a user agent on a touch-screen
  device could provide haptic feedback when the user croses over a
  <a href="#hit-region's-bounding-circumference">hit region's bounding circumference</a>, and then read the
  <a href="#hit-region's-label">hit region's label</a> to the user. Similarly, a desktop
  user agent with a virtual accessibility focus separate from the
  keyboard input focus could allow the user to navigate through the
  hit regions, using the virtual DOM tree described above to enable
  hierarchical navigation. When an interactive control inside the
  <code><a href=#the-canvas-element>canvas</a></code> element is focused, if the control has a
  corresponding region, then that <a href="#hit-region's-bounding-circumference">hit region's bounding
  circumference</a> could be used to determine what area of the
  display to magnify.</p>

  </div>


  <h6 id=pixel-manipulation><span class=secno>4.8.11.2.16 </span><dfn>Pixel manipulation</dfn></h6>
<!--CLEANUP-->

  <dl class=domintro><dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var title="">sw</var>, <var title="">sh</var>)</dt>

   <dd>

    <p>Returns an <code><a href=#imagedata>ImageData</a></code> object with the given
    dimensions. All the pixels in the returned object are transparent
    black.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either
    of the width or height arguments are zero.</p>

   </dd>

   <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var title="">imagedata</var>)</dt>

   <dd>

    <p>Returns an <code><a href=#imagedata>ImageData</a></code> object with the same
    dimensions as the argument. All the pixels in the returned object
    are transparent black.</p>

   </dd>

   <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageDataHD><a href=#dom-context-2d-createimagedatahd>createImageDataHD</a></code>(<var title="">sw</var>, <var title="">sh</var>)</dt>

   <dd>

    <p>Returns an <code><a href=#imagedata>ImageData</a></code> object whose dimensions equal
    the dimensions given in the arguments, multiplied by the number of
    pixels in the canvas bitmap that correspond to each coordinate
    space unit. All the pixels in the returned object are transparent
    black.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either
    of the width or height arguments are zero.</p>

   </dd>

   <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData</a></code>(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</dt>

   <dd>

    <p>Returns an <code><a href=#imagedata>ImageData</a></code> object containing the image data for the given rectangle of
    the bitmap.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either
    of the width or height arguments are zero.</p>

    <p>The data will be returned with one pixel of image data for each
    coordinate space unit on the canvas (ignoring transforms).</p>

   </dd>

   <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD</a></code>(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</dt>

   <dd>

    <p>Returns an <code><a href=#imagedata>ImageData</a></code> object containing the image data for the given rectangle of
    the bitmap.</p>

    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either
    of the width or height arguments are zero.</p>

    <p>The data will be returned at the same resolution as the canvas
    bitmap.</p>

   </dd>

   <dt><var title="">imagedata</var> . <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code></dt>
   <dt><var title="">imagedata</var> . <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code></dt>

   <dd>

    <p>Returns the actual dimensions of the data in the
    <code><a href=#imagedata>ImageData</a></code> object, in pixels. For objects returned by
    the non-HD variants of the methods in this API, this will
    correspond to the dimensions given to the methods. For the HD
    variants, the number of pixels might be different than the number
    of corresponding coordinate space units.</p>

   </dd>

   <dt><var title="">imagedata</var> . <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code></dt>

   <dd>

    <p>Returns the theoretical number of pixels in the <code><a href=#imagedata>ImageData</a></code> object's data per
    corresponding coordinate space unit. This value is automatically determined from the source
    image when the <code><a href=#imagedata>ImageData</a></code> object is created. It is only used to ensure that
    <code><a href=#imagebitmap>ImageBitmap</a></code> objects have the right pixel density when generated from
    <code><a href=#imagedata>ImageData</a></code> objects.</p>

   </dd>

   <dt><var title="">imagedata</var> . <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code></dt>

   <dd>

    <p>Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData</a></code>(<var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var> [, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, <var title="">dirtyHeight</var> ])</dt>

   <dd>

    <p>Paints the data from the given <code><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 title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>
    and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
    attributes, as well as the shadow attributes, are ignored for the
    purposes of this method call; pixels in the canvas are replaced
    wholesale, with no composition, alpha blending, no shadows,
    etc.</p>

    <p>Throws a <code><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the
    arguments are not finite.</p>

    <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless
    of the value of the <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute.</p>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-putImageDataHD><a href=#dom-context-2d-putimagedatahd>putImageDataHD</a></code>(<var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var> [, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, <var title="">dirtyHeight</var> ])</dt>

   <dd>

    <p>Paints the data from the given <code><a href=#imagedata>ImageData</a></code> object onto the bitmap, at the bitmap's
    native pixel density (regardless of the value of the <code><a href=#imagedata>ImageData</a></code> object's <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute). If a dirty rectangle is provided,
    only the pixels from that rectangle are painted.</p>

    <p>The <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>
    and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
    attributes, as well as the shadow attributes, are ignored for the
    purposes of this method call; pixels in the canvas are replaced
    wholesale, with no composition, alpha blending, no shadows,
    etc.</p>

    <p>Throws a <code><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the
    arguments are not finite.</p>

   </dd>

  </dl><div class=impl>
<!--CLEANUP-->

  <p>The <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData()</a></code> and
  <code title=dom-context-2d-createImageDataHD><a href=#dom-context-2d-createimagedatahd>createImageDataHD()</a></code>
  methods are used to instantiate new blank <code><a href=#imagedata>ImageData</a></code>
  objects.</p>

  <p>When the <dfn id=dom-context-2d-createimagedata title=dom-context-2d-createImageData><code>createImageData()</code></dfn>
  method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must
  return a new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width in equal to the
  absolute magnitude of <var title="">sw</var> and a height equal to the absolute magnitude of <var title="">sh</var>, and with a 1.0 pixel density, if both <var title="">sw</var> and <var title="">sh</var>
  are non-zero. If one or both of <var title="">sw</var> and <var title="">sh</var> are zero, then the
  method must throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception instead. When invoked with a single <var title="">imagedata</var> argument, it must return a new <code><a href=#imagedata>ImageData</a></code> object representing
  a rectangle with the same dimensions and pixel density as the <code><a href=#imagedata>ImageData</a></code> object passed
  as the argument. When the method returns an <code><a href=#imagedata>ImageData</a></code> object, it must be filled with
  transparent black.</p>

  <p>When the <dfn id=dom-context-2d-createimagedatahd title=dom-context-2d-createImageDataHD><code>createImageDataHD()</code></dfn>
  method is invoked and both of its arguments (<var title="">sw</var> and <var title="">sh</var>) are non-zero, it
  must return a new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width equal to
  the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var>, a height
  equal to the absolute magnitude of <var title="">sh</var> multiplied by <var title="">scale</var>,
  and a pixel density equal to <var title="">scale</var>, where <var title="">scale</var> is the
  number of pixels in the <a href=#scratch-bitmap>scratch bitmap</a> per coordinate space units. The
  <code><a href=#imagedata>ImageData</a></code> object returned must be filled with transparent black. If either or both
  of the arguments are zero, the method must instead throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

  <p>The <dfn id=dom-context-2d-getimagedata title=dom-context-2d-getImageData><code>getImageData(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must, if
  either the <var title="">sw</var> or <var title="">sh</var> arguments are zero, throw an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception; otherwise,
  <!--ADD-TOPIC:Security-->
  if the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a>
  flag is set to false, it must throw a <code><a href=#securityerror>SecurityError</a></code> exception;
  <!--REMOVE-TOPIC:Security-->
  otherwise, it must return an <code><a href=#imagedata>ImageData</a></code> object with width <var title="">sw</var> and
  height <var title="">sh</var> representing the <a href=#scratch-bitmap>scratch bitmap</a> for the area of that
  bitmap denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
  units. If the bitmap does not represent each coordinate space unit square using exactly one pixel,
  the value of each pixel in the returned object must be derived from the value(s) of the pixel(s)
  in the bitmap that correspond to the same coordinate. Pixels outside the <a href=#scratch-bitmap>scratch
  bitmap</a> must be returned as transparent black. Pixels must be returned as non-premultiplied
  alpha values. The pixel density of the object returned must be 1.0.</p>

  <p>The <dfn id=dom-context-2d-getimagedatahd title=dom-context-2d-getImageDataHD><code>getImageDataHD(<var title="">sx</var>,
  <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must,
  if either the <var title="">sw</var> or <var title="">sh</var> arguments are zero, throw an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception; otherwise,
  <!--ADD-TOPIC:Security-->
  if the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a>
  flag is set to false, it must throw a <code><a href=#securityerror>SecurityError</a></code> exception;
  <!--REMOVE-TOPIC:Security-->
  otherwise, it must return an <code><a href=#imagedata>ImageData</a></code> object with width <var title="">sw</var>
  multiplied by <var title="">scale</var> and height <var title="">sh</var> multiplied by <var title="">scale</var> representing the <a href=#scratch-bitmap>scratch bitmap</a> for the area of that bitmap
  denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
  units. Pixels outside the <a href=#scratch-bitmap>scratch bitmap</a> must be returned as transparent black.
  Pixels must be returned as non-premultiplied alpha values. The pixel density of the object
  returned must be <var title="">scale</var>. For the purposes of this paragraph, <var title="">scale</var> is the number of pixels in the <a href=#scratch-bitmap>scratch bitmap</a> per coordinate
  space units.</p>

<!--CLEANUP-->
  <p>New <code><a href=#imagedata>ImageData</a></code> objects must be initialized so that
  their <dfn id=dom-imagedata-width title=dom-imagedata-width><code>width</code></dfn>
  attribute is set to the number of pixels per row in the image data,
  their <dfn id=dom-imagedata-height title=dom-imagedata-height><code>height</code></dfn>
  attribute is set to the number of rows in the image data,
  their <dfn id=dom-imagedata-resolution title=dom-imagedata-resolution><code>resolution</code></dfn> is set to the object's pixel density, and their
  <dfn id=dom-imagedata-data title=dom-imagedata-data><code>data</code></dfn> attribute is
  initialized to a <code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object. The
  <code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object must use a <a href=#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>Canvas Pixel <code>ArrayBuffer</code></a>
  must contain the image data. At least one pixel's worth of image
  data must be returned. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

  <p>A <dfn id=canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></dfn> is an
  <code><a href=#arraybuffer>ArrayBuffer</a></code> that whose data is represented in
  left-to-right order, row by row top to bottom, starting with the top
  left, with each pixel's red, green, blue, and alpha components being
  given in that order for each pixel. Each component of each pixel
  represented in this array must be in the range 0..255, representing
  the 8 bit value for that component. The components must be assigned
  consecutive indices starting with 0 for the top left pixel's red
  component. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

  <p>The <dfn id=dom-context-2d-putimagedata title=dom-context-2d-putImageData><code>putImageData()</code></dfn> and <dfn id=dom-context-2d-putimagedatahd title=dom-context-2d-putImageDataHD><code>putImageDataHD()</code></dfn> methods write data from
  <code><a href=#imagedata>ImageData</a></code> structures back to the rendering context's <a href=#scratch-bitmap>scratch bitmap</a>.
  Their arguments are: <var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, and <var title="">dirtyHeight</var>.</p>

  <p>When the last four arguments to these methods are omitted, they
  must be assumed to have the values 0, 0, the <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> member of the <var title="">imagedata</var> structure, and the <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> member of the <var title="">imagedata</var> structure, respectively.</p>

  <p>When invoked, these methods must act as follows:</p>

  <ol><li>

    <p>If <var title="">dirtyWidth</var> is negative, let <var title="">dirtyX</var> be <span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span>, and let <var title="">dirtyWidth</var> be equal to the absolute magnitude of
    <var title="">dirtyWidth</var>.</p>

    <p>If <var title="">dirtyHeight</var> is negative, let <var title="">dirtyY</var> be <span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span>, and let <var title="">dirtyHeight</var> be equal to the absolute magnitude of
    <var title="">dirtyHeight</var>.</p>

   </li>

   <li>

    <p>If <var title="">dirtyX</var> is negative, let <var title="">dirtyWidth</var> be <span title=""><var title="">dirtyWidth</var>+<var title="">dirtyX</var></span>, and
    let <var title="">dirtyX</var> be zero.</p>

    <p>If <var title="">dirtyY</var> is negative, let <var title="">dirtyHeight</var> be <span title=""><var title="">dirtyHeight</var>+<var title="">dirtyY</var></span>, and
    let <var title="">dirtyY</var> be zero.</p>

   </li>

   <li>

    <p>If <span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span> is greater than the <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> attribute of the <var title="">imagedata</var> argument, let <var title="">dirtyWidth</var> be the value of that <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> attribute, minus the
    value of <var title="">dirtyX</var>.</p>

    <p>If <span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span> is greater than the <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> attribute of the <var title="">imagedata</var> argument, let <var title="">dirtyHeight</var> be the value of that <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> attribute, minus the
    value of <var title="">dirtyY</var>.</p>

   </li>

   <li>

    <p>If, after those changes, either <var title="">dirtyWidth</var>
    or <var title="">dirtyHeight</var> is negative or zero, stop these
    steps without affecting any bitmaps.</p>

   </li>

   <li>

    <p>Run the appropriate steps from the following list:</p>

    <dl class=switch><dt>If the method was <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code></dt>

     <dd>

      <p>Draw the region of the image data in the horizontal rectangle whose top left corner is at
      (<var title="">dirtyX</var>,<var title="">dirtyY</var>) and whose bottom right corner is at
      (<span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span>,<span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span>) onto the rendering
      context's <a href=#scratch-bitmap>scratch bitmap</a>, aligned such that the top left of the rectangle is at
      coordinate (<var title="">dx</var>,<var title="">dy</var>).</p>

      <p>If the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
      attribute is set to true, then the user agent should attempt to apply a smoothing algorithm to
      the image data if the <a href=#scratch-bitmap>scratch bitmap</a> does not have exactly one device pixel per
      coordinate space unit.</p>

     </dd>

     <dt>If the method was <code title=dom-context-2d-putImageDataHD><a href=#dom-context-2d-putimagedatahd>putImageDataHD()</a></code></dt>

     <dd>

      <ol><li>

        <p>Let <var title="">dx<sub title="">device</sub></var> be the x-coordinate of the device pixel in
        the <a href=#scratch-bitmap>scratch bitmap</a> corresponding to the <var title="">dx</var> coordinate in
        the <a href=#scratch-bitmap>scratch bitmap</a>'s coordinate space.</p>

        <p>Let <var title="">dy<sub title="">device</sub></var> be the y-coordinate of the device pixel in
        the <a href=#scratch-bitmap>scratch bitmap</a> corresponding to the <var title="">dy</var> coordinate in
        the <a href=#scratch-bitmap>scratch bitmap</a>'s coordinate space.</p>

       </li>

       <li><p>For all integer values of <var title="">x</var> and <var title="">y</var> where <span title=""><var title="">dirtyX</var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span></span> and <span title=""><var title="">dirtyY</var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span></span>, copy the
       four channels of the pixel with coordinate (<var title="">x</var>, <var title="">y</var>) in
       the <var title="">imagedata</var> data structure to the pixel with coordinate (<span title=""><var title="">dx<sub title="">device</sub></var>+<var title="">x</var></span>, <span title=""><var title="">dy<sub title="">device</sub></var>+<var title="">y</var></span>) in the
       rendering context's <a href=#scratch-bitmap>scratch bitmap</a>.</li>

      </ol></dd>

    </dl></li>

  </ol><p>The handling of pixel rounding when the specified coordinates do
  not exactly map to the device coordinate space is not defined by
  this specification, except that the following must result in no
  visible changes to the rendering:</p>

  <pre>context.putImageDataHD(context.getImageDataHD(x, y, w, h), p, q);</pre>

  <p>...for any value of <var title="">x</var>, <var title="">y</var>,
  <var title="">w</var>, and <var title="">h</var> and where <var title="">p</var> is the smaller of <var title="">x</var> and the sum
  of <var title="">x</var> and <var title="">w</var>, and <var title="">q</var> is the smaller of <var title="">y</var> and the sum
  of <var title="">y</var> and <var title="">h</var>; and except that
  the following two calls:</p>

  <pre>context.createImageData(w, h);
context.getImageData(0, 0, w, h);</pre>

  <p>...must return <code><a href=#imagedata>ImageData</a></code> objects with the same
  dimensions as each other, and the following two calls:</p>

  <pre>context.createImageDataHD(w, h);
context.getImageDataHD(0, 0, w, h);</pre>

  <p>...must also return <code><a href=#imagedata>ImageData</a></code> objects with the same
  dimensions as each other, for any value of <var title="">w</var> and
  <var title="">h</var> in both cases. In other words, while user
  agents may round the arguments of these methods so that they map to
  device pixel boundaries, any rounding performed must be performed
  consistently for all of the methods described in this section.</p>

  <p class=note>Due to the lossy nature of converting to and from
  premultiplied alpha color values, pixels that have just been set
  using <code title=dom-context-2d-putImageDataHD><a href=#dom-context-2d-putimagedatahd>putImageDataHD()</a></code> might
  be returned to an equivalent <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> as
  different values.</p>

  <p>The current path, <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>,
  <a href=#shadows title=shadows>shadow attributes</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the
  <a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
  operator</a> must not affect the methods described in this
  section.</p>

  </div>

  <div class=example>

   <p>In the following example, the script generates an
   <code><a href=#imagedata>ImageData</a></code> object so that it can draw onto it.</p>

   <pre>// canvas is a reference to a &lt;canvas&gt; element
var context = canvas.getContext('2d');

// create a blank slate
var data = context.createImageDataHD(canvas.width, canvas.height);

// create some plasma
FillPlasma(data, 'green'); // green plasma

// add a cloud to the plasma
AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle

// paint the plasma+cloud on the canvas
context.putImageDataHD(data, 0, 0);

// support methods
function FillPlasma(data, color) { ... }
function AddCloud(data, x, y) { ... }</pre>

  </div>

  <div class=example>

   <p>Here is an example of using <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> and
   <code title=dom-context-2d-putImageDataHD><a href=#dom-context-2d-putimagedatahd>putImageDataHD()</a></code>
   to implement an edge detection filter.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Edge detection demo&lt;/title&gt;
  &lt;script&gt;
   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.getImageDataHD(0, 0, canvas.width, canvas.height);

     // get an empty slate to put the data into
     var output = context.createImageDataHD(canvas.width, canvas.height);

     // alias some variables for convenience
     // notice that we are using input.width and input.height here
     // as they might not be the same as canvas.width and canvas.height
     // (in particular, they might be different on high-res displays)
     var w = input.width, h = input.height;
     var inputData = input.data;
     var outputData = output.data;

     // edge detection
     for (var y = 1; y &lt; h-1; y += 1) {
       for (var x = 1; x &lt; w-1; x += 1) {
         for (var c = 0; c &lt; 3; c += 1) {
           var i = (y*w + x)*4 + c;
           outputData[i] = 127 + -inputData[i - w*4 - 4] -   inputData[i - w*4] - inputData[i - w*4 + 4] +
                                 -inputData[i - 4]       + 8*inputData[i]       - inputData[i + 4] +
                                 -inputData[i + w*4 - 4] -   inputData[i + w*4] - inputData[i + w*4 + 4];
         }
         outputData[(y*w + x)*4 + 3] = 255; // alpha
       }
     }

     // put the image data back after manipulation
     context.putImageDataHD(output, 0, 0);
   }
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body onload="init()"&gt;
  &lt;canvas&gt;&lt;/canvas&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>




  <h6 id=compositing><span class=secno>4.8.11.2.17 </span>Compositing</h6>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>


   <dt><var title="">context</var> . <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

  </dl><div class=impl>

  <p>All drawing operations are affected by the global compositing
  attributes, <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>.</p>

  <!-- conformance criteria for painting are described in the "drawing
  model" section below -->

  <p>The <dfn id=dom-context-2d-globalalpha title=dom-context-2d-globalAlpha><code>globalAlpha</code></dfn> attribute gives an
  alpha value that is applied to shapes and images before they are composited onto the <a href=#scratch-bitmap>scratch
  bitmap</a>. The value must be in the range from 0.0 (fully transparent) to 1.0 (no additional
  transparency). If an attempt is made to set the attribute to a value outside this range, including
  Infinity and Not-a-Number (NaN) values, the attribute must retain its previous value. When the
  context is created, the <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> attribute must
  initially have the value 1.0.</p>

  <p>The <dfn id=dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation><code>globalCompositeOperation</code></dfn>
  attribute sets the current composition operator, which controls how shapes and images are drawn
  onto the <a href=#scratch-bitmap>scratch bitmap</a>, once they
  have had <code title=dom-context-2d-globalAlpha><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. <a href=#refsCOMPOSITE>[COMPOSITE]</a></p>

  <p>These values are all case-sensitive &mdash; they must be used
  exactly as defined. User agents must not recognize values that are not
  a <a href=#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 title=dom-context-2d-globalCompositeOperation><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 title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
  attribute must initially have the value
  <code>source-over</code>.</p>

  </div>



  <h6 id=image-smoothing><span class=secno>4.8.11.2.18 </span>Image smoothing</h6>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns whether pattern fills and the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method will attempt to smooth images if
    their pixels don't line up exactly with the display, when scaling images up.</p>

    <p>Can be set, to change whether images are smoothed (true) or not (false).</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled><code>imageSmoothingEnabled</code></dfn>
  attribute, on getting, must return the last value it was set to. On setting, it must be set to the
  new value. When the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, the attribute must be
  set to true.</p>

  </div>


  <h6 id=shadows><span class=secno>4.8.11.2.19 </span><dfn>Shadows</dfn></h6>

  <p>All drawing operations are affected by the four global shadow
  attributes.</p>

  <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">context</var> . <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

   <dt><var title="">context</var> . <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-context-2d-shadowcolor title=dom-context-2d-shadowColor><code>shadowColor</code></dfn>
  attribute sets the color of the shadow.</p>

  <p>When the context is created, the <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> attribute
  initially must be fully-transparent black.</p>

  <p>On getting, the <a href=#serialization-of-a-color title="serialization 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>parsed as a CSS
  &lt;color&gt; value</a> and the color assigned. If the value
  cannot be parsed as a CSS &lt;color&gt; value then it must be
  ignored, and the attribute must retain its previous value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>

  <p>The <dfn id=dom-context-2d-shadowoffsetx title=dom-context-2d-shadowOffsetX><code>shadowOffsetX</code></dfn>
  and <dfn id=dom-context-2d-shadowoffsety title=dom-context-2d-shadowOffsetY><code>shadowOffsetY</code></dfn>
  attributes specify the distance that the shadow will be offset in
  the positive horizontal and positive vertical distance
  respectively. Their values are in coordinate space units. They are
  not affected by the current transformation matrix.</p>

  <p>When the context is created, the shadow offset attributes must
  initially have the value <code>0</code>.</p>

  <p>On getting, they must return their current value. On setting, the
  attribute being set must be set to the new value, except if the
  value is infinite or NaN, in which case the new value must be
  ignored.</p>

  <p>The <dfn id=dom-context-2d-shadowblur title=dom-context-2d-shadowBlur><code>shadowBlur</code></dfn>
  attribute specifies the level of the blurring effect. (The units do
  not map to coordinate space units, and are not affected by the
  current transformation matrix.)</p>

  <p>When the context is created, the <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> attribute must
  initially have the value <code>0</code>.</p>

  <p>On getting, the attribute must return its current value. On
  setting the attribute must be set to the new value, except if the
  value is negative, infinite or NaN, in which case the new value must
  be ignored.</p>

  <p><dfn id=when-shadows-are-drawn title="when shadows are drawn">Shadows are only drawn
  if</dfn> the opacity component of the alpha component of the color
  of <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> is
  non-zero and either the <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is non-zero, or
  the <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>
  is non-zero, or the <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> is
  non-zero.</p>

  <p class=critical>It is likely that this will change: browser
  vendors have indicated an interest in changing the processing model
  for shadows such that they only draw when the composition operator
  is "source-over" (the default). <a href=http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/thread.html#31457>Read
  more...</a></p>

  <p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, they must be rendered as follows:</p>

  <ol><li> <p>Let <var title="">A</var> be an infinite transparent black
   bitmap on which the source image for which a shadow is being
   created has been rendered.</p> </li>

   <li> <p>Let <var title="">B</var> be an infinite transparent black
   bitmap, with a coordinate space and an origin identical to <var title="">A</var>.</p> </li>

   <li> <p>Copy the alpha channel of <var title="">A</var> to <var title="">B</var>, offset by <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> in the
   positive <var title="">x</var> direction, and <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> in the
   positive <var title="">y</var> direction.</p> </li>

   <li> <p>If <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is greater than
   0:</p>

    <ol><li> <p>Let <var title="">&sigma;</var> be half the value of
     <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>.</li>

     <li> <p>Perform a 2D Gaussian Blur on <var title="">B</var>,
     using <var title="">&sigma;</var> as the standard deviation.</p>
     <!-- wish i could find a reference for this --> </li>

    </ol><p>User agents may limit values of <var title="">&sigma;</var> to
    an implementation-specific maximum value to avoid exceeding
    hardware limitations during the Gaussian blur operation.</p>

   </li>

   <li> <p>Set the red, green, and blue components of every pixel in
   <var title="">B</var> to the red, green, and blue components
   (respectively) of the color of <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>.</p> </li>

   <li> <p>Multiply the alpha component of every pixel in <var title="">B</var> by the alpha component of the color of <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>.</p> </li>

   <li> <p>The shadow is in the bitmap <var title="">B</var>, and is
   rendered as part of the <a href=#drawing-model>drawing model</a> described below.</p> </li>

  </ol></div>

  <p>If the current composition operation is <code title=gcop-copy>copy</code>, shadows effectively won't render
  (since the shape will overwrite the shadow).</p>



  <div class=impl>

  <h6 id=drawing-model><span class=secno>4.8.11.2.20 </span><dfn>Drawing model</dfn></h6>

  <p>When a shape or image is painted, user agents must follow these
  steps, in the order given (or act as if they do):</p>

  <ol><li><p>Render the shape or image onto an infinite transparent black
   bitmap, creating image <var title="">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>

   <li><p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, render the shadow from
   image <var title="">A</var>, using the current shadow styles,
   creating image <var title="">B</var>.</li>

   <li><p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, multiply the alpha
   component of every pixel in <var title="">B</var> by <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>.</li>

   <li><p><a href=#when-shadows-are-drawn>When shadows are drawn</a>, composite <var title="">B</var> within the
   <a href=#clipping-region>clipping region</a> over the current <a href=#scratch-bitmap>scratch bitmap</a> using the current
   composition operator.</li>

   <li><p>Multiply the alpha component of every pixel in <var title="">A</var> by <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>.</li>

   <li><p>Composite <var title="">A</var> within the <a href=#clipping-region>clipping region</a> over the current
   <a href=#scratch-bitmap>scratch bitmap</a> using the current composition operator.</li>

  </ol><p>When compositing onto the <a href=#scratch-bitmap>scratch bitmap</a>, pixels that would fall outside of the
  <a href=#scratch-bitmap>scratch bitmap</a> must be discarded.</p>

  </div>




  <h6 id=best-practices><span class=secno>4.8.11.2.21 </span>Best practices</h6>

  <p><i>This section is non-normative.</i></p>

  <p>When a canvas is interactive, authors should include focusable
  elements in the element's fallback content corresponding to each
  focusable part of the canvas, as in the <a href=#drawCustomFocusRingExample>example above</a>.</p>

  <p>To indicate which focusable part of the canvas is currently
  focused, authors should use the <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing()</a></code>
  method, passing it the element for which a ring is being drawn. This
  method only draws the focus ring if the element is focused, so that
  it can simply be called whenever drawing the element, without
  checking whether the element is focused or not first.</p>

  <p>Authors should avoid implementing text editing controls using the
  <code><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>

   <li>Keyboard movement of the caret has to be reimplemented (possibly across lines, for multiline text input).</li>

   <li>Scrolling of the text field has to be implemented (horizontally for long lines, vertically for multiline input).</li>

   <li>Native features such as copy-and-paste have to be reimplemented.</li>

   <li>Native features such as spell-checking have to be reimplemented.</li>

   <li>Native features such as drag-and-drop have to be reimplemented.</li>

   <li>Native features such as page-wide text search have to be reimplemented.</li>

   <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>

   <li>Bidirectional text editing has to be reimplemented.</li>

   <li>For multiline text editing, line wrapping has to be implemented for all relevant languages.</li>

   <li>Text selection has to be reimplemented.</li>

   <li>Dragging of bidirectional text selections has to be reimplemented.</li>

   <li>Platform-native keyboard shortcuts have to be reimplemented.</li>

   <li>Platform-native input method editors (IMEs) have to be reimplemented.</li>

   <li>Undo and redo functionality has to be reimplemented.</li>

   <li>Accessibility features such as magnification following the
   caret or selection have to be reimplemented.</li>

  </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><a href=#the-input-element>input</a></code> element, the <code><a href=#the-textarea-element>textarea</a></code> element, or
  the <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>
  attribute.</p>


  <h6 id=examples><span class=secno>4.8.11.2.22 </span>Examples</h6>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

  <p>Here is an example of a script that uses canvas to draw <a href="data:text/html;charset=utf-8;base64,PCFET0NUWVBFIEhUTUw%2BDQo8aHRtbCBsYW5nPSJlbiI%2BDQogPGhlYWQ%2BDQogIDx0aXRsZT5QcmV0dHkgR2xvd2luZyBMaW5lczwvdGl0bGU%2BDQogPC9oZWFkPg0KIDxib2R5Pg0KPGNhbnZhcyB3aWR0aD0iODAwIiBoZWlnaHQ9IjQ1MCI%2BPC9jYW52YXM%2BDQo8c2NyaXB0Pg0KDQogdmFyIGNvbnRleHQgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnY2FudmFzJylbMF0uZ2V0Q29udGV4dCgnMmQnKTsNCg0KIHZhciBsYXN0WCA9IGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKTsNCiB2YXIgbGFzdFkgPSBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpOw0KIHZhciBodWUgPSAwOw0KIGZ1bmN0aW9uIGxpbmUoKSB7DQogICBjb250ZXh0LnNhdmUoKTsNCiAgIGNvbnRleHQudHJhbnNsYXRlKGNvbnRleHQuY2FudmFzLndpZHRoLzIsIGNvbnRleHQuY2FudmFzLmhlaWdodC8yKTsNCiAgIGNvbnRleHQuc2NhbGUoMC45LCAwLjkpOw0KICAgY29udGV4dC50cmFuc2xhdGUoLWNvbnRleHQuY2FudmFzLndpZHRoLzIsIC1jb250ZXh0LmNhbnZhcy5oZWlnaHQvMik7DQogICBjb250ZXh0LmJlZ2luUGF0aCgpOw0KICAgY29udGV4dC5saW5lV2lkdGggPSA1ICsgTWF0aC5yYW5kb20oKSAqIDEwOw0KICAgY29udGV4dC5tb3ZlVG8obGFzdFgsIGxhc3RZKTsNCiAgIGxhc3RYID0gY29udGV4dC5jYW52YXMud2lkdGggKiBNYXRoLnJhbmRvbSgpOw0KICAgbGFzdFkgPSBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpOw0KICAgY29udGV4dC5iZXppZXJDdXJ2ZVRvKGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpLA0KICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpLA0KICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RYLCBsYXN0WSk7DQoNCiAgIGh1ZSA9IGh1ZSArIDEwICogTWF0aC5yYW5kb20oKTsNCiAgIGNvbnRleHQuc3Ryb2tlU3R5bGUgPSAnaHNsKCcgKyBodWUgKyAnLCA1MCUsIDUwJSknOw0KICAgY29udGV4dC5zaGFkb3dDb2xvciA9ICd3aGl0ZSc7DQogICBjb250ZXh0LnNoYWRvd0JsdXIgPSAxMDsNCiAgIGNvbnRleHQuc3Ryb2tlKCk7DQogICBjb250ZXh0LnJlc3RvcmUoKTsNCiB9DQogc2V0SW50ZXJ2YWwobGluZSwgNTApOw0KDQogZnVuY3Rpb24gYmxhbmsoKSB7DQogICBjb250ZXh0LmZpbGxTdHlsZSA9ICdyZ2JhKDAsMCwwLDAuMSknOw0KICAgY29udGV4dC5maWxsUmVjdCgwLCAwLCBjb250ZXh0LmNhbnZhcy53aWR0aCwgY29udGV4dC5jYW52YXMuaGVpZ2h0KTsNCiB9DQogc2V0SW50ZXJ2YWwoYmxhbmssIDQwKTsNCg0KPC9zY3JpcHQ%2BDQogPC9ib2R5Pg0KPC9odG1sPg0K">pretty glowing lines</a>.</p>

  <pre>&lt;canvas width="800" height="450"&gt;&lt;/canvas&gt;
&lt;script&gt;

 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);

&lt;/script&gt;</pre>

  </div>

  <div class=example>

   <p>The 2D rendering context for <code><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.html width=396 height=216></iframe>

   <p>Here is the source for this example:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Blue Robot Demo&lt;/title&gt;
&lt;base href="http://www.whatwg.org/demos/canvas/blue-robot/"&gt;
&lt;style&gt;
  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; }
&lt;/style&gt;
&lt;canvas width="380" height="200"&gt;&lt;/canvas&gt;
&lt;script&gt;
 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();
   };
 };
&lt;/script&gt;
&lt;script&gt;
 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 &gt;= this.frameIndex[this.mode].length) {
       // we've reached the end of this animation cycle
       this.frame = 0;
       if (this.mode != this.targetMode) {
         // switch to next cycle
         if (this.mode == 'walk') {
           // we need to stop walking before we decide what to do next
           this.mode = 'stop';
         } else if (this.mode == 'stop') {
           if (this.targetMode == 'walk')
             this.mode = 'walk';
           else
             this.mode = 'idle';
         } else if (this.mode == 'idle') {
           if (this.targetMode == 'walk')
             this.mode = 'walk';
         }
       }
     }
     if (this.mode == 'walk')
       return 8;
     return 0;
   },
   this.paint = function (context, x, y) {
     if (!this.sprites.complete) return;
     // draw the right frame out of the sprite sheet onto the canvas
     // we assume each frame is as high as the sprite sheet
     // the x,y coordinates give the position of the bottom center of the sprite
     context.drawImage(this.sprites,
                       this.frameIndex[this.mode][this.frame] * this.sprites.height, 0, this.sprites.height, this.sprites.height,
                       x-this.sprites.height/2, y-this.sprites.height, this.sprites.height, this.sprites.height);
   };
 };
&lt;/script&gt;
&lt;script&gt;
 var canvas = document.getElementsByTagName('canvas')[0];
 var context = canvas.getContext('2d');
 var landscape = new Landscape(context, canvas.width, canvas.height);
 var blueRobot = new BlueRobot();
 // paint when the browser wants us to, using requestAnimationFrame()
 function paint() {
   context.clearRect(0, 0, canvas.width, canvas.height);
   landscape.paintBackground(context, canvas.width, canvas.height);
   blueRobot.paint(context, canvas.width/2, landscape.horizon*1.1);
   landscape.paintForeground(context, canvas.width, canvas.height);
   requestAnimationFrame(paint);
 }
 paint();
 // but tick every 150ms, so that we don't slow down when we don't paint
 setInterval(function () {
   var dx = blueRobot.tick();
   landscape.advance(dx);
 }, 100);
&lt;/script&gt;
&lt;p class="buttons"&gt;
 &lt;input type=button value="Walk" onclick="blueRobot.walk()"&gt;
 &lt;input type=button value="Stop" onclick="blueRobot.stop()"&gt;
&lt;footer&gt;
 &lt;small&gt; Blue Robot Player Sprite by &lt;a href="http://johncolburn.deviantart.com/"&gt;JohnColburn&lt;/a&gt;.
 Licensed under the terms of the Creative Commons Attribution Share-Alike 3.0 Unported license.&lt;/small&gt;
 &lt;small&gt; This work is itself licensed under a &lt;a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"&gt;Creative
 Commons Attribution-ShareAlike 3.0 Unported License&lt;/a&gt;.&lt;/small&gt;
&lt;/footer&gt;
</pre>

  </div>



  


  <h5 id=pixel-density><span class=secno>4.8.11.3 </span>Pixel density</h5>

  <p>The user agent may use any square pixel density for the bitmaps of a <code><a href=#the-canvas-element>canvas</a></code> and
  its rendering contexts. Once a <code><a href=#the-canvas-element>canvas</a></code> has a bitmap, that canvas must keep its
  resolution for its lifetime.</p>

  <p class=note>In general, user agents are encouraged to use a pixel density equal to the screen
  pixel density. Ideally, the number of device pixels per CSS pixel would be a multiple of two.
  Several factors can affect the screen pixel density: most prominently the actual display pixel
  density, but also important is the current zoom level.</p>

  <p>All the bitmaps created during a single <a href=#concept-task title=concept-task>task</a> for
  <code><a href=#the-canvas-element>canvas</a></code> elements and <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects must have the same
  pixel density.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <pre class=idl>partial interface <a href=#screen id=Screen-partial>Screen</a> {
  readonly attribute double <a href=#dom-screen-canvasresolution title=dom-screen-canvasResolution>canvasResolution</a>;
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-Window-screen>screen</code> . <code title=dom-screen-canvasResolution><a href=#dom-screen-canvasresolution>canvasResolution</a></code></dt>

   <dd>

    <p>Returns the pixel density that has been, or will be, used for bitmaps during this <a href=#concept-task title=concept-task>task</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-screen-canvasresolution title=dom-screen-canvasResolution><code>canvasResolution</code></dfn> attribute of
  the <code><a href=#screen>Screen</a></code> object must return the pixel density, in image pixels per coordinate space
  units, that any <code><a href=#the-canvas-element>canvas</a></code> and <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> bitmaps created
  during this <a href=#concept-task title=concept-task>task</a> will use (or have used). <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></p>

  </div>



  <div class=impl>

  <h5 id=color-spaces-and-color-correction><span class=secno>4.8.11.4 </span>Color spaces and color correction</h5>

  <p>The <code><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 Context's <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method with an <code><a href=#htmlimageelement>HTMLImageElement</a></code>
  object), and when rendering the actual canvas bitmap to the output device.</p>

  <p class=note>Thus, in the 2D context, colors used to draw shapes onto the canvas will exactly
  match colors obtained through the <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> method.</p>

  <p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> and <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> methods 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 title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> must match those
  returned by the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> method, and the
  color of pixels in resources created by <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code>
  must match those returned by the <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> method.</p>

  <p>In user agents that support CSS, the color space used by a <code><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><a href=#the-img-element>img</a></code> element would use the same colors as one
  painted on a <code><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 title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be rendered with no color
  correction.</p>

  <p class=note>Thus, in the 2D context, calling the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render the output of the <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> method to the canvas, given the appropriate
  dimensions, has no visible effect.</p>

  </div>



  <h5 id=serializing-bitmaps-to-a-file><span class=secno>4.8.11.5 </span>Serializing bitmaps to a file</h5>

  <div class=impl>

  <p>When a user agent is to create <dfn id=a-serialization-of-the-bitmap-as-a-file>a serialization of the bitmap as a file</dfn>, optionally
  with some given <var title="">arguments</var>, and optionally with a <var title="">native</var>
  flag set, it must create an image file in the format given by the first value of <var title="">arguments</var>, or, if there are no <var title="">arguments</var>, in the PNG format. <a href=#refsPNG>[PNG]</a></p>

  <p>If the <var title="">native</var> flag is set, or if the bitmap has one pixel per coordinate
  space unit, then the image file must have the same pixel data (before compression, if applicable)
  as the bitmap, and if the file format used supports encoding resolution metadata, the resolution
  of that bitmap (device pixels per coordinate space units being interpreted as image pixels per CSS
  pixel) must be given as well.</p>

  <p>Otherwise, the image file's pixel data must be the bitmap's pixel data scaled to one image
  pixel per coordinate space unit, and if the file format used supports encoding resolution
  metadata, the resolution must be given as 96dpi (one image pixel per CSS pixel).</p>

  <p>If <var title="">arguments</var> is not empty, the first value must be interpreted as a <a href=#mime-type title="MIME type">MIME type</a> giving the format to use. If the type has any parameters, it
  must be treated as not supported.</p>

  <p class=example>For example, the value "<code>image/png</code>" would mean to generate a PNG
  image, the value "<code>image/jpeg</code>" would mean to generate a JPEG image, and the value
  "<code>image/svg+xml</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>image/png</code>"). User agents may support other types.
  If the user agent does not support the requested type, it must create the file using the PNG
  format. <a href=#refsPNG>[PNG]</a></p>

  <p>User agents must <a href=#converted-to-ascii-lowercase title="converted to ASCII lowercase">convert the provided type to ASCII
  lowercase</a> before establishing if they support that type.</p>

  <p>For image types that do not support an alpha channel, the serialized image must be the bitmap
  image composited onto a solid black background using the source-over operator.</p>

  <p>If the first argument in <var title="">arguments</var> gives a type corresponding to one of the
  types given in the first column of the following table, and the user agent supports that type,
  then the subsequent arguments, if any, must be treated as described in the second cell of that
  row.</p>

  </div>

  <table id=canvas-serialization-arguments><caption>Arguments for serialization methods</caption>
   <thead><tr><th> Type <th> Other arguments <th> Reference
   <tbody><tr><td> <code>image/jpeg</code>
     <td> The second argument<span class=impl>, if it</span> is a number in the range 0.0 to 1.0
     inclusive<span class=impl>, must be</span> treated as the desired quality level. <span class=impl>If it is not a number or is outside that range, the user agent must use its
     default value, as if the argument had been omitted.</span>
     <td> <a href=#refsJPEG>[JPEG]</a>
  </table><div class=impl>

  <p>For the purposes of these rules, an argument is considered to be a number if it is converted to
  an IDL double value by the rules for handling arguments of type <code title="">any</code> in the
  Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>

  <p>Other arguments must be ignored and must not cause the user agent to throw an exception. A
  future version of this specification will probably define other parameters to be passed to these
  methods to allow authors to more carefully control compression settings, image metadata, etc.</p>

  </div>


<!--ADD-TOPIC:Security-->
  <div class=impl>

  <h5 id=security-with-canvas-elements><span class=secno>4.8.11.6 </span>Security with <code><a href=#the-canvas-element>canvas</a></code> elements</h5>

  <p><i>This section is non-normative.</i></p>

  <p><strong>Information leakage</strong> can occur if scripts from
  one <a href=#origin>origin</a> can access information (e.g. read pixels)
  from images from another origin (one that isn't the <a href=#same-origin title="same origin">same</a>).</p>

  <p>To mitigate this, bitmaps used with <code><a href=#the-canvas-element>canvas</a></code> elements are defined to have a flag
  indicating whether they are <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a>. All
  bitmaps start with their <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> set to
  true. The flag is set to false when cross-origin images or fonts are used.</p>

  <p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code>, <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code>, <code title=dom-canvas-toBlob><a href=#dom-canvas-toblob>toBlob()</a></code>, <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code>, and <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code>
  methods check the flag and will throw a <code><a href=#securityerror>SecurityError</a></code>
  exception rather than leak cross-origin data.</p>

  <p>The flag can be reset in certain situations; for example, when a
  <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> is bound to a new <code><a href=#the-canvas-element>canvas</a></code>, the bitmap is cleared
  and its flag reset.</p>

  </div>
<!--REMOVE-TOPIC:Security-->


<!--TOPIC:HTML-->
  <h4 id=the-map-element><span class=secno>4.8.12 </span>The <dfn><code>map</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#transparent>Transparent</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-map-name><a href=#attr-map-name>name</a></code> &mdash; Name of <a href=#image-map>image map</a> to reference from the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlmapelement>HTMLMapElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-map-name title=dom-map-name>name</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-map-areas title=dom-map-areas>areas</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-map-images title=dom-map-images>images</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-map-element>map</a></code> element, in conjunction with any
  <code><a href=#the-area-element>area</a></code> element descendants, defines an <a href=#image-map>image
  map</a>. The element <a href=#represents>represents</a> its children.</p>

  <p>The <dfn id=attr-map-name title=attr-map-name><code>name</code></dfn> attribute
  gives the map a name so that it can be referenced. The attribute
  must be present and must have a non-empty value with no <a href=#space-character title="space character">space characters</a>. The value of the
  <code title=attr-map-name><a href=#attr-map-name>name</a></code> attribute must not be a
  <a href=#compatibility-caseless title="compatibility caseless">compatibility-caseless</a>
  match for the value of the <code title=attr-map-name><a href=#attr-map-name>name</a></code>
  attribute of another <code><a href=#the-map-element>map</a></code> element in the same
  document. If the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute is also
  specified, both attributes must have the same value.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">map</var> . <code title=dom-map-areas><a href=#dom-map-areas>areas</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-area-element>area</a></code> elements in the <code><a href=#the-map-element>map</a></code>.</p>

   </dd>

   <dt><var title="">map</var> . <code title=dom-map-images><a href=#dom-map-images>images</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-img-element>img</a></code> and <code><a href=#the-object-element>object</a></code> elements that use the <code><a href=#the-map-element>map</a></code>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-map-areas title=dom-map-areas><code>areas</code></dfn> attribute
  must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#the-map-element>map</a></code> element, whose filter matches only
  <code><a href=#the-area-element>area</a></code> elements.</p>

  <p>The <dfn id=dom-map-images title=dom-map-images><code>images</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only
  <code><a href=#the-img-element>img</a></code> and <code><a href=#the-object-element>object</a></code> elements that are
  associated with this <code><a href=#the-map-element>map</a></code> element according to the
  <a href=#image-map>image map</a> processing model.</p>

  <p>The IDL attribute <dfn id=dom-map-name title=dom-map-name><code>name</code></dfn> must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>Image maps can be defined in conjunction with other content on
   the page, to ease maintenance. This example is of a page with an
   image map at the top of the page and a corresponding set of text
   links at the bottom.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;TITLE&gt;Babies&trade;: Toys&lt;/TITLE&gt;
&lt;HEADER&gt;
 &lt;H1&gt;Toys&lt;/H1&gt;
 &lt;IMG SRC="/images/menu.gif"
      ALT="Babies&trade; navigation menu. Select a department to go to its page."
      USEMAP="#NAV"&gt;
&lt;/HEADER&gt;
 ...
&lt;FOOTER&gt;
 &lt;MAP NAME="NAV"&gt;
  &lt;P&gt;
   &lt;A HREF="/clothes/"&gt;Clothes&lt;/A&gt;
   &lt;AREA ALT="Clothes" COORDS="0,0,100,50" HREF="/clothes/"&gt; |
   &lt;A HREF="/toys/"&gt;Toys&lt;/A&gt;
   &lt;AREA ALT="Toys" COORDS="0,0,100,50" HREF="/toys/"&gt; |
   &lt;A HREF="/food/"&gt;Food&lt;/A&gt;
   &lt;AREA ALT="Food" COORDS="0,0,100,50" HREF="/food/"&gt; |
   &lt;A HREF="/books/"&gt;Books&lt;/A&gt;
   &lt;AREA ALT="Books" COORDS="0,0,100,50" HREF="/books/"&gt;
 &lt;/MAP&gt;
&lt;/FOOTER&gt;</pre>

  </div>



  <h4 id=the-area-element><span class=secno>4.8.13 </span>The <dfn><code>area</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected, but only if there is a <code><a href=#the-map-element>map</a></code> element ancestor or a <code><a href=#the-template-element>template</a></code> element ancestor.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> &mdash; Replacement text for use when images are not available</dd>
   <dd><code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> &mdash; Coordinates for the shape to be created in an <a href=#image-map>image map</a></dd>
   <dd><code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> &mdash; The kind of shape to be created in an <a href=#image-map>image map</a></dd>
   <dd><code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> &mdash; Address of the <a href=#hyperlink>hyperlink</a></dd>
   <dd><code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> &mdash; <a href=#browsing-context>Browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a></dd>
   <dd><code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> &mdash; Whether to download the resource instead of navigating to it, and its file name if so</dd>
   <dd><code title=attr-hyperlink-ping><a href=#ping>ping</a></code> &mdash; <a href=#url title=URL>URLs</a> to ping</dd>
   <dd><code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> &mdash; Relationship between the document containing the hyperlink and the destination resource</dd>
   <dd><code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code> &mdash; Language of the linked resource</dd>
   <dd><code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> &mdash; Hint for the type of the referenced resource</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlareaelement>HTMLAreaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-area-alt title=dom-area-alt>alt</a>;
           attribute DOMString <a href=#dom-area-coords title=dom-area-coords>coords</a>;
           attribute DOMString <a href=#dom-area-shape title=dom-area-shape>shape</a>;
           attribute DOMString <a href=#dom-area-target title=dom-area-target>target</a>;
           attribute DOMString <a href=#dom-area-download title=dom-area-download>download</a>;
           attribute DOMString <a href=#dom-area-ping title=dom-area-ping>ping</a>;
           attribute DOMString <a href=#dom-area-rel title=dom-area-rel>rel</a>;
  readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-area-rellist title=dom-area-relList>relList</a>;
           attribute DOMString <a href=#dom-area-hreflang title=dom-area-hreflang>hreflang</a>;
           attribute DOMString <a href=#dom-area-type title=dom-area-type>type</a>;

  // <a href="#HTMLAreaElement-partial">also has obsolete members</a>
};
<a href=#htmlareaelement>HTMLAreaElement</a> implements <a href=#urlutils>URLUtils</a>;</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-area-element>area</a></code> element <a href=#represents>represents</a> either a hyperlink with some text and a
  corresponding area on an <a href=#image-map>image map</a>, or a dead area on an image map.</p>

  <p>An <code><a href=#the-area-element>area</a></code> element with a parent node must have a <code><a href=#the-map-element>map</a></code> element ancestor
  or a <code><a href=#the-template-element>template</a></code> element ancestor.</p>

  <p>If the <code><a href=#the-area-element>area</a></code> element has an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
  attribute, then the <code><a href=#the-area-element>area</a></code> element represents a <a href=#hyperlink>hyperlink</a>. In this case,
  the <dfn id=attr-area-alt title=attr-area-alt><code>alt</code></dfn> attribute must be present. It specifies the
  text of the hyperlink. Its value must be text that, when presented with the texts specified for
  the other hyperlinks of the <a href=#image-map>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 title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute may be left blank if there is another <code><a href=#the-area-element>area</a></code>
  element in the same <a href=#image-map>image map</a> that points to the same resource and has a non-blank
  <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute.</p>

  <p>If the <code><a href=#the-area-element>area</a></code> element has no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
  attribute, then the area represented by the element cannot be selected, and the <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute must be omitted.</p>

  <p>In both cases, the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> and <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attributes specify the area.</p>

  <p>The <dfn id=attr-area-shape title=attr-area-shape><code>shape</code></dfn> attribute is an <a href=#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.
  <span class=impl>Some of the keywords are non-conforming, as noted in the last
  column.</span></p>

  <table><thead><tr><th>State
     <th>Keywords
     <th class=impl>Notes
   <tbody><tr><td rowspan=2><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a>
     <td><dfn id=attr-area-shape-keyword-circle title=attr-area-shape-keyword-circle><code>circle</code></dfn>
     <td class=impl>
    <tr><td class=impl><dfn id=attr-area-shape-keyword-circ title=attr-area-shape-keyword-circ><code>circ</code></dfn>
     <td class=impl>Non-conforming
    <tr><td><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a>
     <td><dfn id=attr-area-shape-keyword-default title=attr-area-shape-keyword-default><code>default</code></dfn>
     <td class=impl>
    <tr><td rowspan=2><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a>
     <td><dfn id=attr-area-shape-keyword-poly title=attr-area-shape-keyword-poly><code>poly</code></dfn>
     <td class=impl>
    <tr><td class=impl><dfn id=attr-area-shape-keyword-polygon title=attr-area-shape-keyword-polygon><code>polygon</code></dfn>
     <td class=impl>Non-conforming
    <tr><td rowspan=2><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a>
     <td><dfn id=attr-area-shape-keyword-rect title=attr-area-shape-keyword-rect><code>rect</code></dfn>
     <td class=impl>
    <tr><td class=impl><dfn id=attr-area-shape-keyword-rectangle title=attr-area-shape-keyword-rectangle><code>rectangle</code></dfn>
     <td class=impl>Non-conforming
  </table><p>The attribute may be omitted. The <i>missing value default</i> is the <a href=#attr-area-shape-rect title=attr-area-shape-rect>rectangle</a> state.</p>

  <p>The <dfn id=attr-area-coords title=attr-area-coords><code>coords</code></dfn> attribute must, if specified,
  contain a <a href=#valid-list-of-integers>valid list of integers</a>. This attribute gives the coordinates for the shape
  described by the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute. <span class=impl>The
  processing for this attribute is described as part of the <a href=#image-map>image map</a> processing
  model.</span></p>

  <!-- v2: It was suggested by John S. Urban that coords should support percentages as well as
  pixels, so that one could use the same image map for images of various sizes. -->

  <p>In the <dfn id=attr-area-shape-circle title=attr-area-shape-circle>circle state</dfn>, <code><a href=#the-area-element>area</a></code> elements must
  have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute present, with three integers, the
  last of which must be non-negative. The first integer must be the distance in CSS pixels from the
  left edge of the image to the center of the circle, the second integer must be the distance in CSS
  pixels from the top edge of the image to the center of the circle, and the third integer must be
  the radius of the circle, again in CSS pixels.</p>

  <p>In the <dfn id=attr-area-shape-default title=attr-area-shape-default>default state</dfn> state, <code><a href=#the-area-element>area</a></code>
  elements must not have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute. (The area is the
  whole image.)</p>

  <p>In the <dfn id=attr-area-shape-poly title=attr-area-shape-poly>polygon state</dfn>, <code><a href=#the-area-element>area</a></code> elements must
  have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute with at least six integers, and the
  number of integers must be even. Each pair of integers must represent a coordinate given as the
  distances from the left and the top of the image in CSS pixels respectively, and all the
  coordinates together must represent the points of the polygon, in order.</p>

  <p>In the <dfn id=attr-area-shape-rect title=attr-area-shape-rect>rectangle state</dfn>, <code><a href=#the-area-element>area</a></code> elements must
  have a <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute with exactly four integers, the
  first of which must be less than the third, and the second of which must be less than the fourth.
  The four points must represent, respectively, the distance from the left edge of the image to the
  left side of the rectangle, the distance from the top edge to the top side, the distance from the
  left edge to the right side, and the distance from the top edge to the bottom side, all in CSS
  pixels.</p>

  <div class=impl>

  <p>When user agents allow users to <a href=#following-hyperlinks title="following hyperlinks">follow hyperlinks</a> or
  <a href=#downloading-hyperlinks title="downloading hyperlinks">download hyperlinks</a> created using the
  <code><a href=#the-area-element>area</a></code> element, as described in the next section, the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>, <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>, <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>, and <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>
  attributes decide how the link is followed. The <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><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>

  </div>

  <p>The <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>, <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>, <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>,
  <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
  attributes must be omitted if the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute is not
  present.</p>

  <p>If the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an
  <code><a href=#the-area-element>area</a></code> element, then the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute must
  also be specified.</p>

  <div class=impl>

  <p>The <a href=#activation-behavior>activation behavior</a> of <code><a href=#the-area-element>area</a></code> elements is to run the following
  steps:</p>

  <ol><!-- c.f. <a>'s similar section --><li><p>If the <code><a href=#the-area-element>area</a></code> element's <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully active</a>,
   then abort these steps.</li>

   <li>

    <p>If the <code><a href=#the-area-element>area</a></code> element has a <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>
    attribute and the algorithm is not <a href=#allowed-to-show-a-popup>allowed to show a popup</a>, or the element's <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute is present and applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules
    for choosing a browsing context given a browsing context name</a>, using the value of the
    <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name, would
    result in there not being a chosen browsing context, then run these substeps:</p>

    <ol><li><p>If there is an <a href=#entry-script>entry script</a>, throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code>
     exception.</li>

     <li><p>Abort these steps without following the hyperlink.</li>

    </ol></li>

   <li><p>Otherwise, the user agent must <a href=#following-hyperlinks title="following hyperlinks">follow the
   hyperlink</a> or <a href=#downloading-hyperlinks title="downloading hyperlinks">download the hyperlink</a> created by
   the <code><a href=#the-area-element>area</a></code> element, if any, and as determined by the <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute and any expressed user
   preference.</li>

  </ol><p>The IDL attributes <dfn id=dom-area-alt title=dom-area-alt><code>alt</code></dfn>, <dfn id=dom-area-coords title=dom-area-coords><code>coords</code></dfn>, <dfn id=dom-area-target title=dom-area-target><code>target</code></dfn>, <dfn id=dom-area-download title=dom-area-download><code>download</code></dfn>, <dfn id=dom-area-ping title=dom-area-ping><code>ping</code></dfn>, <dfn id=dom-area-rel title=dom-area-rel><code>rel</code></dfn>,
  <dfn id=dom-area-hreflang title=dom-area-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-area-type title=dom-area-type><code>type</code></dfn>, each must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <p>The IDL attribute <dfn id=dom-area-shape title=dom-area-shape><code>shape</code></dfn> must
  <a href=#reflect>reflect</a> the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> content attribute.</p>

  <p>The IDL attribute <dfn id=dom-area-rellist title=dom-area-rellist><code>relList</code></dfn> must
  <a href=#reflect>reflect</a> the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> content attribute.</p>

  <hr><!-- concept-uu --><p>The <code><a href=#the-area-element>area</a></code> element also supports the <code><a href=#urlutils>URLUtils</a></code> interface. <a href=#refsURL>[URL]</a></p>

  <p>When the element is created, and whenever the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute is set, changed, or removed, the user
  agent must invoke the element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-set-the-input title=concept-uu-set-the-input>set the input</a> algorithm with the value of the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute, if any, or the empty string otherwise,
  as the given value.</p>

  <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base title=concept-uu-get-the-base>get the
  base</a> algorithm must simply return <a href="#the-element's-base-url">the element's base URL</a>.</p>

  <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding title=concept-uu-query-encoding>query
  encoding</a> is the <a href="#document's-character-encoding">document's character encoding</a>.</p>

  <p>When the element's <code><a href=#urlutils>URLUtils</a></code> interface invokes its <a href=#concept-uu-update title=concept-uu-update>update steps</a> with a string <var title="">value</var>, the user
  agent must set the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute to
  the string <var title="">value</var>.</p>

  </div>



  <h4 id=image-maps><span class=secno>4.8.14 </span>Image maps</h4>

  <!-- TESTS
  http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/smallcats%22%20usemap%3D%23a%20onclick%3Dw%28%27img%27%29%3E%0A%3Cmap%20name%3Da%3E%0A%20%3Carea%20onclick%3Dw%28%271%27%29%20coords%3D%270%25%200%25%20100%25%20100%25%27%20href%3Djavascript%3A%3E%0A%3C/map%3E
  http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cbody%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/smallcats%22%20usemap%3D%23a%20onclick%3Dw%28%27img%27%29%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/sample%22%20usemap%3D%23a%20onclick%3Dw%28%27img%27%29%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3Cmap%20name%3Da%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%20%3Carea%20onclick%3Dw%28%271%27%29%20coords%3D%270%200%2050%2050%27%20href%3Djavascript%3A%20onfocus%3D%22w%28document.activeElement.tagName%29%22%3E%0A%3C/map%3E%0A%3Cscript%3E%0A%20var%20x%20%3D%20document.getElementsByTagName%28%27img%27%29%5B0%5D%3B%0A%20x.parentNode.appendChild%28x%29%3B%0A%20document.getElementsByTagName%28%27area%27%29%5B0%5D.focus%28%29%3B%0A%3C/script%3E
  http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3Ex%3Cmap%3E%3Carea%20shape%3Dpolyg%20coords%3D%221%2C2%203%22%3E%3C/map%3E%0A%3Cscript%3Ex%20%3D%20document.getElementsByTagName%28%27area%27%29%5B0%5D%3B%20w%28x.shape%20+%20%27%20%27%20+%20x.coords%29%3C/script%3E
  http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Cp%3E%3Cimg%20src%3D%22http%3A//hixie.ch/resources/images/astrophy/128%22%20usemap%3D%23a%3E%0D%0A%3Cmap%20name%3Da%3E%3Carea%20shape%3Dcirc%20coords%3D%2220%2C20%2C10%25%22%20href%3D%23%3E%3Carea%20shape%3Dcirc%20coords%3D%2220%2C20%2C10%22%20href%3D%23%3E%3C/map%3E%0D%0A%3Cscript%3Edocument.write%28document.getElementsByTagName%28%27area%27%29%5B0%5D.coords%29%3C/script%3E
  -->

  <div class=impl>

  <h5 id=authoring><span class=secno>4.8.14.1 </span>Authoring</h5>

  </div>

  <p>An <dfn id=image-map>image map</dfn> allows geometric areas on an image to be
  associated with <a href=#hyperlink title=hyperlink>hyperlinks</a>.</p>

  <p>An image, in the form of an <code><a href=#the-img-element>img</a></code> element or an
  <code><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><a href=#the-map-element>map</a></code> element) by
  specifying a <dfn id=attr-hyperlink-usemap title=attr-hyperlink-usemap><code>usemap</code></dfn> attribute on
  the <code><a href=#the-img-element>img</a></code> or <code><a href=#the-object-element>object</a></code> element. The <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute, if specified,
  must be a <a href=#valid-hash-name-reference>valid hash-name reference</a> to a
  <code><a href=#the-map-element>map</a></code> element.</p>

  <div class=example>

   <p>Consider an image that looks as follows:</p>

   <p><img src=http://images.whatwg.org/sample-usemap.png width=600 alt="A line with four shapes in it, equally spaced: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star." height=150></p>

   <p>If we wanted just the colored areas to be clickable, we could
   do it as follows:</p>

   <pre>&lt;p&gt;
 Please select a shape:
 &lt;img src="shapes.png" usemap="#shapes"
      alt="Four shapes are available: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star."&gt;
 &lt;map name="shapes"&gt;
  &lt;area shape=rect coords="50,50,100,100"&gt; &lt;!-- the hole in the red box --&gt;
  &lt;area shape=rect coords="25,25,125,125" href="red.html" alt="Red box."&gt;
  &lt;area shape=circle coords="200,75,50" href="green.html" alt="Green circle."&gt;
  &lt;area shape=poly coords="325,25,262,125,388,125" href="blue.html" alt="Blue triangle."&gt;
  &lt;area shape=poly coords="450,25,435,60,400,75,435,90,450,125,465,90,500,75,465,60"
        href="yellow.html" alt="Yellow star."&gt;
 &lt;/map&gt;
&lt;/p&gt;</pre>

  </div>

  <div class=impl>

  <h5 id=processing-model-0><span class=secno>4.8.14.2 </span>Processing model</h5>

  <p>If an <code><a href=#the-img-element>img</a></code> element or an <code><a href=#the-object-element>object</a></code> element
  representing an image has a <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute specified,
  user agents must process it as follows:</p>

  <ol><li><p>First, <a href=#rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference</a>
   to a <code><a href=#the-map-element>map</a></code> element must be followed. This will return
   either an element (the <var title="">map</var>) or null.</li>

   <li><p>If that returned null, then abort these steps. The image is
   not associated with an image map after all.</li>

   <li><p>Otherwise, the user agent must collect all the
   <code><a href=#the-area-element>area</a></code> elements that are descendants of the <var title="">map</var>. Let those be the <var title="">areas</var>.</li>

  </ol><p>Having obtained the list of <code><a href=#the-area-element>area</a></code> elements that form
  the image map (the <var title="">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><a href=#the-img-element>img</a></code> element represents, then it must use the following
  steps.</p>

  <p class=note>In user agents that do not support images, or that
  have images disabled, <code><a href=#the-object-element>object</a></code> elements cannot represent
  images, and thus this section never applies (the <a href=#fallback-content>fallback
  content</a> is shown instead). The following steps therefore only
  apply to <code><a href=#the-img-element>img</a></code> elements.</p>

  <ol><li><p>Remove all the <code><a href=#the-area-element>area</a></code> elements in <var title="">areas</var> that have no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute.</li>

   <li><p>Remove all the <code><a href=#the-area-element>area</a></code> elements in <var title="">areas</var> that have no <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute, or whose <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute's value is the empty
   string, <em>if</em> there is another <code><a href=#the-area-element>area</a></code> element in
   <var title="">areas</var> with the same value in the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute and with a
   non-empty <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute.</li>

   <li><p>Each remaining <code><a href=#the-area-element>area</a></code> element in <var title="">areas</var> represents a <a href=#hyperlink>hyperlink</a>. Those
   hyperlinks should all be made available to the user in a manner
   associated with the text of the <code><a href=#the-img-element>img</a></code>.</p>

   <p>In this context, user agents may represent <code><a href=#the-area-element>area</a></code> and
   <code><a href=#the-img-element>img</a></code> elements with no specified <code title="">alt</code> attributes, or whose <code title="">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.</li>

  </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><a href=#the-area-element>area</a></code> elements in <var title="">areas</var>, in reverse
  tree order (so the last specified <code><a href=#the-area-element>area</a></code> element in the
  <var title="">map</var> is the bottom-most shape, and the first
  element in the <var title="">map</var>, in tree order, is the
  top-most shape).</p>

  <p>Each <code><a href=#the-area-element>area</a></code> element in <var title="">areas</var> must
  be processed as follows to obtain a shape to layer onto the
  image:</p>

  <ol><li><p>Find the state that the element's <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute represents.</li>

   <li><p>Use the <a href=#rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</a> to
   parse the element's <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code>
   attribute, if it is present, and let the result be the <var title="">coords</var> list. If the attribute is absent, let the
   <var title="">coords</var> list be the empty list.</li>

   <li><p>If the number of items in the <var title="">coords</var>
   list is less than the minimum number given for the
   <code><a href=#the-area-element>area</a></code> element's current state, as per the following
   table, then the shape is empty; abort these steps.</p>
    <table><thead><tr><th>State
       <th>Minimum number of items
     <tbody><tr><td><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a>
       <td>3
      <tr><td><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a>
       <td>0
      <tr><td><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a>
       <td>6
      <tr><td><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a>
       <td>4
    </table></li>

   <li><p>Check for excess items in the <var title="">coords</var>
   list as per the entry in the following list corresponding to the
   <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute's state:</p>
    <dl class=switch><dt><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a></dt>
     <dd>Drop any items in the list beyond the third.</dd>
     <dt><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a></dt>
     <dd>Drop all items in the list.</dd>
     <dt><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a></dt>
     <dd>Drop the last item if there's an odd number of items.</dd>
     <dt><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a></dt>
     <dd>Drop any items in the list beyond the fourth.</dd>
    </dl></li>

   <li><p>If the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
   represents the <a href=#attr-area-shape-rect title=attr-area-shape-rect>rectangle
   state</a>, and the first number in the list is numerically less
   than the third number in the list, then swap those two numbers
   around.</li>

   <li><p>If the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
   represents the <a href=#attr-area-shape-rect title=attr-area-shape-rect>rectangle
   state</a>, and the second number in the list is numerically less
   than the fourth number in the list, then swap those two numbers
   around.</li>

   <li><p>If the <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
   represents the <a href=#attr-area-shape-circle title=attr-area-shape-circle>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>

   <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 title=attr-area-shape><a href=#attr-area-shape>shape</a></code>
   attribute:</p>

    <dl class=switch><dt><a href=#attr-area-shape-circle title=attr-area-shape-circle>Circle state</a></dt>
     <dd>
      <p>Let <var title="">x</var> be the first number in <var title="">coords</var>, <var title="">y</var> be the second
      number, and <var title="">r</var> be the third number.</p>
      <p>The shape is a circle whose center is <var title="">x</var>
      CSS pixels from the left edge of the image and <var title="">y</var> CSS pixels from the top edge of the image, and
      whose radius is <var title="">r</var> pixels.</p>
     </dd>

     <dt><a href=#attr-area-shape-default title=attr-area-shape-default>Default state</a></dt>
     <dd>
      <p>The shape is a rectangle that exactly covers the entire
      image.</p>
     </dd>

     <dt><a href=#attr-area-shape-poly title=attr-area-shape-poly>Polygon state</a></dt>
     <dd>

      <p>Let <var title="">x<sub title=""><var title="">i</var></sub></var> be the <span title="">(2<var title="">i</var>)</span>th entry in <var title="">coords</var>,
      and <var title="">y<sub title=""><var title="">i</var></sub></var> be the <span title="">(2<var title="">i</var>+1)</span>th entry in <var title="">coords</var>
      (the first entry in <var title="">coords</var> being the one
      with index 0).</p>

      <p>Let <var title="">the coordinates</var> be (<var title="">x<sub title=""><var title="">i</var></sub></var>, <var title="">y<sub title=""><var title="">i</var></sub></var>),
      interpreted in CSS pixels measured from the top left of the
      image, for all integer values of <var title="">i</var> from 0 to
      <span title="">(<var title="">N</var>/2)-1</span>, where <var title="">N</var> is the number of items in <var title="">coords</var>.</p>

      <p>The shape is a polygon whose vertices are given by <var title="">the coordinates</var>, and whose interior is
      established using the even-odd rule. <a href=#refsGRAPHICS>[GRAPHICS]</a></p>

      <!--
        browsers implement the even-odd rule / even winding rule:
        http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cimg%20usemap%3D%22%23x%22%20src%3D%22/resources/images/sample%22%3E%0A%3Cmap%20name%3D%22x%22%3E%0A%20%20%3Carea%20shape%3Dpolygon%20coords%3D%220%2C0%200%2C100%20100%2C100%20100%2C2%201%2C2%202%2C1%202%2C99%2099%2C99%2099%2C0%22%20href%3Da%3E%0A%3C/map%3E%0A
       -->

     </dd>

     <dt><a href=#attr-area-shape-rect title=attr-area-shape-rect>Rectangle state</a></dt>

     <dd>

      <p>Let <var title="">x<sub title="">1</sub></var> be the first
      number in <var title="">coords</var>, <var title="">y<sub title="">1</sub></var> be the second number, <var title="">x<sub title="">2</sub></var> be the third number, and <var title="">y<sub title="">2</sub></var> be the fourth number.</p>

      <p>The shape is a rectangle whose top-left corner is given by
      the coordinate (<var title="">x<sub title="">1</sub></var>, <var title="">y<sub title="">1</sub></var>) and whose bottom right
      corner is given by the coordinate (<var title="">x<sub title="">2</sub></var>, <var title="">y<sub title="">2</sub></var>), those coordinates being interpreted as
      CSS pixels from the top left corner of the image.</p>

     </dd>

    </dl><p>For historical reasons, the coordinates must be interpreted
    relative to the <em>displayed</em> image after any stretching
    caused by the CSS 'width' and 'height' properties (or, for non-CSS
    browsers, the image element's <code title="">width</code> and
    <code title="">height</code> attributes &mdash; CSS browsers map
    those attributes to the aforementioned CSS properties).</p>

    <p class=note>Browser zoom features and transforms applied using
    CSS or SVG do not affect the coordinates.</p>

   </li>

  </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><a href=#the-area-element>area</a></code>
  elements representing <a href=#hyperlink title=hyperlink>hyperlinks</a> to
  be selected and activated (e.g. using a keyboard).</p>

  <p class=note>Because a <code><a href=#the-map-element>map</a></code> element (and its
  <code><a href=#the-area-element>area</a></code> elements) can be associated with multiple
  <code><a href=#the-img-element>img</a></code> and <code><a href=#the-object-element>object</a></code> elements, it is possible
  for an <code><a href=#the-area-element>area</a></code> element to correspond to multiple focusable
  areas of the document.</p>

  <p>Image maps are <a href=#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>

  </div>



  <h4 id=mathml><span class=secno>4.8.15 </span>MathML</h4>

  <p>The <dfn id=math><code>math</code></dfn> element from the <a href=#mathml-namespace>MathML
  namespace</a> falls into the <a href=#embedded-content>embedded content</a>,
  <a href=#phrasing-content>phrasing content</a>, and <a href=#flow-content>flow content</a>
  categories for the purposes of the content models in this
  specification.</p>

  <div class=impl>

  <!-- apparently we get to define error handling, so: -->

  <p>User agents must handle text other than <a href=#inter-element-whitespace>inter-element
  whitespace</a> found in MathML elements whose content models do
  not allow straight text by pretending for the purposes of MathML
  content models, layout, and rendering that that text is actually
  wrapped in an <code title="">mtext</code> element in the
  <a href=#mathml-namespace>MathML namespace</a>. (Such text is not, however,
  conforming.)</p>

  <p>User agents must act as if any MathML element whose contents does
  not match the element's content model was replaced, for the purposes
  of MathML layout and rendering, by an <code title="">merror</code>
  element in the <a href=#mathml-namespace>MathML namespace</a> containing some
  appropriate error message.</p>

  <p>To enable authors to use MathML tools that only accept MathML in
  its XML form, interactive HTML user agents are encouraged to provide
  a way to export any MathML fragment as an XML namespace-well-formed
  XML fragment.</p>

  </div>

  <p>The semantics of MathML elements are defined by the MathML
  specification and <a href=#other-applicable-specifications>other applicable specifications</a>. <a href=#refsMATHML>[MATHML]</a></p>

  <div class=example>

   <p>Here is an example of the use of MathML in an HTML document:</p>

   <pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;The quadratic formula&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;The quadratic formula&lt;/h1&gt;
  &lt;p&gt;
   &lt;math&gt;
    &lt;mi&gt;x&lt;/mi&gt;
    &lt;mo&gt;=&lt;/mo&gt;
    &lt;mfrac&gt;
     &lt;mrow&gt;
      &lt;mo form="prefix"&gt;&minus;&lt;/mo&gt; &lt;mi&gt;b&lt;/mi&gt;
      &lt;mo&gt;&plusmn;&lt;/mo&gt;
      &lt;msqrt&gt;
       &lt;msup&gt; &lt;mi&gt;b&lt;/mi&gt; &lt;mn&gt;2&lt;/mn&gt; &lt;/msup&gt;
       &lt;mo&gt;&minus;&lt;/mo&gt;
       &lt;mn&gt;4&lt;/mn&gt; &lt;mo&gt;&it;&lt;/mo&gt; &lt;mi&gt;a&lt;/mi&gt; &lt;mo&gt;&it;&lt;/mo&gt; &lt;mi&gt;c&lt;/mi&gt;
      &lt;/msqrt&gt;
     &lt;/mrow&gt;
     &lt;mrow&gt;
      &lt;mn&gt;2&lt;/mn&gt; &lt;mo&gt;&it;&lt;/mo&gt; &lt;mi&gt;a&lt;/mi&gt;
     &lt;/mrow&gt;
    &lt;/mfrac&gt;
   &lt;/math&gt;
  &lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>



  <h4 id=svg-0><span class=secno>4.8.16 </span>SVG</h4>

  <p>The <dfn id=svg><code>svg</code></dfn> element from the <a href=#svg-namespace>SVG
  namespace</a> falls into the <a href=#embedded-content>embedded content</a>,
  <a href=#phrasing-content>phrasing content</a>, and <a href=#flow-content>flow content</a>
  categories for the purposes of the content models in this
  specification.</p>

  <div class=impl>

  <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>

  </div>

  <p>When the SVG <code title="">foreignObject</code> element contains
  elements from the <a href=#html-namespace-0>HTML namespace</a>, such elements must
  all be <a href=#flow-content>flow content</a>. <a href=#refsSVG>[SVG]</a></p>

  <p>The content model for <code title="">title</code> elements in the
  <a href=#svg-namespace>SVG namespace</a> inside <a href=#html-documents>HTML documents</a> is
  <a href=#phrasing-content>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>other applicable specifications</a>. <a href=#refsSVG>[SVG]</a></p>

  <!-- The following paragraph is for bug 7510 -->
  <p>The SVG specification includes requirements regarding the
  handling of elements in the DOM that are not in the SVG namespace,
  that are in SVG fragments, and that are not included in a
  <code title="">foreignObject</code> element. <em>This</em>
  specification does not define any processing for elements in SVG
  fragments that are not in the HTML namespace; they are considered
  neither conforming nor non-conforming from the perspective of this
  specification.</p>



  <h4 id=dimension-attributes><span class=secno>4.8.17 </span><dfn>Dimension attributes</dfn></h4>

  <p><span class=impl><strong>Author requirements</strong>:</span>
  The <dfn id=attr-dim-width title=attr-dim-width><code>width</code></dfn> and <dfn id=attr-dim-height title=attr-dim-height><code>height</code></dfn> attributes on
  <code><a href=#the-img-element>img</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>,
  <code><a href=#the-object-element>object</a></code>, <code><a href=#the-video-element>video</a></code>, and, when their <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state,
  <code><a href=#the-input-element>input</a></code> elements may be specified to give the dimensions
  of the visual content of the element (the width and height
  respectively, relative to the nominal direction of the output
  medium), in CSS pixels. The attributes, if specified, must have
  values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid
  non-negative integers</a>.</p>

  <p>The specified dimensions given may differ from the dimensions
  specified in the resource itself, since the resource may have a
  resolution that differs from the CSS pixel resolution. (On screens,
  CSS pixels have a resolution of 96ppi, but in general the CSS pixel
  resolution depends on the reading distance.) If both attributes are
  specified, then one of the following statements must be true:</p>

  <ul><li><span title=""><var title="">specified width</var> - 0.5 &le;
             <var title="">specified height</var> * <var title="">target ratio</var> &le;
             <var title="">specified width</var> + 0.5</span></li>

   <li><span title=""><var title="">specified height</var> - 0.5 &le;
             <var title="">specified width</var> / <var title="">target ratio</var> &le;
             <var title="">specified height</var> + 0.5</span></li>

   <li><span title=""><var title="">specified height</var> = <var title="">specified width</var> = 0</span></li>

  </ul><p>The <var title="">target ratio</var> is the ratio of the
  intrinsic width to the intrinsic height in the resource. The <var title="">specified width</var> and <var title="">specified
  height</var> are the values of the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes respectively.</p>

  <p>The two attributes must be omitted if the resource in question
  does not have both an intrinsic width and an intrinsic height.</p>

  <p>If the two attributes are both zero, it indicates that the
  element is not intended for the user (e.g. it might be a part of a
  service to count page views).</p>

  <p class=note>The dimension attributes are not intended to be used
  to stretch the image.</p>

  <div class=impl>

  <p><strong>User agent requirements</strong>: User agents are
  expected to use these attributes <a href=#dimRendering>as hints
  for the rendering</a>.</p>

  <p>The <dfn id=dom-dim-width title=dom-dim-width><code>width</code></dfn> and <dfn id=dom-dim-height title=dom-dim-height><code>height</code></dfn> IDL attributes on
  the <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-object-element>object</a></code>,
  and <code><a href=#the-video-element>video</a></code> elements must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p class=note>For <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>, and
  <code><a href=#the-object-element>object</a></code> the IDL attributes are <code>DOMString</code>;
  for <code><a href=#the-video-element>video</a></code> the IDL attributes are <code>unsigned
  long</code>.</p>

  <p class=note>The corresponding IDL attributes for <code title=dom-img-height><a href=#dom-img-height>img</a></code> and <code title=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>

  </div>



  <h3 id=tabular-data><span class=secno>4.9 </span>Tabular data</h3>


  <h4 id=the-table-element><span class=secno>4.9.1 </span>The <dfn><code>table</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>In this order: optionally a <code><a href=#the-caption-element>caption</a></code> element,
   followed by zero or more <code><a href=#the-colgroup-element>colgroup</a></code> elements, followed
   optionally by a <code><a href=#the-thead-element>thead</a></code> element, followed optionally by
   a <code><a href=#the-tfoot-element>tfoot</a></code> element, followed by either zero or more
   <code><a href=#the-tbody-element>tbody</a></code> elements or one or more <code><a href=#the-tr-element>tr</a></code>
   elements, followed optionally by a <code><a href=#the-tfoot-element>tfoot</a></code> element (but
   there can only be one <code><a href=#the-tfoot-element>tfoot</a></code> element child in
   total), optionally intermixed with one or more <a href=#script-supporting-elements>script-supporting elements</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-table-sortable><a href=#attr-table-sortable>sortable</a></code></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltableelement>HTMLTableElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute <a href=#htmltablecaptionelement>HTMLTableCaptionElement</a>? <a href=#dom-table-caption title=dom-table-caption>caption</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createcaption title=dom-table-createCaption>createCaption</a>();
  void <a href=#dom-table-deletecaption title=dom-table-deleteCaption>deleteCaption</a>();
           attribute <a href=#htmltablesectionelement>HTMLTableSectionElement</a>? <a href=#dom-table-thead title=dom-table-tHead>tHead</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createthead title=dom-table-createTHead>createTHead</a>();
  void <a href=#dom-table-deletethead title=dom-table-deleteTHead>deleteTHead</a>();
           attribute <a href=#htmltablesectionelement>HTMLTableSectionElement</a>? <a href=#dom-table-tfoot title=dom-table-tFoot>tFoot</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createtfoot title=dom-table-createTFoot>createTFoot</a>();
  void <a href=#dom-table-deletetfoot title=dom-table-deleteTFoot>deleteTFoot</a>();
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-table-tbodies title=dom-table-tBodies>tBodies</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-createtbody title=dom-table-createTBody>createTBody</a>();
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-table-rows title=dom-table-rows>rows</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-table-insertrow title=dom-table-insertRow>insertRow</a>(optional long index = -1);
  void <a href=#dom-table-deleterow title=dom-table-deleteRow>deleteRow</a>(long index);
           attribute boolean <a href=#dom-table-sortable title=dom-table-sortable>sortable</a>;
  void <a href=#dom-table-stopsorting title=dom-table-stopSorting>stopSorting</a>();

  // <a href="#HTMLTableElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-table-element>table</a></code> element <a href=#represents>represents</a> data with
  more than one dimension, in the form of a <a href=#concept-table title=concept-table>table</a>.</p>

  <p><span class=impl>The <code><a href=#the-table-element>table</a></code> element takes part in
  the <a href=#table-model>table model</a>.</span> Tables have rows, columns, and
  cells given by their descendants. The rows and columns form a grid;
  a table's cells must completely cover that grid without overlap.</p>

  <div class=impl>
  <p class=note>Precise rules for determining whether this
  conformance requirement is met are described in the description of
  the <a href=#table-model>table model</a>.</p>
  </div>

  <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>

  <div class=impl>
  <p>If a <code><a href=#the-table-element>table</a></code> element has a (non-conforming) <code title=attr-table-summary><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>
  </div>

  <p>Tables must not be used as layout aids.

  Historically, some Web authors have misused tables in HTML as a way
  to control their page layout. This usage is non-conforming, because
  tools attempting to extract tabular data from such documents would
  obtain very confusing results.

  In particular, users of accessibility tools like screen readers are
  likely to find it very difficult to navigate pages with tables used
  for layout.</p>

  <p class=note>There are a variety of alternatives to using HTML
  tables for layout, primarily using CSS positioning and the CSS table
  model. <a href=#refsCSS>[CSS]</a></p>

  <div class=impl>

  <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>

  </div>

  <p class=note>Authors <span class=impl>and implementors</span>
  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>

  <div class=impl>

  <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 title=attr-aria-role><a href=#attr-aria-role>role</a></code> attribute with the value <code title=attr-aria-role-presentation>presentation</code>
     <td>Probably a layout table
    <tr><td>The use of the non-conforming <code title=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 title=attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> and <code title=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><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-th-element>th</a></code> elements        
     <td>Probably a non-layout table
    <tr><td>The use of the <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> and <code title=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 title=attr-table-border><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 title=attr-table-summary><a href=#attr-table-summary>summary</a></code> attribute
     <td>Not a good indicator (both layout and non-layout tables have historically been given this attribute)
  </table><p class=note>It is quite possible that the above suggestions are
  wrong. Implementors are urged to provide feedback elaborating on
  their experiences with trying to create a layout table detection
  heuristic.</p>

  </div>

  <hr><p>The <code title=attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> attribute is used in the <a href=#table-sorting-model>table
  sorting model</a>.</p>

  <hr><!--TOPIC:DOM APIs--><dl class=domintro><dt><var title="">table</var> . <code title=dom-table-caption><a href=#dom-table-caption>caption</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the table's <code><a href=#the-caption-element>caption</a></code> element.</p>
    <p>Can be set, to replace the <code><a href=#the-caption-element>caption</a></code> element. If the
    new value is not a <code><a href=#the-caption-element>caption</a></code> element, throws a
    <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
   </dd>

   <dt><var title="">caption</var> = <var title="">table</var> . <code title=dom-table-createCaption><a href=#dom-table-createcaption>createCaption</a></code>()</dt>
   <dd>
    <p>Ensures the table has a <code><a href=#the-caption-element>caption</a></code> element, and returns it.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-deleteCaption><a href=#dom-table-deletecaption>deleteCaption</a></code>()</dt>
   <dd>
    <p>Ensures the table does not have a <code><a href=#the-caption-element>caption</a></code> element.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-tHead><a href=#dom-table-thead>tHead</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the table's <code><a href=#the-thead-element>thead</a></code> element.</p>
    <p>Can be set, to replace the <code><a href=#the-thead-element>thead</a></code> element. If the
    new value is not a <code><a href=#the-thead-element>thead</a></code> element, throws a
    <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
   </dd>

   <dt><var title="">thead</var> = <var title="">table</var> . <code title=dom-table-createTHead><a href=#dom-table-createthead>createTHead</a></code>()</dt>
   <dd>
    <p>Ensures the table has a <code><a href=#the-thead-element>thead</a></code> element, and returns it.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-deleteTHead><a href=#dom-table-deletethead>deleteTHead</a></code>()</dt>
   <dd>
    <p>Ensures the table does not have a <code><a href=#the-thead-element>thead</a></code> element.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-tFoot><a href=#dom-table-tfoot>tFoot</a></code> [ = <var title="">value</var> ]</dt>
   <dd>
    <p>Returns the table's <code><a href=#the-tfoot-element>tfoot</a></code> element.</p>
    <p>Can be set, to replace the <code><a href=#the-tfoot-element>tfoot</a></code> element. If the
    new value is not a <code><a href=#the-tfoot-element>tfoot</a></code> element, throws a
    <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
   </dd>

   <dt><var title="">tfoot</var> = <var title="">table</var> . <code title=dom-table-createTFoot><a href=#dom-table-createtfoot>createTFoot</a></code>()</dt>
   <dd>
    <p>Ensures the table has a <code><a href=#the-tfoot-element>tfoot</a></code> element, and returns it.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-deleteTFoot><a href=#dom-table-deletetfoot>deleteTFoot</a></code>()</dt>
   <dd>
    <p>Ensures the table does not have a <code><a href=#the-tfoot-element>tfoot</a></code> element.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-tBodies><a href=#dom-table-tbodies>tBodies</a></code></dt>
   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-tbody-element>tbody</a></code> elements of the table.</p>
   </dd>

   <dt><var title="">tbody</var> = <var title="">table</var> . <code title=dom-table-createTBody><a href=#dom-table-createtbody>createTBody</a></code>()</dt>
   <dd>
    <p>Creates a <code><a href=#the-tbody-element>tbody</a></code> element, inserts it into the table, and returns it.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code></dt>
   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-tr-element>tr</a></code> elements of the table.</p>
   </dd>

   <dt><var title="">tr</var> = <var title="">table</var> . <code title=dom-table-insertRow><a href=#dom-table-insertrow>insertRow</a></code>( [ <var title="">index</var> ] )</dt>
   <dd>
    <p>Creates a <code><a href=#the-tr-element>tr</a></code> element, along with a <code><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><a href=#the-tr-element>tr</a></code>.</p>
    <p>The position is relative to the rows in the table. The index &minus;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 &minus;1 or greater than the number of rows, throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
   </dd>

   <dt><var title="">table</var> . <code title=dom-table-deleteRow><a href=#dom-table-deleterow>deleteRow</a></code>(<var title="">index</var>)</dt>
   <dd>
    <p>Removes the <code><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 &minus;1 is equivalent to deleting the last row of the table.</p>
    <p>If the given position is less than &minus;1 or greater than the index of the last row, or if there are no rows, throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
   </dd>

  </dl><div class=impl>

<!--CLEANUP-->
  <p>The <dfn id=dom-table-caption title=dom-table-caption><code>caption</code></dfn> IDL
  attribute must return, on getting, the first <code><a href=#the-caption-element>caption</a></code>
  element child of the <code><a href=#the-table-element>table</a></code> element, if any, or null
  otherwise. On setting, if the new value is a <code><a href=#the-caption-element>caption</a></code>
  element, the first <code><a href=#the-caption-element>caption</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new
  value must be inserted as the first node of the <code><a href=#the-table-element>table</a></code>
  element. If the new value is not a <code><a href=#the-caption-element>caption</a></code> element,
  then a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be
  thrown instead.</p>

  <p>The <dfn id=dom-table-createcaption title=dom-table-createCaption><code>createCaption()</code></dfn>
  method must return the first <code><a href=#the-caption-element>caption</a></code> element child of
  the <code><a href=#the-table-element>table</a></code> element, if any; otherwise a new
  <code><a href=#the-caption-element>caption</a></code> element must be created, inserted as the first
  node of the <code><a href=#the-table-element>table</a></code> element, and then returned.</p>

  <p>The <dfn id=dom-table-deletecaption title=dom-table-deleteCaption><code>deleteCaption()</code></dfn>
  method must remove the first <code><a href=#the-caption-element>caption</a></code> element child of
  the <code><a href=#the-table-element>table</a></code> element, if any.</p>

  <p>The <dfn id=dom-table-thead title=dom-table-tHead><code>tHead</code></dfn> IDL
  attribute must return, on getting, the first <code><a href=#the-thead-element>thead</a></code>
  element child of the <code><a href=#the-table-element>table</a></code> element, if any, or null
  otherwise. On setting, if the new value is a <code><a href=#the-thead-element>thead</a></code>
  element, the first <code><a href=#the-thead-element>thead</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new
  value must be inserted immediately before the first element in the
  <code><a href=#the-table-element>table</a></code> element that is neither a <code><a href=#the-caption-element>caption</a></code>
  element nor a <code><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 not
  a <code><a href=#the-thead-element>thead</a></code> element, then a
  <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be thrown
  instead.</p>

  <p>The <dfn id=dom-table-createthead title=dom-table-createTHead><code>createTHead()</code></dfn>
  method must return the first <code><a href=#the-thead-element>thead</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any; otherwise a new
  <code><a href=#the-thead-element>thead</a></code> element must be created and inserted immediately
  before the first element in the <code><a href=#the-table-element>table</a></code> element that is
  neither a <code><a href=#the-caption-element>caption</a></code> element nor a <code><a href=#the-colgroup-element>colgroup</a></code>
  element, if any, or at the end of the table if there are no such
  elements, and then that new element must be returned.</p>

  <p>The <dfn id=dom-table-deletethead title=dom-table-deleteTHead><code>deleteTHead()</code></dfn>
  method must remove the first <code><a href=#the-thead-element>thead</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any.</p>

  <p>The <dfn id=dom-table-tfoot title=dom-table-tFoot><code>tFoot</code></dfn> IDL
  attribute must return, on getting, the first <code><a href=#the-tfoot-element>tfoot</a></code>
  element child of the <code><a href=#the-table-element>table</a></code> element, if any, or null
  otherwise. On setting, if the new value is a <code><a href=#the-tfoot-element>tfoot</a></code>
  element, the first <code><a href=#the-tfoot-element>tfoot</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new
  value must be inserted immediately before the first element in the
  <code><a href=#the-table-element>table</a></code> element that is neither a <code><a href=#the-caption-element>caption</a></code>
  element, a <code><a href=#the-colgroup-element>colgroup</a></code> element, nor a <code><a href=#the-thead-element>thead</a></code>
  element, if any, or at the end of the table if there are no such
  elements. If the new value is not a <code><a href=#the-tfoot-element>tfoot</a></code> element, then
  a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be thrown
  instead.</p>

  <p>The <dfn id=dom-table-createtfoot title=dom-table-createTFoot><code>createTFoot()</code></dfn>
  method must return the first <code><a href=#the-tfoot-element>tfoot</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any; otherwise a new
  <code><a href=#the-tfoot-element>tfoot</a></code> element must be created and inserted immediately
  before the first element in the <code><a href=#the-table-element>table</a></code> element that is
  neither a <code><a href=#the-caption-element>caption</a></code> element, a <code><a href=#the-colgroup-element>colgroup</a></code>
  element, nor a <code><a href=#the-thead-element>thead</a></code> element, if any, or at the end of
  the table if there are no such elements, and then that new element
  must be returned.</p>

  <p>The <dfn id=dom-table-deletetfoot title=dom-table-deleteTFoot><code>deleteTFoot()</code></dfn>
  method must remove the first <code><a href=#the-tfoot-element>tfoot</a></code> element child of the
  <code><a href=#the-table-element>table</a></code> element, if any.</p>

  <p>The <dfn id=dom-table-tbodies title=dom-table-tBodies><code>tBodies</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#the-table-element>table</a></code> node, whose filter matches only
  <code><a href=#the-tbody-element>tbody</a></code> elements that are children of the
  <code><a href=#the-table-element>table</a></code> element.</p>

  <p>The <dfn id=dom-table-createtbody title=dom-table-createTBody><code>createTBody()</code></dfn>
  method must create a new <code><a href=#the-tbody-element>tbody</a></code> element, insert it
  immediately after the last <code><a href=#the-tbody-element>tbody</a></code> element child in the
  <code><a href=#the-table-element>table</a></code> element, if any, or at the end of the
  <code><a href=#the-table-element>table</a></code> element if the <code><a href=#the-table-element>table</a></code> element has no
  <code><a href=#the-tbody-element>tbody</a></code> element children, and then must return the new
  <code><a href=#the-tbody-element>tbody</a></code> element.</p>

  <p>The <dfn id=dom-table-rows title=dom-table-rows><code>rows</code></dfn> attribute
  must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#the-table-element>table</a></code> node, whose filter matches only <code><a href=#the-tr-element>tr</a></code>
  elements that are either children of the <code><a href=#the-table-element>table</a></code> element,
  or children of <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, or
  <code><a href=#the-tfoot-element>tfoot</a></code> elements that are themselves children of the
  <code><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><a href=#the-thead-element>thead</a></code> are included first, in tree order, followed by
  those elements whose parent is either a <code><a href=#the-table-element>table</a></code> or
  <code><a href=#the-tbody-element>tbody</a></code> element, again in tree order, followed finally by
  those elements whose parent is a <code><a href=#the-tfoot-element>tfoot</a></code> element, still
  in tree order.</p>

  <p>The behavior of the <dfn id=dom-table-insertrow title=dom-table-insertRow><code>insertRow(<var title="">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 title="">index</var> argument:</p>

  <dl class=switch><dt>If <var title="">index</var> is less than &minus;1 or greater than
   the number of elements in <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code>
   collection:</dt>

   <dd>The method must throw an <code><a href=#indexsizeerror>IndexSizeError</a></code>
   exception.</dd>

   <dt>If the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection has
   zero elements in it, and the <code><a href=#the-table-element>table</a></code> has no
   <code><a href=#the-tbody-element>tbody</a></code> elements in it:</dt>

   <dd>The method must create a <code><a href=#the-tbody-element>tbody</a></code> element, then
   create a <code><a href=#the-tr-element>tr</a></code> element, then append the <code><a href=#the-tr-element>tr</a></code>
   element to the <code><a href=#the-tbody-element>tbody</a></code> element, then append the
   <code><a href=#the-tbody-element>tbody</a></code> element to the <code><a href=#the-table-element>table</a></code> element, and
   finally return the <code><a href=#the-tr-element>tr</a></code> element.</dd>

   <dt>If the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection has
   zero elements in it:</dt>

   <dd>The method must create a <code><a href=#the-tr-element>tr</a></code> element, append it to
   the last <code><a href=#the-tbody-element>tbody</a></code> element in the table, and return the
   <code><a href=#the-tr-element>tr</a></code> element.</dd>

   <dt>If <var title="">index</var> is &minus;1 or
   equal to the number of items in <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection:</dt>

   <dd>The method must create a <code><a href=#the-tr-element>tr</a></code> element, and append it
   to the parent of the last <code><a href=#the-tr-element>tr</a></code> element in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection. Then, the newly
   created <code><a href=#the-tr-element>tr</a></code> element must be returned.</dd>

   <dt>Otherwise:</dt>

   <dd>The method must create a <code><a href=#the-tr-element>tr</a></code> element, insert it
   immediately before the <var title="">index</var>th <code><a href=#the-tr-element>tr</a></code>
   element in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection,
   in the same parent, and finally must return the newly created
   <code><a href=#the-tr-element>tr</a></code> element.</dd>

  </dl><p>When the <dfn id=dom-table-deleterow title=dom-table-deleteRow><code>deleteRow(<var title="">index</var>)</code></dfn> method is called, the user agent
  must run the following steps:</p>

  <ol><li><p>If <var title="">index</var> is equal to &minus;1, then
   <var title="">index</var> must be set to the number of items in the
   <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection, minus
   one.</li>

   <li><p>Now, if <var title="">index</var> is less than zero, or
   greater than or equal to the number of elements in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection, the method must
   instead throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception, and these
   steps must be aborted.</li>

   <li><p>Otherwise, the method must remove the <var title="">index</var>th element in the <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection from its parent.</p>

  </ol><p>The <code title=dom-table-stopSorting><a href=#dom-table-stopsorting>stopSorting()</a></code> method is used in the <a href=#table-sorting-model>table
  sorting model</a>.</p>

  <p>The IDL attribute <dfn id=dom-table-sortable title=dom-table-sortable><code>sortable</code></dfn> must
  <a href=#reflect>reflect</a> the <code title=attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> content attribute.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>Here is an example of a table being used to mark up a Sudoku
   puzzle. Observe the lack of headers, which are not necessary in
   such a table.</p>

   <pre>&lt;section&gt;
 &lt;style scoped&gt;
  table { border-collapse: collapse; border: solid thick; }
  colgroup, tbody { border: solid medium; }
  td { border: solid thin; height: 1.4em; width: 1.4em; text-align: center; padding: 0; }
 &lt;/style&gt;
 &lt;h1&gt;Today's Sudoku&lt;/h1&gt;
 &lt;table&gt;
  &lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;col&gt;
  &lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;col&gt;
  &lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;col&gt;
  &lt;tbody&gt;
   &lt;tr&gt; &lt;td&gt; 1 &lt;td&gt;   &lt;td&gt; 3 &lt;td&gt; 6 &lt;td&gt;   &lt;td&gt; 4 &lt;td&gt; 7 &lt;td&gt;   &lt;td&gt; 9
   &lt;tr&gt; &lt;td&gt;   &lt;td&gt; 2 &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 9 &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 1 &lt;td&gt;
   &lt;tr&gt; &lt;td&gt; 7 &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 6
  &lt;tbody&gt;
   &lt;tr&gt; &lt;td&gt; 2 &lt;td&gt;   &lt;td&gt; 4 &lt;td&gt;   &lt;td&gt; 3 &lt;td&gt;   &lt;td&gt; 9 &lt;td&gt;   &lt;td&gt; 8
   &lt;tr&gt; &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;
   &lt;tr&gt; &lt;td&gt; 5 &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 9 &lt;td&gt;   &lt;td&gt; 7 &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 1
  &lt;tbody&gt;
   &lt;tr&gt; &lt;td&gt; 6 &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 5 &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 2
   &lt;tr&gt; &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 7 &lt;td&gt;   &lt;td&gt;   &lt;td&gt;   &lt;td&gt;
   &lt;tr&gt; &lt;td&gt; 9 &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 8 &lt;td&gt;   &lt;td&gt; 2 &lt;td&gt;   &lt;td&gt;   &lt;td&gt; 5
 &lt;/table&gt;
&lt;/section&gt;</pre>

  </div>




  <h5 id=table-descriptions-techniques><span class=secno>4.9.1.1 </span>Techniques for describing tables</h5>

  <p id=table-descriptions>For tables that consist of more than just
  a grid of cells with headers in the first row and headers in the
  first column, and for any table in general where the reader might
  have difficulty understanding the content, authors should include
  explanatory information introducing the table. This information is
  useful for all users, but is especially useful for users who cannot
  see the table, e.g. users of screen readers.</p>

  <p>Such explanatory information should introduce the purpose of the
  table, outline its basic cell structure, highlight any trends or
  patterns, and generally teach the user how to use the table.</p>

  <!--Describing the conclusions of the data in a table is useful to
  everyone; explaining how to read the table, if not obvious from the
  headers alone, is useful to everyone; describing the structure of
  the table, if it is easy to grasp visually, might not be useful to
  everyone, but it might also not be useful to users who can quickly
  navigate the table with an accessibility tool.-->

  <p>For instance, the following table:</p>

  <table><caption>Characteristics with positive and negative sides</caption>
   <thead><tr><th id=n> Negative
     <th> Characteristic
     <th> Positive
   <tbody><tr><td headers="n r1"> Sad
     <th id=r1> Mood
     <td> Happy
    <tr><td headers="n r2"> Failing
     <th id=r2> Grade
     <td> Passing
  </table><p>...might benefit from a description explaining the way the table
  is laid out, something like "Characteristics are given in the
  second column, with the negative side in the left column and the
  positive side in the right column".</p>

  <p>There are a variety of ways to include this information, such as:</p>

  <dl><dt>In prose, surrounding the table</dt>

   <dd>
    <div class=example><pre>&lt;p&gt;In the following table, characteristics are given in the second
column, with the negative side in the left column and the positive
side in the right column.&lt;/p&gt;
&lt;table&gt;
 &lt;caption&gt;Characteristics with positive and negative sides&lt;/caption&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th id="n"&gt; Negative
   &lt;th&gt; Characteristic
   &lt;th&gt; Positive
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;td headers="n r1"&gt; Sad
   &lt;th id="r1"&gt; Mood
   &lt;td&gt; Happy
  &lt;tr&gt;
   &lt;td headers="n r2"&gt; Failing
   &lt;th id="r2"&gt; Grade
   &lt;td&gt; Passing
&lt;/table&gt;</pre></div>
   </dd>

   <dt>In the table's <code><a href=#the-caption-element>caption</a></code></dt>

   <dd>
    <div class=example><pre>&lt;table&gt;
 &lt;caption&gt;
  &lt;strong&gt;Characteristics with positive and negative sides.&lt;/strong&gt;
  &lt;p&gt;Characteristics are given in the second column, with the
  negative side in the left column and the positive side in the right
  column.&lt;/p&gt;
 &lt;/caption&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th id="n"&gt; Negative
   &lt;th&gt; Characteristic
   &lt;th&gt; Positive
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;td headers="n r1"&gt; Sad
   &lt;th id="r1"&gt; Mood
   &lt;td&gt; Happy
  &lt;tr&gt;
   &lt;td headers="n r2"&gt; Failing
   &lt;th id="r2"&gt; Grade
   &lt;td&gt; Passing
&lt;/table&gt;</pre></div>
   </dd>

   <dt>In the table's <code><a href=#the-caption-element>caption</a></code>, in a <code><a href=#the-details-element>details</a></code> element</dt>

   <dd>
    <div class=example><pre>&lt;table&gt;
 &lt;caption&gt;
  &lt;strong&gt;Characteristics with positive and negative sides.&lt;/strong&gt;
  &lt;details&gt;
   &lt;summary&gt;Help&lt;/summary&gt;
   &lt;p&gt;Characteristics are given in the second column, with the
   negative side in the left column and the positive side in the right
   column.&lt;/p&gt;
  &lt;/details&gt;
 &lt;/caption&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th id="n"&gt; Negative
   &lt;th&gt; Characteristic
   &lt;th&gt; Positive
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;td headers="n r1"&gt; Sad
   &lt;th id="r1"&gt; Mood
   &lt;td&gt; Happy
  &lt;tr&gt;
   &lt;td headers="n r2"&gt; Failing
   &lt;th id="r2"&gt; Grade
   &lt;td&gt; Passing
&lt;/table&gt;</pre></div>
   </dd>

   <dt>Next to the table, in the same <code><a href=#the-figure-element>figure</a></code></dt>

   <dd>
    <div class=example><pre>&lt;figure&gt;
 &lt;figcaption&gt;Characteristics with positive and negative sides&lt;/figcaption&gt;
 &lt;p&gt;Characteristics are given in the second column, with the
 negative side in the left column and the positive side in the right
 column.&lt;/p&gt;
 &lt;table&gt;
  &lt;thead&gt;
   &lt;tr&gt;
    &lt;th id="n"&gt; Negative
    &lt;th&gt; Characteristic
    &lt;th&gt; Positive
  &lt;tbody&gt;
   &lt;tr&gt;
    &lt;td headers="n r1"&gt; Sad
    &lt;th id="r1"&gt; Mood
    &lt;td&gt; Happy
   &lt;tr&gt;
    &lt;td headers="n r2"&gt; Failing
    &lt;th id="r2"&gt; Grade
    &lt;td&gt; Passing
 &lt;/table&gt;
&lt;/figure&gt;</pre></div>
   </dd>

   <dt>Next to the table, in a <code><a href=#the-figure-element>figure</a></code>'s <code><a href=#the-figcaption-element>figcaption</a></code></dt>

   <dd>
    <div class=example><pre>&lt;figure&gt;
 &lt;figcaption&gt;
  &lt;strong&gt;Characteristics with positive and negative sides&lt;/strong&gt;
  &lt;p&gt;Characteristics are given in the second column, with the
  negative side in the left column and the positive side in the right
  column.&lt;/p&gt;
 &lt;/figcaption&gt;
 &lt;table&gt;
  &lt;thead&gt;
   &lt;tr&gt;
    &lt;th id="n"&gt; Negative
    &lt;th&gt; Characteristic
    &lt;th&gt; Positive
  &lt;tbody&gt;
   &lt;tr&gt;
    &lt;td headers="n r1"&gt; Sad
    &lt;th id="r1"&gt; Mood
    &lt;td&gt; Happy
   &lt;tr&gt;
    &lt;td headers="n r2"&gt; Failing
    &lt;th id="r2"&gt; Grade
    &lt;td&gt; Passing
 &lt;/table&gt;
&lt;/figure&gt;</pre></div>
   </dd>

  </dl><p>Authors may also use other techniques, or combinations of the
  above techniques, as appropriate.</p>

  <p>The best option, of course, rather than writing a description
  explaining the way the table is laid out, is to adjust the table
  such that no explanation is needed.</p>

  <div class=example>

   <p>In the case of the table used in the examples above, a simple
   rearrangement of the table so that the headers are on the top and
   left sides removes the need for an explanation as well as removing
   the need for the use of <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes:</p>

   <pre>&lt;table&gt;
 &lt;caption&gt;Characteristics with positive and negative sides&lt;/caption&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th&gt; Characteristic
   &lt;th&gt; Negative
   &lt;th&gt; Positive
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;th&gt; Mood
   &lt;td&gt; Sad
   &lt;td&gt; Happy
  &lt;tr&gt;
   &lt;th&gt; Grade
   &lt;td&gt; Failing
   &lt;td&gt; Passing
&lt;/table&gt;</pre>

  </div>



  <h5 id=table-layout-techniques><span class=secno>4.9.1.2 </span>Techniques for table design</h5>

  <p>Good table design is key to making tables more readable and usable.</p>

  <p>In visual media, providing column and row borders and alternating
  row backgrounds can be very effective to make complicated tables
  more readable.</p>

  <p>For tables with large volumes of numeric content, using
  monospaced fonts can help users see patterns, especially in
  situations where a user agent does not render the borders.
  (Unfortunately, for historical reasons, not rendering borders on
  tables is a common default.)</p>

  <p>In speech media, table cells can be distinguished by reporting
  the corresponding headers before reading the cell's contents, and by
  allowing users to navigate the table in a grid fashion, rather than
  serializing the entire contents of the table in source order.</p>

  <p>Authors are encouraged to use CSS to achieve these effects.</p>

  <div class=impl>
  <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>
  </div>




  <h4 id=the-caption-element><span class=secno>4.9.2 </span>The <dfn><code>caption</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the first element child of a <code><a href=#the-table-element>table</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no descendant <code><a href=#the-table-element>table</a></code> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltablecaptionelement>HTMLTableCaptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  // <a href="#HTMLTableCaptionElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-caption-element>caption</a></code> element <a href=#represents>represents</a> the title of the <code><a href=#the-table-element>table</a></code>
  that is its parent, if it has a parent and that is a <code><a href=#the-table-element>table</a></code> element.</p>

  <div class=impl>

  <p>The <code><a href=#the-caption-element>caption</a></code> element takes part in the <a href=#table-model>table model</a>.</p>

  </div>

  <p>When a <code><a href=#the-table-element>table</a></code> element is the only content in a <code><a href=#the-figure-element>figure</a></code> element other
  than the <code><a href=#the-figcaption-element>figcaption</a></code>, the <code><a href=#the-caption-element>caption</a></code> element should be omitted in favor of
  the <code><a href=#the-figcaption-element>figcaption</a></code>.</p>

  <p>A caption can introduce context for a table, making it significantly easier to understand.</p>

  <div class=example>

   <p>Consider, for instance, the following table:</p>

   <table class=dice-example><tr><th>   <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
    <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
    <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
    <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
    <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
    <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
    <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
   </table><p>In the abstract, this table is not clear. However, with a caption giving the table's number
   (for reference in the main prose) and explaining its use, it makes more sense:</p>

   <pre>&lt;caption&gt;
&lt;p&gt;Table 1.
&lt;p&gt;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.
&lt;/caption&gt;</pre>

   <p>This provides the user with more context:</p>

   <table class=dice-example><caption>
     <p>Table 1.
     <p>This table shows the total score obtained from rolling two
     six-sided dice. The first row represents the value of the first
     die, the first column the value of the second die. The total is
     given in the cell that corresponds to the values of the two dice.
    </caption>
    <tr><th>   <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
    <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
    <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
    <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
    <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
    <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
    <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
   </table></div>




  <h4 id=the-colgroup-element><span class=secno>4.9.3 </span>The <dfn><code>colgroup</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
   <code><a href=#the-caption-element>caption</a></code> elements and before any <code><a href=#the-thead-element>thead</a></code>,
   <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, and <code><a href=#the-tr-element>tr</a></code>
   elements.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>If the <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute is present: Empty.</dd>
   <dd>If the <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute is absent: Zero or more <code><a href=#the-col-element>col</a></code> and <code><a href=#the-template-element>template</a></code> elements.</dd>
   
   <dd>A <code><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> can be
   omitted if the first thing inside the <code><a href=#the-colgroup-element>colgroup</a></code> element is a <code><a href=#the-col-element>col</a></code> element,
   and if the element is not immediately preceded by another <code><a href=#the-colgroup-element>colgroup</a></code> element whose
   <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> has been omitted. (It can't be omitted if the element
   is empty.)</dd>
   <dd>A <code><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if
   the <code><a href=#the-colgroup-element>colgroup</a></code> element is not immediately followed by a <a href=#space-character>space character</a> or
   a <a href=#syntax-comments title=syntax-comments>comment</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> &mdash; Number of columns spanned by the element</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltablecolelement>HTMLTableColElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute unsigned long <a href=#dom-colgroup-span title=dom-colgroup-span>span</a>;

  // <a href="#HTMLTableColElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-colgroup-element>colgroup</a></code> element <a href=#represents>represents</a> a <a href=#concept-column-group title=concept-column-group>group</a> of one or more <a href=#concept-column title=concept-column>columns</a> in the <code><a href=#the-table-element>table</a></code> that
  is its parent, if it has a parent and that is a <code><a href=#the-table-element>table</a></code>
  element.</p>

  <p>If the <code><a href=#the-colgroup-element>colgroup</a></code> element contains no <code><a href=#the-col-element>col</a></code>
  elements, then the element may have a <dfn id=attr-colgroup-span title=attr-colgroup-span><code>span</code></dfn> content attribute
  specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
  integer</a> greater than zero.</p>

  <div class=impl>

  <p>The <code><a href=#the-colgroup-element>colgroup</a></code> element and its <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute take part in the
  <a href=#table-model>table model</a>.</p>

  <p>The <dfn id=dom-colgroup-span title=dom-colgroup-span><code>span</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
  numbers greater than zero</a>.</p>

  </div>


  <h4 id=the-col-element><span class=secno>4.9.4 </span>The <dfn><code>col</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-colgroup-element>colgroup</a></code> element that doesn't have
   a <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-col-span><a href=#attr-col-span>span</a></code> &mdash; Number of columns spanned by the element</dd>
   <!-- v2: char, to specify the decimal character used in numeric data cells in the column (not header cells) -->
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <p><code><a href=#htmltablecolelement>HTMLTableColElement</a></code>, same as for
    <code><a href=#the-colgroup-element>colgroup</a></code> elements. This interface defines one member,
    <code title=dom-col-span><a href=#dom-col-span>span</a></code>.</p>
   </dd>
  </dl><!--TOPIC:HTML--><p>If a <code><a href=#the-col-element>col</a></code> element has a parent and that is a
  <code><a href=#the-colgroup-element>colgroup</a></code> element that itself has a parent that is a
  <code><a href=#the-table-element>table</a></code> element, then the <code><a href=#the-col-element>col</a></code> element
  <a href=#represents>represents</a> one or more <a href=#concept-column title=concept-column>columns</a> in the <a href=#concept-column-group title=concept-column-group>column group</a> represented by that
  <code><a href=#the-colgroup-element>colgroup</a></code>.</p>

  <p>The element may have a <dfn id=attr-col-span title=attr-col-span><code>span</code></dfn> content attribute
  specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
  integer</a> greater than zero.</p>

  <div class=impl>

  <p>The <code><a href=#the-col-element>col</a></code> element and its <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute take part in the
  <a href=#table-model>table model</a>.</p>

  <p>The <dfn id=dom-col-span title=dom-col-span><code>span</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
  numbers greater than zero</a>.</p>

  </div>


  <h4 id=the-tbody-element><span class=secno>4.9.5 </span>The <dfn><code>tbody</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
   <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, and
   <code><a href=#the-thead-element>thead</a></code> elements, but only if there are no
   <code><a href=#the-tr-element>tr</a></code> elements that are children of the
   <code><a href=#the-table-element>table</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-tr-element>tr</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements</dd>
   
   <dd>A <code><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> can be omitted
   if the first thing inside the <code><a href=#the-tbody-element>tbody</a></code> element is a <code><a href=#the-tr-element>tr</a></code> element, and if the
   element is not immediately preceded by a <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
   <code><a href=#the-tfoot-element>tfoot</a></code> element whose <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> has been omitted. (It
   can't be omitted if the element is empty.)</dd>
   <dd>A <code><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if
   the <code><a href=#the-tbody-element>tbody</a></code> element is immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> or
   <code><a href=#the-tfoot-element>tfoot</a></code> element, or if there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmltablesectionelement>HTMLTableSectionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-tbody-rows title=dom-tbody-rows>rows</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-tbody-insertrow title=dom-tbody-insertRow>insertRow</a>(optional long index = -1);
  void <a href=#dom-tbody-deleterow title=dom-tbody-deleteRow>deleteRow</a>(long index);

  // <a href="#HTMLTableSectionElement-partial">also has obsolete members</a>
};</pre>
    <p>The <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> interface is also
    used for <code><a href=#the-thead-element>thead</a></code> and <code><a href=#the-tfoot-element>tfoot</a></code> elements.</p>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-tbody-element>tbody</a></code> element <a href=#represents>represents</a> a <a href=#concept-row-group title=concept-row-group>block</a> of <a href=#concept-row title=concept-row>rows</a> that consist of a body of data for
  the parent <code><a href=#the-table-element>table</a></code> element, if the <code><a href=#the-tbody-element>tbody</a></code>
  element has a parent and it is a <code><a href=#the-table-element>table</a></code>.</p>

  <div class=impl>

  <p>The <code><a href=#the-tbody-element>tbody</a></code> element takes part in the <a href=#table-model>table
  model</a>.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">tbody</var> . <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code></dt>
   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-tr-element>tr</a></code> elements of the table section.</p>
   </dd>

   <dt><var title="">tr</var> = <var title="">tbody</var> . <code title=dom-tbody-insertRow><a href=#dom-tbody-insertrow>insertRow</a></code>( [ <var title="">index</var> ] )</dt>
   <dd>
    <p>Creates a <code><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><a href=#the-tr-element>tr</a></code>.</p>
    <p>The position is relative to the rows in the table section. The index &minus;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 &minus;1 or greater than the number of rows, throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
   </dd>

   <dt><var title="">tbody</var> . <code title=dom-tbody-deleteRow><a href=#dom-tbody-deleterow>deleteRow</a></code>(<var title="">index</var>)</dt>
   <dd>
    <p>Removes the <code><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 &minus;1 is equivalent to deleting the last row of the table section.</p>
    <p>If the given position is less than &minus;1 or greater than the index of the last row, or if there are no rows, throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-tbody-rows title=dom-tbody-rows><code>rows</code></dfn> attribute
  must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the element,
  whose filter matches only <code><a href=#the-tr-element>tr</a></code> elements that are children
  of the element.</p>

  <p>The <dfn id=dom-tbody-insertrow title=dom-tbody-insertRow><code>insertRow(<var title="">index</var>)</code></dfn> method must, when invoked on an
  element <var title="">table section</var>, act as follows:</p>

  <p>If <var title="">index</var> is less than &minus;1 or greater than the
  number of elements in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code>
  collection, the method must throw an <code><a href=#indexsizeerror>IndexSizeError</a></code>
  exception.</p>

  <p>If <var title="">index</var> is &minus;1 or
  equal to the number of items in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection, the method must
  create a <code><a href=#the-tr-element>tr</a></code> element, append it to the element <var title="">table section</var>, and return the newly created
  <code><a href=#the-tr-element>tr</a></code> element.</p>

  <p>Otherwise, the method must create a <code><a href=#the-tr-element>tr</a></code> element,
  insert it as a child of the <var title="">table section</var>
  element, immediately before the <var title="">index</var>th
  <code><a href=#the-tr-element>tr</a></code> element in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection, and finally must
  return the newly created <code><a href=#the-tr-element>tr</a></code> element.</p>

  <p>The <dfn id=dom-tbody-deleterow title=dom-tbody-deleteRow><code>deleteRow(<var title="">index</var>)</code></dfn> method must remove the <var title="">index</var>th element in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection from its parent. If
  <var title="">index</var> is less than zero or greater than or equal
  to the number of elements in the <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> collection, the method must
  instead throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

  </div>
<!--TOPIC:HTML-->


  <h4 id=the-thead-element><span class=secno>4.9.6 </span>The <dfn><code>thead</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
   <code><a href=#the-caption-element>caption</a></code>, and <code><a href=#the-colgroup-element>colgroup</a></code>
   elements and before any <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, and
   <code><a href=#the-tr-element>tr</a></code> elements, but only if there are no other
   <code><a href=#the-thead-element>thead</a></code> elements that are children of the
   <code><a href=#the-table-element>table</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-tr-element>tr</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements</dd>
   
   <dd>A <code><a href=#the-thead-element>thead</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if
   the <code><a href=#the-thead-element>thead</a></code> element is immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> or
   <code><a href=#the-tfoot-element>tfoot</a></code> element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, as defined for
   <code><a href=#the-tbody-element>tbody</a></code> elements.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-thead-element>thead</a></code> element <a href=#represents>represents</a> the <a href=#concept-row-group title=concept-row-group>block</a> of <a href=#concept-row title=concept-row>rows</a> that consist of the column labels
  (headers) for the parent <code><a href=#the-table-element>table</a></code> element, if the
  <code><a href=#the-thead-element>thead</a></code> element has a parent and it is a
  <code><a href=#the-table-element>table</a></code>.</p>

  <div class=impl>

  <p>The <code><a href=#the-thead-element>thead</a></code> element takes part in the <a href=#table-model>table
  model</a>.</p>

  </div>

  <div class=example>

   <p>This example shows a <code><a href=#the-thead-element>thead</a></code> element being used.
   Notice the use of both <code><a href=#the-th-element>th</a></code> and <code><a href=#the-td-element>td</a></code> elements
   in the <code><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>&lt;table&gt;
 &lt;caption&gt; School auction sign-up sheet &lt;/caption&gt;
<strong> &lt;thead&gt;
  &lt;tr&gt;
   &lt;th&gt;&lt;label for=e1&gt;Name&lt;/label&gt;
   &lt;th&gt;&lt;label for=e2&gt;Product&lt;/label&gt;
   &lt;th&gt;&lt;label for=e3&gt;Picture&lt;/label&gt;
   &lt;th&gt;&lt;label for=e4&gt;Price&lt;/label&gt;
  &lt;tr&gt;
   &lt;td&gt;Your name here
   &lt;td&gt;What are you selling?
   &lt;td&gt;Link to a picture
   &lt;td&gt;Your reserve price
</strong> &lt;tbody&gt;
  &lt;tr&gt;
   &lt;td&gt;Ms Danus
   &lt;td&gt;Doughnuts
   &lt;td&gt;&lt;img src="http://example.com/mydoughnuts.png" title="Doughnuts from Ms Danus"&gt;
   &lt;td&gt;$45
  &lt;tr&gt;
   &lt;td&gt;&lt;input id=e1 type=text name=who required form=f&gt;
   &lt;td&gt;&lt;input id=e2 type=text name=what required form=f&gt;
   &lt;td&gt;&lt;input id=e3 type=url name=pic form=f&gt;
   &lt;td&gt;&lt;input id=e4 type=number step=0.01 min=0 value=0 required form=f&gt;
&lt;/table&gt;
&lt;form id=f action="/auction.cgi"&gt;
 &lt;input type=button name=add value="Submit"&gt;
&lt;/form&gt;</pre>

  </div>


  <h4 id=the-tfoot-element><span class=secno>4.9.7 </span>The <dfn><code>tfoot</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
   <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, and <code><a href=#the-thead-element>thead</a></code>
   elements and before any <code><a href=#the-tbody-element>tbody</a></code> and <code><a href=#the-tr-element>tr</a></code>
   elements, but only if there are no other <code><a href=#the-tfoot-element>tfoot</a></code>
   elements that are children of the <code><a href=#the-table-element>table</a></code> element.</dd>
   <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
   <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, <code><a href=#the-thead-element>thead</a></code>,
   <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tr-element>tr</a></code> elements, but only if there
   are no other <code><a href=#the-tfoot-element>tfoot</a></code> elements that are children of the
   <code><a href=#the-table-element>table</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-tr-element>tr</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements</dd>
   
   <dd>A <code><a href=#the-tfoot-element>tfoot</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if
   the <code><a href=#the-tfoot-element>tfoot</a></code> element is immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> element, or if
   there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, as defined for
   <code><a href=#the-tbody-element>tbody</a></code> elements.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-tfoot-element>tfoot</a></code> element <a href=#represents>represents</a> the <a href=#concept-row-group title=concept-row-group>block</a> of <a href=#concept-row title=concept-row>rows</a> that consist of the column summaries
  (footers) for the parent <code><a href=#the-table-element>table</a></code> element, if the
  <code><a href=#the-tfoot-element>tfoot</a></code> element has a parent and it is a
  <code><a href=#the-table-element>table</a></code>.</p>

  <div class=impl>

  <p>The <code><a href=#the-tfoot-element>tfoot</a></code> element takes part in the <a href=#table-model>table
  model</a>.</p>

  </div>


  <h4 id=the-tr-element><span class=secno>4.9.8 </span>The <dfn><code>tr</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-thead-element>thead</a></code> element.</dd>
   <dd>As a child of a <code><a href=#the-tbody-element>tbody</a></code> element.</dd>
   <dd>As a child of a <code><a href=#the-tfoot-element>tfoot</a></code> element.</dd>
   <dd>As a child of a <code><a href=#the-table-element>table</a></code> element, after any
   <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>, and <code><a href=#the-thead-element>thead</a></code>
   elements, but only if there are no <code><a href=#the-tbody-element>tbody</a></code> elements that
   are children of the <code><a href=#the-table-element>table</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-td-element>td</a></code>, <code><a href=#the-th-element>th</a></code>, and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements</dd>
   
   <dd>A <code><a href=#the-tr-element>tr</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-tr-element>tr</a></code> element is immediately followed by another <code><a href=#the-tr-element>tr</a></code> element, or if there is
   no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmltablerowelement>HTMLTableRowElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  readonly attribute long <a href=#dom-tr-rowindex title=dom-tr-rowIndex>rowIndex</a>;
  readonly attribute long <a href=#dom-tr-sectionrowindex title=dom-tr-sectionRowIndex>sectionRowIndex</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-tr-cells title=dom-tr-cells>cells</a>;
  <a href=#htmlelement>HTMLElement</a> <a href=#dom-tr-insertcell title=dom-tr-insertCell>insertCell</a>(optional long index = -1);
  void <a href=#dom-tr-deletecell title=dom-tr-deleteCell>deleteCell</a>(long index);

  // <a href="#HTMLTableRowElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-tr-element>tr</a></code> element <a href=#represents>represents</a> a <a href=#concept-row title=concept-row>row</a> of
  <a href=#concept-cell title=concept-cell>cells</a> in a <a href=#concept-table title=concept-table>table</a>.</p>

  <div class=impl>

  <p>The <code><a href=#the-tr-element>tr</a></code> element takes part in the <a href=#table-model>table model</a>.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">tr</var> . <code title=dom-tr-rowIndex><a href=#dom-tr-rowindex>rowIndex</a></code></dt>

   <dd>

    <p>Returns the position of the row in the table's <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code>
    list.</p>

    <p>Returns &minus;1 if the element isn't in a table.</p>

   </dd>

   <dt><var title="">tr</var> . <code title=dom-tr-sectionRowIndex><a href=#dom-tr-sectionrowindex>sectionRowIndex</a></code></dt>

   <dd>

    <p>Returns the position of the row in the table section's <code title=dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> list.</p>

    <p>Returns &minus;1 if the element isn't in a table section.</p>

   </dd>

   <dt><var title="">tr</var> . <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code></dt>
   <dd>

    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements of
    the row.</p>

   </dd>

   <dt><var title="">cell</var> = <var title="">tr</var> . <code title=dom-tr-insertCell><a href=#dom-tr-insertcell>insertCell</a></code>( [ <var title="">index</var> ] )</dt>

   <dd>

    <p>Creates a <code><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><a href=#the-td-element>td</a></code>.</p>

    <p>The position is relative to the cells in the row. The index &minus;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 &minus;1 or greater than the number of cells, throws an
    <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

   </dd>

   <dt><var title="">tr</var> . <code title=dom-tr-deleteCell><a href=#dom-tr-deletecell>deleteCell</a></code>(<var title="">index</var>)</dt>
   <dd>

    <p>Removes the <code><a href=#the-td-element>td</a></code> or <code><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 &minus;1 is equivalent to
    deleting the last cell of the row.</p>

    <p>If the given position is less than &minus;1 or greater than the index of the last cell, or
    if there are no cells, throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-tr-rowindex title=dom-tr-rowIndex><code>rowIndex</code></dfn> attribute must, if the element has
  a parent <code><a href=#the-table-element>table</a></code> element, or a parent <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
  <code><a href=#the-tfoot-element>tfoot</a></code> element and a <em>grandparent</em> <code><a href=#the-table-element>table</a></code> element, return the index
  of the <code><a href=#the-tr-element>tr</a></code> element in that <code><a href=#the-table-element>table</a></code> element's <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> collection. If there is no such <code><a href=#the-table-element>table</a></code> element,
  then the attribute must return &minus;1.</p>

  <p>The <dfn id=dom-tr-sectionrowindex title=dom-tr-sectionRowIndex><code>sectionRowIndex</code></dfn> attribute must, if
  the element has a parent <code><a href=#the-table-element>table</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
  <code><a href=#the-tfoot-element>tfoot</a></code> element, return the index of the <code><a href=#the-tr-element>tr</a></code> element in the parent
  element's <code title="">rows</code> collection (for tables, that's the <code title=dom-table-rows><a href=#dom-table-rows>HTMLTableElement.rows</a></code> collection; for table sections, that's the
  <code title=dom-tbody-rows><a href=#dom-tbody-rows>HTMLTableRowElement.rows</a></code> collection). If there is no such
  parent element, then the attribute must return &minus;1.</p>

  <p>The <dfn id=dom-tr-cells title=dom-tr-cells><code>cells</code></dfn> attribute must return an
  <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code><a href=#the-tr-element>tr</a></code> element, whose filter matches only
  <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements that are children of the <code><a href=#the-tr-element>tr</a></code> element.</p>

  <p>The <dfn id=dom-tr-insertcell title=dom-tr-insertCell><code>insertCell(<var title="">index</var>)</code></dfn>
  method must act as follows:</p>

  <p>If <var title="">index</var> is less than &minus;1 or greater than the number of elements in
  the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, the method must throw an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

  <p>If <var title="">index</var> is equal to &minus;1 or equal to the number of items in <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, the method must create a <code><a href=#the-td-element>td</a></code> element,
  append it to the <code><a href=#the-tr-element>tr</a></code> element, and return the newly created <code><a href=#the-td-element>td</a></code>
  element.</p>

  <p>Otherwise, the method must create a <code><a href=#the-td-element>td</a></code> element, insert it as a child of the
  <code><a href=#the-tr-element>tr</a></code> element, immediately before the <var title="">index</var>th <code><a href=#the-td-element>td</a></code> or
  <code><a href=#the-th-element>th</a></code> element in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, and finally
  must return the newly created <code><a href=#the-td-element>td</a></code> element.</p>

  <p>The <dfn id=dom-tr-deletecell title=dom-tr-deleteCell><code>deleteCell(<var title="">index</var>)</code></dfn>
  method must remove the <var title="">index</var>th element in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection from its parent. If <var title="">index</var> is less
  than zero or greater than or equal to the number of elements in the <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection, the method must instead throw an
  <code><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>

  </div>
<!--TOPIC:HTML-->


  <h4 id=the-td-element><span class=secno>4.9.9 </span>The <dfn><code>td</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-tr-element>tr</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>A <code><a href=#the-td-element>td</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-td-element>td</a></code> element is immediately followed by a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element,
   or if there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> &mdash; Number of columns that the cell is to span</dd>
   <dd><code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> &mdash; Number of rows that the cell is to span</dd>
   <dd><code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> &mdash; The header cells for this cell</dd>
   <!-- v2 char, to specify the decimal character used in numeric cells -->
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmltabledatacellelement>HTMLTableDataCellElement</dfn> : <a href=#htmltablecellelement>HTMLTableCellElement</a> {
  // <a href="#HTMLTableDataCellElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-td-element>td</a></code> element <a href=#represents>represents</a> a data <a href=#concept-cell title=concept-cell>cell</a> in a table.</p>

  <div class=impl>

  <p>The <code><a href=#the-td-element>td</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>
  attributes take part in the <a href=#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>table model</a>, or listing the cell's header cells
  (as determined by the <a href=#algorithm-for-assigning-header-cells>algorithm for assigning header cells</a>). When a cell's header
  cells are being listed, user agents may use the value of <code title=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>


  <h4 id=the-th-element><span class=secno>4.9.10 </span>The <dfn><code>th</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>If the <code><a href=#the-th-element>th</a></code> element is a <a href=#sorting-interface-th-element>sorting interface <code>th</code> element</a>: <a href=#interactive-content>Interactive content</a>.</dd>
   <dd>Otherwise: None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-tr-element>tr</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-header-element>header</a></code>, <code><a href=#the-footer-element>footer</a></code>, <a href=#sectioning-content>sectioning content</a>, or <a href=#heading-content>heading content</a> descendants, and if the <code><a href=#the-th-element>th</a></code> element is a <a href=#sorting-interface-th-element>sorting interface <code>th</code> element</a>, no <a href=#interactive-content>interactive content</a> descendants.</dd>
   <!-- EDITING NOTE: If you remove 'heading content' from the list above, make sure to fix the definition of 'sectioning root' to include <th> -->
   
   <dd>A <code><a href=#the-th-element>th</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if the
   <code><a href=#the-th-element>th</a></code> element is immediately followed by a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element,
   or if there is no more content in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> &mdash; Number of columns that the cell is to span</dd>
   <dd><code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> &mdash; Number of rows that the cell is to span</dd>
   <dd><code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> &mdash; The header cells for this cell</dd>
   <dd><code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> &mdash; Specifies which cells the header cell applies to</dd>
   <dd><code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> &mdash; Alternative label to use for the header cell when referencing the cell in other contexts</dd>
   <dd><code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmltableheadercellelement>HTMLTableHeaderCellElement</dfn> : <a href=#htmltablecellelement>HTMLTableCellElement</a> {
           attribute DOMString <a href=#dom-th-scope title=dom-th-scope>scope</a>;
           attribute DOMString <a href=#dom-th-abbr title=dom-th-abbr>abbr</a>;
           attribute DOMString <a href=#dom-th-sorted title=dom-th-sorted>sorted</a>;
  void <a href=#dom-th-sort title=dom-th-sort>sort</a>();
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-th-element>th</a></code> element <a href=#represents>represents</a> a header <a href=#concept-cell title=concept-cell>cell</a> in a table.</p>

  <p>The <code><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-th-scope title=attr-th-scope><code>scope</code></dfn>
  content attribute specified. The <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is an
  <a href=#enumerated-attribute>enumerated attribute</a> with five states, four of which have explicit keywords:</p>

  <dl><dt>The <dfn id=attr-th-scope-row title=attr-th-scope-row><code>row</code></dfn> keyword, which maps to the
   <i>row</i> state</dt>

   <dd>The <i>row</i> state means the header cell applies to some of the subsequent cells in the
   same row(s).</dd>

   <dt>The <dfn id=attr-th-scope-col title=attr-th-scope-col><code>col</code></dfn> keyword, which maps to the
   <i>column</i> state</dt>

   <dd>The <i>column</i> state means the header cell applies to some of the subsequent cells in the
   same column(s).</dd>

   <dt>The <dfn id=attr-th-scope-rowgroup title=attr-th-scope-rowgroup><code>rowgroup</code></dfn> keyword, which maps to
   the <i>row group</i> state</dt>

   <dd>The <i>row group</i> state means the header cell applies to all the remaining cells in the
   row group. A <code><a href=#the-th-element>th</a></code> element's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute must
   not be in the <a href=#attr-th-scope-rowgroup title=attr-th-scope-rowgroup>row group</a> state if the element is not
   anchored in a <a href=#concept-row-group title=concept-row-group>row group</a>.</dd>

   <dt>The <dfn id=attr-th-scope-colgroup title=attr-th-scope-colgroup><code>colgroup</code></dfn> keyword, which maps to
   the <i>column group</i> state</dt>

   <dd>The <i>column group</i> state means the header cell applies to all the remaining cells in the
   column group. A <code><a href=#the-th-element>th</a></code> element's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute must
   not be in the <a href=#attr-th-scope-colgroup title=attr-th-scope-colgroup>column group</a> state if the element is
   not anchored in a <a href=#concept-column-group title=concept-column-group>column group</a>.</dd>

   <dt>The <dfn id=attr-th-scope-auto title=attr-th-scope-auto>auto</dfn> state</dt>

   <dd>The <i>auto</i> state makes the header cell apply to a set of cells selected based on
   context.</dd>

  </dl><p>The <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute's <i>missing value default</i> is the
  <i>auto</i> state.</p>

  <p>The <code><a href=#the-th-element>th</a></code> element may have an <dfn id=attr-th-abbr title=attr-th-abbr><code>abbr</code></dfn>
  content attribute specified. Its value must be an alternative label for the header cell, to be
  used when referencing the cell in other contexts (e.g. when describing the header cells that apply
  to a data cell). It is typically an abbreviated form of the full header cell, but can also be an
  expansion, or merely a different phrasing.</p>

  <p>The <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute is used in the <a href=#table-sorting-model>table
  sorting model</a>.</p>

  <div class=impl>

  <p>The <code><a href=#the-th-element>th</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>, and
  <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attributes take part in the <a href=#table-model>table model</a>.</p>

  <p>The <code title=dom-th-sort><a href=#dom-th-sort>sort()</a></code> method is used in the <a href=#table-sorting-model>table sorting
  model</a>.</p>

  <p>The <dfn id=dom-th-scope title=dom-th-scope><code>scope</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the content attribute of the same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <dfn id=dom-th-abbr title=dom-th-abbr><code>abbr</code></dfn> and <dfn id=dom-th-sorted title=dom-th-sorted><code>sorted</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  content attributes of the same name.</p>

  </div>

  <div class=example>

   <p>The following example shows how the <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute's <code title=attr-th-scope-rowgroup><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>&lt;table&gt;
 &lt;thead&gt;
  &lt;tr&gt; &lt;th&gt; ID &lt;th&gt; Measurement &lt;th&gt; Average &lt;th&gt; Maximum
 &lt;tbody&gt;
  &lt;tr&gt; &lt;td&gt; &lt;th scope=rowgroup&gt; Cats &lt;td&gt; &lt;td&gt;
  &lt;tr&gt; &lt;td&gt; 93 &lt;th scope=row&gt; Legs &lt;td&gt; 3.5 &lt;td&gt; 4
  &lt;tr&gt; &lt;td&gt; 10 &lt;th scope=row&gt; Tails &lt;td&gt; 1 &lt;td&gt; 1
 &lt;tbody&gt;
  &lt;tr&gt; &lt;td&gt; &lt;th scope=rowgroup&gt; English speakers &lt;td&gt; &lt;td&gt;
  &lt;tr&gt; &lt;td&gt; 32 &lt;th scope=row&gt; Legs &lt;td&gt; 2.67 &lt;td&gt; 4
  &lt;tr&gt; &lt;td&gt; 35 &lt;th scope=row&gt; Tails &lt;td&gt; 0.33 &lt;td&gt; 1
&lt;/table&gt;</pre>

   <p>This would result in the following table:</p>

   <table><thead><tr><th> ID <th> Measurement <th> Average <th> Maximum
    <tbody><tr><td> <th scope=rowgroup> Cats <td> <td>
     <tr><td> 93 <th scope=row> Legs <td> 3.5 <td> 4
     <tr><td> 10 <th scope=row> Tails <td> 1 <td> 1
    <tbody><tr><td> <th scope=rowgroup> English speakers <td> <td>
     <tr><td> 32 <th scope=row> Legs <td> 2.67 <td> 4
     <tr><td> 35 <th scope=row> Tails <td> 0.33 <td> 1
   </table><p>The headers in the first row all apply directly down to the rows in their column.</p>

   <p>The headers with the explicit <code title=attr-th-scope><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>

   <!-- image source: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/151 -->
   <img src=http://images.whatwg.org/table-scope-diagram.png width=459 alt="" height=256><!-- (alt is empty because the diagram is completely described by the previous paragraphs) --></div>



  <h4 id=attributes-common-to-td-and-th-elements><span class=secno>4.9.11 </span>Attributes common to <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</h4>

  <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements may have a <dfn id=attr-tdth-colspan title=attr-tdth-colspan><code>colspan</code></dfn> content attribute specified, whose value must
  be a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>

  <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements may also have a <dfn id=attr-tdth-rowspan title=attr-tdth-rowspan><code>rowspan</code></dfn> content attribute specified, whose value must
  be a <a href=#valid-non-negative-integer>valid non-negative integer</a>. For this attribute, the value zero means that the
  cell is to span all the remaining rows in the row group.</p> <!-- only in no-quirks and
  limited-quirks mode though, for back compat! -->

  <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<span class=impl>, as described in the
  description of the <a href=#table-model>table model</a></span>.</p> <!-- conformance criteria for determining
  when this is violated are given in the processing model -->

  <hr><p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-tdth-headers title=attr-tdth-headers><code>headers</code></dfn> content attribute specified. The <code title=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>unordered set of unique space-separated tokens</a> that are
  <a href=#case-sensitive>case-sensitive</a>, each of which must have the value of an <a href=#concept-id title=concept-id>ID</a> of a <code><a href=#the-th-element>th</a></code> element taking part in the same <a href=#concept-table title=concept-table>table</a> as the <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element<span class=impl> (as defined by the <a href=#table-model>table model</a>)</span>.</p>

  <p>A <code><a href=#the-th-element>th</a></code> element with <a href=#concept-id title=concept-id>ID</a> <var title="">id</var> is
  said to be <i>directly targeted</i> by all <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements in the
  same <a href=#concept-table title=concept-table>table</a> that have <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes whose values include as one of their tokens
  the <a href=#concept-id title=concept-id>ID</a> <var title="">id</var>. A <code><a href=#the-th-element>th</a></code> element <var title="">A</var> is said to be <i>targeted</i> by a <code><a href=#the-th-element>th</a></code> or <code><a href=#the-td-element>td</a></code> element
  <var title="">B</var> if either <var title="">A</var> is <i>directly targeted</i> by <var title="">B</var> or if there exists an element <var title="">C</var> that is itself
  <i>targeted</i> by the element <var title="">B</var> and <var title="">A</var> is <i>directly
  targeted</i> by <var title="">C</var>.</p>

  <p>A <code><a href=#the-th-element>th</a></code> element must not be <i>targeted</i> by itself.</p>

  <div class=impl>

  <p>The <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>
  attributes take part in the <a href=#table-model>table model</a>.</p>

  </div>

  <hr><p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements implement interfaces that inherit from the
  <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code> interface:</p>

  <pre class=idl>interface <dfn id=htmltablecellelement>HTMLTableCellElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute unsigned long <a href=#dom-tdth-colspan title=dom-tdth-colSpan>colSpan</a>;
           attribute unsigned long <a href=#dom-tdth-rowspan title=dom-tdth-rowSpan>rowSpan</a>;
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-tdth-headers title=dom-tdth-headers>headers</a>;
  readonly attribute long <a href=#dom-tdth-cellindex title=dom-tdth-cellIndex>cellIndex</a>;

  // <a href="#HTMLTableCellElement-partial">also has obsolete members</a>
};</pre>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">cell</var> . <code title=dom-tdth-cellIndex><a href=#dom-tdth-cellindex>cellIndex</a></code></dt>

   <dd>

    <p>Returns the position of the cell in the row's <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> list.
    This does not necessarily correspond to the <var title="">x</var>-position of the cell in the
    table, since earlier cells might cover multiple rows or columns.</p>

    <p>Returns &minus;1 if the element isn't in a row.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-tdth-colspan title=dom-tdth-colSpan><code>colSpan</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> content attribute. Its
  default value is 1.</p>

  <!--
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1699
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1700
  -->

  <p>The <dfn id=dom-tdth-rowspan title=dom-tdth-rowSpan><code>rowSpan</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> content attribute. Its
  default value is 1.</p>

  <p>The <dfn id=dom-tdth-headers title=dom-tdth-headers><code>headers</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  <p>The <dfn id=dom-tdth-cellindex title=dom-tdth-cellIndex><code>cellIndex</code></dfn> IDL attribute must, if the
  element has a parent <code><a href=#the-tr-element>tr</a></code> element, return the index of the cell's element in the parent
  element's <code title=dom-tr-cells><a href=#dom-tr-cells>cells</a></code> collection. If there is no such parent element,
  then the attribute must return &minus;1.</p>

  </div>
<!--TOPIC:HTML-->


  <div class=impl>

  <h4 id=processing-model-1><span class=secno>4.9.12 </span>Processing model</h4>

  <p>The various table elements and their content attributes together define the <dfn id=table-model>table
  model</dfn>.</p>

  <p>A <dfn id=concept-table title=concept-table>table</dfn> consists of cells aligned on a two-dimensional grid of
  <dfn id=concept-slots title=concept-slots>slots</dfn> with coordinates (<var title="">x</var>, <var title="">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 title="">x</var> coordinates are always in the range <span title="">0&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">width</sub></var></span>, and the <var title="">y</var> coordinates are always in the
  range <span title="">0&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">height</sub></var></span>. If one or both of <var title="">x<sub title="">width</sub></var> and <var title="">y<sub title="">height</sub></var> are zero, then the
  table is empty (has no slots). Tables correspond to <code><a href=#the-table-element>table</a></code> elements.</p>

  <p>A <dfn id=concept-cell title=concept-cell>cell</dfn> is a set of slots anchored at a slot (<var title="">cell<sub title="">x</sub></var>, <var title="">cell<sub title="">y</sub></var>), and with
  a particular <var title="">width</var> and <var title="">height</var> such that the cell covers
  all the slots with coordinates (<var title="">x</var>, <var title="">y</var>) where <span title=""><var title="">cell<sub title="">x</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">cell<sub title="">x</sub></var>+<var title="">width</var></span> and <span title=""><var title="">cell<sub title="">y</sub></var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">cell<sub title="">y</sub></var>+<var title="">height</var></span>. Cells can either be <em>data cells</em>
  or <em>header cells</em>. Data cells correspond to <code><a href=#the-td-element>td</a></code> elements, and header cells
  correspond to <code><a href=#the-th-element>th</a></code> elements. Cells of both types can have zero or more associated
  header cells.</p>

  <p>It is possible, in certain error cases, for two cells to occupy the same slot.</p>

  <p>A <dfn id=concept-row title=concept-row>row</dfn> is a complete set of slots from <span title=""><var title="">x</var>=0</span> to <span title=""><var title="">x</var>=<var title="">x<sub title="">width</sub></var>-1</span>, for a particular value of <var title="">y</var>. Rows usually
  correspond to <code><a href=#the-tr-element>tr</a></code> elements, though a <a href=#concept-row-group title=concept-row-group>row group</a>
  can have some implied <a href=#concept-row title=concept-row>rows</a> at the end in some cases involving
  <a href=#concept-cell title=concept-cell>cells</a> spanning multiple rows.</p>

  <p>A <dfn id=concept-column title=concept-column>column</dfn> is a complete set of slots from <span title=""><var title="">y</var>=0</span> to <span title=""><var title="">y</var>=<var title="">y<sub title="">height</sub></var>-1</span>, for a particular value of <var title="">x</var>. Columns can
  correspond to <code><a href=#the-col-element>col</a></code> elements. In the absence of <code><a href=#the-col-element>col</a></code> elements, columns are
  implied.</p>

  <p>A <dfn id=concept-row-group title=concept-row-group>row group</dfn> is a set of <a href=#concept-row title=concept-row>rows</a> anchored at a slot (0, <var title="">group<sub title="">y</sub></var>) with a particular <var title="">height</var> such that the row group
  covers all the slots with coordinates (<var title="">x</var>, <var title="">y</var>) where <span title="">0&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">width</sub></var></span> and <span title=""><var title="">group<sub title="">y</sub></var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">group<sub title="">y</sub></var>+<var title="">height</var></span>. Row groups correspond to
  <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements. Not every row is
  necessarily in a row group.</p>

  <p>A <dfn id=concept-column-group title=concept-column-group>column group</dfn> is a set of <a href=#concept-column title=concept-column>columns</a> anchored at a slot (<var title="">group<sub title="">x</sub></var>, 0) with a particular <var title="">width</var> such that the column group
  covers all the slots with coordinates (<var title="">x</var>, <var title="">y</var>) where <span title=""><var title="">group<sub title="">x</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">group<sub title="">x</sub></var>+<var title="">width</var></span> and <span title="">0&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">height</sub></var></span>. Column
  groups correspond to <code><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 title=concept-row-group>Row groups</a> cannot overlap each other. Similarly, <a href=#concept-column-group title=concept-column-group>column groups</a> cannot overlap each other.</p>

  <p>A <a href=#concept-cell title=concept-cell>cell</a> cannot cover slots that are from two or more <a href=#concept-row-group title=concept-row-group>row groups</a>. It is, however, possible for a cell to be in multiple
  <a href=#concept-column-group title=concept-column-group>column groups</a>. All the slots that form part of one cell
  are part of zero or one <a href=#concept-row-group title=concept-row-group>row groups</a> and zero or more <a href=#concept-column-group title=concept-column-group>column groups</a>.</p>

  <p>In addition to <a href=#concept-cell title=concept-cell>cells</a>, <a href=#concept-column title=concept-column>columns</a>, <a href=#concept-row title=concept-row>rows</a>, <a href=#concept-row-group title=concept-row-group>row groups</a>, and <a href=#concept-column-group title=concept-column-group>column
  groups</a>, <a href=#concept-table title=concept-table>tables</a> can have a <code><a href=#the-caption-element>caption</a></code> element
  associated with them. This gives the table a heading, or legend.</p>

  <p>A <dfn id=table-model-error>table model error</dfn> is an error with the data represented by <code><a href=#the-table-element>table</a></code>
  elements and their descendants. Documents must not have table model errors.</p>


  <h5 id=forming-a-table><span class=secno>4.9.12.1 </span>Forming a table</h5>

  <p>To determine which elements correspond to which slots in a <a href=#concept-table title=concept-table>table</a> associated with a <code><a href=#the-table-element>table</a></code> element, to determine the
  dimensions of the table (<var title="">x<sub title="">width</sub></var> and <var title="">y<sub title="">height</sub></var>), and to determine if there are any <a href=#table-model-error title="table model
  error">table model errors</a>, user agents must use the following algorithm:</p>

  <ol><li>
    <p>Let <var title="">x<sub title="">width</sub></var> be zero.</p>
   </li>

   <li>
    <p>Let <var title="">y<sub title="">height</sub></var> be zero.</p>
   </li>

   <li>

    <p>Let <var title="">pending <code><a href=#the-tfoot-element>tfoot</a></code> elements</var> be a list of <code><a href=#the-tfoot-element>tfoot</a></code>
    elements, initially empty.</p>

   </li>

   <li>

    <p>Let <var title="">the table</var> be the <a href=#concept-table title=concept-table>table</a> represented
    by the <code><a href=#the-table-element>table</a></code> element. The <var title="">x<sub title="">width</sub></var> and <var title="">y<sub title="">height</sub></var> variables give <var title="">the table</var>'s
    dimensions. <var title="">The table</var> is initially empty.</p>

   </li>

   <li>

    <!-- this step is here just so that we can be sure to have a first element in the next step, so
    that we can set up the "advance" exception-handling thingy below; otherwise it'd be more
    complicated. it's not a perf optimization per se. -->

    <p>If the <code><a href=#the-table-element>table</a></code> element has no children elements, then return <var title="">the
    table</var> (which will be empty), and abort these steps.</p>

   </li>

   <li>

    <p>Associate the first <code><a href=#the-caption-element>caption</a></code> element child of the <code><a href=#the-table-element>table</a></code> element with
    <var title="">the table</var>. If there are no such children, then it has no associated
    <code><a href=#the-caption-element>caption</a></code> element.</p>

   </li>

   <li>

    <p>Let the <var title="">current element</var> be the first element child of the
    <code><a href=#the-table-element>table</a></code> element.</p>

    <p>If a step in this algorithm ever requires the <var title="">current element</var> to be <dfn id=concept-table-advance title=concept-table-advance>advanced to the next child of the <code>table</code></dfn> when
    there is no such next child, then the user agent must jump to the step labeled <i>end</i>, near
    the end of this algorithm.</p>

   </li>

   <li>

    <p>While the <var title="">current element</var> is not one of the following elements, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next
    child of the <code><a href=#the-table-element>table</a></code>:</p>

    <ul class=brief><li><code><a href=#the-colgroup-element>colgroup</a></code></li>
     <li><code><a href=#the-thead-element>thead</a></code></li>
     <li><code><a href=#the-tbody-element>tbody</a></code></li>
     <li><code><a href=#the-tfoot-element>tfoot</a></code></li>
     <li><code><a href=#the-tr-element>tr</a></code></li>
    </ul></li>

   <li>

    <p>If the <var title="">current element</var> is a <code><a href=#the-colgroup-element>colgroup</a></code>, follow these
    substeps:</p>

    <ol><li>

      <p><i>Column groups</i>: Process the <var title="">current element</var> according to the
      appropriate case below:</p>

      <dl class=switch><dt>If the <var title="">current element</var> has any <code><a href=#the-col-element>col</a></code> element children</dt>

       <dd>

        <p>Follow these steps:</p>

        <ol><li>

          <p>Let <var title="">x<sub title="">start</sub></var> have the value of <span title=""><var title="">x<sub title="">width</sub></var></span>.</p>

         </li>

         <li>

          <p>Let the <var title="">current column</var> be the first <code><a href=#the-col-element>col</a></code> element child
          of the <code><a href=#the-colgroup-element>colgroup</a></code> element.</p>

         </li>

         <li>

          <p><i>Columns</i>: If the <var title="">current column</var> <code><a href=#the-col-element>col</a></code> element has
          a <code title=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>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 title="">span</var> be that value.</p>

          <p>Otherwise, if the <code><a href=#the-col-element>col</a></code> element has no <code title=attr-col-span><a href=#attr-col-span>span</a></code> attribute, or if trying to parse the attribute's value
          resulted in an error or zero, then let <var title="">span</var> be 1.</p>

         </li>

         <li>

          <p>Increase <var title="">x<sub title="">width</sub></var> by <var title="">span</var>.</p>

         </li>

         <li>

          <p>Let the last <var title="">span</var> <a href=#concept-column title=concept-column>columns</a> in
          <var title="">the table</var> correspond to the <var title="">current column</var>
          <code><a href=#the-col-element>col</a></code> element.</p>

         </li>

         <li>

          <p>If <var title="">current column</var> is not the last <code><a href=#the-col-element>col</a></code> element child of
          the <code><a href=#the-colgroup-element>colgroup</a></code> element, then let the <var title="">current column</var> be the
          next <code><a href=#the-col-element>col</a></code> element child of the <code><a href=#the-colgroup-element>colgroup</a></code> element, and return to
          the step labeled <i>columns</i>.</p>

         </li>

         <li>

          <p>Let all the last <a href=#concept-column title=concept-column>columns</a> in <var title="">the
          table</var> from <span title="">x=<var title="">x<sub title="">start</sub></var></span> to
          <span title="">x=<var title="">x<sub title="">width</sub></var>-1</span> form a new <a href=#concept-column-group title=concept-column-group>column group</a>, anchored at the slot (<var title="">x<sub title="">start</sub></var>, 0), with width <span title=""><var title="">x<sub title="">width</sub></var>-<var title="">x<sub title="">start</sub></var></span>, corresponding to the <code><a href=#the-colgroup-element>colgroup</a></code> element.</p>

         </li>

        </ol></dd>


       <dt>If the <var title="">current element</var> has no <code><a href=#the-col-element>col</a></code> element children</dt>

       <dd>

        <ol><li>

          <p>If the <code><a href=#the-colgroup-element>colgroup</a></code> element has a <code title=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>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 title="">span</var> be that value.</p>

          <p>Otherwise, if the <code><a href=#the-colgroup-element>colgroup</a></code> element has no <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute, or if trying to parse the attribute's
          value resulted in an error or zero, then let <var title="">span</var> be 1.</p>

         </li>

         <li>

          <p>Increase <var title="">x<sub title="">width</sub></var> by <var title="">span</var>.</p>

         </li>

         <li>

          <p>Let the last <var title="">span</var> <a href=#concept-column title=concept-column>columns</a> in
          <var title="">the table</var> form a new <a href=#concept-column-group title=concept-column-group>column
          group</a>, anchored at the slot (<span title=""><var title="">x<sub title="">width</sub></var>-<var title="">span</var></span>, 0), with width <var title="">span</var>, corresponding to the <code><a href=#the-colgroup-element>colgroup</a></code> element.</p>

         </li>

        </ol></dd>

      </dl></li>

     <li>

      <p><a href=#concept-table-advance title=concept-table-advance>Advance</a> the <var title="">current element</var>
      to the next child of the <code><a href=#the-table-element>table</a></code>.</p>

     </li>

     <li>

      <p>While the <var title="">current element</var> is not one of the following elements, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the
      next child of the <code><a href=#the-table-element>table</a></code>:</p>

      <ul class=brief><li><code><a href=#the-colgroup-element>colgroup</a></code></li>
       <li><code><a href=#the-thead-element>thead</a></code></li>
       <li><code><a href=#the-tbody-element>tbody</a></code></li>
       <li><code><a href=#the-tfoot-element>tfoot</a></code></li>
       <li><code><a href=#the-tr-element>tr</a></code></li>
      </ul></li>

     <li>

      <p>If the <var title="">current element</var> is a <code><a href=#the-colgroup-element>colgroup</a></code> element, jump to the
      step labeled <i>column groups</i> above.</p>

     </li>

    </ol></li>

   <li>

    <p>Let <var title="">y<sub title="">current</sub></var> be zero.</p>

   </li>

   <li>

    <p>Let the <var title="">list of downward-growing cells</var> be an empty list.</p>

   </li>

   <li>

    <p><i>Rows</i>: While the <var title="">current element</var> is not one of the following
    elements, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current
    element</var> to the next child of the <code><a href=#the-table-element>table</a></code>:</p>

    <ul class=brief><li><code><a href=#the-thead-element>thead</a></code></li>
     <li><code><a href=#the-tbody-element>tbody</a></code></li>
     <li><code><a href=#the-tfoot-element>tfoot</a></code></li>
     <li><code><a href=#the-tr-element>tr</a></code></li>
    </ul></li>

   <li>

    <p>If the <var title="">current element</var> is a <code><a href=#the-tr-element>tr</a></code>, then run the <a href=#algorithm-for-processing-rows>algorithm
    for processing rows</a>, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next child of the <code><a href=#the-table-element>table</a></code>, and return to the
    step labeled <i>rows</i>.</p>

   </li>

   <li>

    <p>Run the <a href=#algorithm-for-ending-a-row-group>algorithm for ending a row group</a>.</p>

   </li>

   <li>

    <p>If the <var title="">current element</var> is a <code><a href=#the-tfoot-element>tfoot</a></code>, then add that element to
    the list of <var title="">pending <code><a href=#the-tfoot-element>tfoot</a></code> elements</var>, <a href=#concept-table-advance title=concept-table-advance>advance</a> the <var title="">current element</var> to the next
    child of the <code><a href=#the-table-element>table</a></code>, and return to the step labeled <i>rows</i>.</p>

   </li>

   <li>

    <p>The <var title="">current element</var> is either a <code><a href=#the-thead-element>thead</a></code> or a
    <code><a href=#the-tbody-element>tbody</a></code>.</p>

    <p>Run the <a href=#algorithm-for-processing-row-groups>algorithm for processing row groups</a>.</p>

   </li>

   <li>

    <p><a href=#concept-table-advance title=concept-table-advance>Advance</a> the <var title="">current element</var> to
    the next child of the <code><a href=#the-table-element>table</a></code>.</p>

   </li>

   <li>

    <p>Return to the step labeled <i>rows</i>.</p>

   </li>

   <li>

    <p><i>End</i>: For each <code><a href=#the-tfoot-element>tfoot</a></code> element in the list of <var title="">pending
    <code><a href=#the-tfoot-element>tfoot</a></code> elements</var>, in tree order, run the <a href=#algorithm-for-processing-row-groups>algorithm for processing row
    groups</a>.</p>

   </li>

   <li>

    <p>If there exists a <a href=#concept-row title=concept-row>row</a> or <a href=#concept-column title=concept-column>column</a> in <var title="">the table</var> containing only <a href=#concept-slots title=concept-slots>slots</a> that do not have a <a href=#concept-cell title=concept-cell>cell</a>
    anchored to them, then this is a <a href=#table-model-error>table model error</a>.</p>

   </li>

   <li>

    <p>Return <var title="">the table</var>.</p>

   </li>

  </ol><p>The <dfn id=algorithm-for-processing-row-groups>algorithm for processing row groups</dfn>, which is invoked by the set of steps above
  for processing <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements, is:</p>

  <ol><li>

    <p>Let <var title="">y<sub title="">start</sub></var> have the value of <var title="">y<sub title="">height</sub></var>.</p>

   </li>

   <li>

    <p>For each <code><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>algorithm for processing rows</a>.</p>

   </li>

   <li>

    <!-- if we added any rows, make them part of a row group -->
    <p>If <span title=""><var title="">y<sub title="">height</sub></var>&nbsp;&gt;&nbsp;<var title="">y<sub title="">start</sub></var></span>, then let all the last <a href=#concept-row title=concept-row>rows</a> in <var title="">the table</var> from <span title="">y=<var title="">y<sub title="">start</sub></var></span> to <span title="">y=<var title="">y<sub title="">height</sub></var>-1</span> form a new <a href=#concept-row-group title=concept-row-group>row
    group</a>, anchored at the slot with coordinate (0, <var title="">y<sub title="">start</sub></var>), with height <span title=""><var title="">y<sub title="">height</sub></var>-<var title="">y<sub title="">start</sub></var></span>, corresponding
    to the element being processed.</p>

   </li>

   <li>

    <p>Run the <a href=#algorithm-for-ending-a-row-group>algorithm for ending a row group</a>.</p>

   </li>

  </ol><p>The <dfn id=algorithm-for-ending-a-row-group>algorithm for ending a row group</dfn>, which is invoked by the set of steps above
  when starting and ending a block of rows, is:</p>

  <ol><li>

    <p>While <var title="">y<sub title="">current</sub></var> is less than <var title="">y<sub title="">height</sub></var>, follow these steps:</p>

    <ol><li>

      <p>Run the <a href=#algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing cells</a>.</p>

     </li>

     <li>

      <p>Increase <var title="">y<sub title="">current</sub></var> by 1.</p>

     </li>

    </ol></li>

   <li>

    <p>Empty the <var title="">list of downward-growing cells</var>.</p>

   </li>

  </ol><p>The <dfn id=algorithm-for-processing-rows>algorithm for processing rows</dfn>, which is invoked by the set of steps above for
  processing <code><a href=#the-tr-element>tr</a></code> elements, is:</p>

  <ol><li>

    <p>If <var title="">y<sub title="">height</sub></var> is equal to <var title="">y<sub title="">current</sub></var>, then increase <var title="">y<sub title="">height</sub></var> by
    1. (<var title="">y<sub title="">current</sub></var> is never <em>greater</em> than <var title="">y<sub title="">height</sub></var>.)</p>

   </li>

   <li>

    <p>Let <var title="">x<sub title="">current</sub></var> be 0.</p>

   </li>

   <li>

    <p>Run the <a href=#algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing cells</a>.</p>

   </li>

   <li>

    <p>If the <code><a href=#the-tr-element>tr</a></code> element being processed has no <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code>
    element children, then increase <var title="">y<sub title="">current</sub></var> by 1, abort
    this set of steps, and return to the algorithm above.</p>

   </li>

   <li>

    <p>Let <var title="">current cell</var> be the first <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element child
    in the <code><a href=#the-tr-element>tr</a></code> element being processed.</p>

   </li>

   <li>

    <p><i>Cells</i>: While <var title="">x<sub title="">current</sub></var> is less than <var title="">x<sub title="">width</sub></var> and the slot with coordinate (<var title="">x<sub title="">current</sub></var>, <var title="">y<sub title="">current</sub></var>) already has a
    cell assigned to it, increase <var title="">x<sub title="">current</sub></var> by 1.</p>

   </li>

   <li>

    <p>If <var title="">x<sub title="">current</sub></var> is equal to <var title="">x<sub title="">width</sub></var>, increase <var title="">x<sub title="">width</sub></var> by 1. (<var title="">x<sub title="">current</sub></var> is never <em>greater</em> than <var title="">x<sub title="">width</sub></var>.)</p>

   </li>

   <li>

    <p>If the <var title="">current cell</var> has a <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>
    attribute, then <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">parse that attribute's
    value</a>, and let <var title="">colspan</var> be the result.</p>

    <p>If parsing that value failed, or returned zero, or if the attribute is absent, then let <var title="">colspan</var> be 1, instead.</p>

   </li>

   <li>

    <p>If the <var title="">current cell</var> has a <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>
    attribute, then <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">parse that attribute's
    value</a>, and let <var title="">rowspan</var> be the result.</p>

    <p>If parsing that value failed or if the attribute is absent, then let <var title="">rowspan</var> be 1, instead.</p>

   </li>

   <li>

    <p>If <var title="">rowspan</var> is zero and the <code><a href=#the-table-element>table</a></code> element's
    <code><a href=#document>Document</a></code> is not set to <a href=#quirks-mode>quirks mode</a>, then let <var title="">cell grows
    downward</var> be true, and set <var title="">rowspan</var> to 1. Otherwise, let <var title="">cell grows downward</var> be false.</p>

   </li>

   <li>

    <p>If <span title=""><var title="">x<sub title="">width</sub></var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">current</sub></var>+<var title="">colspan</var></span>, then let <var title="">x<sub title="">width</sub></var> be <span title=""><var title="">x<sub title="">current</sub></var>+<var title="">colspan</var></span>.</p>

   </li>

   <li>

    <p>If <span title=""><var title="">y<sub title="">height</sub></var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">current</sub></var>+<var title="">rowspan</var></span>, then let <var title="">y<sub title="">height</sub></var> be <span title=""><var title="">y<sub title="">current</sub></var>+<var title="">rowspan</var></span>.</p>

   </li>

   <li>

    <p>Let the slots with coordinates (<var title="">x</var>, <var title="">y</var>) such that <span title=""><var title="">x<sub title="">current</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">x<sub title="">current</sub></var>+<var title="">colspan</var></span> and <span title=""><var title="">y<sub title="">current</sub></var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<var title="">y<sub title="">current</sub></var>+<var title="">rowspan</var></span> be covered by a
    new <a href=#concept-cell title=concept-cell>cell</a> <var title="">c</var>, anchored at (<var title="">x<sub title="">current</sub></var>, <var title="">y<sub title="">current</sub></var>),
    which has width <var title="">colspan</var> and height <var title="">rowspan</var>,
    corresponding to the <var title="">current cell</var> element.</p>

    <p>If the <var title="">current cell</var> element is a <code><a href=#the-th-element>th</a></code> element, let this new
    cell <var title="">c</var> be a header cell; otherwise, let it be a data cell.</p>

    <p>To establish which header cells apply to the <var title="">current cell</var> element, use
    the <a href=#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 title=concept-cell>cell</a> covering
    them, then this is a <a href=#table-model-error>table model error</a>. Those slots now have two cells
    overlapping.</p>

   </li>

   <li>

    <p>If <var title="">cell grows downward</var> is true, then add the tuple {<var title="">c</var>, <var title="">x<sub title="">current</sub></var>, <var title="">colspan</var>}
    to the <var title="">list of downward-growing cells</var>.</p>

   </li>

   <li>

    <p>Increase <var title="">x<sub title="">current</sub></var> by <var title="">colspan</var>.</p>

   </li>

   <li>

    <p>If <var title="">current cell</var> is the last <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element child in
    the <code><a href=#the-tr-element>tr</a></code> element being processed, then increase <var title="">y<sub title="">current</sub></var> by 1, abort this set of steps, and return to the algorithm
    above.</p>

   </li>

   <li>

    <p>Let <var title="">current cell</var> be the next <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element child
    in the <code><a href=#the-tr-element>tr</a></code> element being processed.</p>

   </li>

   <li>

    <p>Return to the step labeled <i>cells</i>.</p>

   </li>

  </ol><p>When the algorithms above require the user agent to run the <dfn id=algorithm-for-growing-downward-growing-cells>algorithm for growing
  downward-growing cells</dfn>, the user agent must, for each {<var title="">cell</var>, <var title="">cell<sub title="">x</sub></var>, <var title="">width</var>} tuple in the <var title="">list of downward-growing cells</var>, if any, extend the <a href=#concept-cell title=concept-cell>cell</a> <var title="">cell</var> so that it also covers the slots with
  coordinates (<var title="">x</var>, <var title="">y<sub title="">current</sub></var>), where <span title=""><var title="">cell<sub title="">x</sub></var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<var title="">cell<sub title="">x</sub></var>+<var title="">width</var></span>.</p>




  <h5 id=header-and-data-cell-semantics><span class=secno>4.9.12.2 </span>Forming relationships between data cells and header cells</h5>

  <p>Each cell can be assigned zero or more header cells. The <dfn id=algorithm-for-assigning-header-cells>algorithm for assigning header
  cells</dfn> to a cell <var title="">principal cell</var> is as follows.</p>

  <ol><!-- INITIALIZATION --><li>

    <p>Let <var title="">header list</var> be an empty list of cells.</p>

   </li>

   <li>

    <p>Let (<var title="">principal<sub title="">x</sub></var>, <var title="">principal<sub title="">y</sub></var>) be the coordinate of the slot to which the <var title="">principal
    cell</var> is anchored.</p>

   </li>

   <li>

    <dl class=switch><dt>If the <var title="">principal cell</var> has a <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified</dt>

     <dd>

      <!-- HEADERS="" -->

      <ol><li>

        <p>Take the value of the <var title="">principal cell</var>'s <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute and <a href=#split-a-string-on-spaces title="split a string on
        spaces">split it on spaces</a>, letting <var title="">id list</var> be the list of tokens
        obtained.</p>

       </li>

       <li>

        <!-- support headers="" to <td> for legacy compat -->
        <!-- note that it's not conforming though -->
        <p>For each token in the <var title="">id list</var>, if the
        first element in the <code><a href=#document>Document</a></code> with an <a href=#concept-id title=concept-id>ID</a> equal to
        the token is a cell in the same <a href=#concept-table title=concept-table>table</a>, and that cell is not the
        <var title="">principal cell</var>, then add that cell to <var title="">header list</var>.</p>

       </li>

      </ol></dd>


     <dt>If <var title="">principal cell</var> does not have a <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified</dt>

     <dd>

      <ol><li>

        <p>Let <var title="">principal<sub title="">width</sub></var> be the width of the <var title="">principal cell</var>.</p>

       </li>

       <li>

        <p>Let <var title="">principal<sub title="">height</sub></var> be the height of the <var title="">principal cell</var>.</p>

       </li>


       <!-- HORIZONTAL -->

       <li>

        <p>For each value of <var title="">y</var> from <var title="">principal<sub title="">y</sub></var> to <span title=""><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span>, run
        the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header cells</a>, with the <var title="">principal cell</var>, the <var title="">header list</var>, the initial coordinate
        (<var title="">principal<sub title="">x</sub></var>,<var title="">y</var>), and the
        increments <span title="">&Delta;<var title="">x</var>=&minus;1</span> and <span title="">&Delta;<var title="">y</var>=0</span>.</p>

       </li>


       <!-- VERTICAL -->

       <li>

        <p>For each value of <var title="">x</var> from <var title="">principal<sub title="">x</sub></var> to <span title=""><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span>, run
        the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header cells</a>, with the <var title="">principal cell</var>, the <var title="">header list</var>, the initial coordinate
        (<var title="">x</var>,<var title="">principal<sub title="">y</sub></var>), and the
        increments <span title="">&Delta;<var title="">x</var>=0</span> and <span title="">&Delta;<var title="">y</var>=&minus;1</span>.</p>

       </li>


       <!-- ROW GROUP HEADERS -->

       <li>

        <p>If the <var title="">principal cell</var> is anchored in a <a href=#concept-row-group title=concept-row-group>row group</a>, then add all header cells that are <a href=#row-group-header title="row group header">row group headers</a> and are anchored in the same row group
        with an <var title="">x</var>-coordinate less than or equal to <span title=""><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span> and a <var title="">y</var>-coordinate less than or
        equal to <span title=""><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span> to <var title="">header
        list</var>.</p>

        <!-- this might introduce principal accidentally; fixed below -->

       </li>


       <!-- COLUMN GROUP HEADERS -->

       <li>

        <p>If the <var title="">principal cell</var> is anchored in a <a href=#concept-column-group title=concept-column-group>column group</a>, then add all header cells that are <a href=#column-group-header title="column group header">column group headers</a> and are anchored in the same column
        group with an <var title="">x</var>-coordinate less than or equal to <span title=""><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span> and a <var title="">y</var>-coordinate less than or
        equal to <span title=""><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span> to <var title="">header
        list</var>.</p>

        <!-- this might introduce principal accidentally; fixed below -->

       </li>

      </ol></dd>

    </dl></li>


   <!--CLEANING UP-->

   <li>

    <p>Remove all the <a href=#empty-cell title="empty cell">empty cells</a> from the <var title="">header
    list</var>.</p>

   </li>

   <li>

    <p>Remove any duplicates from the <var title="">header list</var>.</p>

   </li>

   <li>

    <p>Remove <var title="">principal cell</var> from the <var title="">header list</var> if it is
    there.</p> <!-- see "might introduce principal accidentally" above -->

   </li>

   <li>

    <p>Assign the headers in the <var title="">header list</var> to the <var title="">principal
    cell</var>.</p>

   </li>

  </ol><p>The <dfn id=internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header cells</dfn>, given a <var title="">principal cell</var>, a <var title="">header list</var>, an initial coordinate (<var title="">initial<sub title="">x</sub></var>, <var title="">initial<sub title="">y</sub></var>),
  and &Delta;<var title="">x</var> and &Delta;<var title="">y</var> increments, is as follows:</p>

  <ol><li>

    <p>Let <var title="">x</var> equal <var title="">initial<sub title="">x</sub></var>.</p>

   </li>

   <li>

    <p>Let <var title="">y</var> equal <var title="">initial<sub title="">y</sub></var>.</p>

   </li>

   <li>

    <p>Let <var title="">opaque headers</var> be an empty list of cells.</p>

   </li>

   <li>

    <dl class=switch><dt>If <var title="">principal cell</var> is a header cell</dt>

     <dd><p>Let <var title="">in header block</var> be true, and let <var title="">headers from
     current header block</var> be a list of cells containing just the <var title="">principal
     cell</var>.</dd>

     <dt>Otherwise</dt>

     <dd><p>Let <var title="">in header block</var> be false and let <var title="">headers from
     current header block</var> be an empty list of cells.</p>

    </dl></li>

   <li>

    <p><i>Loop</i>: Increment <var title="">x</var> by &Delta;<var title="">x</var>; increment <var title="">y</var> by &Delta;<var title="">y</var>.</p>

    <p class=note>For each invocation of this algorithm, one of &Delta;<var title="">x</var> and
    &Delta;<var title="">y</var> will be &minus;1, and the other will be 0.</p>

   </li>

   <li>

    <p>If either <var title="">x</var> or <var title="">y</var> is less than 0, then abort this
    internal algorithm.</p>

   </li>

   <li>

    <p>If there is no cell covering slot (<var title="">x</var>, <var title="">y</var>), or if there
    is more than one cell covering slot (<var title="">x</var>, <var title="">y</var>), return to
    the substep labeled <i>loop</i>.</p>

   </li>

   <li>

    <p>Let <var title="">current cell</var> be the cell covering slot (<var title="">x</var>, <var title="">y</var>).</p>

   </li>

   <li>

    <dl class=switch><dt>If <var title="">current cell</var> is a header cell</dt>

     <dd>

      <ol><li><p>Set <var title="">in header block</var> to true.</li>

       <li><p>Add <var title="">current cell</var> to <var title="">headers from current header
       block</var>.</li>

       <li><p>Let <var title="">blocked</var> be false.</li>

       <li>

        <dl class=switch><dt>If &Delta;<var title="">x</var> is 0</dt>

         <dd>

          <p>If there are any cells in the <var title="">opaque headers</var> list anchored with the
          same <var title="">x</var>-coordinate as the <var title="">current cell</var>, and with
          the same width as <var title="">current cell</var>, then let <var title="">blocked</var>
          be true.</p>

          <p>If the <var title="">current cell</var> is not a <a href=#column-header>column header</a>, then let
          <var title="">blocked</var> be true.</p>

         </dd>

         <dt>If &Delta;<var title="">y</var> is 0</dt>

         <dd>

          <p>If there are any cells in the <var title="">opaque headers</var> list anchored with the
          same <var title="">y</var>-coordinate as the <var title="">current cell</var>, and with
          the same height as <var title="">current cell</var>, then let <var title="">blocked</var>
          be true.</p>

          <p>If the <var title="">current cell</var> is not a <a href=#row-header>row header</a>, then let <var title="">blocked</var> be true.</p>

         </dd>

        </dl></li>

       <li><p>If <var title="">blocked</var> is false, then add the <var title="">current cell</var>
       to the <var title="">headers list</var>.</li>

      </ol></dd>

     <dt>If <var title="">current cell</var> is a data cell and <var title="">in header block</var> is true</dt>

     <dd><p>Set <var title="">in header block</var> to false. Add all the cells in <var title="">headers from current header block</var> to the <var title="">opaque headers</var>
     list, and empty the <var title="">headers from current header block</var> list.</p>

    </dl></li>

   <li>

    <p>Return to the step labeled <i>loop</i>.</p>

   </li>

  </ol><p>A header cell anchored at the slot with coordinate (<var title="">x</var>, <var title="">y</var>) with width <var title="">width</var> and height <var title="">height</var> is
  said to be a <dfn id=column-header>column header</dfn> if any of the following conditions are true:</p>

  <ul><li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-col title=attr-th-scope-col>column</a> state, or</li>

   <li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-auto title=attr-th-scope-auto>auto</a> state, and there are no data cells in any of the cells
   covering slots with <var title="">y</var>-coordinates <var title="">y</var> .. <span title=""><var title="">y</var>+<var title="">height</var>-1</span>.</li>

  </ul><p>A header cell anchored at the slot with coordinate (<var title="">x</var>, <var title="">y</var>) with width <var title="">width</var> and height <var title="">height</var> is
  said to be a <dfn id=row-header>row header</dfn> if any of the following conditions are true:</p>

  <ul><li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-row title=attr-th-scope-row>row</a> state, or</li>

   <li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-auto title=attr-th-scope-auto>auto</a> state, the cell is not a <a href=#column-header>column header</a>, and
   there are no data cells in any of the cells covering slots with <var title="">x</var>-coordinates
   <var title="">x</var> .. <span title=""><var title="">x</var>+<var title="">width</var>-1</span>.</li>

  </ul><p>A header cell is said to be a <dfn id=column-group-header>column group header</dfn> if its <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-colgroup title=attr-th-scope-colgroup>column
  group</a> state.</p>

  <p>A header cell is said to be a <dfn id=row-group-header>row group header</dfn> if its <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-rowgroup title=attr-th-scope-rowgroup>row
  group</a> state.</p>

  <p>A cell is said to be an <dfn id=empty-cell>empty cell</dfn> if it contains no elements and its text content,
  if any, consists only of <a href=#white_space>White_Space</a> characters.</p>

  </div>


  <h4 id=table-sorting-model><span class=secno>4.9.13 </span><dfn>Table sorting model</dfn></h4>

  <p>The <dfn id=attr-table-sortable title=attr-table-sortable><code>sortable</code></dfn> attribute on
  <code><a href=#the-table-element>table</a></code> elements is a <a href=#boolean-attribute>boolean attribute</a>. When present, it indicates that
  the user agent is to <a href=#sortable-ui>allow the user to sort</a> the <code><a href=#the-table-element>table</a></code>.</p>

  <p>To make a column sortable in a <code><a href=#the-table-element>table</a></code> with a <code><a href=#the-thead-element>thead</a></code>, the column needs
  to have <code><a href=#the-th-element>th</a></code> element that does not <a href=#attr-tdth-colspan title=attr-tdth-colspan>span multiple
  columns</a> in a <code><a href=#the-thead-element>thead</a></code> above any rows that it is to sort.</p>

  <p>To make a column sortable in a <code><a href=#the-table-element>table</a></code> without a <code><a href=#the-thead-element>thead</a></code>, the column
  needs to have <code><a href=#the-th-element>th</a></code> element that does not <a href=#attr-tdth-colspan title=attr-tdth-colspan>span multiple
  columns</a> in the first <code><a href=#the-tr-element>tr</a></code> element of the <code><a href=#the-table-element>table</a></code>, where that
  <code><a href=#the-tr-element>tr</a></code> element is not in a <code><a href=#the-tfoot-element>tfoot</a></code>.</p>

  <p>When the user selects a column by which to sort, the user agent sets the <code><a href=#the-th-element>th</a></code>
  element's <dfn id=attr-th-sorted title=attr-th-sorted><code>sorted</code></dfn> attribute. This attribute can also
  be set manually, to indicate that the table should be automatically sorted, even when scripts
  modify the page on when the page is loaded.</p>

  <p>The <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute, if specified, must have a value that
  is a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a> consisting of optionally a token whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<dfn id=attr-th-sorted-reversed title=attr-th-sorted-reversed><code>reversed</code></dfn>", and optionally a token whose value
  is a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than zero, in either order.</p>

  <p class=note>In other words, ignoring spaces and case, the <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute's value can be empty, "<code title="">reversed</code>", "<code title="">1</code>", "<code title="">reversed 1</code>", or
  "<code title="">1 reversed</code>", where "1" is any number equal to or greater than 1.</p>

  <p>While one or more <code><a href=#the-th-element>th</a></code> elements in the table have a <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute, the user agent will keep the table's data rows
  sorted. The value of the attribute controls how the column is used in determining the sort order.
  The <code title=attr-th-sorted-reversed><a href=#attr-th-sorted-reversed>reversed</a></code> keyword means that the <dfn id=column-sort-direction>column sort
  direction</dfn> is <i>reversed</i>, rather than <i>normal</i>, which is the default if the keyword
  is omitted. The number, if present, indicates the <dfn id=column-key-ordinality>column key ordinality</dfn>; if the number
  is omitted, the column is the primary key, as if the value 1 had been specified.</p>

  <p class=note>Thus, <code title="">sorted="1"</code> indicates the table's primary key, <code title="">sorted="2"</code> its secondary key, and so forth.</p>

  <hr><p>A <dfn id=sorting-capable-th-element>sorting-capable <code>th</code> element</dfn> is a <code><a href=#the-th-element>th</a></code> element that matches
  all the following conditions simultaneously:</p>

  <ul><li><p>It corresponds to a <a href=#concept-cell title=concept-cell>cell</a> whose <i>width</i> is 1.
   (Specifically, a <i>header cell</i>, since this is a <code><a href=#the-th-element>th</a></code> element.)</li>

   <li><p>There is no <a href=#concept-cell title=concept-cell>cell</a> that corresponds to another
   <a href=#sorting-capable-th-element>sorting-capable <code>th</code> element</a> that covers slots in the same <a href=#concept-column title=concept-column>column</a> but on a higher (earlier) <a href=#concept-row title=concept-row>row</a>.</li> <!-- only matters if there's a <thead> -->

   <li>

    <p>If the <a href=#concept-cell title=concept-cell>cell</a>'s <a href=#concept-table title=concept-table>table</a> has
    a <a href=#concept-row-group title=concept-row-group>row group</a> corresponding to a <code><a href=#the-thead-element>thead</a></code>
    element, the <a href=#concept-cell title=concept-cell>cell</a> is in a <a href=#concept-row-group title=concept-row-group>row
    group</a> that corresponds to the <em>first</em> <code><a href=#the-thead-element>thead</a></code> element of the <a href=#concept-cell title=concept-cell>cell</a>'s <a href=#concept-table title=concept-table>table</a>.</p>

    <p>Otherwise: the <a href=#concept-cell title=concept-cell>cell</a> is not in a <a href=#concept-row-group title=concept-row-group>row group</a> corresponding to a <code><a href=#the-tfoot-element>tfoot</a></code> element, and
    the <a href=#concept-cell title=concept-cell>cell</a> is in the first <a href=#concept-row title=concept-row>row</a>
    of the <a href=#concept-table title=concept-table>table</a>.</p>

   </li>

  </ul><p class=note>In other words, each <a href=#concept-column title=concept-column>column</a> can have one
  <a href=#sorting-capable-th-element>sorting-capable <code>th</code> element</a>; this will be the highest <code><a href=#the-th-element>th</a></code> in
  a <code><a href=#the-thead-element>thead</a></code> that spans no other columns, or, if there is no <code><a href=#the-thead-element>thead</a></code>, the
  <code><a href=#the-th-element>th</a></code> in the first row (that is not in a <code><a href=#the-tfoot-element>tfoot</a></code>), assuming it spans no
  columns.</p>

  <p>The <dfn id=sorting-capable-th-elements-of-the-table-element>sorting-capable <code>th</code> elements of the <code>table</code> element</dfn> <var title="">table</var> are the <a href=#sorting-capable-th-element title="sorting-capable th element">sorting-capable
  <code>th</code> elements</a> whose <a href=#concept-cell title=concept-cell>cell</a>'s <a href=#concept-table title=concept-table>table</a> is <var title="">table</var>.</p>

  <p>A <code><a href=#the-table-element>table</a></code> element <var title="">table</var> is a <dfn id=sorting-capable-table-element>sorting-capable
  <code>table</code> element</dfn> if there are one or more <a href=#sorting-capable-th-elements-of-the-table-element>sorting-capable <code>th</code>
  elements of the <code>table</code> element</a> <var title="">table</var>.</p>

  <p>A <code><a href=#the-th-element>th</a></code> element is a <dfn id=sorting-enabled-th-element>sorting-enabled <code>th</code> element</dfn> if it is a
  <a href=#sorting-capable-th-element>sorting-capable <code>th</code> element</a> and it has a <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute.</p>

  <p>The <dfn id=sorting-enabled-th-elements-of-the-table-element>sorting-enabled <code>th</code> elements of the <code>table</code> element</dfn> <var title="">table</var> are the <a href=#sorting-enabled-th-element title="sorting-enabled th element">sorting-enabled
  <code>th</code> elements</a> whose <a href=#concept-cell title=concept-cell>cell</a>'s <a href=#concept-table title=concept-table>table</a> is <var title="">table</var>.</p>

  <p>A <code><a href=#the-table-element>table</a></code> element <var title="">table</var> is a <dfn id=sorting-enabled-table-element>sorting-enabled
  <code>table</code> element</dfn> if there are one or more <a href=#sorting-capable-th-elements-of-the-table-element>sorting-capable <code>th</code>
  elements of the <code>table</code> element</a> <var title="">table</var>, and at least one of
  them is a <a href=#sorting-enabled-th-element>sorting-enabled <code>th</code> element</a> (i.e. at least one has a <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute).</p>

  <p>A <code><a href=#the-table-element>table</a></code> element is a <dfn id=table-element-with-a-user-agent-exposed-sorting-interface><code>table</code> element with a user-agent exposed
  sorting interface</dfn> if it is a <a href=#sorting-capable-table-element>sorting-capable <code>table</code> element</a> and has
  a <code title=attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> attribute specified.</p>

  <p>A <dfn id=sorting-interface-th-element>sorting interface <code>th</code> element</dfn> is a <a href=#sorting-capable-th-element>sorting-capable
  <code>th</code> element</a> whose <a href=#concept-cell title=concept-cell>cell</a>'s <a href=#concept-table title=concept-table>table</a> is a <a href=#table-element-with-a-user-agent-exposed-sorting-interface><code>table</code> element with a user-agent exposed
  sorting interface</a>.</p>

  <hr><p>Each <code><a href=#the-table-element>table</a></code> element has a <dfn id=currently-sorting-flag>currently-sorting flag</dfn>, which must initially
  be false.</p>

  <hr><p>The <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute must not be specified on
  <code><a href=#the-th-element>th</a></code> elements that are not <a href=#sorting-capable-th-element title="sorting-capable th element">sorting-capable
  <code>th</code> elements</a>. The <code title=attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> attribute
  must not be specified on <code><a href=#the-table-element>table</a></code> elements that are not <a href=#sorting-capable-table-element title="sorting-capable
  table element">sorting-capable <code>table</code> elements</a>.</p>

  <div class=impl>

  <p>To determine a <code><a href=#the-th-element>th</a></code> element's <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute's
  <a href=#column-sort-direction>column sort direction</a> and <a href=#column-key-ordinality>column key ordinality</a>, user agents must use
  the following algorithm:</p>

  <ol><li><p>Let <var title="">direction</var> be <i>normal</i>.</p>

   <li><p>Let <var title="">have explicit direction</var> be false.</p>

   <li><p>Let <var title="">ordinality</var> be 1.</p>

   <li><p>Let <var title="">have explicit ordinality</var> be false.</p>

   <li><p>Let <var title="">tokens</var> be the result of <a href=#split-a-string-on-spaces title="split a string on
   spaces">splitting the attribute's value on spaces</a>.</li>

   <li>

    <p>For each token <var title="">token</var> in <var title="">tokens</var>, run the appropriate
    steps from the following list:</p>

    <dl class=switch><dt>If <var title="">have explicit direction</var> is false and <var title="">token</var> is an
     <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title=attr-th-sorted-reversed><a href=#attr-th-sorted-reversed>reversed</a></code>"</dt>

     <dd>

      <p>Let <var title="">direction</var> be <i>reversed</i> and <var title="">have explicit
      direction</var> be true.</p>

     </dd>


     <dt>If <var title="">have explicit ordinality</var> is false</dt>

     <dd>

      <p><a href=#rules-for-parsing-integers title="rules for parsing integers">Parse <var title="">token</var> as an
      integer</a>. If this resulted in an error or the value zero, then ignore the token.
      Otherwise, set <var title="">ordinality</var> to the parsed value, and set <var title="">have
      explicit ordinality</var> to true.</p>

     </dd>


     <dt>Otherwise</dt>

     <dd><p>Ignore the token.</dd>

    </dl></li>

   <li><p>The <a href=#column-sort-direction>column sort direction</a> is the value of <var title="">direction</var>, and
   the <a href=#column-key-ordinality>column key ordinality</a> is the value of <var title="">ordinality</var>.</li>

  </ol></div>

  <p>A <code><a href=#the-table-element>table</a></code> must not have two <code><a href=#the-th-element>th</a></code> elements whose <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute have the same <a href=#column-key-ordinality>column key
  ordinality</a>.</p>

  <div class=impl>

  <hr><p>The <dfn id=table-sorting-algorithm>table sorting algorithm</dfn>, which is applied to a <code><a href=#the-table-element>table</a></code>, is as
  follows:</p>

  <ol><li><p>Let <var title="">table</var> be the <code><a href=#the-table-element>table</a></code> element being sorted.</li>

   <li><p>If <var title="">table</var>'s <a href=#currently-sorting-flag>currently-sorting flag</a> is true, then abort
   these steps.</li>

   <li><p>Set <var title="">table</var>'s <a href=#currently-sorting-flag>currently-sorting flag</a> to true.</li>

   <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-sort>sort</code> that is
   cancelable at <var title="">table</var>.</li>

   <li><p>If the event fired in the previous step was canceled, then jump to the step labeled
   <i>end</i> below.</li>

   <li>

    <p>If <var title="">table</var> is not now a <a href=#sorting-enabled-table-element>sorting-enabled <code>table</code>
    element</a>, then jump to the step labeled <i>end</i> below.</p>

    <p class=note>Even if <var title="">table</var> was a <a href=#sorting-enabled-table-element>sorting-enabled <code>table</code>
    element</a> when the algorithm was invoked, the DOM might have been entirely changed by the
    event handlers for the <code title=event-sort>sort</code> event, so this has to be verified at
    this stage, not earlier.</p>

   </li>

   <li><p>Let <var title="">key heading cells</var> be the <a href=#sorting-enabled-th-elements-of-the-table-element>sorting-enabled <code>th</code>
   elements of the <code>table</code> element</a> <var title="">table</var>.</li>

   <li><p>Sort <var title="">key heading cells</var> in ascending order of the <a href=#column-key-ordinality>column key
   ordinality</a> of their <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attributes, with those
   having the same <a href=#column-key-ordinality>column key ordinality</a> being sorted in <a href=#tree-order>tree order</a>.</p>

   <li>

    <p>Let <var title="">row collection cursor</var> be a pointer to an element, initially pointing
    at the first child of <var title="">table</var> that is after <var title="">table</var>'s first
    <code><a href=#the-thead-element>thead</a></code>, if any, and that is either a <code><a href=#the-tbody-element>tbody</a></code> or a <code><a href=#the-tr-element>tr</a></code>
    element, assuming there is one. If there is no such child, then jump to the step labeled
    <i>end</i> below.</p>

   </li>

   <li><p>If <var title="">table</var> has no <a href=#concept-row-group title=concept-row-group>row group</a>
   corresponding to a <code><a href=#the-thead-element>thead</a></code> element, then set <var title="">ignore first group</var> to
   true. Otherwise, set it to false.</li>

   <li><p><i>Row loop</i>: Let <var title="">rows</var> be an empty list of <code><a href=#the-tr-element>tr</a></code>
   elements.</li>

   <li>

    <p>Run the appropriate steps from the following list:</p>

    <dl class=switch><dt>If <var title="">row collection cursor</var> points to a <code><a href=#the-tr-element>tr</a></code> element

     <dd>

      <ol><li><p><i>Collect</i>: Append the element pointed to by <var title="">row collection
       cursor</var> to <var title="">rows</var>.</li>

       <li><p>If there are no <code><a href=#the-tr-element>tr</a></code> or <code><a href=#the-tbody-element>tbody</a></code> children of <var title="">table</var> that are later siblings of the element pointed to by <var title="">row
       collection cursor</var>, or if the next such child is a <code><a href=#the-tbody-element>tbody</a></code> element, then jump
       to the step labeled <i>group</i> below.</li>

       <li><p>Let <var title="">row collection cursor</var> point to the next <code><a href=#the-tr-element>tr</a></code> child
       of <var title="">table</var> that is a later sibling of the element pointed to by <var title="">row collection cursor</var>.</li>

       <li><p>Return to the step labeled <i>collect</i> above.</li>

      </ol></dd>


     <dt>If <var title="">row collection cursor</var> points to a <code><a href=#the-tbody-element>tbody</a></code> element

     <dd>

      <ol><li><p>Place all the <code><a href=#the-tr-element>tr</a></code> element children of the element pointed to by <var title="">row collection cursor</var> into <var title="">rows</var>, in <a href=#tree-order>tree
       order</a>.</li>

       <li><p>If <var title="">rows</var> is empty, jump to the step labeled <i>increment loop</i>
       below.</li>

      </ol></dd>

    </dl></li>

   <li><p><i>Group</i>: Let <var title="">groups</var> be an empty list of groups of <code><a href=#the-tr-element>tr</a></code>
   elements.</li>

   <li><p>Let <var title="">group</var> be an empty group of <code><a href=#the-tr-element>tr</a></code> elements.</li>

   <li><p>Let <var title="">group cursor</var> be a pointer to an element, initially pointing at the
   first <code><a href=#the-tr-element>tr</a></code> element in <var title="">rows</var>.</li>

   <li><p><i>Start group</i>: Let <var title="">pending rows in group</var> be 1.</li>

   <li><p><i>Group loop</i>: Append the <code><a href=#the-tr-element>tr</a></code> element pointed to by <var title="">group
   cursor</var> to <var title="">group</var>.</li>

   <li><p>If there are any <a href=#concept-cell title=concept-cell>cells</a> whose highest <a href=#concept-row title=concept-row>row</a>'s element is the one pointed to by <var title="">group
   cursor</var>, then let <var title="">tallest height</var> be the number of rows covered by the
   tallest such <a href=#concept-cell title=concept-cell>cell</a>.</li>

   <li><p>If <var title="">tallest height</var> is greater than <var title="">pending rows in
   group</var> then set <var title="">pending rows in group</var> to <var title="">tallest
   height</var>.</li>

   <li><p>Decrement <var title="">pending rows in group</var> by one.</li>

   <li><p>Let <var title="">group cursor</var> point to the next <code><a href=#the-tr-element>tr</a></code> element in <var title="">rows</var>, if any; otherwise, let it be null.</li>

   <li><p>If <var title="">group cursor</var> is not null and <var title="">pending rows in
   group</var> is not zero, return to the step labeled <i>group loop</i>.</li>

   <li><p>Append a new group to <var title="">groups</var> consisting of the <code><a href=#the-tr-element>tr</a></code>
   elements in <var title="">group</var>.</li>

   <li><p>Empty <var title="">group</var>.</li>

   <li><p>If <var title="">group cursor</var> is not null, then return to the step labeled <i>start
   group</i>.</li>

   <li><p>If <var title="">ignore first group</var> is true, then drop the first group in <var title="">groups</var> and set <var title="">ignore first group</var> to false.</li>

   <li><p><i>Drop leading header groups</i>: If <var title="">groups</var> is now empty, jump to the
   step labeled <i>increment loop</i> below.</li>

   <!-- if you insert steps here, update the next step -->

   <li><p>If the first group of <var title="">groups</var> consists of <code><a href=#the-tr-element>tr</a></code> elements
   whose element children are all <code><a href=#the-th-element>th</a></code> elements, then drop the first group in <var title="">groups</var> and return to the previous step (labeled <i>drop leading header
   groups</i>).</li>

   <li><p>Let <var title="">insertion point</var> be a placeholder in a DOM tree, which can be used
   to reinsert nodes at a specific point in the DOM. Insert <var title="">insertion point</var> into
   the parent of the first <code><a href=#the-tr-element>tr</a></code> element of the first group in <var title="">groups</var>,
   immediately before that <code><a href=#the-tr-element>tr</a></code> element.</li>

   <li>

    <p>Sort the groups in <var title="">groups</var>, using the following algorithm to decide the
    relative order of any two groups <var title="">a</var> and <var title="">b</var> (the algorithm
    either returns that <var title="">a</var> comes before <var title="">b</var>, or that <var title="">b</var> comes before <var title="">a</var>):</p>

    <ol><li><p>Let <var title="">key index</var> be an index into <var title="">key heading
     cells</var>, initially denoting the first element in the list.</li>

     <li><p>Let <var title="">direction</var> be a sort direction, initially <i>ascending</i>. Its
     other possible value is <i>descending</i>. When <var title="">direction</var> is
     <i>toggled</i>, that means that if its value is <i>ascending</i>, it must be changed to
     <i>descending</i>, and when its value is <i>descending</i>, it must be changed to
     <i>ascending</i>.</li>

     <li><p><i>Column loop</i>: Let <var title="">th</var> be the <var title="">key index</var>th
     <code><a href=#the-th-element>th</a></code> in <var title="">key heading cells</var>.</li>

     <li><p>If <var title="">th</var>'s <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute's
     <a href=#column-sort-direction>column sort direction</a> is <i>reversed</i>, then toggle <var title="">direction</var>.</li>

     <li><p>Let <var title="">tentative order</var> be the result of <a href=#comparing-two-row-groups-using-the-th-element>comparing two row groups
     using the <code>th</code> element</a> <var title="">th</var>, with <var title="">a</var> and
     <var title="">b</var> as the rows.</li>

     <li><p>If <var title="">tentative order</var> is not "equal", then jump to the step labeled
     <i>return</i> below.</li>

     <li><p>Increment <var title="">key index</var>.</li>

     <li><p>If <var title="">key index</var> still denotes a <code><a href=#the-th-element>th</a></code> element in <var title="">key heading cells</var>, then jump back to the step above labeled <i>column
     loop</i>.</li>

     <li><p>If <var title="">a</var>'s <code><a href=#the-tr-element>tr</a></code> elements precede <var title="">b</var>'s in
     <a href=#tree-order>tree order</a>, then let <var title="">tentative order</var> be "a before b".
     Otherwise, let <var title="">tentative order</var> be "b before a".</li>

     <li><p><i>Return</i>: Return the relative order given by the matching option from the following
     list:</p>

      <dl class=switch><dt>If <var title="">direction</var> is <i>ascending</i> and <var title="">tentative
       order</var> is "a before b"</dt>

       <dd>Return that <var title="">a</var> comes before <var title="">b</var>.</dd>


       <dt>If <var title="">direction</var> is <i>ascending</i> and <var title="">tentative
       order</var> is "b before a"</dt>

       <dd>Return that <var title="">b</var> comes before <var title="">a</var>.</dd>


       <dt>If <var title="">direction</var> is <i>descending</i> and <var title="">tentative
       order</var> is "a before b"</dt>

       <dd>Return that <var title="">b</var> comes before <var title="">a</var>.</dd>


       <dt>If <var title="">direction</var> is <i>descending</i> and <var title="">tentative
       order</var> is "b before a"</dt>

       <dd>Return that <var title="">a</var> comes before <var title="">b</var>.</dd>

      </dl></li>

    </ol><p>When the user agent is required to <dfn id=comparing-two-row-groups-using-the-th-element title="comparing two row groups using the th
    element">compare two row groups using the <code>th</code> element</dfn> <var title="">th</var>,
    with <var title="">a</var> and <var title="">b</var> being the two row groups respectively, the
    user agent must run the following steps:</p>

    <ol><li><p>Let <var title="">x</var> be the <var title="">x</var>-coordinate of the slots that
     <code><a href=#the-th-element>th</a></code> covers in its <a href=#concept-table title=concept-table>table</a>.</li>

     <li>

      <p>Let <var title="">cell<sub title="">a</sub></var> be the element corresponding to the <a href=#concept-cell title=concept-cell>cell</a> in the first <a href=#concept-row title=concept-row>row</a> of group
      <var title="">a</var> that covers the slot in that <a href=#concept-row title=concept-row>row</a> whose
      <var title="">x</var>-coordinate is <var title="">x</var>.</p>

      <p>Let <var title="">cell<sub title="">b</sub></var> be the element corresponding to the <a href=#concept-cell title=concept-cell>cell</a> in the first <a href=#concept-row title=concept-row>row</a> of group
      <var title="">b</var> that covers the slot in that <a href=#concept-row title=concept-row>row</a> whose
      <var title="">x</var>-coordinate is <var title="">x</var>.</p>

      <!-- there can't be two cells that cover the slot, unusually, because the only way that can
      happen is if there's a cell that's extended into this row from above, and the groups, by
      virtue of the way they are created above, never have cells that extend into them from above.
      -->

      <p>In either case, if there's no <a href=#concept-cell title=concept-cell>cell</a> that actually covers
      the slot, then use the value <i>null</i> instead.</p>

     </li>

     <li>

      <p>Let <var title="">type<sub title="">a</sub></var> and <var title="">value<sub title="">a</sub></var> be
      the <a href=#type-and-value-of-the-cell>type and value of the cell</a> <var title="">cell<sub title="">a</sub></var>, as defined
      below.</p>

      <p>Let <var title="">type<sub title="">b</sub></var> and <var title="">value<sub title="">b</sub></var> be
      the <a href=#type-and-value-of-the-cell>type and value of the cell</a> <var title="">cell<sub title="">b</sub></var>, as defined
      below.</p>

      <p>The <dfn id=type-and-value-of-the-cell>type and value of the cell</dfn> <var title="">cell</var> are computed as follows.</p>

      <ol><li><p>If <var title="">cell</var> is <i>null</i>, then the type is "string" and the value is
       the empty string; abort these steps.</li>

       <li><p>If, ignoring <a href=#inter-element-whitespace>inter-element whitespace</a> and nodes other than
       <a href=#element>Element</a> and <a href=#text>Text</a> nodes, <var title="">cell</var> has only one child
       and that child is a <code><a href=#the-data-element>data</a></code> element, then the value is the value of that
       <code><a href=#the-data-element>data</a></code> element's <code title=attr-data-value><a href=#attr-data-value>value</a></code> attribute, if there is
       one, or the empty string otherwise; the type is "string".</p>

       <li><p>If, ignoring <a href=#inter-element-whitespace>inter-element whitespace</a> and nodes other than
       <a href=#element>Element</a> and <a href=#text>Text</a> nodes, <var title="">cell</var> has only one child
       and that child is a <code><a href=#the-progress-element>progress</a></code> element, then the value is the value of that
       <code><a href=#the-progress-element>progress</a></code> element's <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute, if
       there is one, or the empty string otherwise; the type is "string".</p>

       <li><p>If, ignoring <a href=#inter-element-whitespace>inter-element whitespace</a> and nodes other than
       <a href=#element>Element</a> and <a href=#text>Text</a> nodes, <var title="">cell</var> has only one child
       and that child is a <code><a href=#the-meter-element>meter</a></code> element, then the value is the value of that
       <code><a href=#the-meter-element>meter</a></code> element's <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute, if there is
       one, or the empty string otherwise; the type is "string".</p>

       <li>

        <p>If, ignoring <a href=#inter-element-whitespace>inter-element whitespace</a> and nodes other than
        <a href=#element>Element</a> and <a href=#text>Text</a> nodes, <var title="">cell</var> has only one
        child and that child is a <code><a href=#the-time-element>time</a></code> element, then the value is the
        <a href="#machine-readable-equivalent-of-the-element's-contents">machine-readable equivalent of the element's contents</a>, if any, and the type is
        the kind of value that is thus obtained
       (a <a href=#concept-month title=concept-month>month</a>,
        a <a href=#concept-date title=concept-date>date</a>,
        a <a href=#concept-yearless-date title=concept-yearless-date>yearless date</a>,
        a <a href=#concept-time title=concept-time>time</a>,
        a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>,
        a <a href=#concept-timezone title=concept-timezone>time-zone offset</a>,
        a <a href=#concept-datetime title=concept-datetime>global date and time</a>,
        a <a href=#concept-week title=concept-week>week</a>,
        a year, or
        a <a href=#concept-duration title=concept-duration>duration</a>);
        abort these steps after completing this one.</p>

        <p>If there is no machine-readable equivalent, then the type is "string" and the value is
        the empty string.</p>

        <p>If the type is
        a <a href=#concept-month title=concept-month>month</a>,
        a <a href=#concept-date title=concept-date>date</a>,
        a <a href=#concept-week title=concept-week>week</a>, or
        a year,
        then change the value to be the instant in time (with no time zone) that describes the
        earliest moment that the value represents, and change the type to be
        a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>.</p>

        <p class=example>For example, if the cell was
        <code>&lt;td&gt;&lt;time&gt;2011-11&lt;/time&gt;</code> then for sorting purposes the value is
        interpreted as "2011-11-01T00:00:00.000" and the type is treated as a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a> rather than a <a href=#concept-month title=concept-month>month</a>.</p>

        <p class=example>Similarly, if the cell was <code>&lt;td&gt;&lt;time
        datetime="2014"&gt;MMXIV&lt;/time&gt;</code> then for sorting purposes the value is interpreted as
        "2014-01-01T00:00:00.000" and the type is treated as a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a> rather than a year.</p>

       </li>

       <li><p>The value is the element's <code><a href=#textcontent>textContent</a></code>. The type is "string".</li>

      </ol></li>

     <li>

      <p>If <var title="">type<sub title="">a</sub></var> and <var title="">type<sub title="">b</sub></var> are not
      equal, then: return "a before b" if <var title="">type<sub title="">a</sub></var> is earlier in the
      following list than <var title="">type<sub title="">b</sub></var>, otherwise, return "b before a";
      then, abort these steps.</p>

      <ol class=brief><li><a href=#concept-time title=concept-time>time</a></li>
       <li><a href=#concept-yearless-date title=concept-yearless-date>yearless date</a></li>
       <li><a href=#concept-datetime-local title=concept-datetime-local>local date and time</a></li>
       <li><a href=#concept-datetime title=concept-datetime>global date and time</a></li>
       <li><a href=#concept-timezone title=concept-timezone>time-zone offset</a></li>
       <li><a href=#concept-duration title=concept-duration>duration</a></li>
       <li>"string"</li>
      </ol></li>

     <li><p>If <var title="">value<sub title="">a</sub></var> and <var title="">value<sub title="">b</sub></var> are
     equal, then return "equal" and abort these steps.</li>

     <li>

      <p>If <var title="">type<sub title="">a</sub></var> and <var title="">type<sub title="">b</sub></var> are not
      "string", then: if <var title="">value<sub title="">a</sub></var> is earlier than <var title="">value<sub title="">b</sub></var> then return "a before b" and abort these steps, otherwise,
      return "b before a" and abort these steps.</p>

      <p>Values sort in their natural order, with the following additional constraints:</p>

      <p>For <a href=#concept-time title=concept-time>time</a> values, 00:00:00.000 is the earliest value and
      23:59:59.999 is the latest value.</p>

      <p>For <a href=#concept-yearless-date title=concept-yearless-date>yearless date</a> values, 01-01 is the earliest
      value and 12-31 is the latest value; 02-28 is earlier than 02-29 which is earlier than
      03-01.</p>

      <p>Values that are <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a> compare as
      if they were in the same time zone.</p>

      <!-- no ambiguity for <span title="concept-datetime">global date and time</span> -->

      <p>For <a href=#concept-timezone title=concept-timezone>time-zone offset</a> values, -23:59 is the earliest
      value and +23:59 is the latest value.</p>

      <!-- MONTHS: <span title="concept-duration">duration</span> is unambiguous until we add months -->

     </li>

     <!-- At this point we know that they are both strings and they're not equal. -->

     <li>

      <p>Let <var title="">components<sub title="">a</sub></var> be the result of <a href=#parsing-the-sort-key>parsing the sort
      key</a> <var title="">value<sub title="">a</sub></var>.</p>

      <p>Let <var title="">components<sub title="">b</sub></var> be the result of <a href=#parsing-the-sort-key>parsing the sort
      key</a> <var title="">value<sub title="">b</sub></var>.</p>

      <p>As described below, <var title="">components<sub title="">a</sub></var> and <var title="">components<sub title="">b</sub></var> are tuples consisting of a list of <var title="">n</var>
      <i>numbers</i>, a list of <var title="">n</var> <i>number strings</i>, a list of <var title="">n</var>+1 <i>non-numeric strings</i>, and a list of 2<var title="">n</var>+1 <i>raw
      strings</i>, for any non-negative integer value of <var title="">n</var> (zero or more).</p>

     </li>

     <li>

      <p>Let <var title="">order</var> be the result of a <a href=#locale-specific-string-comparison>locale-specific string
      comparison</a> of <var title="">components<sub title="">a</sub></var>'s first <i>non-numeric
      string</i> and <var title="">components<sub title="">b</sub></var>'s first <i>non-numeric string</i>,
      in the context of <var title="">th</var>.</p>

      <p>If <var title="">order</var> is not "equal" then return <var title="">order</var> and abort
      these steps.</p>

     </li>

     <li>

      <p>If <var title="">components<sub title="">a</sub></var> and <var title="">components<sub title="">b</sub></var> both have exactly one <i>number</i>, then run these
      substeps:</p>

      <ol><li>

        <p>If <var title="">components<sub title="">a</sub></var>'s <i>number</i> is less than <var title="">components<sub title="">b</sub></var>'s <i>number</i>, return "a before b".</p>

        <p>If <var title="">components<sub title="">b</sub></var>'s <i>number</i> is less than <var title="">components<sub title="">a</sub></var>'s <i>number</i>, return "b before a".</p>

       </li>

       <li>

        <p>Let <var title="">order</var> be the result of a <a href=#locale-specific-string-comparison>locale-specific string
        comparison</a> of <var title="">components<sub title="">a</sub></var>'s second <i>non-numeric
        string</i> and <var title="">components<sub title="">b</sub></var>'s second <i>non-numeric
        string</i>, in the context of <var title="">th</var>.</p>

        <p>If <var title="">order</var> is not "equal" then return <var title="">order</var> and
        abort these steps.</p>

       </li>

       <li>

        <p>Let <var title="">order</var> be the result of a <a href=#locale-specific-string-comparison>locale-specific string
        comparison</a> of <var title="">components<sub title="">a</sub></var>'s <i>number string</i> and
        <var title="">components<sub title="">b</sub></var>'s <i>number string</i>, in the context of <var title="">th</var>.</p>

        <p>If <var title="">order</var> is not "equal" then return <var title="">order</var> and
        abort these steps.</p>

       </li>

      </ol><p>Otherwise, run these substeps:</p>

      <ol><li>

        <p>If <var title="">components<sub title="">a</sub></var> has zero <i>numbers</i> but <var title="">components<sub title="">b</sub></var> has more than zero <i>numbers</i>, return "a before
        b".</p>

        <p>If <var title="">components<sub title="">b</sub></var> has zero <i>numbers</i> but <var title="">components<sub title="">a</sub></var> has more than zero <i>numbers</i>, return "b before
        a".</p>

       </li>

       <li>

        <!-- either an=bn=0, an=1 bn>1, bn=1 an>1, or an and bn > 1. -->

        <p>If <var title="">components<sub title="">a</sub></var> has one <i>number</i>, return "a before
        b".</p>

        <p>If <var title="">components<sub title="">b</sub></var> has one <i>number</i>, return "b before
        a".</p>

       </li>

       <li>

        <!-- either an=bn=0, or an and bn > 1. -->

        <p>If <var title="">components<sub title="">a</sub></var> and <var title="">components<sub title="">b</sub></var> have more than one <i>number</i>, run these substeps:</p>

        <ol><li><p>Let <var title="">count</var> be the smaller of the number of <i>numbers</i> in <var title="">components<sub title="">a</sub></var> and the number of <i>numbers</i> in <var title="">components<sub title="">b</sub></var>.</li>

         <li><p>For each <i>number</i> in <var title="">components<sub title="">a</sub></var> and <var title="">components<sub title="">b</sub></var> from the first to the <var title="">count</var>th, in
         order: if <var title="">components<sub title="">a</sub></var>'s <i>number</i> is less than <var title="">components<sub title="">b</sub></var>'s <i>number</i>, then return "a before b" and abort
         these steps; otherwise, if <var title="">components<sub title="">b</sub></var>'s <i>number</i> is
         less than <var title="">components<sub title="">a</sub></var>'s <i>number</i>, return "b before a"
         and abort these steps.</li>

         <li>

          <p>If <var title="">components<sub title="">a</sub></var> has fewer <i>numbers</i> than <var title="">components<sub title="">b</sub></var>, return "a before b" and abort these steps.</p>

          <p>If <var title="">components<sub title="">b</sub></var> has fewer <i>numbers</i> than <var title="">components<sub title="">a</sub></var>, return "b before a" and abort these steps.</p>

         </li>

         <!-- at this point, we know /a/ and /b/ have the same number of components -->

         <li><p>Let <var title="">index</var> be zero.</li>

         <li>

          <p><i>String loop</i>: Let <var title="">order</var> be the result of a <a href=#locale-specific-string-comparison>locale-specific
          string comparison</a> of <var title="">components<sub title="">a</sub></var>'s <var title="">index</var>th <i>number string</i> and <var title="">components<sub title="">b</sub></var>'s <var title="">index</var>th <i>number string</i>,
          in the context of <var title="">th</var>.</p>

          <p>If <var title="">order</var> is not "equal" then return <var title="">order</var> and
          abort these steps.</p>

         </li>

         <li>

          <p>Increment <var title="">index</var>.</p>

         </li>

         <li>

          <p>Let <var title="">order</var> be the result of a <a href=#locale-specific-string-comparison>locale-specific string
          comparison</a> of <var title="">components<sub title="">a</sub></var>'s <var title="">index</var>th <i>separator string</i> and <var title="">components<sub title="">b</sub></var>'s <var title="">index</var>th <i>separator
          string</i>, in the context of <var title="">th</var>.</p>

          <p>If <var title="">order</var> is not "equal" then return <var title="">order</var> and
          abort these steps.</p>

         </li>

         <li>

          <p>If <var title="">index</var> is less than the number of <i>numbers</i> in <var title="">components<sub title="">a</sub></var> and <var title="">components<sub title="">b</sub></var>, return
          to the step labeled <i>string loop</i>.</p>

         </li>

        </ol></li>

      </ol></li>

     <li>

      <!-- at this point, we know /a/ and /b/ have the same number of components -->

      <p>Let <var title="">index</var> be zero.</p>

     </li>

     <li>

      <p><i>Final loop:</i> Let <var title="">order</var> be the result of a <a href=#raw-string-comparison>raw string
      comparison</a> of <var title="">components<sub title="">a</sub></var>'s <var title="">n</var>th
      <i>raw string</i> and <var title="">components<sub title="">b</sub></var>'s <var title="">n</var>th
      <i>raw string</i>.</p>

      <p>If <var title="">order</var> is not "equal" then return <var title="">order</var> and abort
      these steps.</p>

     </li>

     <li>

      <p>Increment <var title="">index</var>.</p>

     </li>

     <li>

      <p>If <var title="">index</var> is less than the number of <i>raw strings</i> in <var title="">components<sub title="">a</sub></var> and <var title="">components<sub title="">b</sub></var>, return
      to the step labeled <i>final loop</i>.</p>

     </li>

     <li>

      <p>Return "equal".</p>

     </li>

    </ol></li>


   <li><p>Let <var title="">new order</var> be a list of <code><a href=#the-tr-element>tr</a></code> elements consisting of the
   <code><a href=#the-tr-element>tr</a></code> elements of all the groups in the newly ordered <var title="">groups</var>, with
   the <code><a href=#the-tr-element>tr</a></code> elements being in the same order as the groups to which they belong are in
   <var title="">groups</var>, and the <code><a href=#the-tr-element>tr</a></code> elements within each such group themselves
   being ordered in <a href=#tree-order>tree order</a>.</li>

   <li><p><a href=#concept-node-remove title=concept-node-remove>Remove</a> all the <code><a href=#the-tr-element>tr</a></code> elements in <var title="">new order</var> from their parents, in <a href=#tree-order>tree order</a>.</li>

   <li><p><a href=#concept-node-insert title=concept-node-insert>Insert</a> all the <code><a href=#the-tr-element>tr</a></code> elements in <var title="">new order</var> into the DOM at the location of <var title="">insertion point</var>, in
   the order these elements are found in <var title="">new order</var>.</li>

   <!-- done with this set of rows -->

   <li><p>Remove <var title="">insertion point</var> from the DOM.</li>

   <li><p><i>Increment loop</i>: If there are no <code><a href=#the-tr-element>tr</a></code> or <code><a href=#the-tbody-element>tbody</a></code> children of
   <var title="">table</var> that are later siblings of the element pointed to by <var title="">row
   collection cursor</var>, then jump to the step labeled <i>end</i> below.</li>

   <li><p>Let <var title="">row collection cursor</var> point to the next <code><a href=#the-tr-element>tr</a></code> or
   <code><a href=#the-tbody-element>tbody</a></code> child of <var title="">table</var> that is a later sibling of the element
   pointed to by <var title="">row collection cursor</var>.</li>

   <li><p>Return to the step labeled <i>row loop</i> above.</li>

   <li><p><i>End</i>: Set <var title="">table</var>'s <a href=#currently-sorting-flag>currently-sorting flag</a> to
   false.</li>

  </ol><p>When a user agent is to <dfn id=parsing-the-sort-key title="parsing the sort key">parse the sort key</dfn> <var title="">value</var>, it must run the following steps. These return a tuple consisting of a list
  of <var title="">n</var> <i>numbers</i>, a list of <var title="">n</var> <i>number strings</i>, a
  list of <var title="">n</var>+1 <i>non-numeric strings</i>, and a list of 2<var title="">n</var>+1
  <i>raw strings</i>, respectively, for any non-negative integer value of <var title="">n</var> (zero or
  more).</p>

  <ol><li>
    <p>Let <var title="">raw strings</var> be a list of strings initially containing just one entry, an empty string.</p>
   </li>

   <li>
    <p>Let <var title="">negatives prejudiced</var> be false.</p>
    <p>Let <var title="">decimals prejudiced</var> be false.</p>
    <p>Let <var title="">exponents prejudiced</var> be false.</p>
   </li>

   <li>
    <p>Let <var title="">buffer</var> be the empty string.</p>
    <p>Let <var title="">index</var> be zero.</p>
    <p>Let <var title="">mode</var> be "<a href=#sort-parser-mode:-separator title="sort parser mode: separator">separator</a>".</p>

    <p>When a subsequent step in this algorithm says to <dfn id=sort-parser-push-the-buffer title="sort parser push the
    buffer">push the buffer</dfn>, the user agent must run the following substeps:</p>

    <ol><li><p>Add an entry to <var title="">raw strings</var> that consists of the value of <var title="">buffer</var>.</li>

     <li><p>Add an entry to <var title="">raw strings</var> that is the empty string.</li>

     <li><p>Decrement <var title="">index</var> by one.</li>

     <li><p>Set <var title="">mode</var> to "<a href=#sort-parser-mode:-separator title="sort parser mode: separator">separator</a>".</li>

    </ol></li>

   <li>
    <p>Let <var title="">checkpoint buffer</var> be the empty string.</p> <!-- actual value doesn't matter; it won't be used -->
    <p>Let <var title="">checkpoint index</var> be zero.</p> <!-- actual value doesn't matter; it won't be used -->

    <p>When a subsequent step in this algorithm says to <dfn id=sort-parser-checkpoint title="sort parser
    checkpoint">checkpoint</dfn>, the user agent must run the following substeps:</p>

    <ol><li><p>Set the <var title="">checkpoint buffer</var> to the value of <var title="">buffer</var>.</p>
     <li><p>Set the <var title="">checkpoint index</var> to the value of <var title="">index</var>.</p>
    </ol><p>When a subsequent step in this algorithm says to <dfn id=sort-parser-push-the-checkpoint title="sort parser push the
    checkpoint">push the checkpoint</dfn>, the user agent must run the following substeps:</p>

    <ol><li><p>Add an entry to <var title="">raw strings</var> that consists of the value of <var title="">checkpoint buffer</var>.</li>

     <li><p>Add an entry to <var title="">raw strings</var> that is the empty string.</li>

     <li><p>Decrement <var title="">index</var> by one.</li>

     <li><p>Set <var title="">mode</var> to "<a href=#sort-parser-mode:-separator title="sort parser mode: separator">separator</a>".</li>

    </ol></li>

   <li>

    <p>Run through the following steps repeatedly until the condition in the last step is met.</p>

    <ol><li>

      <p><i>Top of loop</i>: If <var title="">index</var> is equal to or greater than the number of
      characters in <var title="">value</var>, let <var title="">c</var> be EOF. Otherwise, let <var title="">c</var> be the <var title="">index</var>th character in <var title="">value</var>.</p>

     </li>

     <li>

      <p>Run the appropriate steps from the following list:</p>

      <dl class=switch><dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-separator title="sort parser mode: separator">separator</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a <a href=#space-character>space character</a></dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to false.</p>
          <p>Set <var title="">decimals prejudiced</var> to false.</p>
          <p>Set <var title="">exponents prejudiced</var> to false.</p>
          <p>Append <var title="">c</var> to the last entry in <var title="">raw strings</var>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-) and <var title="">negatives prejudiced</var> is false</dt>
         <dd>
          <p>Set <var title="">buffer</var> to the value of <var title="">c</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-negative title="sort parser mode: negative">negative</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.) and <var title="">decimals prejudiced</var> is false</dt>
         <dd>
          <p>Set <var title="">buffer</var> to the value of <var title="">c</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-leading-decimal title="sort parser mode: leading-decimal">leading-decimal</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Set <var title="">buffer</var> to the value of <var title="">c</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-integral title="sort parser mode: integral">integral</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#uppercase-ascii-letters title="uppercase ASCII letters">uppercase ASCII letter</a> or a <a href=#lowercase-ascii-letters title="lowercase ASCII letters">lowercase ASCII letter</a></dt>
         <dd>
          <p>Set <var title="">exponents prejudiced</var> to true.</p>
          <p>Append <var title="">c</var> to the last entry in <var title="">raw strings</var>.</p>
         </dd>
         <dt>If <var title="">c</var> is EOF</dt>
         <dd>
          <p>Do nothing.</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p>Append <var title="">c</var> to the last entry in <var title="">raw strings</var>.</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-negative title="sort parser mode: negative">negative</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-)</dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to true.</p>
          <p>Append <var title="">buffer</var> to the last entry in <var title="">raw strings</var>.</p>
          <p>Append <var title="">c</var> to the last entry in <var title="">raw strings</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-separator title="sort parser mode: separator">separator</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.) and <var title="">decimals prejudiced</var> is false</dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-leading-decimal title="sort parser mode: leading-decimal">leading-decimal</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-integral title="sort parser mode: integral">integral</a>".</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p>Append <var title="">buffer</var> to the last entry in <var title="">raw strings</var>.</p>
          <p>Decrement <var title="">index</var> by one.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-separator title="sort parser mode: separator">separator</a>".</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-integral title="sort parser mode: integral">integral</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-)</dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.) and <var title="">decimals prejudiced</var> is false</dt>
         <dd>
          <p><a href=#sort-parser-checkpoint title="sort parser checkpoint">Checkpoint</a>.</p>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-decimal title="sort parser mode: decimal">decimal</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to the last entry in <var title="">raw strings</var>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character and <var title="">exponents prejudiced</var> is false</dt>
         <dd>
          <p><a href=#sort-parser-checkpoint title="sort parser checkpoint">Checkpoint</a>.</p>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-exponent title="sort parser mode: exponent">exponent</a>".</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-leading-decimal title="sort parser mode: leading-decimal">leading-decimal</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-decimal title="sort parser mode: decimal">decimal</a>".</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p>Append <var title="">buffer</var> to the last entry in <var title="">raw strings</var>.</p>
          <p>Decrement <var title="">index</var> by one.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-separator title="sort parser mode: separator">separator</a>".</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-decimal title="sort parser mode: decimal">decimal</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-)</dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.) and any of the characters in <var title="">value</var> past the <var title="">index</var>th character are <a href=#ascii-digits>ASCII digits</a></dt>
         <dd>
          <p>Set <var title="">decimals prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.) and none of the characters in <var title="">value</var> past the <var title="">index</var>th character are <a href=#ascii-digits>ASCII digits</a></dt>
         <dd>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character and <var title="">exponents prejudiced</var> is false</dt>
         <dd>
          <p><a href=#sort-parser-checkpoint title="sort parser checkpoint">Checkpoint</a>.</p>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-exponent title="sort parser mode: exponent">exponent</a>".</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-exponent title="sort parser mode: exponent">exponent</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-) and <var title="">negatives prejudiced</var> is false</dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-exponent-negative title="sort parser mode: exponent-negative">exponent-negative</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.)</dt>
         <dd>
          <p>Set <var title="">decimals prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-exponent-number title="sort parser mode: exponent-number">exponent-number</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character</dt>
         <dd>
          <p>Set <var title="">exponents prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-exponent-negative title="sort parser mode: exponent-negative">exponent-negative</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-)</dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.)</dt>
         <dd>
          <p>Set <var title="">decimals prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
          <p>Set <var title="sort parser mode">mode</var> to "<a href=#sort-parser-mode:-exponent-negative-number title="sort parser mode: exponent-negative-number">exponent-negative-number</a>".</p>
         </dd>
         <dt>If <var title="">c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character</dt>
         <dd>
          <p>Set <var title="">exponents prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-exponent-number title="sort parser mode: exponent-number">exponent-number</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-)</dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.)</dt>
         <dd>
          <p>Set <var title="">decimals prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character</dt>
         <dd>
          <p>Set <var title="">exponents prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
        </dl></dd>
       <dt>If <var title="sort parser mode">mode</var> is "<dfn id=sort-parser-mode:-exponent-negative-number title="sort parser mode: exponent-negative-number">exponent-negative-number</dfn>"</dt>
       <dd>
        <p>Run the appropriate substeps from the following list:</p>
        <dl class=switch><dt>If <var title="">c</var> is a U+002D HYPHEN-MINUS character (-)</dt>
         <dd>
          <p>Set <var title="">negatives prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+002E FULL STOP character (.)</dt>
         <dd>
          <p>Set <var title="">decimals prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>If <var title="">c</var> is an <a href=#ascii-digits title="ASCII digits">ASCII digit</a></dt>
         <dd>
          <p>Append <var title="">c</var> to <var title="">buffer</var>.</p>
         </dd>
         <dt>If <var title="">c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character</dt>
         <dd>
          <p>Set <var title="">exponents prejudiced</var> to true.</p>
          <p><a href=#sort-parser-push-the-checkpoint title="sort parser push the checkpoint">Push the checkpoint</a>.</p>
         </dd>
         <dt>Otherwise</dt>
         <dd>
          <p><a href=#sort-parser-push-the-buffer title="sort parser push the buffer">Push the buffer</a>.</p>
         </dd>
        </dl></dd>
      </dl></li>

     <li>

      <p>Increment <var title="">index</var> by one.</p>

     </li>

     <li>

      <p>If <var title="">index</var> is greater than the number of characters in <var title="">value</var>, stop repeating these substeps and continue along the overall steps.
      Otherwise, return to the step labeled <i>top of loop</i>.</p>

     </li>

    </ol></li>

   <li>
    <p>Let <var title="">numbers</var> be an empty list.</p>
    <p>Let <var title="">number strings</var> be an empty list.</p>
    <p>Let <var title="">non-numeric strings</var> be an empty list.</p>
   </li>

   <li>

    <p>For each even-numbered entry in <var title="">raw strings</var>, in order, starting from the
    first entry (numbered 0), append an entry to <var title="">non-numeric strings</var> that
    consists of the result of <a href=#trimming-and-collapsing>trimming and collapsing</a> the value of the entry.</p>

   </li>

   <li>

    <p>If <var title="">raw strings</var> has more than one entry, then, for each odd-numbered entry
    in <var title="">raw strings</var>, in order, starting from the second entry (numbered 1),
    append an entry to <var title="">number strings</var> that consists of the value of the entry,
    and append an entry to <var title="">number strings</var> that consists of the result of parsing
    the value of the entry using the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number
    values</a>.</p>

   </li>

   <li>

    <p>Return <var title="">numbers</var>, <var title="">number strings</var>, <var title="">non-numeric strings</var>, and <var title="">raw strings</var> respectively.</p>

   </li>

  </ol><p>When the user agent is required by the step above to perform a <dfn id=locale-specific-string-comparison>locale-specific string
  comparison</dfn> of two strings <var title="">a</var> and <var title="">b</var> in the context of
  an element <var title="">e</var>, the user agent must apply the Unicode Collation Algorithm, using
  the Default Unicode Collation Element Table as customized for the <a href=#language>language</a> of the
  element <var title="">e</var> in the Common Locale Data Repository, to the strings <var title="">a</var> and <var title="">b</var>, ignoring case. If the result of this algorithm places
  <var title="">a</var> first, then return "a before b"; if it places <var title="">b</var> first,
  then return "b before a"; otherwise, if they compare as equal, then return "equal". <a href=#refsUCA>[UCA]</a> <a href=#refsCLDR>[CLDR]</a></p>

  <p>When the user agent is required by the step above to perform a <dfn id=raw-string-comparison>raw string comparison</dfn>
  of two strings <var title="">a</var> and <var title="">b</var>, the user agent must apply the
  Unicode Collation Algorithm, using the Default Unicode Collation Element Table without
  customizations, to the strings <var title="">a</var> and <var title="">b</var>. If the result of
  this algorithm places <var title="">a</var> first, then return "a before b"; if it places <var title="">b</var> first, then return "b before a"; otherwise, if they compare as equal, then return
  "equal". <a href=#refsUCA>[UCA]</a></p>

  <p>Where the steps above refer to <dfn id=trimming-and-collapsing>trimming and collapsing</dfn> a string <var title="">value</var>, it means running the following algorithm:</p>

  <ol><li><p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var title="">value</var>.</li>

   <li><p>Replace any sequence of one or more <a href=#space-character title="space character">space characters</a>
   in <var title="">value</var> with a single U+0020 SPACE character.</li>

  </ol><hr><p>When any of the descendants of a <a href=#sorting-enabled-table-element>sorting-enabled <code>table</code> element</a> change
  in any way (including attributes changing), and when a <code><a href=#the-table-element>table</a></code> element becomes a
  <a href=#sorting-enabled-table-element>sorting-enabled <code>table</code> element</a>, the <code><a href=#the-table-element>table</a></code> element is said to
  become <dfn id=a-table-with-a-pending-sort>a table with a pending sort</dfn>.</p>

  <p>When the user agent is to <dfn id=sort-the-tables-with-pending-sorts>sort the tables with pending sorts</dfn>, which happens during
  the <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a> algorithm, the user agent must run the following
  algorithm:</p>

  <ol><li><p>Let <var title="">tables</var> be a list of each <code><a href=#the-table-element>table</a></code> in the <a href=#unit-of-related-similar-origin-browsing-contexts>unit of
   related similar-origin browsing contexts</a> that is <a href=#a-table-with-a-pending-sort>a table with a pending sort</a>,
   in the order that they became such, with those that become such at the same time being listed in
   <a href=#tree-order>tree order</a>.</p>

   <li><p>Let all the <code><a href=#the-table-element>table</a></code> elements in <var title="">tables</var> no longer be <a href=#a-table-with-a-pending-sort title="a table with a pending sort">tables with a pending sort</a>.</li>

   <li><p>Apply the <a href=#table-sorting-algorithm>table sorting algorithm</a> to each <code><a href=#the-table-element>table</a></code> in <var title="">tables</var>, in order.</li>

  </ol><hr><p>When the user agent is to <dfn id=set-the-sort-key>set the sort key</dfn> to a <code><a href=#the-th-element>th</a></code> element <var title="">target</var>, it must run the following algorithm:</p>

  <ol><li><p>Let <var title="">table</var> be the <code><a href=#the-table-element>table</a></code> of the <a href=#concept-table title=concept-table>table</a> of which <var title="">target</var> is a header cell.</li>

   <li><p>If <code><a href=#the-th-element>th</a></code> is a <a href=#sorting-enabled-th-element>sorting-enabled <code>th</code> element</a> whose
   <a href=#column-key-ordinality>column key ordinality</a> is 1, then: if its <a href=#column-sort-direction>column sort direction</a> is
   <i>normal</i>, set that element's <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute to the
   string "<code title="">reversed</code>", otherwise, set it to the empty string; then, abort these
   steps.</li>

   <li><p>Let <var title="">current headers</var> be the <a href=#sorting-enabled-th-elements-of-the-table-element>sorting-enabled <code>th</code>
   elements of the <code>table</code> element</a> <var title="">table</var>, excluding <var title="">target</var>.</li>

   <li><p>Sort <var title="">current headers</var> by their <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attributes' <a href=#column-key-ordinality>column key ordinality</a>, in ascending
   order, with elements that have the same <a href=#column-key-ordinality>column key ordinality</a> being sorted in
   <a href=#tree-order>tree order</a>.</li>

   <li><p>Let <var title="">level</var> be 2.</li>

   <li>

    <p>For each <code><a href=#the-th-element>th</a></code> element <var title="">th</var> in <var title="">current
    headers</var>, in order, run the following substeps:</p>

    <ol><li><p>If <var title="">th</var>'s <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute's
     <a href=#column-sort-direction>column sort direction</a> is <i>normal</i>, then set <var title="">th</var>'s <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute to a <a href=#valid-integer>valid integer</a> whose value is
     <var title="">level</var>. Otherwise, set it to the concatenation of the string "<code title="">reversed</code>", a U+0020 SPACE character, and a <a href=#valid-integer>valid integer</a> whose
     value is <var title="">level</var>.</p>

     <li><p>Increment <var title="">level</var> by 1.</li>

    </ol></li>

   <li><p>Set <var title="">target</var>'s <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute to
   the empty string.</li>

  </ol><hr><p>The <a href=#activation-behavior>activation behavior</a> of a <a href=#sorting-interface-th-element>sorting interface <code>th</code>
  element</a> is to <a href=#set-the-sort-key>set the sort key</a> to the <code><a href=#the-th-element>th</a></code> element.</p>

  <p class=note>The <code><a href=#the-table-element>table</a></code> will be sorted the next time the user agent <a href=#perform-a-microtask-checkpoint title="perform a microtask checkpoint">performs a microtask checkpoint</a>.</p>

  </div>

  <dl class=domintro><dt><var title="">th</var> . <code title=dom-th-sort><a href=#dom-th-sort>sort</a></code>()</dt>

   <dd>

    <p>Act as if the user had indicated that this was to be the new primary sort column.</p>

    <p>The <code><a href=#the-table-element>table</a></code> won't actually be sorted until the script terminates.</p>

   </dd>


   <dt><var title="">table</var> . <code title=dom-table-stopSorting><a href=#dom-table-stopsorting>stopSorting</a></code>()</dt>

   <dd>

    <p>Removes all the <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attributes that are causing the
    table to automatically sort its contents, if any.</p>

   </dd>

  </dl><div class=impl>

  <p>The <code><a href=#the-th-element>th</a></code> element's <dfn id=dom-th-sort title=dom-th-sort><code>sort()</code></dfn> method, when
  invoked, must run the following steps:</p>

  <ol><li><p>If the <code><a href=#the-th-element>th</a></code> element is not a <a href=#sorting-capable-th-element>sorting-capable <code>th</code>
   element</a>, then abort these steps.</li>

   <li>

    <p><a href=#set-the-sort-key>Set the sort key</a> to the <code><a href=#the-th-element>th</a></code> element.</p>

    <p class=note>The <code><a href=#the-table-element>table</a></code> will be sorted the next time the user agent <a href=#perform-a-microtask-checkpoint title="perform a microtask checkpoint">performs a microtask checkpoint</a>.</p>

   </li>

  </ol><p>The <code><a href=#the-table-element>table</a></code> element's <dfn id=dom-table-stopsorting title=dom-table-stopSorting><code>stopSorting()</code></dfn> method, when invoked, must remove
  the <code title=attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute of all the <a href=#sorting-enabled-th-elements-of-the-table-element>sorting-enabled
  <code>th</code> elements of the table element</a> on which the method was invoked.</p>

  </div>


  <h4 id=examples-0><span class=secno>4.9.14 </span>Examples</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The following shows how might one mark up the bottom part of
  table 45 of the <cite>Smithsonian physical tables, Volume
  71</cite>:</p>

   <!-- Smithsonian physical tables, Volume 71: By Smithsonian Institution, Frederick Eugene Fowle; page 76 -->
   <!-- from the reprint of the seventh revised edition; publication 2539, published 1921 -->
  <pre>&lt;table&gt;
 &lt;caption&gt;Specification values: &lt;b&gt;Steel&lt;/b&gt;, &lt;b&gt;Castings&lt;/b&gt;,
 Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.&lt;/caption&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th rowspan=2&gt;Grade.&lt;/th&gt;
   &lt;th rowspan=2&gt;Yield Point.&lt;/th&gt;
   &lt;th colspan=2&gt;Ultimate tensile strength&lt;/th&gt;
   &lt;th rowspan=2&gt;Per cent elong. 50.8mm or 2 in.&lt;/th&gt;
   &lt;th rowspan=2&gt;Per cent reduct. area.&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;th&gt;kg/mm&lt;sup&gt;2&lt;/sup&gt;&lt;/th&gt;
   &lt;th&gt;lb/in&lt;sup&gt;2&lt;/sup&gt;&lt;/th&gt;
  &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;td&gt;Hard&lt;/td&gt;
   &lt;td&gt;0.45 ultimate&lt;/td&gt;
   &lt;td&gt;56.2&lt;/td&gt;
   &lt;td&gt;80,000&lt;/td&gt;
   &lt;td&gt;15&lt;/td&gt;
   &lt;td&gt;20&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td&gt;Medium&lt;/td&gt;
   &lt;td&gt;0.45 ultimate&lt;/td&gt;
   &lt;td&gt;49.2&lt;/td&gt;
   &lt;td&gt;70,000&lt;/td&gt;
   &lt;td&gt;18&lt;/td&gt;
   &lt;td&gt;25&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td&gt;Soft&lt;/td&gt;
   &lt;td&gt;0.45 ultimate&lt;/td&gt;
   &lt;td&gt;42.2&lt;/td&gt;
   &lt;td&gt;60,000&lt;/td&gt;
   &lt;td&gt;22&lt;/td&gt;
   &lt;td&gt;30&lt;/td&gt;
  &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;</pre>

  <p>This table could look like this:</p>

  <table id=table-example-1><caption>Specification values: <b>Steel</b>, <b>Castings</b>,
   Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.</caption>
   <thead><tr><th rowspan=2>Grade.</th>
     <th rowspan=2>Yield Point.</th>
     <th colspan=2>Ultimate tensile strength</th>
     <th rowspan=2>Per cent elong. 50.8&nbsp;mm or&nbsp;2&nbsp;in.</th>
     <th rowspan=2>Per cent reduct. area.</th>
    <tr><th>kg/mm<sup>2</sup></th>
     <th>lb/in<sup>2</sup></th>
    <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><td>Medium</td>
     <td>0.45 ultimate</td>
     <td>49.2</td>
     <td>70,000</td>
     <td>18</td>
     <td>25</td>
    <tr><td>Soft</td>
     <td>0.45 ultimate</td>
     <td>42.2</td>
     <td>60,000</td>
     <td>22</td>
     <td>30</td>
    </table><hr><p>The following shows how one might mark up the gross margin table
  on page 46 of Apple, Inc's 10-K filing for fiscal year 2008:</p>

  <pre>&lt;table&gt;
 &lt;thead&gt;
  &lt;tr&gt;
   &lt;th&gt;
   &lt;th&gt;2008
   &lt;th&gt;2007
   &lt;th&gt;2006
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;th&gt;Net sales
   &lt;td&gt;$ 32,479
   &lt;td&gt;$ 24,006
   &lt;td&gt;$ 19,315
  &lt;tr&gt;
   &lt;th&gt;Cost of sales
   &lt;td&gt;  21,334
   &lt;td&gt;  15,852
   &lt;td&gt;  13,717
 &lt;tbody&gt;
  &lt;tr&gt;
   &lt;th&gt;Gross margin
   &lt;td&gt;$ 11,145
   &lt;td&gt;$  8,154
   &lt;td&gt;$  5,598
 &lt;tfoot&gt;
  &lt;tr&gt;
   &lt;th&gt;Gross margin percentage
   &lt;td&gt;34.3%
   &lt;td&gt;34.0%
   &lt;td&gt;29.0%
&lt;/table&gt;</pre>

  <p>This table could look like this:</p>

  <table class="apple-table-examples e1"><thead><tr><th>
     <th>2008
     <th>2007
     <th>2006
   <tbody><tr><th>Net sales
     <td>$ 32,479
     <td>$ 24,006
     <td>$ 19,315
    <tr><th>Cost of sales
     <td>  21,334
     <td>  15,852
     <td>  13,717
   <tbody><tr><th>Gross margin
     <td>$ 11,145
     <td>$  8,154
     <td>$  5,598
   <tfoot><tr><th>Gross margin percentage
     <td>34.3%
     <td>34.0%
     <td>29.0%
  </table><hr><p>The following shows how one might mark up the operating expenses
  table from lower on the same page of that document:</p>

  <pre>&lt;table&gt;
 &lt;colgroup&gt; &lt;col&gt;
 &lt;colgroup&gt; &lt;col&gt; &lt;col&gt; &lt;col&gt;
 &lt;thead&gt;
  &lt;tr&gt; &lt;th&gt; &lt;th&gt;2008 &lt;th&gt;2007 &lt;th&gt;2006
 &lt;tbody&gt;
  &lt;tr&gt; &lt;th scope=rowgroup&gt; Research and development
       &lt;td&gt; $ 1,109 &lt;td&gt; $ 782 &lt;td&gt; $ 712
  &lt;tr&gt; &lt;th scope=row&gt; Percentage of net sales
       &lt;td&gt; 3.4% &lt;td&gt; 3.3% &lt;td&gt; 3.7%
 &lt;tbody&gt;
  &lt;tr&gt; &lt;th scope=rowgroup&gt; Selling, general, and administrative
       &lt;td&gt; $ 3,761 &lt;td&gt; $ 2,963 &lt;td&gt; $ 2,433
  &lt;tr&gt; &lt;th scope=row&gt; Percentage of net sales
       &lt;td&gt; 11.6% &lt;td&gt; 12.3% &lt;td&gt; 12.6%
&lt;/table&gt;</pre>

  <p>This table could look like this:</p>

  <table class="apple-table-examples e2"><thead><tr><th> <th>2008 <th>2007 <th>2006
   <tbody><tr><th scope=rowgroup> Research and development
         <td> $ 1,109 <td> $ 782 <td> $ 712
    <tr><th scope=row> Percentage of net sales
         <td> 3.4% <td> 3.3% <td> 3.7%
   <tbody><tr><th scope=rowgroup> Selling, general, and administrative
         <td> $ 3,761 <td> $ 2,963 <td> $ 2,433
    <tr><th scope=row> Percentage of net sales
         <td> 11.6% <td> 12.3% <td> 12.6%
  </table><h3 id=forms><span class=secno>4.10 </span>Forms</h3>

  <h4 id=introduction-1><span class=secno>4.10.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>A form is a component of a Web page that has form controls, such as text fields, buttons,
  checkboxes, range controls, or color pickers. A user can interact with such a form, providing data
  that can then be sent to the server for further processing (e.g. returning the results of a search
  or calculation). No client-side scripting is needed in many cases, though an API is available so
  that scripts can augment the user experience or use forms for purposes other than submitting data
  to a server.</p>

  <p>Writing a form consists of several steps, which can be performed in any order: writing the user
  interface, implementing the server-side processing, and configuring the user interface to
  communicate with the server.</p>


  <h5 id="writing-a-form's-user-interface"><span class=secno>4.10.1.1 </span>Writing a form's user interface</h5>

  <p><i>This section is non-normative.</i></p>

  <p>For the purposes of this brief introduction, we will create a pizza ordering form.</p>

  <p>Any form starts with a <code><a href=#the-form-element>form</a></code> element, inside which are placed the controls. Most
  controls are represented by the <code><a href=#the-input-element>input</a></code> element, which by default provides a one-line
  text field. To label a control, the <code><a href=#the-label-element>label</a></code> element is used; the label text and the
  control itself go inside the <code><a href=#the-label-element>label</a></code> element. Each part of a form is considered a
  <a href=#paragraph>paragraph</a>, and is typically separated from other parts using <code><a href=#the-p-element>p</a></code> elements.
  Putting this together, here is how one might ask for the customer's name:</p>

  <pre><strong>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
&lt;/form&gt;</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><a href=#the-input-element>input</a></code> element, this time with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute with the value <code title=attr-input-type-radio><a href="#radio-button-state-(type=radio)">radio</a></code>. To make the radio buttons work as a group, they are
  given a common name using the <code title=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><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><a href=#the-fieldset-element>fieldset</a></code>, which has to be a <code><a href=#the-legend-element>legend</a></code> element.</p>

  <pre>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
<strong> &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;</strong>
&lt;/form&gt;</pre>

  <p class=note>Changes from the previous step are highlighted.</p>

  <p>To pick toppings, we can use checkboxes. These use the <code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute with the value <code title=attr-input-type-checkbox><a href="#checkbox-state-(type=checkbox)">checkbox</a></code>:</p>

  <pre>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
<strong> &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;</strong>
&lt;/form&gt;</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><a href=#the-input-element>input</a></code> elements with their <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute set to <code title=attr-input-type-tel><a href="#telephone-state-(type=tel)">tel</a></code>) and e-mail addresses
  (<code><a href=#the-input-element>input</a></code> elements with their <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute set to
  <code title=attr-input-type-email><a href="#e-mail-state-(type=email)">email</a></code>):</p>

  <pre>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
<strong> &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;</strong>
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
&lt;/form&gt;</pre>

  <p>We can use an <code><a href=#the-input-element>input</a></code> element with its <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute set to <code title=attr-input-type-time><a href="#time-state-(type=time)">time</a></code> to ask for a delivery time. Many
  of these form controls have attributes to control exactly what values can be specified; in this
  case, three attributes of particular interest are <code title=attr-input-min><a href=#attr-input-min>min</a></code>, <code title=attr-input-max><a href=#attr-input-max>max</a></code>, and <code title=attr-input-step><a href=#attr-input-step>step</a></code>. These set the
  minimum time, the maximum time, and the interval between allowed values (in seconds). This
  pizzeria only delivers between 11am and 9pm, and doesn't promise anything better than 15 minute
  increments, which we can mark up as follows:</p>

  <pre>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
<strong> &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"&gt;&lt;/label&gt;&lt;/p&gt;</strong>
&lt;/form&gt;</pre>

  <p>The <code><a href=#the-textarea-element>textarea</a></code> element can be used to provide a free-form text field. In this
  instance, we are going to use it to provide a space for the customer to give delivery
  instructions:</p>

  <pre>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"&gt;&lt;/label&gt;&lt;/p&gt;
<strong> &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;</strong>
&lt;/form&gt;</pre>

  <p>Finally, to make the form submittable we use the <code><a href=#the-button-element>button</a></code> element:</p>

  <pre>&lt;form&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
<strong> &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;/p&gt;</strong>
&lt;/form&gt;</pre>


  <h5 id=implementing-the-server-side-processing-for-a-form><span class=secno>4.10.1.2 </span>Implementing the server-side processing for a form</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The exact details for writing a server-side processor are out of scope for this specification.
  For the purposes of this introduction, we will assume that the script at <code title="">https://pizza.example.com/order.cgi</code> is configured to accept submissions using the
  <code title=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 title="">custname</code></dt>
   <dd>Customer's name</dd>

   <dt><code title="">custtel</code></dt>
   <dd>Customer's telephone number</dd>

   <dt><code title="">custemail</code></dt>
   <dd>Customer's e-mail address</dd>

   <dt><code title="">size</code></dt>
   <dd>The pizza size, either <code title="">small</code>, <code title="">medium</code>, or <code title="">large</code></dd>

   <dt><code title="">topping</code></dt>
   <dd>A topping, specified once for each selected topping, with the allowed values being <code title="">bacon</code>, <code title="">cheese</code>, <code title="">onion</code>, and <code title="">mushroom</code></dd>

   <dt><code title="">delivery</code></dt>
   <dd>The requested delivery time</dd>

   <dt><code title="">comments</code></dt>
   <dd>The delivery instructions</dd>

  </dl><h5 id=configuring-a-form-to-communicate-with-a-server><span class=secno>4.10.1.3 </span>Configuring a form to communicate with a server</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Form submissions are exposed to servers in a variety of ways, most commonly as HTTP GET or POST
  requests. To specify the exact method used, the <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>
  attribute is specified on the <code><a href=#the-form-element>form</a></code> element. This doesn't specify how the form data is
  encoded, though; to specify that, you use the <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>
  attribute. You also have to specify the <a href=#url>URL</a> of the service that will handle the
  submitted data, using the <code title=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 title=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 title=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 &mdash; like the radio buttons, they are also given unique values with the <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute.</p>

  <p>Given the settings in the previous section, this all becomes:</p>

  <pre>&lt;form<strong> method="post"
      enctype="application/x-www-form-urlencoded"
      action="https://pizza.example.com/order.cgi"</strong>&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input<strong> name="custname"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel<strong> name="custtel"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email<strong> name="custemail"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> value="small"</strong>&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> value="medium"</strong>&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> value="large"</strong>&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="bacon"</strong>&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="cheese"</strong>&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="onion"</strong>&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox<strong> name="topping" value="mushroom"</strong>&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"<strong> name="delivery"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea<strong> name="comments"</strong>&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;</pre>

  <p class=note>There is no particular significance to the way some
  of the attributes have their values quoted and others don't. The
  HTML syntax allows a variety of equally valid ways to specify
  attributes, as discussed <a href=#syntax-attributes title=syntax-attributes>in the
  syntax section</a>.</p>

  <p>For example, if the customer entered "Denise Lawrence" as their
  name, "555-321-8642" as their telephone number, did not specify an
  e-mail address, asked for a medium-sized pizza, selected the Extra
  Cheese and Mushroom toppings, entered a delivery time of 7pm, and
  left the delivery instructions text field blank, the user agent
  would submit the following to the online Web service:</p>

  <pre>custname=Denise+Lawrence&amp;custtel=555-321-8624&amp;custemail=&amp;size=medium&amp;topping=cheese&amp;topping=mushroom&amp;delivery=19%3A00&amp;comments=</pre>


  <h5 id=client-side-form-validation><span class=secno>4.10.1.4 </span>Client-side form validation</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Forms can be annotated in such a way that the user agent will
  check the user's input before the form is submitted. The server
  still has to verify the input is valid (since hostile users can
  easily bypass the form validation), but it allows the user to avoid
  the wait incurred by having the server be the sole checker of the
  user's input.</p>

  <p>The simplest annotation is the <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute, which can be
  specified on <code><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>&lt;form method="post"
      enctype="application/x-www-form-urlencoded"
      action="https://pizza.example.com/order.cgi"&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input name="custname"<strong> required</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel name="custtel"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email name="custemail"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> required</strong> value="small"&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> required</strong> value="medium"&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size<strong> required</strong> value="large"&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="bacon"&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="cheese"&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="onion"&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="mushroom"&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery"<strong> required</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea name="comments"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;</pre>

  <p>It is also possible to limit the length of the input, using the
  <code title=attr-fe-maxlength><a href=#attr-fe-maxlength>maxlength</a></code> attribute. By
  adding this to the <code><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>&lt;form method="post"
      enctype="application/x-www-form-urlencoded"
      action="https://pizza.example.com/order.cgi"&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input name="custname" required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel name="custtel"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email name="custemail"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="small"&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="medium"&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="large"&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="bacon"&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="cheese"&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="onion"&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="mushroom"&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea name="comments"<strong> maxlength=1000</strong>&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;</pre>

  <p class=note>When a form is submitted, <code title=event-invalid>invalid</code> events are
  fired at each form control that is invalid, and then at the <code><a href=#the-form-element>form</a></code> element itself. This
  can be useful for displaying a summary of the problems with the form, since typically the browser
  itself will only report one problem at a time.</p>



  <h5 id=enabling-client-side-automatic-filling-of-form-controls><span class=secno>4.10.1.5 </span>Enabling client-side automatic filling of form controls</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Some browsers attempt to aid the user by automatically filling
  form controls rather than having the user reenter their information
  each time. For example, a field asking for the user's telephone
  number can be automatically filled with the user's phone number.</p>

  <p>To help the user agent with this, we can tell it what the field
  is using the <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
  attribute. 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>&lt;form method="post"
      enctype="application/x-www-form-urlencoded"
      action="https://pizza.example.com/order.cgi"&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input name="custname" required <strong>autocomplete="shipping name"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel name="custtel" <strong>autocomplete="shipping tel"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email name="custemail" <strong>autocomplete="shipping email"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="small"&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="medium"&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="large"&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="bacon"&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="cheese"&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="onion"&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="mushroom"&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea name="comments" maxlength=1000&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;</pre>


  <h5 id=improving-the-user-experience-on-mobile-devices><span class=secno>4.10.1.6 </span>Improving the user experience on mobile devices</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Some devices, in particular those with on-screen keyboards and those in locales with languages
  with many characters (e.g. Japanese), can provide the user with multiple input modalities. For
  example, when typing in a credit card number the user may wish to only see keys for digits 0-9,
  while when typing in their name they may wish to see a form field that by default capitalises each
  word.</p>

  <p>Using the <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute we can select appropriate
  input modalities:</p>

  <pre>&lt;form method="post"
      enctype="application/x-www-form-urlencoded"
      action="https://pizza.example.com/order.cgi"&gt;
 &lt;p&gt;&lt;label&gt;Customer name: &lt;input name="custname" required autocomplete="shipping name" <strong>inputmode="latin-name"</strong>&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Telephone: &lt;input type=tel name="custtel" autocomplete="shipping tel"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;E-mail address: &lt;input type=email name="custemail" autocomplete="shipping email"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Size &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="small"&gt; Small &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="medium"&gt; Medium &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=radio name=size required value="large"&gt; Large &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset&gt;
  &lt;legend&gt; Pizza Toppings &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="bacon"&gt; Bacon &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="cheese"&gt; Extra Cheese &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="onion"&gt; Onion &lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt; &lt;input type=checkbox name="topping" value="mushroom"&gt; Mushroom &lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;p&gt;&lt;label&gt;Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Delivery instructions: &lt;textarea name="comments" maxlength=1000 <strong>inputmode="latin-prose"</strong>&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;button&gt;Submit order&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;</pre>



  <h5 id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality><span class=secno>4.10.1.7 </span>The difference between the field type, the autofill field name, and the input modality</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The <code title=attr-input-type><a href=#attr-input-type>type</a></code>, <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>, and <code title=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 title="">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 title=attr-input-type><a href=#attr-input-type>type</a></code> attribute on <code><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><a href=#the-input-element>input</a></code>
  element, a <code><a href=#the-textarea-element>textarea</a></code> element, a <code><a href=#the-select-element>select</a></code> element, a <code><a href=#the-keygen-element>keygen</a></code>
  element, etc.</p>

  <p>The <code title=attr-fe-autocomplete><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 title=attr-input-type-tel><a href="#telephone-state-(type=tel)">&lt;input type=tel&gt;</a></code>.
  However, which <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> value to use depends on
  which phone number the page is asking for, whether they expect a telephone number in the
  international format or just the local format, and so forth.</p>

  <p>For example, a page that forms part of a checkout process on an e-commerce site for a customer
  buying a gift to be shipped to a friend might need both the buyer's telephone number (in case of
  payment issues) and the friend's telephone number (in case of delivery issues). If the site
  expects international phone numbers (with the country code prefix), this could thus look like
  this:</p>

  <pre>&lt;p&gt;&lt;label&gt;Your phone number: &lt;input type=tel name=custtel autocomplete="billing tel"&gt;&lt;/label&gt;
&lt;p&gt;&lt;label&gt;Recipient's phone number: &lt;input type=tel name=shiptel autocomplete="shipping tel"&gt;&lt;/label&gt;
&lt;p&gt;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 title=attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code> rather than
  <code title=attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>):</p>

  <pre>&lt;p&gt;&lt;label&gt;Your phone number: &lt;input type=tel name=custtel autocomplete="billing tel-national"&gt;&lt;/label&gt;
&lt;p&gt;&lt;label&gt;Recipient's phone number: &lt;input type=tel name=shiptel autocomplete="shipping tel-national"&gt;&lt;/label&gt;
&lt;p&gt;Please enter complete UK phone numbers, as in "(01632) 960 123".</pre>

  <p>Now, consider a person's preferred languages. The right <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> value is <code title=attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>. However, there could be a number of
  different form controls used for the purpose: a free text field (<code title=attr-input-type-text><a href="#text-(type=text)-state-and-search-state-(type=search)">&lt;input type=text&gt;</a></code>), a drop-down list (<code title=select><a href=#the-select-element>&lt;select&gt;</a></code>), radio buttons (<code title=attr-input-type-radio><a href="#radio-button-state-(type=radio)">&lt;input
  type=radio&gt;</a></code>), etc. It only depends on what kind of interface is desired.</p>

  <p>The <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> decides what kind of input modality (e.g.
  keyboard) to use, when the control is a free-form text field.</p>

  <p>Consider names. If a page just wants one name from the user, then the relevant control is <code title=attr-input-type-text><a href="#text-(type=text)-state-and-search-state-(type=search)">&lt;input type=text&gt;</a></code>. If the page is asking for the user's
  full name, then the relevant <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> value is <code title=attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>. But if the user is Japanese, and the page is asking
  for the user's Japanese name and the user's 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 title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute can help:</p>

  <pre>&lt;p&gt;&lt;label&gt;Japanese name: &lt;input name="j" type="text" autocomplete="section-jp name" inputmode="kana"&gt;&lt;/label&gt;
&lt;label&gt;Romanized name: &lt;input name="e" type="text" autocomplete="section-en name" inputmode="latin-name"&gt;&lt;/label&gt;</pre>

  <p>In this example, the "<code title=attr-fe-autocomplete-section>section-*</code>" keywords in
  the <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attributes' values tell the user agent
  that the two fields expect <em>different</em> names. Without them, the user agent could
  automatically fill the second field with the value given in the first field when the user gave a
  value to the first field.</p>

  <p class=note>The "<code title="">-jp</code>" and "<code title="">-en</code>" parts of the
  keywords are opaque to the user agent; the user agent cannot guess, from those, that the two names
  are expected to be in Japanese and English respectively.</p>


  <h5 id=input-author-notes><span class=secno>4.10.1.8 </span>Date, time, and number formats</h5>
  <!-- ID referenced from other parts of the spec -->

  <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 &mdash; 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&#x5e74;02&#x6708;01&#x65e5;" &mdash; and even with numbers, where locales differ, for
  example, in what punctuation is used as the decimal separator and the thousands separator.</p>

  <p>It is therefore important to distinguish the time, date, and number formats used in HTML and in
  form submissions, which are always the formats defined in this specification (and based on the
  well-established ISO 8601 standard for computer-readable date and time formats), from the time,
  date, and number formats presented to the user by the browser and accepted as input from the user
  by the browser.</p>

  <p>The format used "on the wire", i.e. in HTML markup and in form submissions, is intended to be
  computer-readable and consistent irrespective of the user's locale. Dates, for instance, are
  always written in the format "YYYY-MM-DD", as in "2003-02-01". Users are not expected to ever see
  this format.</p>

  <p>The time, date, or number given by the page in the wire format is then translated to the user's
  preferred presentation (based on user preferences or on the locale of the page itself), before
  being displayed to the user. Similarly, after the user inputs a time, date, or number using their
  preferred format, the user agent converts it back to the wire format before putting it in the DOM
  or submitting it.</p>

  <p>This allows scripts in pages and on servers to process times, dates, and numbers in a
  consistent manner without needing to support dozens of different formats, while still supporting
  the users' needs.</p>

  <div class=impl>
  <p class=note>See also the <a href=#input-impl-notes>implementation notes</a> regarding
  localization of form controls.</p>
  </div>


  <h4 id=categories><span class=secno>4.10.2 </span>Categories</h4>

  <p>Mostly for historical reasons, elements in this section fall into several overlapping (but
  subtly different) categories in addition to the usual ones like <a href=#flow-content>flow content</a>,
  <a href=#phrasing-content>phrasing content</a>, and <a href=#interactive-content>interactive content</a>.</p>

  <p>A number of the elements are <dfn id=form-associated-element title="form-associated element">form-associated
  elements</dfn>, which means they can have a <a href=#form-owner>form owner</a>.

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
   <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
   <li><code><a href=#the-input-element>input</a></code></li>
   <li><code><a href=#the-keygen-element>keygen</a></code></li>
   <li><code><a href=#the-label-element>label</a></code></li>
   <li><code><a href=#the-object-element>object</a></code></li>
   <li><code><a href=#the-output-element>output</a></code></li>
   <li><code><a href=#the-select-element>select</a></code></li>
   <li><code><a href=#the-textarea-element>textarea</a></code></li>
   <li><code><a href=#the-img-element>img</a></code></li>
  </ul><p>The <a href=#form-associated-element title="form-associated element">form-associated
  elements</a> fall into several subcategories:</p>

  <dl><dt><dfn id=category-listed title=category-listed>Listed elements</dfn></dt>

   <dd>

    <p>Denotes elements that are listed in the <code title=dom-form-elements><a href=#dom-form-elements><var title="">form</var>.elements</a></code>
    and <code title=dom-fieldset-elements><a href=#dom-fieldset-elements><var title="">fieldset</var>.elements</a></code> APIs.</p>

    <!-- when updating this also update the category index -->
    <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
     <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
     <li><code><a href=#the-input-element>input</a></code></li>
     <li><code><a href=#the-keygen-element>keygen</a></code></li>
     <li><code><a href=#the-object-element>object</a></code></li>
     <li><code><a href=#the-output-element>output</a></code></li>
     <li><code><a href=#the-select-element>select</a></code></li>
     <li><code><a href=#the-textarea-element>textarea</a></code></li>
    </ul></dd>

   <dt><dfn id=category-submit title=category-submit>Submittable elements</dfn></dt>

   <dd>

    <p>Denotes elements that can be used for <a href=#constructing-form-data-set>constructing the form data
    set</a> when a <code><a href=#the-form-element>form</a></code> element is <a href=#concept-form-submit title=concept-form-submit>submitted</a>.</p>

    <!-- when updating this also update the category index -->
    <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
     <li><code><a href=#the-input-element>input</a></code></li>
     <li><code><a href=#the-keygen-element>keygen</a></code></li>
     <li><code><a href=#the-object-element>object</a></code></li>
     <li><code><a href=#the-select-element>select</a></code></li>
     <li><code><a href=#the-textarea-element>textarea</a></code></li>
    </ul><p>Some <a href=#category-submit title=category-submit>submittable elements</a>
    can be, depending on their attributes, <dfn id=concept-button title=concept-button>buttons</dfn>. The prose below defines when
    an element is a button. Some buttons are specifically <dfn id=concept-submit-button title=concept-submit-button>submit buttons</dfn>.</p>

   </dd>

   <dt><dfn id=category-reset title=category-reset>Resettable elements</dfn></dt>

   <dd>

    <p>Denotes elements that can be affected when a <code><a href=#the-form-element>form</a></code>
    element is <a href=#concept-form-reset title=concept-form-reset>reset</a>.</p>

    <!-- when updating this also update the category index -->
    <ul class="brief category-list"><li><code><a href=#the-input-element>input</a></code></li>
     <li><code><a href=#the-keygen-element>keygen</a></code></li>
     <li><code><a href=#the-output-element>output</a></code></li>
     <li><code><a href=#the-select-element>select</a></code></li>
     <li><code><a href=#the-textarea-element>textarea</a></code></li>
    </ul></dd>

   <dt><dfn id=category-form-attr title=category-form-attr>Reassociateable elements</dfn></dt>

   <dd>

    <p>Denotes elements that have a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute, and a
    matching <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute, that allow authors to specify an
    explicit <a href=#form-owner>form owner</a>.</p>

    <!-- when updating this also update the category index -->
    <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
     <li><code><a href=#the-fieldset-element>fieldset</a></code></li>
     <li><code><a href=#the-input-element>input</a></code></li>
     <li><code><a href=#the-keygen-element>keygen</a></code></li>
     <li><code><a href=#the-label-element>label</a></code></li>
     <li><code><a href=#the-object-element>object</a></code></li>
     <li><code><a href=#the-output-element>output</a></code></li>
     <li><code><a href=#the-select-element>select</a></code></li>
     <li><code><a href=#the-textarea-element>textarea</a></code></li>
    </ul></dd>

  </dl><p>Some elements, not all of them <a href=#form-associated-element title="form-associated
  element">form-associated</a>, are categorized as <dfn id=category-label title=category-label>labelable elements</dfn>. These are elements
  that can be associated with a <code><a href=#the-label-element>label</a></code> element.

  <!-- when updating this also update the category index -->
  <ul class="brief category-list"><li><code><a href=#the-button-element>button</a></code></li>
   <li><code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state)</li>
   <li><code><a href=#the-keygen-element>keygen</a></code></li>
   <li><code><a href=#the-meter-element>meter</a></code></li>
   <li><code><a href=#the-output-element>output</a></code></li>
   <li><code><a href=#the-progress-element>progress</a></code></li>
   <li><code><a href=#the-select-element>select</a></code></li>
   <li><code><a href=#the-textarea-element>textarea</a></code></li>
  </ul><h4 id=the-form-element><span class=secno>4.10.3 </span>The <dfn><code>form</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>, but with no <code><a href=#the-form-element>form</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> &mdash; Character encodings to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-action><a href=#attr-fs-action>action</a></code> &mdash; <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> &mdash; Default setting for autofill feature for controls in the form</dd>
   <dd><code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code> &mdash; Form data set encoding type to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-method><a href=#attr-fs-method>method</a></code> &mdash; HTTP method to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-form-name><a href=#attr-form-name>name</a></code> &mdash; Name of form to use in the <code title=dom-document-forms><a href=#dom-document-forms>document.forms</a></code> API</dd>
   <dd><code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code> &mdash; Bypass form control validation for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-target><a href=#attr-fs-target>target</a></code> &mdash; <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>[OverrideBuiltins]
interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-form-acceptcharset title=dom-form-acceptCharset>acceptCharset</a>;
           attribute DOMString <a href=#dom-fs-action title=dom-fs-action>action</a>;
           attribute DOMString <a href=#dom-form-autocomplete title=dom-form-autocomplete>autocomplete</a>;
           attribute DOMString <a href=#dom-fs-enctype title=dom-fs-enctype>enctype</a>;
           attribute DOMString <a href=#dom-fs-encoding title=dom-fs-encoding>encoding</a>;<!-- historical artefact -->
           attribute DOMString <a href=#dom-fs-method title=dom-fs-method>method</a>;
           attribute DOMString <a href=#dom-form-name title=dom-form-name>name</a>;
           attribute boolean <a href=#dom-fs-novalidate title=dom-fs-noValidate>noValidate</a>;
           attribute DOMString <a href=#dom-fs-target title=dom-fs-target>target</a>;

  readonly attribute <a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a> <a href=#dom-form-elements title=dom-form-elements>elements</a>;
  readonly attribute long <a href=#dom-form-length title=dom-form-length>length</a>;
  <a href=#dom-form-item title=dom-form-item>getter</a> <a href=#element>Element</a> (unsigned long index);
  <a href=#dom-form-nameditem title=dom-form-namedItem>getter</a> (<a href=#radionodelist>RadioNodeList</a> or <a href=#htmlinputelement>HTMLInputElement</a> or <a href=#htmlimageelement>HTMLImageElement</a>) (DOMString name);

  void <a href=#dom-form-submit title=dom-form-submit>submit</a>();
  void <a href=#dom-form-reset title=dom-form-reset>reset</a>();
  boolean <a href=#dom-form-checkvalidity title=dom-form-checkValidity>checkValidity</a>();
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-form-element>form</a></code> element <a href=#represents>represents</a> a collection of <a href=#form-associated-element title="form-associated element">form-associated elements</a>, some of which can represent
  editable values that can be submitted to a server for processing.</p>

  <p>The <dfn id=attr-form-accept-charset title=attr-form-accept-charset><code>accept-charset</code></dfn> attribute gives the
  character encodings that are to be used for the submission. If specified, the value must be an
  <a href=#ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</a> that are <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a>, and each token must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
  one of the <a href=#encoding-label title="encoding label">labels</a> of an <a href=#ascii-compatible-character-encoding>ASCII-compatible character
  encoding</a>. <a href=#refsENCODING>[ENCODING]</a></p>

  <p>The <dfn id=attr-form-name title=attr-form-name><code>name</code></dfn> attribute represents the
  <code><a href=#the-form-element>form</a></code>'s name within the <code title=dom-document-forms><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><a href=#the-form-element>form</a></code>
  elements in the <code title=dom-document-forms><a href=#dom-document-forms>forms</a></code> collection that it is in, if
  any.</p>

  <p>The <dfn id=attr-form-autocomplete title=attr-form-autocomplete><code>autocomplete</code></dfn> attribute is an
  <a href=#enumerated-attribute>enumerated attribute</a>. The attribute has two states. The <code title=attr-form-autocomplete-on>on</code> keyword maps to the <dfn id=attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</dfn> state, and the <code title=attr-form-autocomplete-off>off</code> keyword maps to the <dfn id=attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</dfn> state. The attribute may also be omitted. The
  <i>missing value default</i> is the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state.
  The <a href=#attr-form-autocomplete-off-state title=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>autofill field name</a> set to "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>"; the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state indicates that by default, form controls
  in the form will have their <a href=#autofill-field-name>autofill field name</a> set to "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>".</p>

  <p>The <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>, <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>,
  <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>, <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>,
  and <code title=attr-fs-target><a href=#attr-fs-target>target</a></code> attributes are <a href=#attributes-for-form-submission>attributes for form
  submission</a>.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">form</var> . <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the form controls in the form (excluding image
    buttons for historical reasons).</p>

   </dd>

   <dt><var title="">form</var> . <code title=dom-form-length><a href=#dom-form-length>length</a></code></dt>

   <dd>

    <p>Returns the number of form controls in the form (excluding image buttons for historical
    reasons).</p>

   </dd>

   <dt><var title="">form</var>[<var title="">index</var>]</dt>

   <dd>

    <p>Returns the <var title="">index</var>th element in the form (excluding image buttons for
    historical reasons).</p>

   </dd>

   <dt><var title="">form</var>[<var title="">name</var>]</dt>

   <dd>

    <p>Returns the form control (or, if there are several, a <code><a href=#radionodelist>RadioNodeList</a></code> of the form
    controls) in the form with the given <a href=#concept-id title=concept-id>ID</a> or <code title=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><a href=#the-img-element>img</a></code> element with the given ID.</p>

    <p>Once an element has been referenced using a particular name, that name will continue being
    available as a way to reference that element in this method, even if the element's actual <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> changes, for as long as
    the element remains in the <code><a href=#document>Document</a></code>.</p>

    <p>If there are multiple matching items, then a <code><a href=#radionodelist>RadioNodeList</a></code> object containing all
    those elements is returned.</p>

   </dd>

   <dt><var title="">form</var> . <code title=dom-form-submit><a href=#dom-form-submit>submit</a></code>()</dt>

   <dd>

    <p>Submits the form.</p>

   </dd>

   <dt><var title="">form</var> . <code title=dom-form-reset><a href=#dom-form-reset>reset</a></code>()</dt>

   <dd>

    <p>Resets the form.</p>

   </dd>

   <dt><var title="">form</var> . <code title=dom-form-checkValidity><a href=#dom-form-checkvalidity>checkValidity</a></code>()</dt>

   <dd>

    <p>Returns true if the form's controls are all valid; otherwise, returns false.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-form-autocomplete title=dom-form-autocomplete><code>autocomplete</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values>limited to only known
  values</a>.</p>

  <p>The <dfn id=dom-form-name title=dom-form-name><code>name</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <p>The <dfn id=dom-form-acceptcharset title=dom-form-acceptCharset><code>acceptCharset</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> content
  attribute.</p>

  <hr><p>The <dfn id=dom-form-elements title=dom-form-elements><code>elements</code></dfn> IDL attribute must return an
  <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> rooted at the <code><a href=#document>Document</a></code> node while the
  <code><a href=#the-form-element>form</a></code> element is <a href=#in-a-document>in a <code>Document</code></a> and rooted at the
  <code><a href=#the-form-element>form</a></code> element itself when it is not, whose filter matches <a href=#category-listed title=category-listed>listed elements</a> whose <a href=#form-owner>form owner</a> is the
  <code><a href=#the-form-element>form</a></code> element, with the exception of <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image
  Button</a> state, which must, for historical reasons, be excluded from this particular
  collection.</p>

  <p>The <dfn id=dom-form-length title=dom-form-length><code>length</code></dfn> IDL attribute must return the number
  of nodes <a href=#represented-by-the-collection title="represented by the collection">represented</a> by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> collection.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> at any instant are the indices supported by the
  object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute at that
  instant.</p>

  <p>When a <code><a href=#the-form-element>form</a></code> element is <dfn id=dom-form-item title=dom-form-item>indexed for indexed property
  retrieval</dfn>, the user agent must return the value returned by the <code title=dom-HTMLFormControlsCollection-item>item</code> method on the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> collection, when invoked with the given index as its
  argument.</p>

  <hr><!-- Welcome to crazy town. Population: The Web. --><p>Each <code><a href=#the-form-element>form</a></code> element has a mapping of names to elements called the <dfn id=past-names-map>past names
  map</dfn>. It is used to persist names of controls even when they change names.</p>

  <p>The <a href=#supported-property-names>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 title="">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>

   <li>

    <p>For each <a href=#category-listed title=category-listed>listed element</a> <var title="">candidate</var>
    whose <a href=#form-owner>form owner</a> is the <code><a href=#the-form-element>form</a></code> element, with the exception of any
    <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the
    <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, run these substeps:</p>

    <ol><li><p>If <var title="">candidate</var> has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute, add
     an entry to <var title="">sourced names</var> with that <code title=attr-id><a href=#the-id-attribute>id</a></code>
     attribute's value as the string, <var title="">candidate</var> as the element, and <i>id</i> as
     the source.</li>

     <li><p>If <var title="">candidate</var> has a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute,
     add an entry to <var title="">sourced names</var> with that <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute's value as the string, <var title="">candidate</var>
     as the element, and <i>name</i> as the source.</li>

    </ol></li>

   <li>

    <p>For each <code><a href=#the-img-element>img</a></code> element <var title="">candidate</var> whose <a href=#form-owner>form owner</a>
    is the <code><a href=#the-form-element>form</a></code> element, run these substeps:</p>

    <ol><!-- this is the same as the above list, except 'name' xrefs to something differnet --><li><p>If <var title="">candidate</var> has an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute, add
     an entry to <var title="">sourced names</var> with that <code title=attr-id><a href=#the-id-attribute>id</a></code>
     attribute's value as the string, <var title="">candidate</var> as the element, and <i>id</i> as
     the source.</li>

     <li><p>If <var title="">candidate</var> has a <code title=attr-img-name><a href=#attr-img-name>name</a></code> attribute,
     add an entry to <var title="">sourced names</var> with that <code title=attr-img-name><a href=#attr-img-name>name</a></code> attribute's value as the string, <var title="">candidate</var>
     as the element, and <i>name</i> as the source.</li>

    </ol></li>

   <li>

    <p>For each entry <var title="">past entry</var> in the <a href=#past-names-map>past names map</a> add an entry
    to <var title="">sourced names</var> with the <var title="">past entry</var>'s name as the
    string, <var title="">past entry</var>'s element as the element, <i>past</i> as the source, and
    the length of time <var title="">past entry</var> has been in the <a href=#past-names-map>past names map</a> as
    the age.</p>

   </li>

   <li><p>Sort <var title="">sourced names</var> by <a href=#tree-order>tree order</a> of the element entry of
   each tuple, sorting entries with the same element by putting entries whose source is <i>id</i>
   first, then entries whose source is <i>name</i>, and finally entries whose source is <i>past</i>,
   and sorting entries with the same element and source by their age, oldest first.</li>

   <li><p>Remove any entries in <var title="">sourced names</var> that have the empty string as
   their name.</li>

   <li><p>Remove any entries in <var title="">sourced names</var> that have the same name as an
   earlier entry in the map.</li>

   <li><p>Return the list of names from <var title="">sourced names</var>, maintaining their
   relative order.</li>

  </ol><p>The properties exposed in this way must not be enumerable.</p>

  <p>When a <code><a href=#the-form-element>form</a></code> element is <dfn id=dom-form-nameditem title=dom-form-namedItem>indexed for named property
  retrieval</dfn>, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">candidates</var> be a <a href=#live>live</a> <code><a href=#radionodelist>RadioNodeList</a></code>
   object containing all the <a href=#category-listed title=category-listed>listed elements</a> whose <a href=#form-owner>form
   owner</a> is the <code><a href=#the-form-element>form</a></code> element that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code>
   attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>, with the exception of <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image
   Button</a> state, in <a href=#tree-order>tree order</a>.</li>

   <!-- we return RadioNodeList here for consistency -->
   <li><p>If <var title="">candidates</var> is empty, let <var title="">candidates</var> be a
   <a href=#live>live</a> <code><a href=#radionodelist>RadioNodeList</a></code> object containing all the <code><a href=#the-img-element>img</a></code> elements
   that are descendants of the <code><a href=#the-form-element>form</a></code> element and that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-img-name><a href=#attr-img-name>name</a></code> attribute equal
   to <var title="">name</var>, in <a href=#tree-order>tree order</a>.</li>

   <li><p>If <var title="">candidates</var> is empty, <var title="">name</var> is the name of one of
   the entries in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names map</a>: return the object
   associated with <var title="">name</var> in that map.</li>

   <li><p>If <var title="">candidates</var> contains more than one node, return <var title="">candidates</var> and abort these steps.</li>

   <li><p>Otherwise, <var title="">candidates</var> contains exactly one node. Add a mapping from
   <var title="">name</var> to the node in <var title="">candidates</var> in the <code><a href=#the-form-element>form</a></code>
   element's <a href=#past-names-map>past names map</a>, replacing the previous entry with the same name, if
   any.</li>

   <li><p>Return the node in <var title="">candidates</var>.</li>

  </ol><p>If an element listed in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names map</a> is removed
  from the <code><a href=#document>Document</a></code>, then its entries must be removed from the map.</p>

  <!--
    This ridiculous setup is intended to do as much of the right thing
    while still supporting code written to work in IE7. IE versions
    prior to IE8 do not update the names on the <form> element
    collection to match new names when elements are renamed, and there
    are enough pages that rename elements and then access them by
    their old name that we have to support this.

    But we still want to expose them using the new names, so as far as
    possible we pretend the legacy names aren't there except if
    there's no other element actually named that way.

    Removing the element did remove the legacy name in IE7:
    http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Dsubmit%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w(document.forms%5B0%5D.submit)%3B%0A%20w(document.forms%5B0%5D.removeChild(document.getElementsByTagName('input')%5B0%5D))%3B%0A%20w(document.forms%5B0%5D.length)%3B%0A%20try%20%7B%20document.forms%5B0%5D.submit()%3B%20%7D%20catch%20(e)%20%20%7B%20w(e.message)%20%7D%0A%3C%2Fscript%3E

    There's no interop on what happens when the name was originally a
    duplicate name, so we don't persist such accesses - at the time
    of writing, Safari returned the first element, Firefox returned
    null (as we do), and IE7 returned the original collection:
    http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Da%20id%3Dfirst%3E%3Cinput%20name%3Da%20id%3Dsecond%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w%28document.forms[0].a%29%3B%0A%20document.getElementsByTagName%28%27input%27%29[0].name%20%3D%20%27b%27%3B%0A%20document.getElementsByTagName%28%27input%27%29[1].name%20%3D%20%27b%27%3B%0A%20w%28document.forms[0].length%29%3B%0A%20w%28document.forms[0].a.id%29%3B%0A%3C%2Fscript%3E

    In addition, the <img> fallback nonsense is similarly here for
    legacy reasons. As is the exclusion of <input type=image>.

    Also, check these out:
    http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1220
    http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2388

  -->

  <!-- Now leaving crazy town. -->

  <hr><p>The <dfn id=dom-form-submit title=dom-form-submit><code>submit()</code></dfn> method, when invoked, must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <code><a href=#the-form-element>form</a></code> element from the <code><a href=#the-form-element>form</a></code>
  element itself, with the <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code> method</var> flag set.</p>

  <p>The <dfn id=dom-form-reset title=dom-form-reset><code>reset()</code></dfn> method, when invoked, must run the
  following steps:</p>

  <ol><li><p>If the <code><a href=#the-form-element>form</a></code> element is marked as <i><a href=#locked-for-reset>locked for reset</a></i>, then abort these
   steps.</li>

   <li><p>Mark the <code><a href=#the-form-element>form</a></code> element as <dfn id=locked-for-reset>locked for reset</dfn>.</li>

   <li><p><a href=#concept-form-reset title=concept-form-reset>Reset</a> the <code><a href=#the-form-element>form</a></code> element.</li>

   <li><p>Unmark the <code><a href=#the-form-element>form</a></code> element as <i><a href=#locked-for-reset>locked for reset</a></i>.</li>

  </ol><p>If the <dfn id=dom-form-checkvalidity title=dom-form-checkValidity><code>checkValidity()</code></dfn> method is
  invoked, the user agent must <a href=#statically-validate-the-constraints>statically validate the constraints</a> of the
  <code><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>
<!--TOPIC:HTML-->

  <div class=example>

   <p>This example shows two search forms:</p>

   <pre>&lt;form action="http://www.google.com/search" method="get"&gt;
 &lt;label&gt;Google: &lt;input type="search" name="q"&gt;&lt;/label&gt; &lt;input type="submit" value="Search..."&gt;
&lt;/form&gt;
&lt;form action="http://www.bing.com/search" method="get"&gt;
 &lt;label&gt;Bing: &lt;input type="search" name="q"&gt;&lt;/label&gt; &lt;input type="submit" value="Search..."&gt;
&lt;/form&gt;</pre>

  </div>




  <h4 id=the-fieldset-element><span class=secno>4.10.4 </span>The <dfn><code>fieldset</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dd><a href=#category-listed title=category-listed>Listed</a> and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Optionally a <code><a href=#the-legend-element>legend</a></code> element, followed by <a href=#flow-content>flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlfieldsetelement>HTMLFieldSetElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-fieldset-disabled title=dom-fieldset-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;

  readonly attribute DOMString <a href=#dom-fieldset-type title=dom-fieldset-type>type</a>;

  readonly attribute <a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a> <a href=#dom-fieldset-elements title=dom-fieldset-elements>elements</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-fieldset-element>fieldset</a></code> element <a href=#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><a href=#the-legend-element>legend</a></code> element that is a child of the
  <code><a href=#the-fieldset-element>fieldset</a></code> element, if any. The remainder of the descendants form the group.</p>

  <p>The <dfn id=attr-fieldset-disabled title=attr-fieldset-disabled><code>disabled</code></dfn> attribute, when specified,
  causes all the form control descendants of the <code><a href=#the-fieldset-element>fieldset</a></code> element, excluding those that
  are descendants of the <code><a href=#the-fieldset-element>fieldset</a></code> element's first <code><a href=#the-legend-element>legend</a></code> element child, if
  any, to be <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</p>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
  <code><a href=#the-fieldset-element>fieldset</a></code> element with its <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute represents the element's name.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">fieldset</var> . <code title=dom-fieldset-type><a href=#dom-fieldset-type>type</a></code></dt>

   <dd>

    <p>Returns the string "fieldset".</p>

   </dd>

   <dt><var title="">fieldset</var> . <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> of the form controls in the element.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-fieldset-disabled title=dom-fieldset-disabled><code>disabled</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  <p>The <dfn id=dom-fieldset-type title=dom-fieldset-type><code>type</code></dfn> IDL attribute must return the string
  "<code title="">fieldset</code>".</p>

  <p>The <dfn id=dom-fieldset-elements title=dom-fieldset-elements><code>elements</code></dfn> IDL attribute must return an
  <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> rooted at the <code><a href=#the-fieldset-element>fieldset</a></code> element, whose filter
  matches <a href=#category-listed title=category-listed>listed elements</a>.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
  <a href=#the-constraint-validation-api>constraint validation API</a>. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the element's forms API.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>This example shows a <code><a href=#the-fieldset-element>fieldset</a></code> element being used to group a set of related
   controls:</p>

   <pre>&lt;fieldset&gt;
 &lt;legend&gt;Display&lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type=radio name=c value=0 checked&gt; Black on White&lt;/label&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type=radio name=c value=1&gt; White on Black&lt;/label&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type=checkbox name=g&gt; Use grayscale&lt;/label&gt;
 &lt;p&gt;&lt;label&gt;Enhance contrast &lt;input type=range name=e list=contrast min=0 max=100 value=0 step=1&gt;&lt;/label&gt;
 &lt;datalist id=contrast&gt;
  &lt;option label=Normal value=0&gt;
  &lt;option label=Maximum value=100&gt;
 &lt;/datalist&gt;
&lt;/fieldset&gt;</pre>

  </div>

  <div class=example>

   <p>The following snippet shows a fieldset with a checkbox in the legend that controls whether or
   not the fieldset is enabled. The contents of the fieldset consist of two required text fields and
   an optional year/month control.</p>

   <pre>&lt;fieldset name="clubfields" disabled&gt;
 &lt;legend&gt; &lt;label&gt;
  &lt;input type=checkbox name=club onchange="form.clubfields.disabled = !checked"&gt;
  Use Club Card
 &lt;/label&gt; &lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;Name on card: &lt;input name=clubname required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Card number: &lt;input name=clubnum required pattern="[-0-9]+"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Expiry date: &lt;input name=clubexp type=month&gt;&lt;/label&gt;&lt;/p&gt;
&lt;/fieldset&gt;</pre>

  </div>

  <div class=example>

   <p>You can also nest <code><a href=#the-fieldset-element>fieldset</a></code> elements. Here is an example expanding on the previous
   one that does so:</p>

   <pre>&lt;fieldset name="clubfields" disabled&gt;
 &lt;legend&gt; &lt;label&gt;
  &lt;input type=checkbox name=club onchange="form.clubfields.disabled = !checked"&gt;
  Use Club Card
 &lt;/label&gt; &lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;Name on card: &lt;input name=clubname required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;fieldset name="numfields"&gt;
  &lt;legend&gt; &lt;label&gt;
   &lt;input type=radio checked name=clubtype onchange="form.numfields.disabled = !checked"&gt;
   My card has numbers on it
  &lt;/label&gt; &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt;Card number: &lt;input name=clubnum required pattern="[-0-9]+"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
 &lt;fieldset name="letfields" disabled&gt;
  &lt;legend&gt; &lt;label&gt;
   &lt;input type=radio name=clubtype onchange="form.letfields.disabled = !checked"&gt;
   My card has letters on it
  &lt;/label&gt; &lt;/legend&gt;
  &lt;p&gt;&lt;label&gt;Card code: &lt;input name=clublet required pattern="[A-Za-z]+"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;/fieldset&gt;
&lt;/fieldset&gt;</pre>

   <p>In this example, if the outer "Use Club Card" checkbox is not checked, everything inside the
   outer <code><a href=#the-fieldset-element>fieldset</a></code>, including the two radio buttons in the legends of the two nested
   <code><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><a href=#the-fieldset-element>fieldset</a></code>s is to be enabled.</p>

  </div>


  <h4 id=the-legend-element><span class=secno>4.10.5 </span>The <dfn><code>legend</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the first child of a <code><a href=#the-fieldset-element>fieldset</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
    <pre class=idl>interface <dfn id=htmllegendelement>HTMLLegendElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-legend-form title=dom-legend-form>form</a>;

  // <a href="#HTMLLegendElement-partial">also has obsolete members</a>
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-legend-element>legend</a></code> element <a href=#represents>represents</a> a caption for the rest of the contents
  of the <code><a href=#the-legend-element>legend</a></code> element's parent <code><a href=#the-fieldset-element>fieldset</a></code> element<span class=impl>, if
  any</span>.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">legend</var> . <code title=dom-legend-form><a href=#dom-legend-form>form</a></code></dt>

   <dd>

    <p>Returns the element's <code><a href=#the-form-element>form</a></code> element, if any, or null otherwise.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-legend-form title=dom-legend-form><code>form</code></dfn> IDL attribute's behavior depends on
  whether the <code><a href=#the-legend-element>legend</a></code> element is in a <code><a href=#the-fieldset-element>fieldset</a></code> element or not. If the
  <code><a href=#the-legend-element>legend</a></code> has a <code><a href=#the-fieldset-element>fieldset</a></code> element as its parent, then the <code title=dom-legend-form><a href=#dom-legend-form>form</a></code> IDL attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute on that <code><a href=#the-fieldset-element>fieldset</a></code> element. Otherwise,
  it must return null.</p>

  </div>
<!--TOPIC:HTML-->



  <h4 id=the-label-element><span class=secno>4.10.6 </span>The <dfn><code>label</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#category-form-attr title=category-form-attr>Reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>, but with no descendant <a href=#category-label title=category-label>labelable elements</a> unless it is the element's <a href=#labeled-control>labeled control</a>, and no descendant <code><a href=#the-label-element>label</a></code> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-label-for><a href=#attr-label-for>for</a></code> &mdash; Associate the label with form control</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmllabelelement>HTMLLabelElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-label-htmlfor title=dom-label-htmlFor>htmlFor</a>;
  readonly attribute <a href=#htmlelement>HTMLElement</a>? <a href=#dom-label-control title=dom-label-control>control</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-label-element>label</a></code> element <a href=#represents>represents</a> a caption in a user interface. The
  caption can be associated with a specific form control<span class=impl>, known as the
  <code><a href=#the-label-element>label</a></code> element's <dfn id=labeled-control>labeled control</dfn></span>, either using the <code title=attr-label-for><a href=#attr-label-for>for</a></code> attribute, or by putting the form control inside the
  <code><a href=#the-label-element>label</a></code> element itself.</p>

  <div class=impl>

  <p>Except where otherwise specified by the following rules, a <code><a href=#the-label-element>label</a></code> element has no
  <a href=#labeled-control>labeled control</a>.</p>

  </div>

  <p>The <dfn id=attr-label-for title=attr-label-for><code>for</code></dfn> attribute may be specified to indicate a
  form control with which the caption is to be associated. If the attribute is specified, the
  attribute's value must be the <a href=#concept-id title=concept-id>ID</a> of a <a href=#category-label title=category-label>labelable element</a> in the same <code><a href=#document>Document</a></code> as the
  <code><a href=#the-label-element>label</a></code> element. <span class=impl>If the attribute is specified and there is an
  element in the <code><a href=#document>Document</a></code> whose <a href=#concept-id title=concept-id>ID</a> is equal to the
  value of the <code title=attr-label-for><a href=#attr-label-for>for</a></code> attribute, and the first such element is a
  <a href=#category-label title=category-label>labelable element</a>, then that element is the <code><a href=#the-label-element>label</a></code>
  element's <a href=#labeled-control>labeled control</a>.</span></p>

  <div class=impl>

  <p>If the <code title=attr-label-for><a href=#attr-label-for>for</a></code> attribute is not specified, but the
  <code><a href=#the-label-element>label</a></code> element has a <a href=#category-label title=category-label>labelable element</a> descendant,
  then the first such descendant in <a href=#tree-order>tree order</a> is the <code><a href=#the-label-element>label</a></code> element's
  <a href=#labeled-control>labeled control</a>.</p>

  <p>The <code><a href=#the-label-element>label</a></code> element's exact default presentation and behavior, in particular what
  its <a href=#activation-behavior>activation behavior</a> might be, if anything, should match the platform's label
  behavior. The <a href=#activation-behavior>activation behavior</a> of a <code><a href=#the-label-element>label</a></code> element for events targeted
  at <a href=#interactive-content>interactive content</a> descendants of a <code><a href=#the-label-element>label</a></code> element, and any
  descendants of those <a href=#interactive-content>interactive content</a> descendants, must be to do nothing.</p>

  <!-- activation behaviour need not be dependent on whether the
  labeled control is being rendered:
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/371
  -->

  <div class=example>

   <p>For example, on platforms where clicking a checkbox label checks the checkbox, clicking the
   <code><a href=#the-label-element>label</a></code> in the following snippet could trigger the user agent to <a href=#run-synthetic-click-activation-steps>run synthetic
   click activation steps</a> on the <code><a href=#the-input-element>input</a></code> element, as if the element itself had
   been triggered by the user:</p>

   <pre>&lt;label&gt;&lt;input type=checkbox name=lost&gt; Lost&lt;/label&gt;</pre>

   <p>On other platforms, the behavior might be just to focus the control, or do nothing.</p>

  </div>

  </div>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
  <code><a href=#the-label-element>label</a></code> element with its <a href=#form-owner>form owner</a>.</p>

  <div class=example>

   <p>The following example shows three form controls each with a label, two of which have small
   text showing the right format for users to use.</p>

   <pre>&lt;p&gt;&lt;label&gt;Full name: &lt;input name=fn&gt; &lt;small&gt;Format: First Last&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;label&gt;Age: &lt;input name=age type=number min=0&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;label&gt;Post code: &lt;input name=pc&gt; &lt;small&gt;Format: AB12 3CD&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;</pre>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">label</var> . <code title=dom-label-control><a href=#dom-label-control>control</a></code></dt>

   <dd>

    <p>Returns the form control that is associated with this element.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-label-htmlfor title=dom-label-htmlFor><code>htmlFor</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-label-for><a href=#attr-label-for>for</a></code> content attribute.</p>

  <p>The <dfn id=dom-label-control title=dom-label-control><code>control</code></dfn> IDL attribute must return the
  <code><a href=#the-label-element>label</a></code> element's <a href=#labeled-control>labeled control</a>, if any, or null if there isn't one.</p>

  <p>The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute is part of the element's forms
  API.</p>

  </div>

  <hr><dl class=domintro><dt><var title="">control</var> . <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#nodelist>NodeList</a></code> of all the <code><a href=#the-label-element>label</a></code> elements that the form control
    is associated with.</p>

   </dd>

  </dl><div class=impl>

  <p><a href=#category-label title=category-label>Labelable elements</a> have a <code><a href=#nodelist>NodeList</a></code> object
  associated with them that represents the list of <code><a href=#the-label-element>label</a></code> elements, in <a href=#tree-order>tree
  order</a>, whose <a href=#labeled-control>labeled control</a> is the element in question. The <dfn id=dom-lfe-labels title=dom-lfe-labels><code>labels</code></dfn> IDL attribute of <a href=#category-label title=category-label>labelable elements</a>, on getting, must return that
  <code><a href=#nodelist>NodeList</a></code> object.</p>

  </div>
<!--TOPIC:HTML-->


  <h4 id=the-input-element><span class=secno>4.10.7 </span>The <dfn><code>input</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd>If the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state: <a href=#interactive-content>Interactive content</a>.</dd>
   <dd>If the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state: <a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, <a href=#category-reset title=category-reset>resettable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd>If the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state: <a href=#category-listed title=category-listed>Listed</a>, <a href=#category-submit title=category-submit>submittable</a>, <a href=#category-reset title=category-reset>resettable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd>If the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state: <a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-input-accept><a href=#attr-input-accept>accept</a></code> &mdash; Hint for expected file type in <a href="#file-upload-state-(type=file)" title=attr-input-type-file>file upload controls</a></dd>
   <dd><code title=attr-input-alt><a href=#attr-input-alt>alt</a></code> &mdash; Replacement text for use when images are not available</dd>
   <dd><code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> &mdash; Hint for form autofill feature</dd>
   <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> &mdash; Automatically focus the form control when the page is loaded</dd>
   <dd><code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> &mdash; Whether the command or control is checked</dd>
   <dd><code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> &mdash; Name of form field to use for sending the element's <a href=#the-directionality title="the directionality">directionality</a> in <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> &mdash; <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> &mdash; Form data set encoding type to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> &mdash; HTTP method to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> &mdash; Bypass form control validation for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> &mdash; <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-dim-height><a href=#attr-dim-height>height</a></code> &mdash; Vertical dimension</dd>
   <dd><code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> &mdash; Hint for selecting an input modality</dd>
   <dd><code title=attr-input-list><a href=#attr-input-list>list</a></code> &mdash; List of autocomplete options</dd>
   <dd><code title=attr-input-max><a href=#attr-input-max>max</a></code> &mdash; Maximum value</dd>
   <dd><code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> &mdash; Maximum length of value</dd>
   <dd><code title=attr-input-min><a href=#attr-input-min>min</a></code> &mdash; Minimum value</dd>
   <dd><code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> &mdash; Whether to allow multiple values</dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dd><code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> &mdash; Pattern to be matched by the form control's value</dd>
   <dd><code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> &mdash; User-visible label to be placed within the form control</dd>
   <dd><code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> &mdash; Whether to allow the value to be edited by the user</dd>
   <dd><code title=attr-input-required><a href=#attr-input-required>required</a></code> &mdash; Whether the control is required for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-input-size><a href=#attr-input-size>size</a></code> &mdash; Size of the control</dd>
   <dd><code title=attr-input-src><a href=#attr-input-src>src</a></code> &mdash; Address of the resource</dd>
   <dd><code title=attr-input-step><a href=#attr-input-step>step</a></code> &mdash; Granularity to be matched by the form control's value</dd>
   <dd><code title=attr-input-type><a href=#attr-input-type>type</a></code> &mdash; Type of form control</dd>
   <dd><code title=attr-input-value><a href=#attr-input-value>value</a></code> &mdash; Value of the form control</dd>
   <dd><code title=attr-dim-width><a href=#attr-dim-width>width</a></code> &mdash; Horizontal dimension</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlinputelement>HTMLInputElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-input-accept title=dom-input-accept>accept</a>;
           attribute DOMString <a href=#dom-input-alt title=dom-input-alt>alt</a>;
           attribute DOMString <a href=#dom-fe-autocomplete title=dom-fe-autocomplete>autocomplete</a>;
           attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
           attribute boolean <a href=#dom-input-defaultchecked title=dom-input-defaultChecked>defaultChecked</a>;
           attribute boolean <a href=#dom-input-checked title=dom-input-checked>checked</a>;
           attribute DOMString <a href=#dom-input-dirname title=dom-input-dirName>dirName</a>;
           attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
  readonly attribute <a href=#filelist>FileList</a>? <a href=#dom-input-files title=dom-input-files>files</a>;
           attribute DOMString <a href=#dom-fs-formaction title=dom-fs-formAction>formAction</a>;
           attribute DOMString <a href=#dom-fs-formenctype title=dom-fs-formEnctype>formEnctype</a>;
           attribute DOMString <a href=#dom-fs-formmethod title=dom-fs-formMethod>formMethod</a>;
           attribute boolean <a href=#dom-fs-formnovalidate title=dom-fs-formNoValidate>formNoValidate</a>;
           attribute DOMString <a href=#dom-fs-formtarget title=dom-fs-formTarget>formTarget</a>;
           attribute unsigned long <a href=#dom-input-height title=dom-input-height>height</a>;
           attribute boolean <a href=#dom-input-indeterminate title=dom-input-indeterminate>indeterminate</a>;
           attribute DOMString <a href=#dom-input-inputmode title=dom-input-inputMode>inputMode</a>;
  readonly attribute <a href=#htmlelement>HTMLElement</a>? <a href=#dom-input-list title=dom-input-list>list</a>;
           attribute DOMString <a href=#dom-input-max title=dom-input-max>max</a>;
           attribute long <a href=#dom-input-maxlength title=dom-input-maxLength>maxLength</a>;
           attribute DOMString <a href=#dom-input-min title=dom-input-min>min</a>;
           attribute boolean <a href=#dom-input-multiple title=dom-input-multiple>multiple</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
           attribute DOMString <a href=#dom-input-pattern title=dom-input-pattern>pattern</a>;
           attribute DOMString <a href=#dom-input-placeholder title=dom-input-placeholder>placeholder</a>;
           attribute boolean <a href=#dom-input-readonly title=dom-input-readOnly>readOnly</a>;
           attribute boolean <a href=#dom-input-required title=dom-input-required>required</a>;
           attribute unsigned long <a href=#dom-input-size title=dom-input-size>size</a>;
           attribute DOMString <a href=#dom-input-src title=dom-input-src>src</a>;
           attribute DOMString <a href=#dom-input-step title=dom-input-step>step</a>;
           attribute DOMString <a href=#dom-input-type title=dom-input-type>type</a>;
           attribute DOMString <a href=#dom-input-defaultvalue title=dom-input-defaultValue>defaultValue</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-input-value title=dom-input-value>value</a>;
           attribute <span>Date</span>? <a href=#dom-input-valueasdate title=dom-input-valueAsDate>valueAsDate</a>;
           attribute unrestricted double <a href=#dom-input-valueasnumber title=dom-input-valueAsNumber>valueAsNumber</a>;
           attribute unsigned long <a href=#dom-input-width title=dom-input-width>width</a>;

  void <a href=#dom-input-stepup title=dom-input-stepUp>stepUp</a>(optional long n = 1);
  void <a href=#dom-input-stepdown title=dom-input-stepDown>stepDown</a>(optional long n = 1);

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;

  void <a href=#dom-textarea/input-select title=dom-textarea/input-select>select</a>();
           attribute unsigned long <a href=#dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart>selectionStart</a>;
           attribute unsigned long <a href=#dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd>selectionEnd</a>;
           attribute DOMString <a href=#dom-textarea/input-selectiondirection title=dom-textarea/input-selectionDirection>selectionDirection</a>;
  void <a href=#dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText>setRangeText</a>(DOMString replacement);
  void <a href=#dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText>setRangeText</a>(DOMString replacement, unsigned long start, unsigned long end, optional <a href=#selectionmode>SelectionMode</a> selectionMode);
  void <a href=#dom-textarea/input-setselectionrange title=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>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a typed data field,
  usually with a form control to allow the user to edit the data.</p>

  <p>The <dfn id=attr-input-type title=attr-input-type><code>type</code></dfn>
  attribute controls the data type (and associated control) of the
  element. It is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
  table lists the keywords and states for the attribute &mdash; the
  keywords in the left column map to the states in the cell in the
  second column on the same row as the keyword.</p>

  <table id=attr-input-type-keywords><thead><tr><th> Keyword
     <th> State
     <th> Data type
     <th> Control type
   <tbody><tr><td> <dfn id=attr-input-type-hidden-keyword title=attr-input-type-hidden-keyword><code>hidden</code></dfn>
     <td> <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a>
     <td> An arbitrary string
     <td> n/a
    <tr><td> <dfn id=attr-input-type-text-keyword title=attr-input-type-text-keyword><code>text</code></dfn>
     <td> <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>
     <td> Text with no line breaks
     <td> A text field
    <tr><td> <dfn id=attr-input-type-search-keyword title=attr-input-type-search-keyword><code>search</code></dfn>
     <td> <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>
     <td> Text with no line breaks
     <td> Search field
    <tr><td> <dfn id=attr-input-type-tel-keyword title=attr-input-type-tel-keyword><code>tel</code></dfn>
     <td> <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a>
     <td> Text with no line breaks
     <td> A text field
    <tr><td> <dfn id=attr-input-type-url-keyword title=attr-input-type-url-keyword><code>url</code></dfn>
     <td> <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>
     <td> An absolute URL
     <td> A text field
    <tr><td> <dfn id=attr-input-type-email-keyword title=attr-input-type-email-keyword><code>email</code></dfn>
     <td> <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a>
     <td> An e-mail address or list of e-mail addresses
     <td> A text field
    <tr><td> <dfn id=attr-input-type-password-keyword title=attr-input-type-password-keyword><code>password</code></dfn>
     <td> <a href="#password-state-(type=password)" title=attr-input-type-password>Password</a>
     <td> Text with no line breaks (sensitive information)
     <td> A text field that obscures data entry
    <tr><td> <dfn id=attr-input-type-datetime-keyword title=attr-input-type-datetime-keyword><code>datetime</code></dfn>
     <td> <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a>
     <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with the time zone set to UTC
     <td> A date and time control
    <tr><td> <dfn id=attr-input-type-date-keyword title=attr-input-type-date-keyword><code>date</code></dfn>
     <td> <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a>
     <td> A date (year, month, day) with no time zone
     <td> A date control
    <tr><td> <dfn id=attr-input-type-month-keyword title=attr-input-type-month-keyword><code>month</code></dfn>
     <td> <a href="#month-state-(type=month)" title=attr-input-type-month>Month</a>
     <td> A date consisting of a year and a month with no time zone
     <td> A month control
    <tr><td> <dfn id=attr-input-type-week-keyword title=attr-input-type-week-keyword><code>week</code></dfn>
     <td> <a href="#week-state-(type=week)" title=attr-input-type-week>Week</a>
     <td> A date consisting of a week-year number and a week number with no time zone
     <td> A week control
    <tr><td> <dfn id=attr-input-type-time-keyword title=attr-input-type-time-keyword><code>time</code></dfn>
     <td> <a href="#time-state-(type=time)" title=attr-input-type-time>Time</a>
     <td> A time (hour, minute, seconds, fractional seconds) with no time zone
     <td> A time control
    <tr><td> <dfn id=attr-input-type-datetime-local-keyword title=attr-input-type-datetime-local-keyword><code>datetime-local</code></dfn>
     <td> <a href="#local-date-and-time-state-(type=datetime-local)" title=attr-input-type-datetime-local>Local Date and Time</a>
     <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone
     <td> A date and time control
    <tr><td> <dfn id=attr-input-type-number-keyword title=attr-input-type-number-keyword><code>number</code></dfn>
     <td> <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a>
     <td> A numerical value
     <td> A text field or spinner control
    <tr><td> <dfn id=attr-input-type-range-keyword title=attr-input-type-range-keyword><code>range</code></dfn>
     <td> <a href="#range-state-(type=range)" title=attr-input-type-range>Range</a>
     <td> A numerical value, with the extra semantic that the exact value is not important
     <td> A slider control or similar
    <tr><td> <dfn id=attr-input-type-color-keyword title=attr-input-type-color-keyword><code>color</code></dfn>
     <td> <a href="#color-state-(type=color)" title=attr-input-type-color>Color</a>
     <td> An sRGB color with 8-bit red, green, and blue components
     <td> A color well
    <tr><td> <dfn id=attr-input-type-checkbox-keyword title=attr-input-type-checkbox-keyword><code>checkbox</code></dfn>
     <td> <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a>
     <td> A set of zero or more values from a predefined list
     <td> A checkbox
    <tr><td> <dfn id=attr-input-type-radio-keyword title=attr-input-type-radio-keyword><code>radio</code></dfn>
     <td> <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a>
     <td> An enumerated value
     <td> A radio button
    <tr><td> <dfn id=attr-input-type-file-keyword title=attr-input-type-file-keyword><code>file</code></dfn>
     <td> <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a>
     <td> Zero or more files each with a <a href=#mime-type>MIME type</a> and optionally a file name
     <td> A label and a button
    <tr><td> <dfn id=attr-input-type-submit-keyword title=attr-input-type-submit-keyword><code>submit</code></dfn>
     <td> <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a>
     <td> An enumerated value, with the extra semantic that it must be the last value selected and initiates form submission
     <td> A button
    <tr><td> <dfn id=attr-input-type-image-keyword title=attr-input-type-image-keyword><code>image</code></dfn>
     <td> <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a>
     <td> A coordinate, relative to a particular image's size, with the extra semantic that it must be the last value selected and initiates form submission
     <td> Either a clickable image, or a button
    <tr><td> <dfn id=attr-input-type-reset-keyword title=attr-input-type-reset-keyword><code>reset</code></dfn>
     <td> <a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset Button</a>
     <td> n/a
     <td> A button
    <tr><td> <dfn id=attr-input-type-button-keyword title=attr-input-type-button-keyword><code>button</code></dfn>
     <td> <a href="#button-state-(type=button)" title=attr-input-type-button>Button</a>
     <td> n/a
     <td> A button
  </table><p>The <i>missing value default</i> is the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state.</p>

  <p>Which of the <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>, <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>, <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>, <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>, <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>, <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>, <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>, <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>, <code title=attr-input-list><a href=#attr-input-list>list</a></code>, <code title=attr-input-max><a href=#attr-input-max>max</a></code>, <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>, <code title=attr-input-min><a href=#attr-input-min>min</a></code>, <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>, <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>, <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>, <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>, <code title=attr-input-required><a href=#attr-input-required>required</a></code>,
  <code title=attr-input-size><a href=#attr-input-size>size</a></code>, <code title=attr-input-src><a href=#attr-input-src>src</a></code>, <code title=attr-input-step><a href=#attr-input-step>step</a></code>, and <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> content
  attributes, the <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code>, <code title=dom-input-files><a href=#dom-input-files>files</a></code>, <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, and <code title=dom-input-list><a href=#dom-input-list>list</a></code> IDL attributes, the <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code> method, the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, IDL attributes, the <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code> and <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods, the <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> and <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>
  methods, and the <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <dfn id=concept-input-apply title=concept-input-apply>apply</dfn> to an <code><a href=#the-input-element>input</a></code> element depends on
  the state of its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute. The subsections that define
  each type also clearly define in normative "bookkeeping" sections which of these feature apply,
  and which <dfn id=do-not-apply>do not apply</dfn>, to each type. The behavior of these features depends on whether
  they apply or not, as defined in their various sections.</p>

  <p>The following table <span class=impl>is non-normative and</span> summarizes which of those
  content attributes, IDL attributes, methods, and events <a href=#concept-input-apply title=concept-input-apply>apply</a> to each state:</p>

  <table class=applies id=input-type-attr-summary><thead><tr><th>
     <th> <span title=""><a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a></span>
     <th> <span title=""><a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>,</span>
          <span title=""><a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a></span>
     <th> <span title=""><a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>,</span>
          <span title=""><a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a></span>
     <th> <span title=""><a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a></span>
     <th> <span title=""><a href="#password-state-(type=password)" title=attr-input-type-password>Password</a></span>
     <th> <span title=""><a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a>,</span>
          <span title=""><a href="#date-state-(type=date)" title=attr-input-type-date>Date</a>,</span>
          <span title=""><a href="#month-state-(type=month)" title=attr-input-type-month>Month</a>,</span>
          <span title=""><a href="#week-state-(type=week)" title=attr-input-type-week>Week</a>,</span>
          <span title=""><a href="#time-state-(type=time)" title=attr-input-type-time>Time</a></span>
     <th> <span title=""><a href="#local-date-and-time-state-(type=datetime-local)" title=attr-input-type-datetime-local>Local Date and Time</a></span>
     <th> <span title=""><a href="#number-state-(type=number)" title=attr-input-type-number>Number</a></span>
     <th> <span title=""><a href="#range-state-(type=range)" title=attr-input-type-range>Range</a></span>
     <th> <span title=""><a href="#color-state-(type=color)" title=attr-input-type-color>Color</a></span>
     <th> <span title=""><a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a>,</span>
          <span title=""><a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a></span>
     <th> <span title=""><a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a></span>
     <th> <span title=""><a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a></span>
     <th> <span title=""><a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a></span>
     <th> <span title=""><a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset Button</a>,</span>
          <span title=""><a href="#button-state-(type=button)" title=attr-input-type-button>Button</a></span>

   <tbody><tr><th scope=rowgroup colspan=16>Content attributes

    <tr><th> <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=yes> Yes     <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=yes> Yes     <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=yes> Yes     <!-- Checkbox -->
<!-- <td class="yes"> Yes          Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=yes> Yes     <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=yes> Yes     <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=yes> Yes     <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=yes> Yes     <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=yes> Yes     <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-list><a href=#attr-input-list>list</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=yes> Yes     <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-max><a href=#attr-input-max>max</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-min><a href=#attr-input-min>min</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone --> <!-- if you change this, you can merge this line with the next to save room on the chart -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=yes> Yes     <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-required><a href=#attr-input-required>required</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=yes> Yes     <!-- Checkbox -->
<!-- <td class="yes"> Yes          Radio Button -->
     <td class=yes> Yes     <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-size><a href=#attr-input-size>size</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-src><a href=#attr-input-src>src</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-input-step><a href=#attr-input-step>step</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=yes> Yes     <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

   <tbody><tr><th scope=rowgroup colspan=16>IDL attributes and methods

    <tr><th> <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=yes> Yes     <!-- Checkbox -->
<!-- <td class="yes"> Yes          Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-input-files><a href=#dom-input-files>files</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=yes> Yes     <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr class=impl><th> <code title=dom-input-value><a href=#dom-input-value>value</a></code>
     <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Hidden -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Text -->
<!-- <td class="yes"> <span title="dom-input-value-value">value</span>      Search -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- URL, Telephone -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- E-mail -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Password -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Date and Time -->
<!-- <td class="yes"> <span title="dom-input-value-value">value</span>      Date -->
<!-- <td class="yes"> <span title="dom-input-value-value">value</span>      Month -->
<!-- <td class="yes"> <span title="dom-input-value-value">value</span>      Week -->
<!-- <td class="yes"> <span title="dom-input-value-value">value</span>      Time -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Local Date and Time -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Number -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Range -->
     <td class=yes> <a href=#dom-input-value-value title=dom-input-value-value>value</a> <!-- Color -->
     <td class=yes> <a href=#dom-input-value-default-on title=dom-input-value-default-on>default/on</a> <!-- Checkbox -->
<!-- <td class="yes"> <span title="dom-input-value-default-on">default/on</span>      Radio Button -->
     <td class=yes> <a href=#dom-input-value-filename title=dom-input-value-filename>filename</a> <!-- File Upload -->
     <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Submit Button -->
     <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Image Button -->
     <td class=yes> <a href=#dom-input-value-default title=dom-input-value-default>default</a> <!-- Reset Button -->
<!-- <td class="yes"> <span title="dom-input-value-default">default</span>      Button -->

    <tr><th> <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-input-list><a href=#dom-input-list>list</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=yes> Yes     <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=no> &middot; <!-- Date and Time -->
<!-- <td class="no"> &middot;      Date -->
<!-- <td class="no"> &middot;      Month -->
<!-- <td class="no"> &middot;      Week -->
<!-- <td class="no"> &middot;      Time -->
     <td class=no> &middot; <!-- Local Date and Time -->
     <td class=no> &middot; <!-- Number -->
     <td class=no> &middot; <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code>
     <td class=no> &middot; <!-- Hidden -->
     <td class=no> &middot; <!-- Text -->
<!-- <td class="no"> &middot;      Search -->
     <td class=no> &middot; <!-- URL, Telephone -->
     <td class=no> &middot; <!-- E-mail -->
     <td class=no> &middot; <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=no> &middot; <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

   <tbody><tr><th scope=rowgroup colspan=16>Events

    <tr><th> <span title=""><code title=event-input-input><a href=#event-input-input>input</a></code> event</span>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=yes> Yes     <!-- Color -->
     <td class=no> &middot; <!-- Checkbox -->
<!-- <td class="no"> &middot;      Radio Button -->
     <td class=no> &middot; <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

    <tr><th> <span title=""><code title=event-input-change><a href=#event-input-change>change</a></code> event</span>
     <td class=no> &middot; <!-- Hidden -->
     <td class=yes> Yes     <!-- Text -->
<!-- <td class="yes"> Yes          Search -->
     <td class=yes> Yes     <!-- URL, Telephone -->
     <td class=yes> Yes     <!-- E-mail -->
     <td class=yes> Yes     <!-- Password -->
     <td class=yes> Yes     <!-- Date and Time -->
<!-- <td class="yes"> Yes          Date -->
<!-- <td class="yes"> Yes          Month -->
<!-- <td class="yes"> Yes          Week -->
<!-- <td class="yes"> Yes          Time -->
     <td class=yes> Yes     <!-- Local Date and Time -->
     <td class=yes> Yes     <!-- Number -->
     <td class=yes> Yes     <!-- Range -->
     <td class=yes> Yes     <!-- Color -->
     <td class=yes> Yes     <!-- Checkbox -->
<!-- <td class="yes"> Yes          Radio Button -->
     <td class=yes> Yes     <!-- File Upload -->
     <td class=no> &middot; <!-- Submit Button -->
     <td class=no> &middot; <!-- Image Button -->
     <td class=no> &middot; <!-- Reset Button -->
<!-- <td class="no"> &middot;      Button -->

  </table><div class=impl>

  <p>Some states of the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute define a <dfn id=value-sanitization-algorithm>value
  sanitization algorithm</dfn>.</p>

  <p>Each <code><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-value title=concept-fe-value>value</a>, which is
  exposed by the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute. Some states define an
  <dfn id=concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a number</dfn>, an
  <dfn id=concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a string</dfn>, an
  <dfn id=concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a <code>Date</code>
  object</dfn>, and an <dfn id=concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
  <code>Date</code> object to a string</dfn>, which are used by <code title=attr-input-max><a href=#attr-input-max>max</a></code>, <code title=attr-input-min><a href=#attr-input-min>min</a></code>, <code title=attr-input-step><a href=#attr-input-step>step</a></code>, <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code>.</p>

  <p>Each <code><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty
  value flag</dfn>. The <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a> must be
  initially set to false when the element is created, and must be set to true whenever the user
  interacts with the control in a way that changes the <a href=#concept-fe-value title=concept-fe-value>value</a>.
  (It is also set to true when the value is programmatically changed, as described in the definition
  of the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute.)</p>

  </div>

  <p>The <dfn id=attr-input-value title=attr-input-value><code>value</code></dfn> content attribute gives the default
  <a href=#concept-fe-value title=concept-fe-value>value</a> of the <code><a href=#the-input-element>input</a></code> element. <span class=impl>When the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute is added, set,
  or removed, if the control's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a>
  is false, the user agent must set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element
  to the value of the <code title=attr-input-value><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>value sanitization
  algorithm</a>, if one is defined.</span></p>

  <div class=impl>

  <p>Each <code><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>,
  which is exposed by the <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> IDL attribute.</p>

  <p>Each <code><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness flag</dfn>. When it is true, the
  element is said to have a <dfn id=concept-input-checked-dirty title=concept-input-checked-dirty><i>dirty checkedness</i></dfn>.
  The <a href=#concept-input-checked-dirty-flag title=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 title=concept-fe-checked>checkedness</a>.</p>

  </div>

  <p>The <dfn id=attr-input-checked title=attr-input-checked><code>checked</code></dfn> content attribute is a
  <a href=#boolean-attribute>boolean attribute</a> that gives the default <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the <code><a href=#the-input-element>input</a></code> element. <span class=impl>When the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> content attribute is added,
  if the control does not have <i title=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 title=concept-fe-checked>checkedness</a> of the element to
  true; when the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> content attribute is removed, if
  the control does not have <i title=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 title=concept-fe-checked>checkedness</a> of the element to
  false.</span></p>

  <div class=impl>

  <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> for <code><a href=#the-input-element>input</a></code>
  elements is to set the <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a> and
  <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness flag</a> back to false, set
  the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to the value of the <code title=attr-input-value><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 title=concept-fe-checked>checkedness</a> of the element to true if
  the element has a <code title=attr-input-checked><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 title=concept-input-type-file-selected>selected
  files</a>, and then invoke the <a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state defines one.</p>

  <p>Each <code><a href=#the-input-element>input</a></code> element can be <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>. Except where
  otherwise specified, an <code><a href=#the-input-element>input</a></code> element is always <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>. Similarly, except where otherwise specified, the user
  agent should not allow the user to modify the element's <a href=#concept-fe-value title=concept-fe-value>value</a> or <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>.</p>

  <p>When an <code><a href=#the-input-element>input</a></code> element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, it is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</p>

  <p class=note>The <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute can also in some
  cases (e.g. for the <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a> state, but not the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state) stop an <code><a href=#the-input-element>input</a></code> element from
  being <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</p>

  <p>The <a href=#concept-node-clone-ext title=concept-node-clone-ext>cloning steps</a> for <code><a href=#the-input-element>input</a></code> elements
  must propagate the <a href=#concept-fe-value title=concept-fe-value>value</a>, <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a>, <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>, and <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness flag</a> from the node being cloned
  to the copy.</p>

  <hr><p>When an <code><a href=#the-input-element>input</a></code> element is first created, the element's rendering and behavior must
  be set to the rendering and behavior defined for the <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute's state, and the <a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if one is defined for the
  <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's state, must be invoked.</p>

  </div>

  <div id=input-type-change class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
  changes state, the user agent must run the following steps:</p>

  <ol><!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/602 --><li><p>If the previous state of the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
   put the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute in the <i title=dom-input-value-value><a href=#dom-input-value-value>value</a></i> mode, and the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is not the empty string, and the new state of the element's
   <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute puts the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute in either the <i title=dom-input-value-default><a href=#dom-input-value-default>default</a></i> mode or the <i title=dom-input-value-default-on><a href=#dom-input-value-default-on>default/on</a></i> mode, then set the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute to the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</li>

   <li><p>Otherwise, if the previous state of the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute put the <code title=dom-input-value><a href=#dom-input-value>value</a></code>
   IDL attribute in any mode other than the <i title=dom-input-value-value><a href=#dom-input-value-value>value</a></i> mode, and the
   new state of the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute puts the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute in the <i title=dom-input-value-value><a href=#dom-input-value-value>value</a></i> mode, then set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to the value of the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute, if there is one, or the empty string
   otherwise, and then set the control's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value
   flag</a> to false.</li>

   <li><p>Update the element's rendering and behavior to the new state's.</li>

   <li><p>Invoke the <a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if one is defined for the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's new state.</li>

  </ol></div>

  <hr><p>
  The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
  The <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute controls how the element's <a href=#the-directionality title="the directionality">directionality</a> is submitted.
  The <code title=attr-fe-disabled><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 title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the <code><a href=#the-input-element>input</a></code> element with its <a href=#form-owner>form owner</a>.
  The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
  The <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute controls the user interface's input modality for the control.
  The <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute controls how the user agent provides autofill behavior.
  </p>

  <div class=impl>

  <p>The <dfn id=dom-input-indeterminate title=dom-input-indeterminate><code>indeterminate</code></dfn> IDL attribute must
  initially be set to false. On getting, it must return the last value it was set to. On setting, it
  must be set to the new value. It has no effect except for changing the appearance of <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>checkbox</a> controls.</p>

  <p>The <dfn id=dom-input-accept title=dom-input-accept><code>accept</code></dfn>, <dfn id=dom-input-alt title=dom-input-alt><code>alt</code></dfn>, <dfn id=dom-input-max title=dom-input-max><code>max</code></dfn>,
  <dfn id=dom-input-min title=dom-input-min><code>min</code></dfn>, <dfn id=dom-input-multiple title=dom-input-multiple><code>multiple</code></dfn>, <dfn id=dom-input-pattern title=dom-input-pattern><code>pattern</code></dfn>, <dfn id=dom-input-placeholder title=dom-input-placeholder><code>placeholder</code></dfn>, <dfn id=dom-input-required title=dom-input-required><code>required</code></dfn>, <dfn id=dom-input-size title=dom-input-size><code>size</code></dfn>, <dfn id=dom-input-src title=dom-input-src><code>src</code></dfn>,
  and <dfn id=dom-input-step title=dom-input-step><code>step</code></dfn> IDL attributes must <a href=#reflect>reflect</a>
  the respective content attributes of the same name. The <dfn id=dom-input-dirname title=dom-input-dirName><code>dirName</code></dfn> IDL attribute must <a href=#reflect>reflect</a> the
  <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> content attribute. The <dfn id=dom-input-readonly title=dom-input-readOnly><code>readOnly</code></dfn> IDL attribute must <a href=#reflect>reflect</a> the
  <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> content attribute. The <dfn id=dom-input-defaultchecked title=dom-input-defaultChecked><code>defaultChecked</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> content attribute. The
  <dfn id=dom-input-defaultvalue title=dom-input-defaultValue><code>defaultValue</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute.</p>

  <p>The <dfn id=dom-input-type title=dom-input-type><code>type</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the respective content attribute of the same name, <a href=#limited-to-only-known-values>limited to only known values</a>. The
  <dfn id=dom-input-inputmode title=dom-input-inputmode><code>inputMode</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> content attribute,
  <a href=#limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-input-maxlength title=dom-input-maxLength><code>maxLength</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> content attribute, <a href=#limited-to-only-non-negative-numbers>limited to only
  non-negative numbers</a>.</p>

  <p>The IDL attributes <dfn id=dom-input-width title=dom-input-width><code>width</code></dfn> and <dfn id=dom-input-height title=dom-input-height><code>height</code></dfn> must return the rendered width and height of
  the image, in CSS pixels, if an image is <a href=#being-rendered>being rendered</a>, and is being rendered to a
  visual medium; or else the intrinsic width and height of the image, in CSS pixels, if an image is
  <i title=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 title=input-img-available><a href=#input-img-available>available</a></i>. When the <code><a href=#the-input-element>input</a></code> element's
  <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is not in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, then no image is <i title=input-img-available><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 title=reflect>reflected</a> the respective
  content attributes of the same name.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
  <a href=#the-constraint-validation-api>constraint validation API</a>. The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL
  attribute provides a list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>, <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods and IDL attributes
  expose the element's text selection. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the element's forms API.</p>

  </div>



  <h5 id=states-of-the-type-attribute><span class=secno>4.10.7.1 </span>States of the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute</h5>


  <h6 id="hidden-state-(type=hidden)"><span class=secno>4.10.7.1.1 </span><dfn title=attr-input-type-hidden>Hidden</dfn> state (<code title="">type=hidden</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a value that is not intended to be
  examined or manipulated by the user.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state, it is <a href=#barred-from-constraint-validation>barred from constraint
  validation</a>.</p>

  </div>

  <p>If the <code title=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>case-sensitive</a> match for the string "<code title=attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>", then the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute must be omitted.</p>

  <div class=bookkeeping>

   <p>The
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>
   IDL attribute <a href=#concept-input-apply title=concept-input-apply>applies</a> to this element and is
   in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#do-not-apply>do not apply</a>.</p>

  </div>


  <h6 id="text-(type=text)-state-and-search-state-(type=search)"><span class=secno>4.10.7.1.2 </span><dfn title=attr-input-type-text>Text</dfn> (<code title="">type=text</code>) state and <dfn title=attr-input-type-search>Search</dfn> state (<code title="">type=search</code>)</h6>

  <!-- v2 idea: applying input masks to <input>, e.g. for entering
       data with slashes and dashes (ack Greg Kilwein)
  -->

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state or the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a one line plain text edit control for
  the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  <p class=note>The difference between the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state
  and the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a> state is primarily stylistic: on
  platforms where search fields are distinguished from regular text fields, the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a> state might result in an appearance consistent with
  the platform's search fields rather than appearing like a regular text field.</p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, its <a href=#concept-fe-value title=concept-fe-value>value</a> should be editable by the user. User agents must not allow
  users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  <!-- this next bit is also in the <textarea> section -->
  <!-- and something similar is in the session history section -->
  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
  user to change the writing direction of the element, setting it either to a left-to-right writing
  direction or a right-to-left writing direction. If the user does so, the user agent must then run
  the following steps:</p>

  <ol><li><p>Set the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute to "<code title=attr-dir-ltr><a href=#attr-dir-ltr>ltr</a></code>" if the user selected a left-to-right writing direction, and
   "<code title=attr-dir-rtl><a href=#attr-dir-rtl>rtl</a></code>" if the user selected a right-to-left writing
   direction.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-input>input</code> at the <code><a href=#the-input-element>input</a></code> element.</li>

  </ol></div>

  <p>The <code title=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>

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks>Strip line
  breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, 
   <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
   <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

  </div>


  <h6 id="telephone-state-(type=tel)"><span class=secno>4.10.7.1.3 </span><dfn title=attr-input-type-tel>Telephone</dfn> state (<code title="">type=tel</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for editing a telephone number
  given in the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, its <a href=#concept-fe-value title=concept-fe-value>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 title=concept-fe-value>values</a> that the
  user enters. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE
  RETURN (CR) characters into the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  </div>

  <p>The <code title=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>

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks>Strip line
  breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  </div>

  <p class=note>Unlike the <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a> and <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> types, the <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>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 title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute or the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method to hook into the client-side
  validation mechanism.</p>


  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, 
   <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
   <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

  </div>


  <h6 id="url-state-(type=url)"><span class=secno>4.10.7.1.4 </span><dfn title=attr-input-type-url>URL</dfn> state (<code title="">type=url</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for editing a single
  <a href=#absolute-url>absolute URL</a> given in the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-fe-value>value</a>. User agents
  may allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not
  a <a href=#valid-url title="valid URL">valid</a> <a href=#absolute-url>absolute URL</a>, but may also or instead
  automatically escape characters entered by the user so that the <a href=#concept-fe-value title=concept-fe-value>value</a> is always a <a href=#valid-url title="valid URL">valid</a>
  <a href=#absolute-url>absolute URL</a> (even if that isn't the actual value seen and edited by the user in the
  interface). User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>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 title=concept-fe-value>value</a>.</p>

  </div>

  <p>The <code title=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>valid URL potentially surrounded by spaces</a> that is also an
  <a href=#absolute-url>absolute URL</a>.</p>

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks>Strip line
  breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>, then <a href=#strip-leading-and-trailing-whitespace>strip leading and
  trailing whitespace</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value title=concept-fe-value>value</a>
  of the element is neither the empty string nor a <a href=#valid-url title="valid URL">valid</a>
  <a href=#absolute-url>absolute URL</a>, the element is <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
   <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

  </div>

  <div class=example>

   <p>If a document contained the following markup:</p>

   <pre>&lt;input type="url" name="location" list="urls"&gt;
&lt;datalist id="urls"&gt;
 &lt;option label="MIME: Format of Internet Message Bodies" value="http://tools.ietf.org/html/rfc2045"&gt;
 &lt;option label="HTML 4.01 Specification" value="http://www.w3.org/TR/html4/"&gt;
 &lt;option label="Form Controls" value="http://www.w3.org/TR/xforms/slice8.html#ui-commonelems-hint"&gt;
 &lt;option label="Scalable Vector Graphics (SVG) 1.1 Specification" value="http://www.w3.org/TR/SVG/"&gt;
 &lt;option label="Feature Sets - SVG 1.1 - 20030114" value="http://www.w3.org/TR/SVG/feature.html"&gt;
 &lt;option label="The Single UNIX Specification, Version 3" value="http://www.unix-systems.org/version3/"&gt;
&lt;/datalist&gt;
</pre>

   <p>...and the user had typed "<kbd>www.w3</kbd>", and the user agent had also found that the user
   had visited <code>http://www.w3.org/Consortium/#membership</code> and
   <code>http://www.w3.org/TR/XForms/</code> in the recent past, then the rendering might look like
   this:</p>

   <p><img src=http://images.whatwg.org/sample-url.png width=472 alt='A text box with an icon on the left followed by the text "www.w3" and a cursor, with a drop down button on the right hand side; with, below, a drop down box containing a list of six URLs on the left, with the first four having grayed out labels on the right; and a scroll bar to the right of the drop down box, indicating further values are available.' height=134></p>

   <p>The first four URLs in this sample consist of the four URLs in the author-specified list that
   match the text the user has entered, sorted in some UA-defined manner (maybe by how frequently
   the user refers to those URLs). Note how the UA is using the knowledge that the values are URLs
   to allow the user to omit the scheme part and perform intelligent matching on the domain
   name.</p>

   <p>The last two URLs (and probably many more, given the scrollbar's indications of more values
   being available) are the matches from the user agent's session history data. This data is not
   made available to the page DOM. In this particular case, the UA has no titles to provide for
   those values.</p>

  </div>


  <h6 id="e-mail-state-(type=email)"><span class=secno>4.10.7.1.5 </span><dfn title=attr-input-type-email>E-mail</dfn> state (<code title="">type=email</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> state, the rules in this section apply.</p>

  </div>

  <p>How the <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> state operates depends on whether the
  <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is specified or not.</p>

  <dl class=switch><dt>When the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is not specified on the
   element</dt>

   <dd>

    <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for editing an e-mail
    address given in the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

    <div class=impl>

    <p>If the element is <i title=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 title=concept-fe-value>value</a>. User agents may allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that is not a <a href=#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 title=concept-fe-value>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 title=concept-fe-value>value</a>. User agents may transform the <a href=#concept-fe-value title=concept-fe-value>value</a> for display and editing; in particular, user agents should
    convert punycode in the <a href=#concept-fe-value title=concept-fe-value>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>suffering from bad
    input</a>.</p>

    </div>

    <p>The <code title=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>valid e-mail address</a>.</p>

    <div class=impl>

    <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks>Strip
    line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>, then <a href=#strip-leading-and-trailing-whitespace>strip
    leading and trailing whitespace</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

    <p>When the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is removed, the user
    agent must run the <a href=#value-sanitization-algorithm>value sanitization algorithm</a>.</p>

    <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value title=concept-fe-value>value</a>
    of the element is neither the empty string nor a single <a href=#valid-e-mail-address>valid e-mail address</a>, the
    element is <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p>

    </div>

   </dd>

   <dt>When the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute <em>is</em> specified on
   the element</dt>

   <dd>

    <div class=impl>

    <p>The element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a> are the result of <a href=#split-a-string-on-commas title="split a string on commas">splitting on commas</a> the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

    </div>

    <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for adding, removing, and
    editing the e-mail addresses given in the element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a>.</p>

    <div class=impl>

    <p>If the element is <i title=concept-fe-mutable><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 title=concept-fe-values>value<em>s</em></a>. User agents may allow the user to set any
    individual value in the list of <a href=#concept-fe-value title=concept-fe-value>value<em>s</em></a> to a
    string that is not a <a href=#valid-e-mail-address>valid e-mail address</a>, but must not allow users to set any
    individual value to a string containing U+002C COMMA (,), U+000A LINE FEED (LF), or U+000D
    CARRIAGE RETURN (CR) characters. User agents should allow the user to remove all the addresses
    in the element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a>. User agents may
    transform the <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a> for display and editing; in
    particular, user agents should convert punycode in the <a href=#concept-fe-value title=concept-fe-value>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>suffering from bad input</a>.</p>

    <p>Whenever the user changes the element's <a href=#concept-fe-value title=concept-fe-value>value<em>s</em></a>, the user agent must run the following
    steps:</p>

    <ol><li><p>Let <var title="">latest values</var> be a copy of the element's <a href=#concept-fe-value title=concept-fe-value>value<em>s</em></a>.</li>

     <!-- It's a copy because /values/ might include leading and trailing spaces that we don't
     necessarily want to remove from the UI but that we do want to remove before serialising. -->

     <li><p><a href=#strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from each value in <var title="">latest values</var>.</li>

     <li><p>Let the element's <a href=#concept-fe-value title=concept-fe-value>value</a> be the result of
     concatenating all the values in <var title="">latest values</var>, separating each value from
     the next by a single U+002C COMMA character (,), maintaining the list's order.</li>

    </ol></div>

    <p>The <code title=attr-input-value><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>valid e-mail address list</a>.</p>

    <div class=impl>

    <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>:</p>

    <ol><li><p><a href=#split-a-string-on-commas title="split a string on commas">Split on commas</a> the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, <a href=#strip-leading-and-trailing-whitespace>strip leading and trailing whitespace</a> from
     each resulting token, if any, and let the element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a> be the (possibly empty) resulting list of
     (possibly empty) tokens, maintaining the original order.</li>

     <li><p>Let the element's <a href=#concept-fe-value title=concept-fe-value>value</a> be the result of
     concatenating the element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a>, separating
     each value from the next by a single U+002C COMMA character (,), maintaining the list's
     order.</li>

    </ol><p>When the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is set, the user agent
    must run the <a href=#value-sanitization-algorithm>value sanitization algorithm</a>.</p>

    <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value title=concept-fe-value>value</a>
    of the element is not a <a href=#valid-e-mail-address-list>valid e-mail address list</a>, the element is <a href=#suffering-from-a-type-mismatch>suffering
    from a type mismatch</a>.</p>

    </div>

   </dd>

  </dl><p>A <dfn id=valid-e-mail-address>valid e-mail address</dfn> is a string that matches the <code title="">email</code>
  production of the following ABNF, the character set for which is Unicode. This ABNF implements the
  extensions described in RFC 1123. <a href=#refsABNF>[ABNF]</a> <a href=#refsRFC5322>[RFC5322]</a> <a href=#refsRFC1034>[RFC1034]</a> <a href=#refsRFC1123>[RFC1123]</a></p>

  <pre>email         = 1*( atext / "." ) "@" label *( "." label )
label         = let-dig [ [ ldh-str ] let-dig ]  ; limited to a length of 63 characters by <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a>
atext         = &lt; as defined in <a href=http://tools.ietf.org/html/rfc5322#section-3.2.3>RFC 5322 section 3.2.3</a> &gt;
let-dig       = &lt; as defined in <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a> &gt;
ldh-str       = &lt; as defined in <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a> &gt;</pre>

  <!-- Domain syntax based on section 3.5 of [RFC1034] and section 2.1 of [RFC1123] -->

  <p class=note>This requirement is a <a href=#willful-violation>willful violation</a> of RFC 5322, which defines a
  syntax for e-mail addresses that is simultaneously too strict (before the "@" character), too
  vague (after the "@" character), and too lax (allowing comments, whitespace characters, and quoted
  strings in manners unfamiliar to most users) to be of practical use here.</p>

  <div class=note>

   <!--<p><i>This note, like all notes, is non-normative. In case of a conflict
   between this note and the above definition, the above definition takes precedence. Please report
   any such inconsistencies!</i></p>-->

   <p>The following JavaScript- and Perl-compatible regular expression is an implementation of the
   above definition.</p>

   <pre>/^[a-zA-Z0-9.!#$%&amp;'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/</pre>

   <!-- based on: http://blog.gerv.net/2011/05/html5_email_address_regexp/ -->

  </div>

  <p>A <dfn id=valid-e-mail-address-list>valid e-mail address list</dfn> is a <a href=#set-of-comma-separated-tokens>set of comma-separated tokens</a>, where
  each token is itself a <a href=#valid-e-mail-address>valid e-mail address</a>. <span class=impl>To obtain the list of
  tokens from a <a href=#valid-e-mail-address-list>valid e-mail address list</a>, and implementation must <a href=#split-a-string-on-commas title="split a
  string on commas">split the string on commas</a>.</span></p>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code> and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>

<!--
   <p>The following common <code>input</code> element content
   attributes, IDL attributes, and methods <span title="concept-input-apply">apply</span> to the element when
   the <code title="attr-input-multiple">multiple</code> attribute is
   not specified:
   .</p>
-->

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

  </div>


  <h6 id="password-state-(type=password)"><span class=secno>4.10.7.1.6 </span><dfn title=attr-input-type-password>Password</dfn> state (<code title="">type=password</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#password-state-(type=password)" title=attr-input-type-password>Password</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a one line plain text edit control for
  the element's <a href=#concept-fe-value title=concept-fe-value>value</a>. The user agent should obscure the value
  so that people other than the user cannot see it.</p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, its <a href=#concept-fe-value title=concept-fe-value>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 title=concept-fe-value>value</a>.</p>

  </div>

  <p>The <code title=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>

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks>Strip line
  breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-size><a href=#attr-input-size>size</a></code> content attributes;
   <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes;
   <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

  </div>


  <h6 id="date-and-time-state-(type=datetime)"><span class=secno>4.10.7.1.7 </span><dfn title=attr-input-type-datetime>Date and Time</dfn> state (<code title="">type=datetime</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a specific <a href=#concept-datetime title=concept-datetime>global date and time</a>. <span class=impl>User agents may display
  the date and time in whatever time zone is appropriate for the user.</span></p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-datetime>global date and time</a> represented by its
  <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-global-date-and-time-string title="parse a global date and
  time string">parsing a global date and time</a> from it. User agents must not allow the user to
  set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a non-empty string that is not a
  <a href=#valid-normalized-forced-utc-global-date-and-time-string>valid normalized forced-UTC global date and time string</a>, though user agents may allow
  the user to set and view the time in another time zone and silently translate the time to and from
  the UTC time zone in the <a href=#concept-fe-value title=concept-fe-value>value</a>. If the user agent provides a
  user interface for selecting a <a href=#concept-datetime title=concept-datetime>global date and time</a>, then
  the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#valid-normalized-forced-utc-global-date-and-time-string>valid normalized forced-UTC
  global date and time string</a> representing the user's selection. User agents should allow the
  user to set the <a href=#concept-fe-value title=concept-fe-value>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-normalized-forced-utc-global-date-and-time-string>valid normalized forced-UTC global date and time string</a>,
  the control is <a href=#suffering-from-bad-input>suffering from bad input</a>.</p>

  </div>

  <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  the difference between the input format and submission format for date, time, and number form
  controls<span class=impl>, and the <a href=#input-impl-notes>implementation notes</a>
  regarding localization of form controls</span>.</p>

  <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
  have a value that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p> <!-- ok to set
  out-of-range value, we never know when we might have to represent bogus input; also ok to be
  non-UTC, we convert it -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is a <a href=#valid-global-date-and-time-string>valid global date and time
  string</a>, then adjust the time so that the <a href=#concept-fe-value title=concept-fe-value>value</a>
  represents the same point in time but expressed in the UTC time zone as a <a href=#valid-normalized-forced-utc-global-date-and-time-string>valid normalized
  forced-UTC global date and time string</a>, otherwise, set it to the empty string instead.</p>

  </div>

  <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
  a <a href=#valid-global-date-and-time-string>valid global date and time string</a>. The <code title=attr-input-max><a href=#attr-input-max>max</a></code>
  attribute, if specified, must have a value that is a <a href=#valid-global-date-and-time-string>valid global date and time
  string</a>.</p>

  <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is expressed in seconds. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1000 (which
  converts the seconds to milliseconds, as used in the other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 60 seconds.</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-datetime title=concept-datetime>global date and time</a> for which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step mismatch</a>.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-global-date-and-time-string title="parse a global date and time string">parsing a global date and time</a> from <var title="">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 title="">1970-01-01T00:00:00.0Z</code>") to the parsed <a href=#concept-datetime title=concept-datetime>global date and time</a>, ignoring leap seconds.</p>

  <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-normalized-forced-utc-global-date-and-time-string>valid normalized forced-UTC global date and time string</a> that represents the <a href=#concept-datetime title=concept-datetime>global date and time</a> that is <var title="">input</var>
  milliseconds after midnight UTC on the morning of 1970-01-01 (the time represented by the value
  "<code title="">1970-01-01T00:00:00.0Z</code>").</p>

  <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a
  <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>:
  If <a href=#parse-a-global-date-and-time-string title="parse a global date and time string">parsing a global date and time</a> from
  <var title="">input</var> results in an error, then return an error; otherwise, return <a href=#create-a-date-object title="create a Date object">a new <code>Date</code> object</a> representing the parsed <a href=#concept-datetime title=concept-datetime>global date and time</a>, expressed in UTC.</p>

  <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
  <code>Date</code> object to a string</a>, given a <code>Date</code> object <var title="">input</var>, is as follows</strong>: Return a <a href=#valid-normalized-forced-utc-global-date-and-time-string>valid normalized forced-UTC global
  date and time string</a> that represents the <a href=#concept-datetime title=concept-datetime>global date and
  time</a> that is represented by <var title="">input</var>.</p>

  </div>

  <div class=note id=only-contemporary-times>

   <p>The <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state (and other date- and
   time-related states described in subsequent sections) is not intended for the entry of values for
   which a precise date and time relative to the contemporary calendar cannot be established. For
   example, it would be inappropriate for the entry of times like "one millisecond after the big
   bang", "the early part of the Jurassic period", or "a winter around 250 BCE".</p>

   <p>For the input of dates before the introduction of the Gregorian calendar, authors are
   encouraged to not use the <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state (and
   the other date- and time-related states described in subsequent sections), as user agents are not
   required to support converting dates and times from earlier periods to the Gregorian calendar,
   and asking users to do so manually puts an undue burden on users. (This is complicated by the
   manner in which the Gregorian calendar was phased in, which occurred at different times in
   different countries, ranging from partway through the 16th century all the way to early in the
   20th.) Instead, authors are encouraged to provide fine-grained input controls using the
   <code><a href=#the-select-element>select</a></code> element and <code><a href=#the-input-element>input</a></code> elements with the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
   <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>

  <div class=example>

   <p>The following fragment shows part of a calendar application. A user can specify a date and
   time for a meeting (in his local time zone, probably, though the user agent can allow the user to
   change that), and since the submitted data includes the time-zone offset, the application can
   ensure that the meeting is shown at the correct time regardless of the time zones used by all the
   participants.</p>

   <pre>&lt;fieldset&gt;
 &lt;legend&gt;Add Meeting&lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;Meeting name: &lt;input type=text name="meeting.label"&gt;&lt;/label&gt;
 &lt;p&gt;&lt;label&gt;Meeting time: &lt;input type=datetime name="meeting.start"&gt;&lt;/label&gt;
&lt;/fieldset&gt;</pre>

   <p>Had the application used the <code title=attr-input-type-datetime-local><a href="#local-date-and-time-state-(type=datetime-local)">datetime-local</a></code> type instead, the calendar
   application would have also had to explicitly determine which time zone the user intended.</p>

   <p>For events where the precise time is to vary as the user travels (e.g. "celebrate the new
   year!"), and for recurring events that are to stay at the same time for a specific geographic
   location even though that location may go in and out of daylight savings time (e.g. "bring the
   kid to school"), the <code title=attr-input-type-datetime-local><a href="#local-date-and-time-state-(type=datetime-local)">datetime-local</a></code> type
   combined with a <code><a href=#the-select-element>select</a></code> element (or other similar control) to pick the specific
   geographic location to which to anchor the time would be more appropriate.</p>

  </div>


  <h6 id="date-state-(type=date)"><span class=secno>4.10.7.1.8 </span><dfn title=attr-input-type-date>Date</dfn> state (<code title="">type=date</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a specific <a href=#concept-date title=concept-date>date</a>.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-date>date</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-date-string title="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 title=concept-fe-value>value</a> to a non-empty string that is not a <a href=#valid-date-string>valid date
  string</a>. If the user agent provides a user interface for selecting a <a href=#concept-date title=concept-date>date</a>, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set
  to a <a href=#valid-date-string>valid date string</a> representing the user's selection. User agents should allow
  the user to set the <a href=#concept-fe-value title=concept-fe-value>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>valid date string</a>, the control is <a href=#suffering-from-bad-input>suffering from bad
  input</a>.</p>

  </div>

  <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  the difference between the input format and submission format for date, time, and number form
  controls<span class=impl>, and the <a href=#input-impl-notes>implementation notes</a>
  regarding localization of form controls</span>.</p>

  <p>The <code title=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>valid date string</a>.</p> <!-- ok to set out-of-range value, we
  never know when we might have to represent bogus input -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-date-string>valid date string</a>, then
  set it to the empty string instead.</p>

  </div>

  <p>The <code title=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>valid date string</a>. The <code title=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>valid date string</a>.</p>

  <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is expressed in days. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 86,400,000
  (which converts the days to milliseconds, as used in the other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 1 day.</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-date title=concept-date>date</a> for which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a
  step mismatch">suffer from a step mismatch</a>.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-date-string title="parse a date string">parsing a date</a> from <var title="">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 title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on the morning of the parsed <a href=#concept-date title=concept-date>date</a>, ignoring leap seconds.</p>

  <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-date-string>valid date string</a> that represents the <a href=#concept-date title=concept-date>date</a> that, in
  UTC, is current <var title="">input</var> milliseconds after midnight UTC on the morning of
  1970-01-01 (the time represented by the value "<code title="">1970-01-01T00:00:00.0Z</code>").</p>

  <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a
  <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>:
  If <a href=#parse-a-date-string title="parse a date string">parsing a date</a> from <var title="">input</var> results
  in an error, then return an error; otherwise, return <a href=#create-a-date-object title="create a Date object">a new
  <code>Date</code> object</a> representing midnight UTC on the morning of the parsed <a href=#concept-date title=concept-date>date</a>.</p>

  <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
  <code>Date</code> object to a string</a>, given a <code>Date</code> object <var title="">input</var>, is as follows</strong>: Return a <a href=#valid-date-string>valid date string</a> that
  represents the <a href=#concept-date title=concept-date>date</a> current at the time represented by <var title="">input</var> in the UTC time zone.</p>

  </div>

  <p class=note>See <a href=#only-contemporary-times>the note on historical dates</a> in the
  <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state section.</p>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
   <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>


  <h6 id="month-state-(type=month)"><span class=secno>4.10.7.1.9 </span><dfn title=attr-input-type-month>Month</dfn> state (<code title="">type=month</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#month-state-(type=month)" title=attr-input-type-month>Month</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a specific <a href=#concept-month title=concept-month>month</a>.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-month>month</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-month-string title="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 title=concept-fe-value>value</a> to a non-empty string that is not a <a href=#valid-month-string>valid month
  string</a>. If the user agent provides a user interface for selecting a <a href=#concept-month title=concept-month>month</a>, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be
  set to a <a href=#valid-month-string>valid month string</a> representing the user's selection. User agents should
  allow the user to set the <a href=#concept-fe-value title=concept-fe-value>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>valid month string</a>, the control is <a href=#suffering-from-bad-input>suffering from bad
  input</a>.</p>

  </div>

  <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  the difference between the input format and submission format for date, time, and number form
  controls<span class=impl>, and the <a href=#input-impl-notes>implementation notes</a>
  regarding localization of form controls</span>.</p>

  <p>The <code title=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>valid month string</a>.</p> <!-- ok to set out-of-range value, we
  never know when we might have to represent bogus input -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-month-string>valid month string</a>,
  then set it to the empty string instead.</p>

  </div>

  <p>The <code title=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>valid month string</a>. The <code title=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>valid month string</a>.</p>

  <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is expressed in months. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1 (there is no
  conversion needed as the algorithms use months).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 1 month.</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-month title=concept-month>month</a> for which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a
  step mismatch">suffer from a step mismatch</a>.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-month-string title="parse a month string">parsing a month</a> from <var title="">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 title=concept-month>month</a>.</p>

  <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-month-string>valid month string</a> that represents the <a href=#concept-month title=concept-month>month</a> that
  has <var title="">input</var> months between it and January 1970.</p>

  <!-- note - it doesn't matter exactly how many months are "between" two months, so long as the UA
  implements this consistently. The number is never actually exposed. -->

  <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a
  <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>:
  If <a href=#parse-a-month-string title="parse a month string">parsing a month</a> from <var title="">input</var>
  results in an error, then return an error; otherwise, return <a href=#create-a-date-object title="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 title=concept-month>month</a>.</p>

  <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
  <code>Date</code> object to a string</a>, given a <code>Date</code> object <var title="">input</var>, is as follows</strong>: Return a <a href=#valid-month-string>valid month string</a> that
  represents the <a href=#concept-month title=concept-month>month</a> current at the time represented by <var title="">input</var> in the UTC time zone.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
   <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>


  <h6 id="week-state-(type=week)"><span class=secno>4.10.7.1.10 </span><dfn title=attr-input-type-week>Week</dfn> state (<code title="">type=week</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#week-state-(type=week)" title=attr-input-type-week>Week</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a specific <a href=#concept-week title=concept-week>week</a>.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-week>week</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-week-string title="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 title=concept-fe-value>value</a> to a non-empty string that is not a <a href=#valid-week-string>valid week
  string</a>. If the user agent provides a user interface for selecting a <a href=#concept-week title=concept-week>week</a>, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set
  to a <a href=#valid-week-string>valid week string</a> representing the user's selection. User agents should allow
  the user to set the <a href=#concept-fe-value title=concept-fe-value>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>valid week string</a>, the control is <a href=#suffering-from-bad-input>suffering from bad
  input</a>.</p>

  </div>

  <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  the difference between the input format and submission format for date, time, and number form
  controls<span class=impl>, and the <a href=#input-impl-notes>implementation notes</a>
  regarding localization of form controls</span>.</p>

  <p>The <code title=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>valid week string</a>.</p> <!-- ok to set out-of-range value, we
  never know when we might have to represent bogus input -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-week-string>valid week string</a>, then
  set it to the empty string instead.</p>

  </div>

  <p>The <code title=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>valid week string</a>. The <code title=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>valid week string</a>.</p>

  <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is expressed in weeks. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 604,800,000
  (which converts the weeks to milliseconds, as used in the other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 1 week. <span class=impl>The <a href=#concept-input-step-default-base title=concept-input-step-default-base>default step base</a> is &minus;259,200,000 (the start
  of week 1970-W01).</span></p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-week title=concept-week>week</a> for which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a
  step mismatch">suffer from a step mismatch</a>.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-week-string title="parse a week string">parsing a week string</a> from <var title="">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 title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on the morning of the Monday of the
  parsed <a href=#concept-week title=concept-week>week</a>, ignoring leap seconds.</p>

  <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-week-string>valid week string</a> that represents the <a href=#concept-week title=concept-week>week</a> that, in
  UTC, is current <var title="">input</var> milliseconds after midnight UTC on the morning of
  1970-01-01 (the time represented by the value "<code title="">1970-01-01T00:00:00.0Z</code>").</p>

  <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a
  <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>:
  If <a href=#parse-a-week-string title="parse a week string">parsing a week</a> from <var title="">input</var> results
  in an error, then return an error; otherwise, return <a href=#create-a-date-object title="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 title=concept-week>week</a>.</p>

  <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
  <code>Date</code> object to a string</a>, given a <code>Date</code> object <var title="">input</var>, is as follows</strong>: Return a <a href=#valid-week-string>valid week string</a> that
  represents the <a href=#concept-week title=concept-week>week</a> current at the time represented by <var title="">input</var> in the UTC time zone.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
   <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>


  <h6 id="time-state-(type=time)"><span class=secno>4.10.7.1.11 </span><dfn title=attr-input-type-time>Time</dfn> state (<code title="">type=time</code>)</h6>

  <!-- v2: allow min="" and max="" to be set such that the range crosses midnight, as in <input
  type=time min="23:00" max="02:00"> (from http://www.w3.org/Bugs/Public/show_bug.cgi?id=7688) -->

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#time-state-(type=time)" title=attr-input-type-time>Time</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a specific <a href=#concept-time title=concept-time>time</a>.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-time>time</a> represented by its <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-time-string title="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 title=concept-fe-value>value</a> to a non-empty string that is not a <a href=#valid-time-string>valid time
  string</a>. If the user agent provides a user interface for selecting a <a href=#concept-time title=concept-time>time</a>, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set
  to a <a href=#valid-time-string>valid time string</a> representing the user's selection. User agents should allow
  the user to set the <a href=#concept-fe-value title=concept-fe-value>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>valid time string</a>, the control is <a href=#suffering-from-bad-input>suffering from bad
  input</a>.</p>

  </div>

  <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  the difference between the input format and submission format for date, time, and number form
  controls<span class=impl>, and the <a href=#input-impl-notes>implementation notes</a>
  regarding localization of form controls</span>.</p>

  <p>The <code title=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>valid time string</a>.</p> <!-- ok to set out-of-range value, we
  never know when we might have to represent bogus input -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-time-string>valid time string</a>, then
  set it to the empty string instead.</p>

  </div>

  <p>The <code title=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>valid time string</a>. The <code title=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>valid time string</a>.</p>

  <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is expressed in seconds. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1000 (which
  converts the seconds to milliseconds, as used in the other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 60 seconds.</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-time title=concept-time>time</a> for which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a
  step mismatch">suffer from a step mismatch</a>.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-time-string title="parse a time string">parsing a time</a> from <var title="">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 title=concept-time>time</a> on a day with no time changes.</p>

  <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-time-string>valid time string</a> that represents the <a href=#concept-time title=concept-time>time</a> that is
  <var title="">input</var> milliseconds after midnight on a day with no time changes.</p>

  <p><strong>The <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a
  <code>Date</code> object</a>, given a string <var title="">input</var>, is as follows</strong>:
  If <a href=#parse-a-time-string title="parse a time string">parsing a time</a> from <var title="">input</var> results
  in an error, then return an error; otherwise, return <a href=#create-a-date-object title="create a Date object">a new
  <code>Date</code> object</a> representing the parsed <a href=#concept-time title=concept-time>time</a> in
  UTC on 1970-01-01.</p>

  <p><strong>The <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a
  <code>Date</code> object to a string</a>, given a <code>Date</code> object <var title="">input</var>, is as follows</strong>: Return a <a href=#valid-time-string>valid time string</a> that
  represents the UTC <a href=#concept-time title=concept-time>time</a> component that is represented by <var title="">input</var>.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>,
   <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>


  <h6 id="local-date-and-time-state-(type=datetime-local)"><span class=secno>4.10.7.1.12 </span><dfn title=attr-input-type-datetime-local>Local Date and Time</dfn> state (<code title="">type=datetime-local</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#local-date-and-time-state-(type=datetime-local)" title=attr-input-type-datetime-local>Local Date and Time</a> state, the rules in
  this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>, with no time-zone offset
  information.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-datetime-local>date and time</a> represented by its
  <a href=#concept-fe-value title=concept-fe-value>value</a>, as obtained by <a href=#parse-a-local-date-and-time-string title="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 title=concept-fe-value>value</a> to a non-empty string that is not a <a href=#valid-normalized-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 title=concept-datetime-local>local date and time</a>, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#valid-normalized-local-date-and-time-string>valid normalized local date and time
  string</a> representing the user's selection. User agents should allow the user to set the
  <a href=#concept-fe-value title=concept-fe-value>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-normalized-local-date-and-time-string>valid normalized local date and time string</a>, the control is
  <a href=#suffering-from-bad-input>suffering from bad input</a>.</p>

  </div>

  <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  the difference between the input format and submission format for date, time, and number form
  controls<span class=impl>, and the <a href=#input-impl-notes>implementation notes</a>
  regarding localization of form controls</span>.</p>

  <p>The <code title=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>valid local date and time string</a>.</p> <!-- ok to set
  out-of-range value, we never know when we might have to represent bogus input -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is a <a href=#valid-local-date-and-time-string>valid local date and time
  string</a>, then set it to a <a href=#valid-normalized-local-date-and-time-string>valid normalized local date and time string</a>
  representing the same date and time; otherwise, set it to the empty string instead.</p>

  </div>

  <p>The <code title=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>valid local date and time string</a>. The <code title=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>valid local date and time
  string</a>.</p>

  <p>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute is expressed in seconds. <span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is 1000 (which
  converts the seconds to milliseconds, as used in the other algorithms).</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 60 seconds.</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a> for which the element would not <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step mismatch</a>.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If <a href=#parse-a-local-date-and-time-string title="parse a local date and time string">parsing a date and time</a> from <var title="">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 title="">1970-01-01T00:00:00.0</code>") to the parsed <a href=#concept-datetime-local title=concept-datetime-local>local date and time</a>, ignoring leap seconds.</p>

  <p><strong>The <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-normalized-local-date-and-time-string>valid normalized local date and time string</a> that represents the date and time that is
  <var title="">input</var> milliseconds after midnight on the morning of 1970-01-01 (the time
  represented by the value "<code title="">1970-01-01T00:00:00.0</code>").</p>

  </div>

  <p class=note>See <a href=#only-contemporary-times>the note on historical dates</a> in the
  <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state section.</p>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>

  <div class=example>

   <p>The following example shows part of a flight booking application. The application uses an
   <code><a href=#the-input-element>input</a></code> element with its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute set to
   <code title=attr-input-type-datetime-local><a href="#local-date-and-time-state-(type=datetime-local)">datetime-local</a></code>, and it then interprets the
   given date and time in the time zone of the selected airport.</p>

   <pre>&lt;fieldset&gt;
 &lt;legend&gt;Destination&lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;Airport: &lt;input type=text name=to list=airports&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Departure time: &lt;input type=datetime-local name=totime step=3600&gt;&lt;/label&gt;&lt;/p&gt;
&lt;/fieldset&gt;
&lt;datalist id=airports&gt;
 &lt;option value=ATL label="Atlanta"&gt;
 &lt;option value=MEM label="Memphis"&gt;
 &lt;option value=LHR label="London Heathrow"&gt;
 &lt;option value=LAX label="Los Angeles"&gt;
 &lt;option value=FRA label="Frankfurt"&gt;
&lt;/datalist&gt;</pre>

   <p>If the application instead used the <code title=attr-input-type-datetime><a href="#date-and-time-state-(type=datetime)">datetime</a></code>
   type, then the user would have to work out the time-zone conversions himself, which is clearly
   not a good user experience!</p>

  </div>


  <h6 id="number-state-(type=number)"><span class=secno>4.10.7.1.13 </span><dfn title=attr-input-type-number>Number</dfn> state (<code title="">type=number</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a number.</p>

  <div class=impl>

  <p>If the element is <i title=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 title=concept-fe-value>value</a>, as
  obtained from applying the <a href=#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 title=concept-fe-value>value</a> to a
  non-empty string that is not a <a href=#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 title=concept-fe-value>value</a> must be set to the <a href=#best-representation-of-the-number-as-a-floating-point-number title="best representation of the
  number as a floating-point number">best representation of the number representing the user's
  selection as a floating-point number</a>. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>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>valid floating-point number</a>, the control is <a href=#suffering-from-bad-input>suffering
  from bad input</a>.</p>

  </div>

  <p class=note>This specification does not define what user interface user agents are to use;
  user agent vendors are encouraged to consider what would best serve their users' needs. For
  example, a user agent in Persian or Arabic markets might support Persian and Arabic numeric input
  (converting it to the format required for submission as described above). Similarly, a user agent
  designed for Romans might display the value in Roman numerals rather than in decimal; or (more
  realistically) a user agent designed for the French market might display the value with
  apostrophes between thousands and commas before the decimals, and allow the user to enter a value
  in that manner, internally converting it to the submission format described above.</p>

  <p>The <code title=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>valid floating-point number</a>.</p> <!-- ok to set out-of-range
  value, we never know when we might have to represent bogus input -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-floating-point-number>valid floating-point
  number</a>, then set it to the empty string instead.</p>

  </div>

  <p>The <code title=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>valid floating-point number</a>. The <code title=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>valid floating-point number</a>.</p>

  <p><span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is
  1.</span> The <a href=#concept-input-step-default title=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 title=concept-input-min-zero>step
  base</a> has a non-integer value).</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent may round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest number for which the element
  would not <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">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 title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If applying the
  <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> to <var title="">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 title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-floating-point-number>valid floating-point number</a> that represents <var title="">input</var>.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code title=attr-input-required><a href=#attr-input-required>required</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>

  <div class=example>

   <p>Here is an example of using a numeric input control:</p>

   <pre>&lt;label&gt;How much do you want to charge? $&lt;input type=number min=0 step=0.01 name=price&gt;&lt;/label&gt;</pre>

   <p>As described above, a user agent might support numeric input in the user's local format,
   converting it to the format required for submission as described above. This might include
   handling grouping separators (as in "872,000,000,000") and various decimal separators (such as
   "3,99" vs "3.99") or using local digits (such as those in Arabic, Devanagari, Persian, and
   Thai).</p>

  </div>

  <p class=note>The <code title="">type=number</code> state is not appropriate for input that
  happens to only consist of numbers but isn't strictly speaking a number. For example, it would be
  inappropriate for credit card numbers or US postal codes. A simple way of determining whether to
  use <code title="">type=number</code> is to consider whether it would make sense for the input
  control to have a spinbox interface (e.g. with "up" and "down" arrows). Getting a credit card
  number wrong by 1 in the last digit isn't a minor mistake, it's as wrong as getting every digit
  incorrect. So it would not make sense for the user to select a credit card number using "up" and
  "down" buttons. When a spinbox interface is not appropriate, <code title="">type=text</code> is
  probably the right choice (possibly with a <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
  attribute).</p>



  <h6 id="range-state-(type=range)"><span class=secno>4.10.7.1.14 </span><dfn title=attr-input-type-range>Range</dfn> state (<code title="">type=range</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#range-state-(type=range)" title=attr-input-type-range>Range</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control for setting the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a number, but with the caveat
  that the exact value is not important, letting UAs provide a simpler interface than they do for
  the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state.</p>

  <div class=impl>

  <p class=note>In this state, the range and step constraints are enforced even during user input,
  and there is no way to set the value to the empty string.</p>

  <p>If the element is <i title=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 title=concept-fe-value>value</a>, as
  obtained from applying the <a href=#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 title=concept-fe-value>value</a> to a string
  that is not a <a href=#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 title=concept-fe-value>value</a> must be set
  to a <a href=#best-representation-of-the-number-as-a-floating-point-number title="best representation of the number as a floating-point number">best
  representation of the number representing the user's selection as a floating-point number</a>.
  User agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>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>valid floating-point number</a>, the control is <a href=#suffering-from-bad-input>suffering
  from bad input</a>.</p>

  </div>

  <p>The <code title=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>valid floating-point number</a>.</p> <!-- ok to set out-of-range value, we never
  know when we might have to represent bogus input; not ok to not have a value if the attribute is
  present, since you can't not have a value (attribute missing is treated as implying a default
  value) -->

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a <a href=#valid-floating-point-number>valid floating-point
  number</a>, then set it to a <a href=#valid-floating-point-number>valid floating-point number</a> that represents the <a href=#concept-input-value-default-range title=concept-input-value-default-range>default value</a>.</p>

  </div>

  <p>The <code title=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>valid floating-point number</a>. The <a href=#concept-input-min-default title=concept-input-min-default>default
  minimum</a> is 0. The <code title=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>valid floating-point number</a>. The <a href=#concept-input-max-default title=concept-input-max-default>default maximum</a> is 100.</p>

  <p>The <dfn id=concept-input-value-default-range title=concept-input-value-default-range>default value</dfn> is the <a href=#concept-input-min title=concept-input-min>minimum</a> plus half the difference between the <a href=#concept-input-min title=concept-input-min>minimum</a> and the <a href=#concept-input-max title=concept-input-max>maximum</a>,
  unless the <a href=#concept-input-max title=concept-input-max>maximum</a> is less than the <a href=#concept-input-min title=concept-input-min>minimum</a>, in which case the <a href=#concept-input-value-default-range title=concept-input-value-default-range>default value</a> is the <a href=#concept-input-min title=concept-input-min>minimum</a>.</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-an-underflow>suffering from an underflow</a>, the user agent must set the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a <a href=#valid-floating-point-number>valid floating-point
  number</a> that represents the <a href=#concept-input-min title=concept-input-min>minimum</a>.</p>

  <p>When the element is <a href=#suffering-from-an-overflow>suffering from an overflow</a>, if the <a href=#concept-input-max title=concept-input-max>maximum</a> is not less than the <a href=#concept-input-min title=concept-input-min>minimum</a>, the user agent must set the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a <a href=#valid-floating-point-number>valid floating-point number</a> that
  represents the <a href=#concept-input-max title=concept-input-max>maximum</a>.</p>

  </div>

  <p><span class=impl>The <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a> is
  1.</span> The <a href=#concept-input-step-default title=concept-input-step-default>default step</a> is 1 (allowing only
  integers, unless the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute has a non-integer
  value).</p>

  <div class=impl>

  <p>When the element is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>, the user agent must round the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the nearest number for which the element
  would not <a href=#suffering-from-a-step-mismatch title="suffering from a step mismatch">suffer from a step mismatch</a>, and
  which is greater than or equal to the <a href=#concept-input-min title=concept-input-min>minimum</a>, and, if the
  <a href=#concept-input-max title=concept-input-max>maximum</a> is not less than the <a href=#concept-input-min title=concept-input-min>minimum</a>, which is less than or equal to the <a href=#concept-input-max title=concept-input-max>maximum</a>, if there is a number that matches these constraints. If
  two numbers match these constraints, then user agents must use the one nearest to positive
  infinity.</p>

  <p class=example>For example, the markup
  <code>&lt;input&nbsp;type="range"&nbsp;min=0&nbsp;max=100&nbsp;step=20&nbsp;value=50&gt;</code>
  results in a range control whose initial value is 60.</p>

  <p><strong>The <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a>, given a string <var title="">input</var>, is as follows</strong>: If applying the
  <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> to <var title="">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 title=concept-input-value-number-string>algorithm to convert a number to a
  string</a>, given a number <var title="">input</var>, is as follows</strong>: Return a
  <a href=#valid-floating-point-number>valid floating-point number</a> that represents <var title="">input</var>.</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes, IDL attributes, and methods <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code title=attr-input-min><a href=#attr-input-min>min</a></code>, and
   <code title=attr-input-step><a href=#attr-input-step>step</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code title=dom-input-value><a href=#dom-input-value>value</a></code>, and
   <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
   <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>

  </div>

  <div class=example>

   <p>Here is an example of a range control using an autocomplete list with the <code title=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>&lt;input type="range" min="-100" max="100" value="0" step="10" name="power" list="powers"&gt;
&lt;datalist id="powers"&gt;
 &lt;option value="0"&gt;
 &lt;option value="-30"&gt;
 &lt;option value="30"&gt;
<span class=bad> &lt;option value="++50"&gt;</span>
&lt;/datalist&gt;
</pre>

   <p>...with the following style sheet applied:</p>

   <pre>input { height: 75px; width: 49px; background: #D5CCBB; color: black; }</pre>

   <p>...might render as:</p>

   <p><img src=http://images.whatwg.org/sample-range.png width=49 alt="A vertical slider control whose primary 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." height=75><p>Note how the UA determined the orientation of the control from the ratio of the
   style-sheet-specified height and width properties. The colors were similarly derived from the
   style sheet. The tick marks, however, were derived from the markup. In particular, the <code title=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 title="">++50</code> was completely ignored.</p>

  </div>

  <div class=example>

   <p>For another example, consider the following markup fragment:</p>

   <pre>&lt;input name=x type=range min=100 max=700 step=9.09090909 value=509.090909&gt;</pre>

   <p>A user agent could display in a variety of ways, for instance:</p>

   <p><img src=http://images.whatwg.org/sample-range-2a.png width=231 alt="As a dial." height=57></p>

   <p>Or, alternatively, for instance:</p>

   <p><img src=http://images.whatwg.org/sample-range-2b.png width=445 alt="As a long horizontal slider with tick marks." height=56></p>

   <p>The user agent could pick which one to display based on the dimensions given in the style
   sheet. This would allow it to maintain the same resolution for the tick marks, despite the
   differences in width.</p>

  </div>

  <div class=example>

   <p>Finally, here is an example of a range control with two labeled values:</p>

   <pre>&lt;input type="range" name="a" list="a-values"&gt;
&lt;datalist id="a-values"&gt;
 &lt;option value="10" label="Low"&gt;
 &lt;option value="90" label="High"&gt;
&lt;/datalist&gt;
</pre>

   <p>With styles that make the control draw vertically, it might look as follows:</p>

   <p><img src=http://images.whatwg.org/sample-range-labels.png width=103 alt="A vertical slider control with two tick marks, one near the top labeled 'High', and one near the bottom labeled 'Low'." height=164></div>



  <h6 id="color-state-(type=color)"><span class=secno>4.10.7.1.15 </span><dfn title=attr-input-type-color>Color</dfn> state (<code title="">type=color</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#color-state-(type=color)" title=attr-input-type-color>Color</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a color well control, for setting the
  element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a string representing a <a href=#simple-color>simple
  color</a>.</p>

  <div class=impl>

  <p class=note>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 title=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 title=concept-fe-value>value</a>, as
  obtained from applying the <a href=#rules-for-parsing-simple-color-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 title=concept-fe-value>value</a> to a string that is
  not a <a href=#valid-lowercase-simple-color>valid lowercase simple color</a>. If the user agent provides a user interface for
  selecting a color, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to the result
  of using the <a href=#rules-for-serializing-simple-color-values>rules for serializing simple color values</a> to the user's selection. User
  agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>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-color>valid lowercase simple color</a>, the control is
  <a href=#suffering-from-bad-input>suffering from bad input</a>.</p>

  </div>

  <p>The <code title=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-color>valid simple color</a>.</p>

  <div class=impl>

  <p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is a <a href=#valid-simple-color>valid simple color</a>, then
  set it to the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element <a href=#converted-to-ascii-lowercase>converted to ASCII
  lowercase</a>; otherwise, set it to the string "<code title="">#000000</code>".</p>

  </div>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes and IDL attributes <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> and
   <code title=attr-input-list><a href=#attr-input-list>list</a></code> content attributes;
   <code title=dom-input-list><a href=#dom-input-list>list</a></code> and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>.</p>

   <p>The <code title=event-input-input><a href=#event-input-input>input</a></code> and <code title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply title=concept-input-apply>apply</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

  </div>


  <h6 id="checkbox-state-(type=checkbox)"><span class=secno>4.10.7.1.16 </span><dfn title=attr-input-type-checkbox>Checkbox</dfn> state (<code title="">type=checkbox</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a two-state control that represents the
  element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state. If the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is true, the control represents a positive
  selection, and if it is false, a negative selection. If the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is set to true, then the
  control's selection should be obscured as if the control was in a third, indeterminate, state.</p>

  <p class=note>The control is never a true tri-state control, even if the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is set to true. The <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute only gives the appearance of a
  third state.</p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, then: The <a href=#pre-click-activation-steps>pre-click
  activation steps</a> consist of setting the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to its opposite value (i.e. true if it is false,
  false if it is true), and of setting the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute to false. The <a href=#canceled-activation-steps>canceled
  activation steps</a> consist of setting the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>
  and the element's <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute back to
  the values they had before the <a href=#pre-click-activation-steps>pre-click activation steps</a> were run. The
  <a href=#activation-behavior>activation behavior</a> is to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the element. <!-- It's not cancelable. Once this fires, the
  control is checked, end of story. --></p>

  <p>If the element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior>activation
  behavior</a>.</p>

  <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and its <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is false, then the element is <a href=#suffering-from-being-missing>suffering from
  being missing</a>.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">input</var> . <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>When set, overrides the rendering of <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>checkbox</a>
    controls so that the current value is not visible.</p>

   </dd>

  </dl><!--TOPIC:HTML--><div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes and IDL attributes <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>, and
   <code title=attr-input-required><a href=#attr-input-required>required</a></code> content attributes;
   <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-default-on title=dom-input-value-default-on>default/on</a>.</p>

   <p>The <code title=event-input-change><a href=#event-input-change>change</a></code> event <a href=#concept-input-apply title=concept-input-apply>applies</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> event <a href=#do-not-apply title="do not apply">does not apply</a>.</p>

  </div>



  <h6 id="radio-button-state-(type=radio)"><span class=secno>4.10.7.1.17 </span><dfn title=attr-input-type-radio>Radio Button</dfn> state (<code title="">type=radio</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a control that, when used in conjunction
  with other <code><a href=#the-input-element>input</a></code> elements, forms a <i><a href=#radio-button-group>radio button group</a></i> in which only one
  control can have its <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state set to true. If the
  element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is true, the control
  represents the selected control in the group, and if it is false, it indicates a control in the
  group that is not selected.</p>

  <p>The <dfn id=radio-button-group><i>radio button group</i></dfn> that contains an <code><a href=#the-input-element>input</a></code> element <var title="">a</var> also contains all the other <code><a href=#the-input-element>input</a></code> elements <var title="">b</var>
  that fulfill all of the following conditions:</p>

  <ul><li>The <code><a href=#the-input-element>input</a></code> element <var title="">b</var>'s <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio
   Button</a> state.</li>

   <li>Either <var title="">a</var> and <var title="">b</var> have the same <a href=#form-owner>form owner</a>,
   or they both have no <a href=#form-owner>form owner</a>.</li>

   <li>Both <var title="">a</var> and <var title="">b</var> are in the same <a href=#home-subtree>home
   subtree</a>.</li>

   <li>They both have a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute, their <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attributes are not empty, and the value of <var title="">a</var>'s <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is a <a href=#compatibility-caseless>compatibility
   caseless</a> match for the value of <var title="">b</var>'s <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute.</li>

  </ul><p>A document must not contain an <code><a href=#the-input-element>input</a></code> element whose <i><a href=#radio-button-group>radio button group</a></i>
  contains only that element.</p>

  <div class=impl>

  <p>When any of the following phenomena occur, if the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is true after the occurrence, the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state of all the other elements in the same <i><a href=#radio-button-group>radio
  button group</a></i> must be set to false:</p>

  <ul><li>The element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is set to true (for
   whatever reason).</li>

   <li>The element's <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is set, changed, or
   removed.</li>

   <li>The element's <a href=#form-owner>form owner</a> changes.</li>

  </ul><p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, then: The <a href=#pre-click-activation-steps>pre-click
  activation steps</a> consist of setting the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to true. The <a href=#canceled-activation-steps>canceled activation steps</a>
  consist of setting the element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to false. The
  <a href=#activation-behavior>activation behavior</a> is to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the element. <!-- It's not cancelable. Once this fires, the
  control is checked, end of story. -->.</p>

  <p>If the element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior>activation
  behavior</a>.</p>

  <p><strong>Constraint validation</strong>: If an element in the <i><a href=#radio-button-group>radio button group</a></i> is <i title=concept-input-required><a href=#concept-input-required>required</a></i>, and all of the <code><a href=#the-input-element>input</a></code> elements in the
  <i><a href=#radio-button-group>radio button group</a></i> have a <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> that is
  false, then the element is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p>

  </div>

  <p class=note>If none of the radio buttons in a <a href=#radio-button-group>radio button group</a> are checked when
  they are inserted into the document, then they will all be initially unchecked in the interface,
  until such time as one of them is checked (either by the user or by script).</p>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes and IDL attributes <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> and
   <code title=attr-input-required><a href=#attr-input-required>required</a></code> content attributes;
   <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-default-on title=dom-input-value-default-on>default/on</a>.</p>

   <p>The <code title=event-input-change><a href=#event-input-change>change</a></code> event <a href=#concept-input-apply title=concept-input-apply>applies</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> event <a href=#do-not-apply title="do not apply">does not apply</a>.</p>

  </div>



  <h6 id="file-upload-state-(type=file)"><span class=secno>4.10.7.1.18 </span><dfn title=attr-input-type-file>File Upload</dfn> state (<code title="">type=file</code>)</h6>

  <!-- v2 ideas:
   * maximum height/width or required ratio for image uploads? - Leons Petrazickis
   * maximum per-file upload size - Alfonso Mart&iacute;nez de Lizarrondo
  -->

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a list of <dfn id=concept-input-type-file-selected title=concept-input-type-file-selected>selected files</dfn>, each file consisting of a file
  name, a file type, and a file body (the contents of the file).</p>

  <div class=impl>

  <p>File names must not contain path components, even in the case that a user has selected an
  entire directory hierarchy or multiple files with the same name from different directories. Path
  components are those separated by U+005C REVERSE SOLIDUS character (\) characters.</p>

  <p>If the element is <i title=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, e.g. adding or removing files. Files can be from the
  filesystem or created on the fly, e.g. a picture taken from a camera connected to the user's
  device.</p>

  <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> is empty, then the element is
  <a href=#suffering-from-being-missing>suffering from being missing</a>.</p>

  <p>Unless the <code title=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 title=concept-input-type-file-selected>selected
  files</a>.</p>

  </div>

  <hr><p>The <dfn id=attr-input-accept title=attr-input-accept><code>accept</code></dfn> attribute may be specified to
  provide user agents with a hint of what file types will be accepted.</p>

  <p>If specified, the attribute must consist of a <a href=#set-of-comma-separated-tokens>set of comma-separated tokens</a>, each
  of which must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the following:</p>

  <dl><dt>The string <code title="">audio/*</code></dt>

   <dd>Indicates that sound files are accepted.</dd>

   <dt>The string <code title="">video/*</code></dt>

   <dd>Indicates that video files are accepted.</dd>

   <dt>The string <code title="">image/*</code></dt>

   <dd>Indicates that image files are accepted.</dd>

   <dt>A <a href=#valid-mime-type-with-no-parameters>valid MIME type with no parameters</a></dt>

   <dd>Indicates that files of the specified type are accepted.</dd>

   <dt>A string whose first character is a U+002E FULL STOP character (.)</dt>

   <dd>Indicates that files with the specified file extension are accepted.</dd>

  </dl><p>The tokens must not be <a href=#ascii-case-insensitive>ASCII case-insensitive</a> matches for any of the other tokens
  (i.e. duplicates are not allowed). <span class=impl>To obtain the list of tokens from the
  attribute, the user agent must <a href=#split-a-string-on-commas title="split a string on commas">split the attribute value on
  commas</a>.</span></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 title="">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 title="">audio/*</code>, a user agent could offer the user
  the option of recording a clip using a headset microphone.</p>

  <div class=impl>

  <p>User agents should prevent the user from selecting files that are not accepted by one (or more)
  of these tokens.</p>

  </div>

  <p class=note>Authors are encouraged to specify both any MIME types and any corresponding
  extensions when looking for data in a specific format.</p>

  <div class=example>

   <p>For example, consider an application that converts Microsoft Word documents to Open Document
   Format files. Since Microsoft Word documents are described with a wide variety of MIME types and
   extensions, the site can list several, as follows:</p>

   <pre>&lt;input type="file" accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"&gt;</pre>

   <p>On platforms that only use file extensions to describe file types, the extensions listed here
   can be used to filter the allowed documents, while the MIME types can be used with the system's
   type registration table (mapping MIME types to extensions used by the system), if any, to
   determine any other extensions to allow. Similarly, on a system that does not have file names or
   extensions but labels documents with MIME types internally, the MIME types can be used to pick
   the allowed files, while the extensions can be used if the system has an extension registration
   table that maps known extensions to MIME types used by the system.</p>

  </div>

  <p class=warning>Extensions tend to be ambiguous (e.g. there are an untold number of formats
  that use the "<code title="">.dat</code>" extension, and users can typically quite easily rename
  their files to have a "<code title="">.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 title=attr-input-accept><a href=#attr-input-accept>accept</a></code> attribute's requirements.</p>

  <div class=example id=fakepath-srsly>

   <p>For historical reasons, the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute prefixes
   the file name with the string "<code title="">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 title=dom-input-value><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 &gt;= 0) // Unix-based path
    return path.substr(x+1);
  x = path.lastIndexOf('\\');
  if (x &gt;= 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>&lt;p&gt;&lt;input type=file name=image onchange="updateFilename(this.value)"&gt;&lt;/p&gt;
&lt;p&gt;The name of the file you picked is: &lt;span id="filename"&gt;(none)&lt;/span&gt;&lt;/p&gt;
&lt;script&gt;
 function updateFilename(path) {
   var name = extractFilename(path);
   document.getElementById('filename').textContent = name;
 }
&lt;/script&gt;</pre>

   <!-- How useful this actually is... is unclear. -->

  </div>

  <hr><div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes and IDL attributes <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>, and
   <code title=attr-input-required><a href=#attr-input-required>required</a></code> content attributes;
   <code title=dom-input-files><a href=#dom-input-files>files</a></code> and
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attributes.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-filename title=dom-input-value-filename>filename</a>.</p>

   <p>The <code title=event-input-change><a href=#event-input-change>change</a></code> event <a href=#concept-input-apply title=concept-input-apply>applies</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The element's <code title=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>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> event <a href=#do-not-apply title="do not apply">does not apply</a>.</p>

  </div>



  <h6 id="submit-button-state-(type=submit)"><span class=secno>4.10.7.1.19 </span><dfn title=attr-input-type-submit>Submit Button</dfn> state (<code title="">type=submit</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a button that, when activated, submits
  the form. <span class=impl>If the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code>
  attribute, the button's label must be the value of that attribute; otherwise, it must be an
  implementation-defined string that means "Submit" or some such.</span> The element is a <a href=#concept-button title=concept-button>button</a>, specifically a <a href=#concept-submit-button title=concept-submit-button>submit
  button</a>.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, then the element's
  <a href=#activation-behavior>activation behavior</a> is as follows: if the element has a <a href=#form-owner>form owner</a>,
  and the element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>,
  <a href=#concept-form-submit title=concept-form-submit>submit</a> the <a href=#form-owner>form owner</a> from the
  <code><a href=#the-input-element>input</a></code> element; otherwise, do nothing.</p>

  <p>If the element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior>activation
  behavior</a>.</p>

  </div>

  <p>The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission>attributes for form
  submission</a>.</p>

  <p class=note>The <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute can be
  used to make submit buttons that do not trigger the constraint validation.</p>

  <div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes and IDL attributes <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and
   <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> content attributes;
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#do-not-apply>do not apply</a>.</p>

  </div>


  <h6 id="image-button-state-(type=image)"><span class=secno>4.10.7.1.20 </span><dfn title=attr-input-type-image>Image Button</dfn> state (<code title="">type=image</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#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 title=concept-button>button</a>, specifically a <a href=#concept-submit-button title=concept-submit-button>submit button</a>.</p>

  <p class=note>The coordinate is sent to the server <a href=#constructing-the-form-data-set title="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 title="">.x</code>" and "<code title="">.y</code>" appended to the
  name with the <var title="">x</var> and <var title="">y</var> components of the coordinate
  respectively.</p>

  <hr><p>The image is given by the <dfn id=attr-input-src title=attr-input-src><code>src</code></dfn> attribute. The
  <code title=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>valid
  non-empty URL potentially surrounded by spaces</a> referencing a non-interactive, optionally
  animated, image resource that is neither paged nor scripted.</p>

  <div class=impl>

  <p>When any of the following events occur, unless the user agent cannot support images, or its
  support for images has been disabled, or the user agent only fetches elements on demand, or the
  <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute's value is the empty string, the user agent must
  <a href=#resolve-a-url title="resolve a url">resolve</a> the value of the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute, relative to the element, and if that is successful,
  must <a href=#fetch>fetch</a><!--FETCH--> the resulting <a href=#absolute-url>absolute URL</a>:</p> <!-- Note how
  this does NOT happen when the base URL changes. --> <!-- http-origin privacy sensitive -->

  <ul><li>The <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is first
   set to the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state (possibly when the
   element is first created), and the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is
   present.</li>

   <li>The <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is
   changed back to the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, and the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is present, and its value has changed since the last
   time the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute was in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state.</li>

   <li>The <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
   the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, and the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is set or changed.</li>

  </ul><!-- same text in <img> section and similar text elsewhere --><p>Fetching the image must <a href=#delay-the-load-event>delay the load event</a> of the element's document until the
  <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the
  <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a>
  (defined below) has been run.</p>

  <p>If the image was successfully obtained, with no network errors, and the image's type is a
  supported image type, and the image is a valid image of that type, then the image is said to be
  <dfn id=input-img-available title=input-img-available><i>available</i></dfn>. If this is true before the image is
  completely downloaded, each <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
  task">queued</a> by the <a href=#networking-task-source>networking task source</a> while the image is being <a href=#fetch title=fetch>fetched</a> must update the presentation of the image appropriately.</p>

  <p>The user agent should apply the <a href=#content-type-sniffing:-image title="Content-Type sniffing: image">image sniffing
  rules</a> to determine the type of the image, with the image's <a href=#content-type title=Content-Type>associated Content-Type headers</a> giving the <var title="">official
  type</var>. If these rules are not applied, then the type of the image must be the type given by
  the image's <a href=#content-type title=Content-Type>associated Content-Type headers</a>.</p>

  <p>User agents must not support non-image resources with the <code><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 title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by
  the <a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a>, must, if the download was successful and the image is <i title=input-img-available><a href=#input-img-available>available</a></i>, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-load>load</code> at the <code><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>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-error>error</code> on the <code><a href=#the-input-element>input</a></code> element.</p>

  <hr></div>

  <p>The <dfn id=attr-input-alt title=attr-input-alt><code>alt</code></dfn> attribute provides the textual label for
  the button for users and user agents who cannot use the image. The <code title=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><a href=#the-input-element>input</a></code> element supports <a href=#dimension-attributes>dimension attributes</a>.</p>

  <div class=impl>

  <hr><p>If the <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is set, and the image is <i title=input-img-available><a href=#input-img-available>available</a></i> and the user agent is configured to display that image,
  then: The element <a href=#represents>represents</a> a control for selecting a <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>coordinate</a> from the image specified by the
  <code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute; if the element is <i title=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 title=concept-input-type-image-coordinate>coordinate</a>, and the element's <a href=#activation-behavior>activation
  behavior</a> is as follows: if the element has a <a href=#form-owner>form owner</a>, and the element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>, take the user's
  selected <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>coordinate</a>, and <a href=#concept-form-submit title=concept-form-submit>submit</a> the <code><a href=#the-input-element>input</a></code> element's <a href=#form-owner>form owner</a>
  from the <code><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>represents</a> a submit button whose label is given by the
  value of the <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code> attribute; if the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, then the element's <a href=#activation-behavior>activation behavior</a> is as
  follows: if the element has a <a href=#form-owner>form owner</a>, and the element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>, set the <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>selected coordinate</a> to (0,0), and <a href=#concept-form-submit title=concept-form-submit>submit</a> the <code><a href=#the-input-element>input</a></code> element's <a href=#form-owner>form owner</a>
  from the <code><a href=#the-input-element>input</a></code> element.</p>

  <p>In either case, if the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i> but has no
  <a href=#form-owner>form owner</a> or the element's <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully active</a>, then its <a href=#activation-behavior>activation behavior</a> must be to do nothing. If the
  element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior>activation
  behavior</a>.</p>

  <p>The <dfn id=concept-input-type-image-coordinate title=concept-input-type-image-coordinate>selected coordinate</dfn> must consist of
  an <var title="">x</var>-component and a <var title="">y</var>-component. The coordinates
  represent the position relative to the edge of the image, with the coordinate space having the
  positive <var title="">x</var> direction to the right, and the positive <var title="">y</var>
  direction downwards.</p>

  <p>The <var title="">x</var>-component must be a <a href=#valid-integer>valid integer</a> representing a number
  <var title="">x</var> in the range <span title="">&minus;(<var title="">border<sub title="">left</sub></var>+<var title="">padding<sub title="">left</sub></var>) &le; <var title="">x</var> &le; <var title="">width</var>+<var title="">border<sub title="">right</sub></var>+<var title="">padding<sub title="">right</sub></var></span>, where <var title="">width</var> is the rendered width of the image, <var title="">border<sub title="">left</sub></var> is the width of the border on the left of the image, <var title="">padding<sub title="">left</sub></var> is the width of the padding on the left of the
  image, <var title="">border<sub title="">right</sub></var> is the width of the border on the right
  of the image, and <var title="">padding<sub title="">right</sub></var> is the width of the padding
  on the right of the image, with all dimensions given in CSS pixels.</p>

  <p>The <var title="">y</var>-component must be a <a href=#valid-integer>valid integer</a> representing a number
  <var title="">y</var> in the range <span title="">&minus;(<var title="">border<sub title="">top</sub></var>+<var title="">padding<sub title="">top</sub></var>) &le; <var title="">y</var> &le; <var title="">height</var>+<var title="">border<sub title="">bottom</sub></var>+<var title="">padding<sub title="">bottom</sub></var></span>, where
  <var title="">height</var> is the rendered height of the image, <var title="">border<sub title="">top</sub></var> is the width of the border above the image, <var title="">padding<sub title="">top</sub></var> is the width of the padding above the image, <var title="">border<sub title="">bottom</sub></var> is the width of the border below the image, and <var title="">padding<sub title="">bottom</sub></var> is the width of the padding below the image, with
  all dimensions given in CSS pixels.</p>

  <p>Where a border or padding is missing, its width is zero CSS pixels.</p>

  <hr></div>

  <p>The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission>attributes for form
  submission</a>.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">image</var> . <code title=dom-input-width><a href=#dom-input-width>width</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">image</var> . <code title=dom-input-height><a href=#dom-input-height>height</a></code> [ = <var title="">value</var> ]</dt>

   <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>

   </dd>

  </dl><!--TOPIC:HTML--><div class=bookkeeping>

   <p>The following common <code><a href=#the-input-element>input</a></code> element content
   attributes and IDL attributes <a href=#concept-input-apply title=concept-input-apply>apply</a> to the element:
   <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code title=attr-input-src><a href=#attr-input-src>src</a></code>, and
   <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> content attributes;
   <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute.</p>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute is
   in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>, and
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>.</p>

   <p>The element's <code title=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>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#do-not-apply>do not apply</a>.</p>

  </div>

  <p class=note>Many aspects of this state's behavior are similar to the behavior of the
  <code><a href=#the-img-element>img</a></code> element. Readers are encouraged to read that section, where many of the same
  requirements are described in more detail.</p>

  <div class=example>

   <p>Take the following form:</p>

   <pre>&lt;form action="process.cgi"&gt;
 &lt;input type=image src=map.png name=where alt="Show location list"&gt;
&lt;/form&gt;</pre>

   <p>If the user clicked on the image at coordinate (127,40) then the URL used to submit the form
   would be "<code title="">process.cgi?where.x=127&amp;where.y=40</code>".</p>

   <p>(In this example, it's assumed that for users who don't see the map, and who instead just see
   a button labeled "Show location list", clicking the button will cause the server to show a list
   of locations to pick from instead of the map.)</p>

  </div>



  <h6 id="reset-button-state-(type=reset)"><span class=secno>4.10.7.1.21 </span><dfn title=attr-input-type-reset>Reset Button</dfn> state (<code title="">type=reset</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset Button</a> state, the rules in this section
  apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a button that, when activated, resets
  the form. <span class=impl>If the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code>
  attribute, the button's label must be the value of that attribute; otherwise, it must be an
  implementation-defined string that means "Reset" or some such.</span> The element is a <a href=#concept-button title=concept-button>button</a>.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, then the element's
  <a href=#activation-behavior>activation behavior</a>, if the element has a <a href=#form-owner>form owner</a> and the element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>, is to <a href=#concept-form-reset title=concept-form-reset>reset</a> the <a href=#form-owner>form owner</a>; otherwise, it is to do
  nothing.</p>

  <p>If the element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior>activation
  behavior</a>.</p>

  <p><strong>Constraint validation</strong>: The element is <a href=#barred-from-constraint-validation>barred from constraint
  validation</a>.</p>

  </div>

  <div class=bookkeeping>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute
   <a href=#concept-input-apply title=concept-input-apply>applies</a> to this element and is in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#do-not-apply>do not apply</a>.</p>

  </div>


  <h6 id="button-state-(type=button)"><span class=secno>4.10.7.1.22 </span><dfn title=attr-input-type-button>Button</dfn> state (<code title="">type=button</code>)</h6>

  <div class=impl>

  <p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
  the <a href="#button-state-(type=button)" title=attr-input-type-button>Button</a> state, the rules in this section apply.</p>

  </div>

  <p>The <code><a href=#the-input-element>input</a></code> element <a href=#represents>represents</a> a button with no default behavior. A
  label for the button must be provided in the <code title=attr-input-value><a href=#attr-input-value>value</a></code>
  attribute, though it may be the empty string. <span class=impl>If the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, the button's label must be the value of that
  attribute; otherwise, it must be the empty string.</span> The element is a <a href=#concept-button title=concept-button>button</a>.</p>

  <div class=impl>

  <p>If the element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, the element's <a href=#activation-behavior>activation
  behavior</a> is to do nothing.</p>

  <p>If the element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior>activation
  behavior</a>.</p>

  <p><strong>Constraint validation</strong>: The element is <a href=#barred-from-constraint-validation>barred from constraint
  validation</a>.</p>

  </div>

  <div class=bookkeeping>

   <p>The <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute
   <a href=#concept-input-apply title=concept-input-apply>applies</a> to this element and is in mode <a href=#dom-input-value-default title=dom-input-value-default>default</a>.</p>

   <p>The following content attributes must not be specified and <a href=#do-not-apply>do not
   apply</a> to the element:
   <code class=no-backref title=attr-input-accept><a href=#attr-input-accept>accept</a></code>,
   <code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
   <code class=no-backref title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>,
   <code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
   <code class=no-backref title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>,
   <code class=no-backref title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>,
   <code class=no-backref title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>,
   <code class=no-backref title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>,
   <code class=no-backref title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
   <code class=no-backref title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>,
   <code class=no-backref title=attr-dim-height><a href=#attr-dim-height>height</a></code>,
   <code class=no-backref title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>,
   <code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
   <code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
   <code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
   <code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
   <code class=no-backref title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>,
   <code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
   <code class=no-backref title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>,
   <code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
   <code class=no-backref title=attr-input-required><a href=#attr-input-required>required</a></code>,
   <code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
   <code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
   <code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
   <code class=no-backref title=attr-dim-width><a href=#attr-dim-width>width</a></code>.</p>

   <p>The following IDL attributes and methods <a href=#do-not-apply>do not apply</a> to the
   element:
   <code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
   <code class=no-backref title=dom-input-files><a href=#dom-input-files>files</a></code>,
   <code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
   <code class=no-backref title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
   <code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
   <code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
   <code class=no-backref title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>,
   <code class=no-backref title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
   <code class=no-backref title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
   <code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code>, and
   <code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

   <p>The <code class=no-backref title=event-input-input><a href=#event-input-input>input</a></code> and <code class=no-backref title=event-input-change><a href=#event-input-change>change</a></code> events <a href=#do-not-apply>do not apply</a>.</p>

  </div>


  <div class=impl>

  <h5 id=input-impl-notes><span class=secno>4.10.7.2 </span>Implemention notes regarding localization of form controls</h5>
  <!-- ID referenced from other parts of the spec -->

  <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><a href=#the-input-element>input</a></code> element's
  <a href=#language>language</a> or the user's preferred locale. Using the page's locale will ensure
  consistency with page-provided data.

  <p class=example>For example, it would be confusing to users if an American English page claimed
  that a Cirque De Soleil show was going to be showing on 02/03<!-- Feb 3 (year) -->, but their
  browser, configured to use the British English locale, only showed the date 03/02<!-- 3 Feb (year)
  --> in the ticket purchase date picker. Using the page's locale would at least ensure that the
  date was presented in the same format everywhere. (There's still a risk that the user would end up
  arriving a month late, of course, but there's only so much that can be done about such cultural
  differences...)</p>

  </div>



  <h5 id=common-input-element-attributes><span class=secno>4.10.7.3 </span>Common <code><a href=#the-input-element>input</a></code> element attributes</h5>

  <div class=impl>

  <p>These attributes only <a href=#concept-input-apply title=concept-input-apply>apply</a> to an <code><a href=#the-input-element>input</a></code> element if its <code title=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 title=concept-input-apply>applies</a>. When an attribute <a href=#do-not-apply title="do not apply">doesn't apply</a> to an
  <code><a href=#the-input-element>input</a></code> element, user agents must <a href=#ignore>ignore</a> the attribute, regardless of the
  requirements and definitions below.</p>

  </div>


  <h6 id=the-maxlength-attribute><span class=secno>4.10.7.3.1 </span>The <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> attribute</h6>

  <p>The <dfn id=attr-input-maxlength title=attr-input-maxlength><code>maxlength</code></dfn> attribute<span class=impl>, when it <a href=#concept-input-apply title=concept-input-apply>applies</a>,</span> is a <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a><span class=impl> controlled by the <code><a href=#the-input-element>input</a></code>
  element's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a></span>.</p>

  <p>If the <code><a href=#the-input-element>input</a></code> element has a <a href=#maximum-allowed-value-length>maximum allowed value length</a>, then the
  <a href=#code-unit-length>code-unit length</a> of the value of the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute must be equal to or less than the element's
  <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>

  <div class=example>

   <p>The following extract shows how a messaging client's text entry could be arbitrarily
   restricted to a fixed number of characters, thus forcing any conversation through this medium to
   be terse and discouraging intelligent discourse.</p>

   <pre>&lt;label&gt;What are you doing? &lt;input name=status maxlength=140&gt;&lt;/label&gt;</pre>

  </div>



  <h6 id=the-size-attribute><span class=secno>4.10.7.3.2 </span>The <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute</h6>

  <p>The <dfn id=attr-input-size title=attr-input-size><code>size</code></dfn> attribute gives the number of
  characters that, in a visual rendering, the user agent is to allow the user to see while editing
  the element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

  <p>The <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute, if specified, must have a value that
  is a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>

  <div class=impl>

  <p>If the attribute is present, then its value must be parsed using the <a href=#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 title=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>limited to only
  non-negative numbers greater than zero</a> and has a default value of 20.</p>

  </div>



  <h6 id=the-readonly-attribute><span class=secno>4.10.7.3.3 </span>The <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute</h6>

  <p>The <dfn id=attr-input-readonly title=attr-input-readonly><code>readonly</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a> that controls whether or not the user can edit the form control. <span class=impl>When specified, the element is not <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</span></p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute is specified on an <code><a href=#the-input-element>input</a></code>
  element, the element is <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>

  </div>

  <p class=note>The difference between <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> and <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> is that read-only controls are still focusable, so the
  user can still select the text and interact with it, whereas disabled controls are entirely
  non-interactive. (For this reason, only text controls can be made read-only: it wouldn't make
  sense for checkboxes or buttons, for instances.)</p>

  <div class=example>

   <p>In the following example, the existing product identifiers cannot be modified, but they are
   still displayed as part of the form, for consistency with the row representing a new product
   (where the identifier is not yet filled in).</p>

   <pre>&lt;form action="products.cgi" method="post" enctype="multipart/form-data"&gt;
 &lt;table&gt;
  &lt;tr&gt; &lt;th&gt; Product ID &lt;th&gt; Product name &lt;th&gt; Price &lt;th&gt; Action
  &lt;tr&gt;
   &lt;td&gt; &lt;input readonly="readonly" name="1.pid" value="H412"&gt;
   &lt;td&gt; &lt;input required="required" name="1.pname" value="Floor lamp Ulke"&gt;
   &lt;td&gt; $&lt;input required="required" type="number" min="0" step="0.01" name="1.pprice" value="49.99"&gt;
   &lt;td&gt; &lt;button formnovalidate="formnovalidate" name="action" value="delete:1"&gt;Delete&lt;/button&gt;
  &lt;tr&gt;
   &lt;td&gt; &lt;input readonly="readonly" name="2.pid" value="FG28"&gt;
   &lt;td&gt; &lt;input required="required" name="2.pname" value="Table lamp Ulke"&gt;
   &lt;td&gt; $&lt;input required="required" type="number" min="0" step="0.01" name="2.pprice" value="24.99"&gt;
   &lt;td&gt; &lt;button formnovalidate="formnovalidate" name="action" value="delete:2"&gt;Delete&lt;/button&gt;
  &lt;tr&gt;
   &lt;td&gt; &lt;input required="required" name="3.pid" value="" pattern="[A-Z0-9]+"&gt;
   &lt;td&gt; &lt;input required="required" name="3.pname" value=""&gt;
   &lt;td&gt; $&lt;input required="required" type="number" min="0" step="0.01" name="3.pprice" value=""&gt;
   &lt;td&gt; &lt;button formnovalidate="formnovalidate" name="action" value="delete:3"&gt;Delete&lt;/button&gt;
 &lt;/table&gt;
 &lt;p&gt; &lt;button formnovalidate="formnovalidate" name="action" value="add"&gt;Add&lt;/button&gt; &lt;/p&gt;
 &lt;p&gt; &lt;button name="action" value="update"&gt;Save&lt;/button&gt; &lt;/p&gt;
&lt;/form&gt;</pre>

  </div>



  <h6 id=the-required-attribute><span class=secno>4.10.7.3.4 </span>The <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute</h6>

  <p>The <dfn id=attr-input-required title=attr-input-required><code>required</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. When specified, the element is <dfn id=concept-input-required title=concept-input-required><i>required</i></dfn>.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i>, and its <code title=dom-input-value><a href=#dom-input-value>value</a></code>
  IDL attribute <a href=#concept-input-apply title=concept-input-apply>applies</a> and is in the mode <a href=#dom-input-value-value title=dom-input-value-value>value</a>, and the
  element is <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, and the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the empty string, then the element is <a href=#suffering-from-being-missing>suffering
  from being missing</a>.</p>

  </div>

  <div class=example>

   <p>The following form has two required fields, one for an e-mail address and one for a password.
   It also has a third field that is only considered valid if the user types the same password in
   the password field and this third field.</p>

   <pre>&lt;h1&gt;Create new account&lt;/h1&gt;
&lt;form action="/newaccount" method=post
      oninput="up2.setCustomValidity(up2.value != up.value ? 'Passwords do not match.' : '')"&gt;
 &lt;p&gt;
  &lt;label for="username"&gt;E-mail address:&lt;/label&gt;
  &lt;input id="username" type=email required name=un&gt;
 &lt;p&gt;
  &lt;label for="password1"&gt;Password:&lt;/label&gt;
  &lt;input id="password1" type=password required name=up&gt;
 &lt;p&gt;
  &lt;label for="password2"&gt;Confirm password:&lt;/label&gt;
  &lt;input id="password2" type=password name=up2&gt;
 &lt;p&gt;
  &lt;input type=submit value="Create account"&gt;
&lt;/form&gt;</pre>

  </div>

  <div class=example>

   <p>For radio buttons, the <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute is
   satisfied if any of the radio buttons in the <a href=#radio-button-group title="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>&lt;fieldset&gt;
 &lt;legend&gt;Did the movie pass the Bechdel test?&lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type="radio" name="bechdel" value="no-characters"&gt; No, there are not even two female characters in the movie. &lt;/label&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type="radio" name="bechdel" value="no-names"&gt; No, the female characters never talk to each other. &lt;/label&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type="radio" name="bechdel" value="no-topic"&gt; No, when female characters talk to each other it's always about a male character. &lt;/label&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type="radio" name="bechdel" value="yes" <strong>required</strong>&gt; Yes. &lt;/label&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type="radio" name="bechdel" value="unknown"&gt; I don't know. &lt;/label&gt;
&lt;/fieldset&gt;</pre>

   <p>To avoid confusion as to whether a <a href=#radio-button-group>radio button group</a> is required or not, authors
   are encouraged to specify the attribute on all the radio buttons in a group. Indeed, in general,
   authors are encouraged to avoid having radio button groups that do not have any initially checked
   controls in the first place, as this is a state that the user cannot return to, and is therefore
   generally considered a poor user interface.</p>

  </div>


  <h6 id=the-multiple-attribute><span class=secno>4.10.7.3.5 </span>The <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute</h6>

  <p>The <dfn id=attr-input-multiple title=attr-input-multiple><code>multiple</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a> that indicates whether the user is to be allowed to specify more than one
  value.</p>

  <div class=example>

   <p>The following extract shows how an e-mail client's "Cc" field could accept multiple e-mail
   addresses.</p>

   <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc&gt;&lt;/label&gt;</pre>

   <p>If the user had, amongst many friends in his user contacts database, two friends "Arthur Dent"
   (with address "art@example.net") and "Adam Josh" (with address "adamjosh@example.net"), then,
   after the user has typed "a", the user agent might suggest these two e-mail addresses to the
   user.</p>

   <!-- Having alternative text in the following image would be bogus and non-conforming use of
   HTML, since the image is redundant with the previous paragraph. In particular, just describing
   the image would be especially bad for accessibility as it would be disorienting, there having
   been no mention that an image is present. -->
   <p><img src=http://images.whatwg.org/sample-email-1.png width=500 alt="" height=140></p>

   <p>The page could also link in the user's contacts database from the site:</p>

   <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc list=contacts&gt;&lt;/label&gt;
...
&lt;datalist id="contacts"&gt;
 &lt;option value="hedral@damowmow.com"&gt;
 &lt;option value="pillar@example.com"&gt;
 &lt;option value="astrophy@cute.example"&gt;
 &lt;option value="astronomy@science.example.org"&gt;
&lt;/datalist&gt;</pre>

   <p>Suppose the user had entered "bob@example.net" into this text field, and then started typing a
   second e-mail address starting with "a". The user agent might show both the two friends mentioned
   earlier, as well as the "astrophy" and "astronomy" values given in the <code><a href=#the-datalist-element>datalist</a></code>
   element.</p>

   <!-- As above, having a non-empty alt="" attribute on the following image would be dumb, which is
   why it's left blank. The pertinent parts of the image are already described in the prose, and the
   non-pertinent parts aren't relevant to users who can't see the image, obviously. -->
   <p><img src=http://images.whatwg.org/sample-email-2.png width=500 alt="" height=171></p>

  </div>

  <div class=example>

   <p>The following extract shows how an e-mail client's "Attachments" field could accept multiple
   files for upload.</p>

   <pre>&lt;label&gt;Attachments: &lt;input type=file multiple name=att&gt;&lt;/label&gt;</pre>

  </div>



  <h6 id=the-pattern-attribute><span class=secno>4.10.7.3.6 </span>The <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute</h6>

  <p>The <dfn id=attr-input-pattern title=attr-input-pattern><code>pattern</code></dfn> attribute specifies a regular
  expression against which the control's <a href=#concept-fe-value title=concept-fe-value>value</a>, or, when the
  <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute <a href=#concept-input-apply title=concept-input-apply>applies</a> and is set, the control's
  <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a>, are to be checked.</p>

  <p>If specified, the attribute's value must match the JavaScript <i title="">Pattern</i>
  production. <a href=#refsECMA262>[ECMA262]</a></p>

  <div class=impl>

  <p>If an <code><a href=#the-input-element>input</a></code> element has a <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
  attribute specified, and the attribute's value, when compiled as a JavaScript regular expression
  with the <code title="">global</code>, <code title="">ignoreCase</code>, and <code title="">multiline</code> flags <em>disabled</em> (see ECMA262 Edition 5, sections 15.10.7.2
  through 15.10.7.4), compiles successfully, then the resulting regular expression is the element's
  <dfn id=compiled-pattern-regular-expression>compiled pattern regular expression</dfn>. If the element has no such attribute, or if the
  value doesn't compile successfully, then the element has no <a href=#compiled-pattern-regular-expression>compiled pattern regular
  expression</a>. <a href=#refsECMA262>[ECMA262]</a></p>

  <p><strong>Constraint validation</strong>: If the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is not the empty string, and either the element's <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is not specified or it <a href=#do-not-apply title="do not apply">does not apply</a> to the
  <code><a href=#the-input-element>input</a></code> element given its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current
  state, and the element has a <a href=#compiled-pattern-regular-expression>compiled pattern regular expression</a> but that regular
  expression does not match the entirety of the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, then the element is <a href=#suffering-from-a-pattern-mismatch>suffering from a pattern
  mismatch</a>.</p>

  <p><strong>Constraint validation</strong>: If the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is not the empty string, and the element's <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute is specified and <a href=#concept-input-apply title=concept-input-apply>applies</a> to the
  <code><a href=#the-input-element>input</a></code> element, and the element has a <a href=#compiled-pattern-regular-expression>compiled pattern regular expression</a>
  but that regular expression does not match the entirety of each of the element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a>, then the element is <a href=#suffering-from-a-pattern-mismatch>suffering from a
  pattern mismatch</a>.</p>

  <p>The <a href=#compiled-pattern-regular-expression>compiled pattern regular expression</a>, when matched against a string, must have
  its start anchored to the start of the string and its end anchored to the end of the string.</p>

  <p class=note>This implies that the regular expression language used for this attribute is the
  same as that used in JavaScript, except that the <code title=attr-input-pattern><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 title="">^(?:</code> at the start of the pattern and a <code title="">)$</code> at the
  end).</p>

  </div>

  <p>When an <code><a href=#the-input-element>input</a></code> element has a <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>
  attribute specified, authors should include a <code title=attr-title><a href=#attr-title>title</a></code> 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 gains focus.</p>

  <div class=example>
   <p>For example, the following snippet:</p>
   <pre>&lt;label&gt; Part number:
 &lt;input pattern="[0-9][A-Z]{3}" name="part"
        title="A part number is a digit followed by three uppercase letters."/&gt;
&lt;/label&gt;</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 title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute, the <code title=attr-title><a href=#attr-title>title</a></code> attribute, if used, must describe the pattern. Additional
  information could also be included, so long as it assists the user in filling in the control.
  Otherwise, assistive technology would be impaired.</p>

  <p class=example>For instance, if the title attribute contained the caption of the control,
  assistive technology could end up saying something like <samp>The text you have entered does not
  match the required pattern. Birthday</samp>, which is not useful.</p>

  <p>UAs may still show the <code title=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 title=attr-title><a href=#attr-title>title</a></code>s as if an error has necessarily occurred.</p>



  <h6 id=the-min-and-max-attributes><span class=secno>4.10.7.3.7 </span>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> and <code title=attr-input-max><a href=#attr-input-max>max</a></code> attributes</h6>

  <p>The <dfn id=attr-input-min title=attr-input-min><code>min</code></dfn> and <dfn id=attr-input-max title=attr-input-max><code>max</code></dfn> attributes indicate the allowed range of values for
  the element.</p>

  <div class=impl>

  <p>Their syntax is defined by the section that defines the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state.</p>

  <p>If the element has a <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute, and the result of
  applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a> to the value of the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute is a number,
  then that number is the element's <dfn id=concept-input-min title=concept-input-min>minimum</dfn>; otherwise, if the
  <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state defines a <dfn id=concept-input-min-default title=concept-input-min-default>default minimum</dfn>, then that is the <a href=#concept-input-min title=concept-input-min>minimum</a>; otherwise, the element has no <a href=#concept-input-min title=concept-input-min>minimum</a>.</p>

  <p><strong>Constraint validation</strong>: When the element has a <a href=#attr-input-min title=attr-input-min>minimum</a>, and the result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a number</a> to the
  string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, and the
  number obtained from that algorithm is less than the <a href=#attr-input-min title=attr-input-min>minimum</a>,
  the element is <a href=#suffering-from-an-underflow>suffering from an underflow</a>.</p>

  <p>The <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute also defines the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>.</p>

  <p>If the element has a <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute, and the result of
  applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a
  number</a> to the value of the <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute is a number,
  then that number is the element's <dfn id=concept-input-max title=concept-input-max>maximum</dfn>; otherwise, if the
  <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state defines a <dfn id=concept-input-max-default title=concept-input-max-default>default maximum</dfn>, then that is the <a href=#concept-input-max title=concept-input-max>maximum</a>; otherwise, the element has no <a href=#concept-input-max title=concept-input-max>maximum</a>.</p>

  <p><strong>Constraint validation</strong>: When the element has a <a href=#attr-input-max title=attr-input-max>maximum</a>, and the result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a number</a> to the
  string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, and the
  number obtained from that algorithm is more than the <a href=#attr-input-max title=attr-input-max>maximum</a>,
  the element is <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p>

  </div>

  <p>The <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute's value (the <a href=#concept-input-max title=concept-input-max>maximum</a>) must not be less than the <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute's value (its <a href=#concept-input-min title=concept-input-min>minimum</a>).</p>

  <div class=impl>

  <p class=note>If an element has a <a href=#attr-input-max title=attr-input-max>maximum</a> that is less than
  its <a href=#attr-input-min title=attr-input-min>minimum</a>, then so long as the element has a <a href=#concept-fe-value title=concept-fe-value>value</a>, it will either be <a href=#suffering-from-an-underflow>suffering from an underflow</a>
  or <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p>

  </div>

  <p>An element <dfn id=have-range-limitations title="have range limitations">has range limitations</dfn> if it has a defined
  <a href=#concept-input-min title=concept-input-min>minimum</a> or a defined <a href=#concept-input-max title=concept-input-max>maximum</a>.</p>

  <div class=example>

   <p>The following date control limits input to dates that are before the 1980s:</p>

   <pre>&lt;input name=bday type=date max="1979-12-31"&gt;</pre>

  </div>

  <div class=example>

   <p>The following number control limits input to whole numbers greater than zero:</p>

   <pre>&lt;input name=quantity required="" type="number" min="1" value="1"&gt;</pre>

  </div>


  <h6 id=the-step-attribute><span class=secno>4.10.7.3.8 </span>The <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute</h6>

  <p>The <dfn id=attr-input-step title=attr-input-step><code>step</code></dfn> attribute indicates the granularity
  that is expected (and required) of the <a href=#concept-fe-value title=concept-fe-value>value</a>, by limiting
  the allowed values. <span class=impl>The section that defines the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state also defines the <dfn id=concept-input-step-default title=concept-input-step-default>default step</dfn>, the <dfn id=concept-input-step-scale title=concept-input-step-scale>step scale factor</dfn>, and in some cases the <dfn id=concept-input-step-default-base title=concept-input-step-default-base>default step base</dfn>, which are used in processing the
  attribute as described below.</span></p>

  <p>The <code title=attr-input-step><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>valid floating-point number</a> that <a href=#rules-for-parsing-floating-point-number-values title="rules for parsing
  floating-point number values">parses</a> to a number that is greater than zero, or must have a
  value that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">any</code>".</p>

  <div class=impl>

  <p>The attribute provides the <dfn id=concept-input-step title=concept-input-step>allowed value step</dfn> for the
  element, as follows:</p>

  <ol><li>If the attribute is absent, then the <a href=#concept-input-step title=concept-input-step>allowed value
   step</a> is the <a href=#concept-input-step-default title=concept-input-step-default>default step</a> multiplied by the
   <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a>.</li>

   <li>Otherwise, if the attribute's value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
   string "<code title="">any</code>", then there is no <a href=#concept-input-step title=concept-input-step>allowed
   value step</a>.</li>

   <li>Otherwise, if the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a>, when they are
   applied to the attribute's value, return an error, zero, or a number less than zero, then the
   <a href=#concept-input-step title=concept-input-step>allowed value step</a> is the <a href=#concept-input-step-default title=concept-input-step-default>default step</a> multiplied by the <a href=#concept-input-step-scale title=concept-input-step-scale>step scale factor</a>.</li>

   <li>Otherwise, the <a href=#concept-input-step title=concept-input-step>allowed value step</a> is the number
   returned by the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> when they are applied
   to the attribute's value, multiplied by the <a href=#concept-input-step-scale title=concept-input-step-scale>step scale
   factor</a>.</li>

  </ol><p>The <dfn id=concept-input-min-zero title=concept-input-min-zero>step base</dfn> is the value returned by the following
  algorithm:</p>

  <ol><li><p>If the element has a <code title=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 title=concept-input-value-string-number>algorithm to convert a
   string to a number</a> to the value of the <code title=attr-input-min><a href=#attr-input-min>min</a></code> content
   attribute is not an error, then return that result and abort these steps.</li>

   <li><p>If the element has a <code title=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 title=concept-input-value-string-number>algorithm to convert a
   string to a number</a> to the value of the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content
   attribute is not an error, then return that result and abort these steps.</li>

   <li><p>If a <a href=#concept-input-step-default-base title=concept-input-step-default-base>default step base</a> is defined for
   this element given its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's state, then return
   it and abort these steps.</p>

   <li><p>Return zero.</li>

  </ol><p><strong>Constraint validation</strong>: When the element has an <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and the result of applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a number</a> to the
  string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is a number, and that
  number subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a> is not an
  integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, the element
  is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p>

  </div>

  <div class=example>

   <p>The following range control only accepts values in the range 0..1, and allows 256 steps in
   that range:</p>

   <pre>&lt;input name=opacity type=range min=0 max=1 step=0.00392156863&gt;</pre>

  </div>

  <div class=example>

   <p>The following control allows any time in the day to be selected, with any accuracy (e.g.
   thousandth-of-a-second accuracy or more):</p>

   <pre>&lt;input name=favtime type=time step=any&gt;</pre>

   <p>Normally, time controls are limited to an accuracy of one minute.</p>

  </div>



  <h6 id=the-list-attribute><span class=secno>4.10.7.3.9 </span>The <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute</h6>

  <p>The <dfn id=attr-input-list title=attr-input-list><code>list</code></dfn> attribute is used to identify an
  element that lists predefined options suggested to the user.</p>

  <p>If present, its value must be the <a href=#concept-id title=concept-id>ID</a> of a <code><a href=#the-datalist-element>datalist</a></code>
  element in the same document.</p>

  <div class=impl>

  <p>The <dfn id=concept-input-list title=concept-input-list>suggestions source element</dfn> is the first element in
  the document in <a href=#tree-order>tree order</a> to have an <a href=#concept-id title=concept-id>ID</a> equal to the
  value of the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute, if that element is a
  <code><a href=#the-datalist-element>datalist</a></code> element. If there is no <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute,
  or if there is no element with that <a href=#concept-id title=concept-id>ID</a>, or if the first element
  with that <a href=#concept-id title=concept-id>ID</a> is not a <code><a href=#the-datalist-element>datalist</a></code> element, then there is
  no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>.</p>

  <p>If there is a <a href=#concept-input-list title=concept-input-list>suggestions source element</a>, then, when
  the user agent is allowing the user to edit the <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value title=concept-fe-value>value</a>, the user agent should offer the suggestions represented by
  the <a href=#concept-input-list title=concept-input-list>suggestions source element</a> to the user in a manner
  suitable for the type of control used. The user agent may use the suggestion's <a href=#concept-option-label title=concept-option-label>label</a> to identify the suggestion if appropriate.</p>

  <p>How user selections of suggestions are handled depends on whether the element is a control
  accepting a single value only, or whether it accepts multiple values:</p>

  <dl class=switch><dt>If the element does not have a <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute
   specified or if the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute does <span>not
   apply</span></dt>

   <dd>

    <p>When the user selects a suggestion, the <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to the selected suggestion's <a href=#concept-option-value title=concept-option-value>value</a>, as if the user had written that value himself.</p>

   </dd>

   <dt>If the element <em>does</em> have a <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>
   attribute specified, and the <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute does
   <a href=#concept-input-apply title=concept-input-apply>apply</a></dt>

   <dd>

    <p>When the user selects a suggestion, the user agent must either add a new entry to the
    <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a>, whose value
    is the selected suggestion's <a href=#concept-option-value title=concept-option-value>value</a>, or change an
    existing entry in the <code><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-values title=concept-fe-values>value<em>s</em></a> to have the value given by the selected
    suggestion's <a href=#concept-option-value title=concept-option-value>value</a>, as if the user had himself added
    an entry with that value, or edited an existing entry to be that value. Which behavior is to be
    applied depends on the user interface in a user-agent-defined manner.</p>

   </dd>

  </dl><hr><p>If the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute <a href=#do-not-apply title="do not apply">does not apply</a>, there is no <a href=#concept-input-list title=concept-input-list>suggestions source element</a>.</p>

  </div>

  <div class=example>

   <p>This URL field offers some suggestions.</p>

   <pre>&lt;label&gt;Homepage: &lt;input name=hp type=url list=hpurls&gt;&lt;/label&gt;
&lt;datalist id=hpurls&gt;
 &lt;option value="http://www.google.com/" label="Google"&gt;
 &lt;option value="http://www.reddit.com/" label="Reddit"&gt;
&lt;/datalist&gt;</pre>

   <p>Other URLs from the user's history might show also; this is up to the user agent.</p>

  </div>

  <div class=example>

   <p>This example demonstrates how to design a form that uses the autocompletion list feature while
   still degrading usefully in legacy user agents.</p>

   <p>If the autocompletion list is merely an aid, and is not important to the content, then simply
   using a <code><a href=#the-datalist-element>datalist</a></code> element with children <code><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 title=attr-option-value><a href=#attr-option-value>value</a></code> attribute instead of inline.</p>

   <pre>&lt;p&gt;
 &lt;label&gt;
  Enter a breed:
  &lt;input type="text" name="breed" list="breeds"&gt;
  &lt;datalist id="breeds"&gt;
   &lt;option value="Abyssinian"&gt;
   &lt;option value="Alpaca"&gt;
   &lt;!-- ... --&gt;
  &lt;/datalist&gt;
 &lt;/label&gt;
&lt;/p&gt;</pre>

   <p>However, if the values need to be shown in legacy UAs, then fallback content can be placed
   inside the <code><a href=#the-datalist-element>datalist</a></code> element, as follows:</p>

   <pre>&lt;p&gt;
 &lt;label&gt;
  Enter a breed:
  &lt;input type="text" name="breed" list="breeds"&gt;
 &lt;/label&gt;
 &lt;datalist id="breeds"&gt;
  &lt;label&gt;
   or select one from the list:
   &lt;select name="breed"&gt;
    &lt;option value=""&gt; (none selected)
    &lt;option&gt;Abyssinian
    &lt;option&gt;Alpaca
    &lt;!-- ... --&gt;
   &lt;/select&gt;
  &lt;/label&gt;
 &lt;/datalist&gt;
&lt;/p&gt;
</pre>

   <p>The fallback content will only be shown in UAs that don't support <code><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><a href=#the-datalist-element>datalist</a></code> element.</p>

   <p>Note that if an <code><a href=#the-option-element>option</a></code> element used in a <code><a href=#the-datalist-element>datalist</a></code> is <code title=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><a href=#the-select-element>select</a></code>), but it will not have any effect on the
   <code><a href=#the-input-element>input</a></code> element in UAs that support <code><a href=#the-datalist-element>datalist</a></code>.</p>

  </div>



  <h6 id=the-placeholder-attribute><span class=secno>4.10.7.3.10 </span>The <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> attribute</h6>

  <!-- substantially similar text in the <textarea> section -->

  <p>The <dfn id=attr-input-placeholder title=attr-input-placeholder><code>placeholder</code></dfn> attribute represents a
  <em>short</em> hint (a word or short phrase) intended to aid the user with data entry when the
  control has no value. A hint could be a sample value or a brief description of the expected
  format. The attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or
  U+000D CARRIAGE RETURN (CR) characters.</p>

  <p>The <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> attribute should not be used as an
  alternative to a <code><a href=#the-label-element>label</a></code>. For a longer hint or other advisory text, the <code title=attr-title><a href=#attr-title>title</a></code> attribute is more appropriate.</p>

  <p class=note>These mechanisms are very similar but subtly different: the hint given by the
  control's <code><a href=#the-label-element>label</a></code> is shown at all times; the short hint given in the <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> attribute is shown before the user enters a
  value; and the hint in the <code title=attr-title><a href=#attr-title>title</a></code> attribute is shown when the user
  requests further help.</p>

  <div class=impl>

  <p>User agents should present this hint to the user, after having <a href=#strip-line-breaks title="strip line
  breaks">stripped line breaks</a> from it, when the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the empty string or the control is not focused (or both),
  e.g. by displaying it inside a blank unfocused control and hiding it otherwise.</p>

  </div>

  <div class=example>

   <p>Here is an example of a mail configuration user interface that uses the <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> attribute:</p>

   <pre>&lt;fieldset&gt;
 &lt;legend&gt;Mail Account&lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;Name: &lt;input type="text" name="fullname" placeholder="John Ratzenberger"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Address: &lt;input type="email" name="address" placeholder="john@example.net"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Password: &lt;input type="password" name="password"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Description: &lt;input type="text" name="desc" placeholder="My Email Account"&gt;&lt;/label&gt;&lt;/p&gt;
&lt;/fieldset&gt;</pre>

  </div>

  <div class=example>

   <p>In situations where the control's content has one directionality but the placeholder needs to
   have a different directionality, Unicode's bidirectional-algorithm formatting characters can be
   used in the attribute value:</p>

   <pre>&lt;input name=t1 type=tel placeholder="<strong>&amp;#x202B;</strong>&thinsp;<bdo dir=rtl>&#x631;&#x642;&#x645;&nbsp;&#x627;&#x644;&#x647;&#x627;&#x62a;&#x641;&nbsp;1</bdo>&thinsp;<strong>&amp;#x202E;</strong>"&gt;
&lt;input name=t2 type=tel placeholder="<strong>&amp;#x202B;</strong>&thinsp;<bdo dir=rtl>&#x631;&#x642;&#x645;&nbsp;&#x627;&#x644;&#x647;&#x627;&#x62a;&#x641;&nbsp;2</bdo>&thinsp;<strong>&amp;#x202E;</strong>"&gt;</pre>

   <p>For slightly more clarity, here's the same example using numeric character references instead of inline Arabic:</p>

   <pre>&lt;input name=t1 type=tel placeholder="<strong>&amp;#x202B;</strong>&amp;#1585;&amp;#1602;&amp;#1605;&nbsp;&amp;#1575;&amp;#1604;&amp;#1607;&amp;#1575;&amp;#1578;&amp;#1601;&nbsp;1<strong>&amp;#x202E;</strong>"&gt;
&lt;input name=t2 type=tel placeholder="<strong>&amp;#x202B;</strong>&amp;#1585;&amp;#1602;&amp;#1605;&nbsp;&amp;#1575;&amp;#1604;&amp;#1607;&amp;#1575;&amp;#1578;&amp;#1601;&nbsp;2<strong>&amp;#x202E;</strong>"&gt;</pre>

  </div>



<!--TOPIC:DOM APIs-->

  <h5 id=common-input-element-apis><span class=secno>4.10.7.4 </span>Common <code><a href=#the-input-element>input</a></code> element APIs</h5>

  <dl class=domintro><dt><var title="">input</var> . <code title=dom-input-value><a href=#dom-input-value>value</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current <a href=#concept-fe-value title=concept-fe-value>value</a> of the form control.</p>

    <p>Can be set, to change the value.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if it is set to any value other than the
    empty string when the control is a file upload control.</p>

   </dd>

   <dt><var title="">input</var> . <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the form
    control.</p>

    <p>Can be set, to change the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>.</p>

   </dd>

   <dt><var title="">input</var> . <code title=dom-input-files><a href=#dom-input-files>files</a></code> <!-- [ = <var title="">files</var> ] --></dt>

   <dd>

    <p>Returns a <code><a href=#filelist>FileList</a></code> object listing the <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> of the form control.</p>

    <p>Returns null if the control isn't a file control.</p>

<!--
    <p>Can be set to an array of <code>File</code> or <code>Blob</code> instances.</p>-
-->

   </dd>

   <dt><var title="">input</var> . <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns a <code>Date</code> object representing the form control's <a href=#concept-fe-value title=concept-fe-value>value</a>, if applicable; otherwise, returns null.</p>

    <p>Can be set, to change the value.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control isn't date- or
    time-based.</p>

   </dd>

   <dt><var title="">input</var> . <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns a number representing the form control's <a href=#concept-fe-value title=concept-fe-value>value</a>,
    if applicable; otherwise, returns NaN.</p>

    <p>Can be set, to change the value. Setting this to NaN will set the underlying value to the
    empty string.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control is neither date- or
    time-based nor numeric.</p>

   </dd>

   <dt><var title="">input</var> . <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp</a></code>( [ <var title="">n</var> ] )</dt>
   <dt><var title="">input</var> . <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown</a></code>( [ <var title="">n</var> ] )</dt>

   <dd>

    <p>Changes the form control's <a href=#concept-fe-value title=concept-fe-value>value</a> by the value given in
    the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute, multiplied by <var title="">n</var>.
    The default value for <var title="">n</var> is 1.</p>

    <p>Throws <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control is neither date- or time-based
    nor numeric, or if the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute's value is "<code title="">any</code>".</p>

   </dd>

   <dt><var title="">input</var> . <code title=dom-input-list><a href=#dom-input-list>list</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#the-datalist-element>datalist</a></code> element indicated by the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-input-value title=dom-input-value><code>value</code></dfn> IDL attribute allows scripts to
  manipulate the <a href=#concept-fe-value title=concept-fe-value>value</a> of an <code><a href=#the-input-element>input</a></code> element. The
  attribute is in one of the following modes, which define its behavior:</p>

  <dl><dt><dfn id=dom-input-value-value title=dom-input-value-value>value</dfn>

   <dd>

    <p>On getting, it must return the current <a href=#concept-fe-value title=concept-fe-value>value</a> of the
    element. On setting, it must set the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to
    the new value, set the element's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value
    flag</a> to true, invoke the <a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if the element's
    <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state defines one, and then, if
    the element has a text entry cursor position, should move the text entry cursor position to the
    end of the text field, unselecting any selected text and resetting the selection direction to
    <i>none</i>.</p>

   </dd>

   <dt><dfn id=dom-input-value-default title=dom-input-value-default>default</dfn>

   <dd>

    <p>On getting, if the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, it
    must return that attribute's value; otherwise, it must return the empty string. On setting, it
    must set the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute to the new
    value.</p>

   </dd>

   <dt><dfn id=dom-input-value-default-on title=dom-input-value-default-on>default/on</dfn>

   <dd>

    <p>On getting, if the element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, it
    must return that attribute's value; otherwise, it must return the string "<code title="">on</code>". On setting, it must set the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute to the new value.</p>

   </dd>

   <dt><dfn id=dom-input-value-filename title=dom-input-value-filename>filename</dfn>

   <dd id=fakepath-orly>

    <p>On getting, it must return the string "<code title="">C:\fakepath\</code>" followed by the
    name of the first file in the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected
    files</a>, if any, or the empty string if the list is empty. On setting, if the new value is
    the empty string, it must empty the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>; otherwise, it must throw an
    <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>

    <p class=note>This "fakepath" requirement is a sad accident of history. See <a href=#fakepath-srsly>the example in the File Upload state section</a> for more
    information.</p>

   </dd>

  </dl><hr><p>The <dfn id=dom-input-checked title=dom-input-checked><code>checked</code></dfn> IDL attribute allows scripts to
  manipulate the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of an <code><a href=#the-input-element>input</a></code>
  element. On getting, it must return the current <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the element; and on setting, it must set the
  element's <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to the new value and set the
  element's <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness flag</a> to
  true.</p>

  <hr><p>The <dfn id=dom-input-files title=dom-input-files><code>files</code></dfn> IDL attribute allows scripts to
  access the element's <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>. On
  getting, if the IDL attribute <a href=#concept-input-apply title=concept-input-apply>applies</a>, it must return a <code><a href=#filelist>FileList</a></code> object that
  represents the current <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>. The
  same object must be returned until the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> changes. If the IDL attribute <a href=#do-not-apply title="do not apply">does
  not apply</a>, then it must instead return null. <a href=#refsFILEAPI>[FILEAPI]</a></p>

  <hr><p>The <dfn id=dom-input-valueasdate title=dom-input-valueAsDate><code>valueAsDate</code></dfn> IDL attribute represents
  the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element, interpreted as a date.</p>

  <p>On getting, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> attribute <a href=#do-not-apply title="do not apply">does not
  apply</a>, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute's current state, then return null. Otherwise, run the <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a <code>Date</code>
  object</a> defined for that state; if the algorithm returned a <code>Date</code> object, then
  return it, otherwise, return null.</p>

  <p>On setting, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> attribute <a href=#do-not-apply title="do not apply">does not
  apply</a>, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute's current state, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception; otherwise, if
  the new value is null or a <code>Date</code> object representing the NaN time value, then set the
  <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to the empty string; otherwise, run the
  <a href=#concept-input-value-date-string title=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 title=concept-fe-value>value</a> of the element to the resulting string.</p>

  <hr><p>The <dfn id=dom-input-valueasnumber title=dom-input-valueAsNumber><code>valueAsNumber</code></dfn> IDL attribute
  represents the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element, interpreted as a
  number.</p>

  <p>On getting, if the <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> attribute <a href=#do-not-apply title="do not apply">does
  not apply</a>, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, then return a Not-a-Number (NaN)
  value. Otherwise, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAs<em>Date</em></a></code> attribute
  <a href=#concept-input-apply title=concept-input-apply>applies</a>, run the <a href=#concept-input-value-string-date title=concept-input-value-string-date>algorithm to convert a string to a
  <code>Date</code> object</a> defined for that state; if the algorithm returned a
  <code>Date</code> object, then return the <i>time value</i> of the object (the number of
  milliseconds from midnight UTC the morning of 1970-01-01 to the time represented by the
  <code>Date</code> object), otherwise, return a Not-a-Number (NaN) value. Otherwise, run the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a string to a number</a> defined
  for that state; 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>TypeError</code> exception.
  Otherwise, if the <code title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> attribute <a href=#do-not-apply title="do not apply">does not
  apply</a>, as defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute's current state, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, if
  the new value is a Not-a-Number (NaN) value, then set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to the empty string. Otherwise, if the <code title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAs<em>Date</em></a></code> attribute <a href=#concept-input-apply title=concept-input-apply>applies</a>, run the <a href=#concept-input-value-date-string title=concept-input-value-date-string>algorithm to convert a <code>Date</code> object to a
  string</a> defined for that state, passing it a <code>Date</code> object whose <i>time
  value</i> is the new value, and set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element
  to the resulting string. Otherwise, run the <a href=#concept-input-value-number-string title=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 title=concept-fe-value>value</a>
  of the element to the resulting string.</p>

  <hr><p>The <dfn id=dom-input-stepdown title=dom-input-stepDown><code>stepDown(<var title="">n</var>)</code></dfn> and <dfn id=dom-input-stepup title=dom-input-stepUp><code>stepUp(<var title="">n</var>)</code></dfn> methods, when invoked,
  must run the following algorithm:</p>

  <ol><li><p>If the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and <code title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods <a href=#do-not-apply>do not apply</a>, as defined for the
   <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state,
   then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception, and abort these steps.</li>

   <li><p>If the element has no <a href=#concept-input-step title=concept-input-step>allowed value step</a>, then
   throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception, and abort these steps.</li>

   <li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a> and a <a href=#concept-input-max title=concept-input-max>maximum</a> and the <a href=#concept-input-min title=concept-input-min>minimum</a>
   is greater than the <a href=#concept-input-max title=concept-input-max>maximum</a>, then abort these steps.</p>

   <li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a> and a <a href=#concept-input-max title=concept-input-max>maximum</a> and there is no value greater than or equal to the
   element's <a href=#concept-input-min title=concept-input-min>minimum</a> and less than or equal to the element's
   <a href=#concept-input-max title=concept-input-max>maximum</a> that, when subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, then abort these steps.</p>

   <li><p>If applying the <a href=#concept-input-value-string-number title=concept-input-value-string-number>algorithm to convert a
   string to a number</a> to the string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> does not result in an error, then let <var title="">value</var> be the result of that algorithm. Otherwise, let <var title="">value</var> be
   zero.</li>

   <li>

    <p>If <var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step
    base</a> is not an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value
    step</a>, then set <var title="">value</var> to the nearest value that, when subtracted from
    the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and that is less than <var title="">value</var> if the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and more than <var title="">value</var>
    otherwise.</p>

    <p>Otherwise (<var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a> is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>), run the following substeps:</p>

    <ol><li><p>Let <var title="">n</var> be the argument.</li>

     <li><p>Let <var title="">delta</var> be the <a href=#concept-input-step title=concept-input-step>allowed value
     step</a> multiplied by <var title="">n</var>.</li>

     <li><p>If the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> method,
     negate <var title="">delta</var>.</li>

     <li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var title="">value</var>.</li>

    </ol></li>

   <li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a>, and <var title="">value</var> is less than that <a href=#concept-input-min title=concept-input-min>minimum</a>, then set
   <var title="">value</var> to the smallest value that, when subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and that is more than or equal to <var title="">minimum</var>.</li>

   <li><p>If the element has a <a href=#concept-input-min title=concept-input-min>maximum</a>, and <var title="">value</var> is greater than that <a href=#concept-input-min title=concept-input-min>maximum</a>, then
   set <var title="">value</var> to the largest value that, when subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and that is less than or equal to <var title="">maximum</var>.</li>

   <li><p>Let <var title="">value as string</var> be the result of running the <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a number to a string</a>, as
   defined for the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
   attribute's current state, on <var title="">value</var>.</li>

   <li><p>Set the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element to <var title="">value
   as string</var>.</li>

  </ol><hr><p>The <dfn id=dom-input-list title=dom-input-list><code>list</code></dfn> IDL attribute must return the current
  <a href=#concept-input-list title=concept-input-list>suggestions source element</a>, if any, or null otherwise.</p>

  </div>
<!--TOPIC:HTML-->


  <div class=impl>

  <h5 id=common-event-behaviors><span class=secno>4.10.7.5 </span>Common event behaviors</h5>

  <p>When the <dfn id=event-input-input title=event-input-input><code>input</code></dfn> event <a href=#concept-input-apply title=concept-input-apply>applies</a>, any time the
  user causes the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to change, the user agent
  must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-input>input</code> at the <code><a href=#the-input-element>input</a></code> element. User agents may wait for a
  suitable break in the user's interaction before queuing the task; for example, a user agent could
  wait for the user to have not hit a key for 100ms, so as to only fire the event when the user
  pauses, instead of continuously for each keystroke.</p> <!-- same text is present in the
  <textarea> section -->

  <p class=example>Examples of a user changing the element's <a href=#concept-fe-value title=concept-fe-value>value</a> would include the user typing into a text field, pasting a
  new value into the field, or undoing an edit in that field. Some user interactions do not cause
  changes to the value, e.g. hitting the "delete" key in an empty text field, or replacing some text
  in the field with text from the clipboard that happens to be exactly the same text.</p>

  <p>When the <dfn id=event-input-change title=event-input-change><code>change</code></dfn> event <a href=#concept-input-apply title=concept-input-apply>applies</a>, if the
  element does not have an <a href=#activation-behavior>activation behavior</a> defined but uses a user interface that
  involves an explicit commit action, then any time the user commits a change to the element's <a href=#concept-fe-value title=concept-fe-value>value</a> or list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>, the user agent must <a href=#queue-a-task>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the <code><a href=#the-input-element>input</a></code> element.</p>

  <p class=example>An example of a user interface with a commit action would be a <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a> control that consists of a single button that
  brings up a file selection dialog: when the dialog is closed, if that the <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>file selection</a> changed as a result, then the user
  has committed a new <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>file selection</a>.</p>

  <p class=example>Another example of a user interface with a commit action would be a <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a> control that allows both text-based user input and user
  selection from a drop-down calendar: while text input might not have an explicit commit step,
  selecting a date from the drop down calendar and then dismissing the drop down would be a commit
  action.</p>

  <p class=example>A third example of a user interface with a commit action would be a <a href="#range-state-(type=range)" title=attr-input-type-range>Range</a> controls that use a slider. While the user is dragging
  the control's knob, <code title=event-input>input</code> events would fire whenever the position
  changed, whereas the <code title=event-change>change</code> event would only fire when the user
  let go of the knob, committing to a specific value.</p>

  <p>When the user agent changes the element's <a href=#concept-fe-value title=concept-fe-value>value</a> on behalf
  of the user (e.g. as part of a form prefilling feature), the user agent must follow these
  steps:</p>

  <ol><li>If the <code title=event-input-input><a href=#event-input-input>input</a></code> event <a href=#concept-input-apply title=concept-input-apply>applies</a>, <a href=#queue-a-task>queue a task</a>
   to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-input>input</code> at
   the <code><a href=#the-input-element>input</a></code> element.</li>

   <li>If the <code title=event-input-change><a href=#event-input-change>change</a></code> event <a href=#concept-input-apply title=concept-input-apply>applies</a>, <a href=#queue-a-task>queue a
   task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the <code><a href=#the-input-element>input</a></code> element.</li>

  </ol><p class=note>In addition, when the <code title=event-input-change><a href=#event-input-change>change</a></code> event
  <a href=#concept-input-apply title=concept-input-apply>applies</a>, <code title=event-change>change</code> events can also be fired as part of the
  element's <a href=#activation-behavior>activation behavior</a> and as part of the <a href=#unfocusing-steps>unfocusing steps</a>.</p>

  <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the
  <a href=#user-interaction-task-source>user interaction task source</a>.</p>

  </div>



  <h4 id=the-button-element><span class=secno>4.10.8 </span>The <dfn><code>button</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <a href=#interactive-content>interactive content</a> descendant.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> &mdash; Automatically focus the form control when the page is loaded</dd>
   <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> &mdash; <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> &mdash; Form data set encoding type to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> &mdash; HTTP method to use for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> &mdash; Bypass form control validation for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> &mdash; <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-button-menu><a href=#attr-button-menu>menu</a></code> &mdash; Specifies the element's <a href=#designated-pop-up-menu>designated pop-up menu</a></dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dd><code title=attr-button-type><a href=#attr-button-type>type</a></code> &mdash; Type of button</dd>
   <dd><code title=attr-button-value><a href=#attr-button-value>value</a></code> &mdash; Value to be used for <a href=#form-submission>form submission</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlbuttonelement>HTMLButtonElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
           attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-fs-formaction title=dom-fs-formAction>formAction</a>;
           attribute DOMString <a href=#dom-fs-formenctype title=dom-fs-formEnctype>formEnctype</a>;
           attribute DOMString <a href=#dom-fs-formmethod title=dom-fs-formMethod>formMethod</a>;
           attribute boolean <a href=#dom-fs-formnovalidate title=dom-fs-formNoValidate>formNoValidate</a>;
           attribute DOMString <a href=#dom-fs-formtarget title=dom-fs-formTarget>formTarget</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
           attribute DOMString <a href=#dom-button-type title=dom-button-type>type</a>;
           attribute DOMString <a href=#dom-button-value title=dom-button-value>value</a>;
           attribute <a href=#htmlmenuelement>HTMLMenuElement</a>? <a href=#dom-button-menu title=dom-button-menu>menu</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-button-element>button</a></code> element <a href=#represents>represents</a> a button labeled by its contents.</p>

  <p>The element is a <a href=#concept-button title=concept-button>button</a>.</p>

  <p>The <dfn id=attr-button-type title=attr-button-type><code>type</code></dfn>
  attribute controls the behavior of the button when it is activated.
  It is an <a href=#enumerated-attribute>enumerated attribute</a>. The following table
  lists the keywords and states for the attribute &mdash; the keywords
  in the left column map to the states in the cell in the second
  column on the same row as the keyword.</p>

  <table><thead><tr><th> Keyword
     <th> State
     <th> Brief description
   <tbody><tr><td><dfn id=attr-button-type-submit title=attr-button-type-submit><code>submit</code></dfn>
     <td><a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
     <td>Submits the form.
    <tr><td><dfn id=attr-button-type-reset title=attr-button-type-reset><code>reset</code></dfn>
     <td><a href=#attr-button-type-reset-state title=attr-button-type-reset-state>Reset Button</a>
     <td>Resets the form.
    <tr><td><dfn id=attr-button-type-button title=attr-button-type-button><code>button</code></dfn>
     <td><a href=#attr-button-type-button-state title=attr-button-type-button-state>Button</a>
     <td>Does nothing.
    <tr><td><dfn id=attr-button-type-menu title=attr-button-type-menu><code>menu</code></dfn>
     <td><a href=#attr-button-type-menu-state title=attr-button-type-menu-state>Menu</a>
     <td>Shows a menu.
  </table><p>The <i>missing value default</i> is the <a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
  state.</p>

  <p>If the <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is in
  the <a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
  state, the element is specifically a <a href=#concept-submit-button title=concept-submit-button>submit button</a>.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If the <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is in the <a href=#attr-button-type-reset-state title=attr-button-type-reset-state>Reset Button</a> state,
  the <a href=#attr-button-type-button-state title=attr-button-type-button-state>Button</a> state,
  or the <a href=#attr-button-type-menu-state title=attr-button-type-menu-state>Menu</a> state,
  the element is <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>

  <p>When a <code><a href=#the-button-element>button</a></code> element is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, its <a href=#activation-behavior>activation
  behavior</a> element is to run the steps defined in the following
  list for the current state of the element's <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute:</p>

  <dl><dt> <dfn id=attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</dfn> </dt>

   <dd><p>If the element has a <a href=#form-owner>form owner</a> and the element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>, the element
   must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <a href=#form-owner>form
   owner</a> from the <code><a href=#the-button-element>button</a></code> element.</dd>

   <dt> <dfn id=attr-button-type-reset-state title=attr-button-type-reset-state>Reset Button</dfn> </dt>

   <dd><p>If the element has a <a href=#form-owner>form owner</a> and the element's <code><a href=#document>Document</a></code> is <a href=#fully-active>fully active</a>, the element
   must <a href=#concept-form-reset title=concept-form-reset>reset</a> the <a href=#form-owner>form
   owner</a>.</dd>

   <dt> <dfn id=attr-button-type-button-state title=attr-button-type-button-state>Button</dfn>

   <dd><p>Do nothing.</dd>

   <dt> <dfn id=attr-button-type-menu-state title=attr-button-type-menu-state>Menu</dfn>

   <dd>

    <p>The element must follow these steps:</p>

    <ol><li><p>If the <code><a href=#the-button-element>button</a></code> is not <a href=#being-rendered>being rendered</a>, abort these
     steps.</li>

     <li><p>If the <code><a href=#the-button-element>button</a></code> element's <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully active</a>, abort these
     steps.</li>
    
     <li><p>Let <var title="">menu</var> be the element's <a href=#designated-pop-up-menu>designated pop-up menu</a>, if
     any. If there isn't one, then abort these steps.</li>

     <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-show>show</code> at <var title="">menu</var>, using the <code><a href=#relatedevent>RelatedEvent</a></code>
     interface, with the <code title=dom-RelatedEvent-relatedTarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute
     initialized to the <code><a href=#the-button-element>button</a></code> element. The event must be cancelable. <!-- v2: include
     modifier key information --></li>

     <li><p>If the event is not canceled, then <a href=#construct-and-show-a-menu title="construct and show a menu">construct and
     show</a> the menu for <var title="">menu</var>, with the <code><a href=#the-button-element>button</a></code> element as the
     subject.</li>

    </ol></dd>

  </dl></div>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
  explicitly associate the <code><a href=#the-button-element>button</a></code> element with its
  <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
  attribute represents the element's name. The <code title=attr-fe-disabled><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 title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
  attribute controls focus. The <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attributes are
  <a href=#attributes-for-form-submission>attributes for form submission</a>.</p>

  <p class=note>The <code title=attr-fs-formnovalidate><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 title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> must not be specified
  if the element's <code title=attr-button-type><a href=#attr-button-type>type</a></code>
  attribute is not in the <a href=#attr-button-type-submit-state title=attr-button-type-submit-state>Submit Button</a>
  state.</p>

  <p>The <dfn id=attr-button-value title=attr-button-value><code>value</code></dfn>
  attribute gives the element's value for the purposes of form
  submission. The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the value of the element's
  <code title=attr-button-value><a href=#attr-button-value>value</a></code> attribute, if there is
  one, or the empty string otherwise.</p>

  <p class=note>A button (and its value) is only included in the
  form submission if the button itself was used to initiate the form
  submission.</p>

  <hr><p>If the element's <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is in the <a href=#attr-button-type-menu-state title=attr-button-type-menu-state>Menu</a> state, the <dfn id=attr-button-menu title=attr-button-menu><code>menu</code></dfn> attribute must be specified to give the element's
  menu. The value must be the <a href=#concept-id title=concept-id>ID</a> of a <code><a href=#the-menu-element>menu</a></code> element in
  the same <a href=#home-subtree>home subtree</a> whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in
  the <a href=#popup-menu-state title="popup menu state">popup menu</a> state. The attribute must not be specified if
  the element's <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is not in the <a href=#attr-button-type-menu-state title=attr-button-type-menu-state>Menu</a> state.</p>

  <div class=impl>

  <p>A <code><a href=#the-button-element>button</a></code> element's <dfn id=designated-pop-up-menu>designated pop-up menu</dfn> is the first element in the
  <code><a href=#the-button-element>button</a></code>'s <a href=#home-subtree>home subtree</a> whose ID is that given by the <code><a href=#the-button-element>button</a></code>
  element's <code title=attr-button-menu><a href=#attr-button-menu>menu</a></code> attribute, if there is such an element and
  its <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu
  state">popup menu</a> state; otherwise, the element has no <a href=#designated-pop-up-menu>designated pop-up
  menu</a>.</p>

  <hr><p>The <dfn id=dom-button-value title=dom-button-value><code>value</code></dfn> and <dfn id=dom-button-menu title=dom-button-menu><code>menu</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  content attributes of the same name.</p>

  <p>The <dfn id=dom-button-type title=dom-button-type><code>type</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL
  attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
  methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
  <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a
  list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
  element's forms API.</p>

  </div>

  <div class=example>

   <p>The following button is labeled "Show hint" and pops up a dialog
   box when activated:</p>

   <pre>&lt;button type=button
        onclick="alert('This 15-20 minute piece was composed by George Gershwin.')"&gt;
 Show hint
&lt;/button&gt;</pre>

  </div>




  <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, <a href=#category-reset title=category-reset>resettable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-option-element>option</a></code>, <code><a href=#the-optgroup-element>optgroup</a></code>, and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> &mdash; Automatically focus the form control when the page is loaded</dd>
   <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> &mdash; Whether to allow multiple values</dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dd><code title=attr-select-required><a href=#attr-select-required>required</a></code> &mdash; Whether the control is required for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-select-size><a href=#attr-select-size>size</a></code> &mdash; Size of the control</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlselectelement>HTMLSelectElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
           attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute boolean <a href=#dom-select-multiple title=dom-select-multiple>multiple</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
           attribute boolean <a href=#dom-select-required title=dom-select-required>required</a>;
           attribute unsigned long <a href=#dom-select-size title=dom-select-size>size</a>;

  readonly attribute DOMString <a href=#dom-select-type title=dom-select-type>type</a>;

  readonly attribute <a href=#htmloptionscollection>HTMLOptionsCollection</a> <a href=#dom-select-options title=dom-select-options>options</a>;
           attribute unsigned long <a href=#dom-select-length title=dom-select-length>length</a>;
  getter <a href=#element>Element</a>? <a href=#dom-select-item title=dom-select-item>item</a>(unsigned long index);
  <a href=#htmloptionelement>HTMLOptionElement</a>? <a href=#dom-select-nameditem title=dom-select-namedItem>namedItem</a>(DOMString name);
  void <a href=#dom-select-add title=dom-select-add>add</a>((<a href=#htmloptionelement>HTMLOptionElement</a> or <a href=#htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement>HTMLElement</a> or long)? before = null);
  void <a href=#dom-select-remove title=dom-select-remove>remove</a>(long index);
  <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement>HTMLOptionElement</a>? option);

  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions title=dom-select-selectedOptions>selectedOptions</a>;
           attribute long <a href=#dom-select-selectedindex title=dom-select-selectedIndex>selectedIndex</a>;
           attribute DOMString <a href=#dom-select-value title=dom-select-value>value</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><!-- Proposals for v2:
       * <select value=""> as an alternative to <option selected>
         http://developers.slashdot.org/comments.pl?sid=426306&cid=22142072
         <Philip`> http://www.ipiao.com.cn/ does <select size="1" name="to"><script>City_Default="PEK"</script><SCRIPT language=javascript
                   src="/js/flightcity.js"></SCRIPT></select> which is the kind of thing that could be much simpler with <select value="PEK">
    --><p>The <code><a href=#the-select-element>select</a></code> element represents a control for selecting amongst a set of
  options.</p>

  <p>The <dfn id=attr-select-multiple title=attr-select-multiple><code>multiple</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. If the attribute is present, then the <code><a href=#the-select-element>select</a></code> element
  <a href=#represents>represents</a> a control for selecting zero or more options from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>. If the attribute is absent, then the
  <code><a href=#the-select-element>select</a></code> element <a href=#represents>represents</a> a control for selecting a single option from
  the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>

  <p>The <dfn id=attr-select-size title=attr-select-size><code>size</code></dfn> attribute gives the number of options
  to show to the user. The <code title=attr-select-size><a href=#attr-select-size>size</a></code> attribute, if specified, must
  have a value that is a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>

  <div class=impl>

  <p>The <dfn id=concept-select-size title=concept-select-size>display size</dfn> of a <code><a href=#the-select-element>select</a></code> element is the
  result of applying the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the value of
  element's <code title=attr-select-size><a href=#attr-select-size>size</a></code> attribute, if it has one and parsing it is
  successful. If applying those rules to the attribute's value is not successful, or if the <code title=attr-select-size><a href=#attr-select-size>size</a></code> attribute is absent, then the element's <a href=#concept-select-size title=concept-select-size>display size</a> is 4 if the element's <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> content attribute is present, and 1 otherwise.</p>

  </div>

  <p>The <dfn id=concept-select-option-list title=concept-select-option-list>list of options</dfn> for a <code><a href=#the-select-element>select</a></code>
  element consists of all the <code><a href=#the-option-element>option</a></code> element children of the <code><a href=#the-select-element>select</a></code>
  element, and all the <code><a href=#the-option-element>option</a></code> element children of all the <code><a href=#the-optgroup-element>optgroup</a></code> element
  children of the <code><a href=#the-select-element>select</a></code> element, in <a href=#tree-order>tree order</a>.</p>

  <p>The <dfn id=attr-select-required title=attr-select-required><code>required</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. When specified, the user will be required to select a value before submitting
  the form.</p>

  <p>If a <code><a href=#the-select-element>select</a></code> element has a <code title=attr-select-required><a href=#attr-select-required>required</a></code>
  attribute specified, does not have a <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
  specified, and has a <a href=#concept-select-size title=concept-select-size>display size</a> of 1; and if the <a href=#concept-option-value title=concept-option-value>value</a> of the first <code><a href=#the-option-element>option</a></code> element in the
  <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> (if
  any) is the empty string, and that <code><a href=#the-option-element>option</a></code> element's parent node is the
  <code><a href=#the-select-element>select</a></code> element (and not an <code><a href=#the-optgroup-element>optgroup</a></code> element), then that
  <code><a href=#the-option-element>option</a></code> is the <code><a href=#the-select-element>select</a></code> element's <dfn id=placeholder-label-option>placeholder label option</dfn>.</p>

  <p>If a <code><a href=#the-select-element>select</a></code> element has a <code title=attr-select-required><a href=#attr-select-required>required</a></code>
  attribute specified, does not have a <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
  specified, and has a <a href=#concept-select-size title=concept-select-size>display size</a> of 1, then the
  <code><a href=#the-select-element>select</a></code> element must have a <a href=#placeholder-label-option>placeholder label option</a>.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If the element has its <code title=attr-select-required><a href=#attr-select-required>required</a></code> attribute specified, and either none of the
  <code><a href=#the-option-element>option</a></code> elements in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, or the only
  <code><a href=#the-option-element>option</a></code> element in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> with its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true is the <a href=#placeholder-label-option>placeholder label
  option</a>, then the element is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p>

  </div>

  <div class=impl>

  <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the element
  is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent should allow the
  user to pick an <code><a href=#the-option-element>option</a></code> element in its <a href=#concept-select-option-list title=concept-select-option-list>list
  of options</a> that is itself not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>. Upon
  this <code><a href=#the-option-element>option</a></code> element being <dfn id=concept-select-pick title=concept-select-pick>picked</dfn> (either
  through a click, or through unfocusing the element after changing its value, or through a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or through any other mechanism), and before the
  relevant user interaction event <!-- interaction event spec point --> is queued (e.g. before the
  <code title=event-click><a href=#event-click>click</a></code> event), the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the picked <code><a href=#the-option-element>option</a></code> element
  to true and then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
  <code title=event-change>change</code> at the <code><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source>user
  interaction task source</a> as the task source.</p>

  <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, whenever an
  <code><a href=#the-option-element>option</a></code> element in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, and whenever an
  <code><a href=#the-option-element>option</a></code> element with its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
  set to true is added to the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the other <code><a href=#the-option-element>option</a></code>
  elements in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false.</p>

  <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent and the element's
  <a href=#concept-select-size title=concept-select-size>display size</a> is greater than 1, then the user agent
  should also allow the user to request that the <code><a href=#the-option-element>option</a></code> whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, if any, be unselected. Upon this
  request being conveyed to the user agent, and before the relevant user interaction event <!--
  interaction event spec point --> is queued (e.g. before the <code title=event-click><a href=#event-click>click</a></code>
  event), the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
  of that <code><a href=#the-option-element>option</a></code> element to false and then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
  simple event</a> that bubbles named <code title=event-change>change</code> at the
  <code><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source>user interaction task source</a> as the task
  source.</p>

  <p>If <a href=#nodes-are-inserted>nodes are inserted</a> or <a href=#nodes-are-removed>nodes are removed</a> causing the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to gain or lose one or more
  <code><a href=#the-option-element>option</a></code> elements, or if an <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> <dfn id=ask-for-a-reset title="ask for a reset">asks for a
  reset</dfn>, then, if the <code><a href=#the-select-element>select</a></code> element's <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, the <code><a href=#the-select-element>select</a></code>
  element's <a href=#concept-select-size title=concept-select-size>display size</a> is 1, and no <code><a href=#the-option-element>option</a></code>
  elements in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of
  options</a> have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
  true, the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of
  the first <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of
  options</a> in <a href=#tree-order>tree order</a> that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, if any, to true.</p>

  <p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present, and the element
  is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent should allow the
  user to <dfn id=concept-select-toggle title=concept-select-toggle>toggle</dfn> the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the <code><a href=#the-option-element>option</a></code> elements in its
  <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that are themselves not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a> (either through a click, or through a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or any other mechanism). Upon the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of one or more <code><a href=#the-option-element>option</a></code>
  elements being changed by the user, and before the relevant user interaction event <!--
  interaction event spec point --> is queued (e.g. before a related <code title=event-click><a href=#event-click>click</a></code> event), the user agent must <a href=#queue-a-task>queue a task</a> to
  <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at
  the <code><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source>user interaction task source</a> as the task
  source.</p>

  <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> for <code><a href=#the-select-element>select</a></code>
  elements is to go through all the <code><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, set their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to true if the <code><a href=#the-option-element>option</a></code> element
  has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise, and then
  have the <code><a href=#the-option-element>option</a></code> elements <a href=#ask-for-a-reset>ask for a reset</a>.</p>

  </div>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
  <code><a href=#the-select-element>select</a></code> element with its <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute represents the element's name. The <code title=attr-fe-disabled><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 title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
  attribute controls focus.</p>

  <p>A <code><a href=#the-select-element>select</a></code> element that is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> is
  <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">select</var> . <code title=dom-select-type><a href=#dom-select-type>type</a></code></dt>

   <dd>

    <p>Returns "<code title="">select-multiple</code>" if the element has a <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute, and "<code title="">select-one</code>"
    otherwise.</p>

   </dd>

   <dt><var title="">select</var> . <code title=dom-select-options><a href=#dom-select-options>options</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> of the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>

   </dd>

   <dt><var title="">select</var> . <code title=dom-select-length><a href=#dom-select-length>length</a></code> [ = <var title="">value</var> ]</dt>
   <dd>

    <p>Returns the number of elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of
    options</a>.</p>

    <p>When set to a smaller number, truncates the number of <code><a href=#the-option-element>option</a></code> elements in the
    <code><a href=#the-select-element>select</a></code>.</p>

    <p>When set to a greater number, adds new blank <code><a href=#the-option-element>option</a></code> elements to the
    <code><a href=#the-select-element>select</a></code>.</p>

   </dd>

   <dt><var title="">element</var> = <var title="">select</var> . <code title=dom-select-item><a href=#dom-select-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">select</var>[<var title="">index</var>]</dt>
   <dd>

    <p>Returns the item with index <var title="">index</var> from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>. The items are sorted in <a href=#tree-order>tree
    order</a>.</p>

   </dd>

   <dt><var title="">element</var> = <var title="">select</var> . <code title=dom-select-item><a href=#dom-select-item>namedItem</a></code>(<var title="">name</var>)</dt>
   <dd>

    <p>Returns the first item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-option-name><a href=#attr-option-name>name</a></code> <var title="">name</var> from the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>

    <p>Returns null if no element with that <a href=#concept-id title=concept-id>ID</a> could be found.</p>

   </dd>

   <dt><var title="">select</var> . <code title=dom-select-add><a href=#dom-select-add>add</a></code>(<var title="">element</var> [, <var title="">before</var> ])</dt>
   <dd>

    <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>

    <p>The <var title="">before</var> argument can be a number, in which case <var title="">element</var> is inserted before the item with that number, or an element from the
    <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, in which case <var title="">element</var> is inserted before that element.</p>

    <p>If <var title="">before</var> is omitted, null, or a number out of range, then <var title="">element</var> will be added at the end of the list.</p>

    <p>This method will throw a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception if <var title="">element</var> is an ancestor of the element into which it is to be inserted.</p>

   </dd>

   <dt><var title="">select</var> . <code title=dom-select-selectedOptions><a href=#dom-select-selectedoptions>selectedOptions</a></code></dt>

   <dd>

    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <a href=#concept-select-option-list title=concept-select-option-list>list
    of options</a> that are selected.</p>

   </dd>

   <dt><var title="">select</var> . <code title=dom-select-selectedIndex><a href=#dom-select-selectedindex>selectedIndex</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the index of the first selected item, if any, or &minus;1 if there is no selected
    item.</p>

    <p>Can be set, to change the selection.</p>

   </dd>

   <dt><var title="">select</var> . <code title=dom-select-value><a href=#dom-select-value>value</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the <a href=#concept-fe-value title=concept-fe-value>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>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-select-type title=dom-select-type><code>type</code></dfn> IDL attribute, on getting, must return
  the string "<code title="">select-one</code>" if the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the string "<code title="">select-multiple</code>" if the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
  attribute is present.</p>

  <p>The <dfn id=dom-select-options title=dom-select-options><code>options</code></dfn> IDL attribute must return an
  <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> rooted at the <code><a href=#the-select-element>select</a></code> node, whose filter matches
  the elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>.</p>

  <p>The <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection is also mirrored on the
  <code><a href=#htmlselectelement>HTMLSelectElement</a></code> object. The <a href=#supported-property-indices>supported property indices</a> at any instant
  are the indices supported by the object returned by the <code title=dom-select-options><a href=#dom-select-options>options</a></code> attribute at that instant.</p>

  <p>The <dfn id=dom-select-length title=dom-select-length><code>length</code></dfn> IDL attribute must return the
  number of nodes <a href=#represented-by-the-collection title="represented by the collection">represented</a> by the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection. On setting, it must act like the attribute
  of the same name on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>

  <p>The <dfn id=dom-select-item title=dom-select-item><code>item(<var title="">index</var>)</code></dfn> method must
  return the value returned by <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>the method of the same
  name</a> on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection, when invoked with
  the same argument.</p>

  <p>The <dfn id=dom-select-nameditem title=dom-select-namedItem><code>namedItem(<var title="">name</var>)</code></dfn>
  method must return the value returned by <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>the
  method of the same name</a> on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection,
  when invoked with the same argument.</p>

  <p>When the user agent is to <dfn id=dom-htmlselectelement-setter title=dom-HTMLSelectElement-setter>set the value of a new
  indexed property</dfn> for a given property index <var title="">index</var> to a new value <var title="">value</var>, it must instead <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value
  of a new indexed property</a> with the given property index <var title="">index</var> to the
  new value <var title="">value</var> on the <code title=dom-select-options><a href=#dom-select-options>options</a></code>
  collection.</p>

  <p>Similarly, the <dfn id=dom-select-add title=dom-select-add><code>add()</code></dfn> and <dfn id=dom-select-remove title=dom-select-remove><code>remove()</code></dfn> methods must act like their namesake methods
  on that same <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>

  <p>The <dfn id=dom-select-selectedoptions title=dom-select-selectedOptions><code>selectedOptions</code></dfn> IDL attribute
  must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code><a href=#the-select-element>select</a></code> node, whose filter
  matches the elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that
  have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

  <p>The <dfn id=dom-select-selectedindex title=dom-select-selectedIndex><code>selectedIndex</code></dfn> IDL attribute, on
  getting, must return the <a href=#concept-option-index title=concept-option-index>index</a> of the first
  <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>
  in <a href=#tree-order>tree order</a> that has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, if any. If there isn't one,
  then it must return &minus;1.</p>

  <p>On setting, the <code title=dom-select-selectedIndex><a href=#dom-select-selectedindex>selectedIndex</a></code> attribute must set
  the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the <code><a href=#the-option-element>option</a></code>
  elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false, and then
  the <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of
  options</a> whose <a href=#concept-option-index title=concept-option-index>index</a> is the given new value, if
  any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

  <p class=note>This can result in no element having a <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true even in the case of the
  <code><a href=#the-select-element>select</a></code> element having no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
  and a <a href=#concept-select-size title=concept-select-size>display size</a> of 1.</p>

  <p>The <dfn id=dom-select-value title=dom-select-value><code>value</code></dfn> IDL attribute, on getting, must
  return the <a href=#concept-option-value title=concept-option-value>value</a> of the first <code><a href=#the-option-element>option</a></code>
  element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in <a href=#tree-order>tree
  order</a> that has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
  true, if any. If there isn't one, then it must return the empty string.</p>

  <p>On setting, the <code title=dom-select-value><a href=#dom-select-value>value</a></code> attribute must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the <code><a href=#the-option-element>option</a></code> elements in
  the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false, and then the first
  <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of
  options</a>, in <a href=#tree-order>tree order</a>, whose <a href=#concept-option-value title=concept-option-value>value</a>
  is equal to the given new value, if any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

  <p class=note>This can result in no element having a <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true even in the case of the
  <code><a href=#the-select-element>select</a></code> element having no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
  and a <a href=#concept-select-size title=concept-select-size>display size</a> of 1.</p>

  <p>The <dfn id=dom-select-multiple title=dom-select-multiple><code>multiple</code></dfn>, <dfn id=dom-select-required title=dom-select-required><code>required</code></dfn>, and <dfn id=dom-select-size title=dom-select-size><code>size</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name. The <code title=dom-select-size><a href=#dom-select-size>size</a></code> IDL
  attribute has a default value of zero.</p> <!-- see bug 12288 for compat reasons why .size allows
  zero (it's not limited to values greater than zero) even though that value really makes no sense
  -->

  <p class=note>For historical reasons, the default value of the <code title=dom-select-size><a href=#dom-select-size>size</a></code> IDL attribute does not return the actual size used, which, in
  the absence of the <code title=attr-select-size><a href=#attr-select-size>size</a></code> content attribute, is either 1 or 4
  depending on the presence of the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
  <a href=#the-constraint-validation-api>constraint validation API</a>. The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL
  attribute provides a list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are
  part of the element's forms API.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>The following example shows how a <code><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>&lt;p&gt;
 &lt;label for="unittype"&gt;Select unit type:&lt;/label&gt;
 &lt;select id="unittype" name="unittype"&gt;
  &lt;option value="1"&gt; Miner &lt;/option&gt;
  &lt;option value="2"&gt; Puffer &lt;/option&gt;
  &lt;option value="3" selected&gt; Snipey &lt;/option&gt;
  &lt;option value="4"&gt; Max &lt;/option&gt;
  &lt;option value="5"&gt; Firebot &lt;/option&gt;
 &lt;/select&gt;
&lt;/p&gt;</pre>

   <p>When there is no default option, a placeholder can be used instead:</p>

   <pre>&lt;select name="unittype" <strong>required</strong>&gt;
 <strong>&lt;option value=""&gt; Select unit type &lt;/option&gt;</strong>
 &lt;option value="1"&gt; Miner &lt;/option&gt;
 &lt;option value="2"&gt; Puffer &lt;/option&gt;
 &lt;option value="3"&gt; Snipey &lt;/option&gt;
 &lt;option value="4"&gt; Max &lt;/option&gt;
 &lt;option value="5"&gt; Firebot &lt;/option&gt;
&lt;/select&gt;</pre>

  </div>

  <div class=example>

   <p>Here, the user is offered a set of options from which he can select any number. By default,
   all five options are selected.</p>

   <pre>&lt;p&gt;
 &lt;label for="allowedunits"&gt;Select unit types to enable on this map:&lt;/label&gt;
 &lt;select id="allowedunits" name="allowedunits" multiple&gt;
  &lt;option value="1" selected&gt; Miner &lt;/option&gt;
  &lt;option value="2" selected&gt; Puffer &lt;/option&gt;
  &lt;option value="3" selected&gt; Snipey &lt;/option&gt;
  &lt;option value="4" selected&gt; Max &lt;/option&gt;
  &lt;option value="5" selected&gt; Firebot &lt;/option&gt;
 &lt;/select&gt;
&lt;/p&gt;</pre>

  </div>

  <div class=example>

   <p>Sometimes, a user has to select one or more items. This example shows such an interface.</p>

   <pre>&lt;p&gt;Select the songs from that you would like on your Act II Mix Tape:&lt;/p&gt;
&lt;select multiple required name="act2"&gt;
 &lt;option value="s1"&gt;It Sucks to Be Me (Reprise)
 &lt;option value="s2"&gt;There is Life Outside Your Apartment
 &lt;option value="s3"&gt;The More You Ruv Someone
 &lt;option value="s4"&gt;Schadenfreude
 &lt;option value="s5"&gt;I Wish I Could Go Back to College
 &lt;option value="s6"&gt;The Money Song
 &lt;option value="s7"&gt;School for Monsters
 &lt;option value="s8"&gt;The Money Song (Reprise)
 &lt;option value="s9"&gt;There's a Fine, Fine Line (Reprise)
 &lt;option value="s10"&gt;What Do You Do With a B.A. in English? (Reprise)
 &lt;option value="s11"&gt;For Now
&lt;/select&gt;</pre>

  </div>



  <h4 id=the-datalist-element><span class=secno>4.10.10 </span>The <dfn><code>datalist</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Either: <a href=#phrasing-content>phrasing content</a>.</dd>
   <dd>Or: Zero or more <code><a href=#the-option-element>option</a></code> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmldatalistelement>HTMLDataListElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-datalist-options title=dom-datalist-options>options</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><!--CLEANUP--><p>The <code><a href=#the-datalist-element>datalist</a></code> element represents a set of
  <code><a href=#the-option-element>option</a></code> elements that represent predefined options for
  other controls. In the rendering,
  the <code><a href=#the-datalist-element>datalist</a></code> element <a href=#represents>represents</a>
  nothing<span class=impl> and it, along with its children, should
  be hidden</span>.</p>

  <p>The <code><a href=#the-datalist-element>datalist</a></code> element can be used in two ways. In the simplest case, the
  <code><a href=#the-datalist-element>datalist</a></code> element has just <code><a href=#the-option-element>option</a></code> element children.</p>

  <div class=example>

   <pre>&lt;label&gt;
 Sex:
 &lt;input name=sex list=sexes&gt;
 &lt;datalist id=sexes&gt;
  &lt;option value="Female"&gt;
  &lt;option value="Male"&gt;
 &lt;/datalist&gt;
&lt;/label&gt;</pre>

  </div>

  <p>In the more elaborate case, the <code><a href=#the-datalist-element>datalist</a></code> element can be given contents that are to
  be displayed for down-level clients that don't support <code><a href=#the-datalist-element>datalist</a></code>. In this case, the
  <code><a href=#the-option-element>option</a></code> elements are provided inside a <code><a href=#the-select-element>select</a></code> element inside the
  <code><a href=#the-datalist-element>datalist</a></code> element.</p>

  <div class=example>

   <pre>&lt;label&gt;
 Sex:
 &lt;input name=sex list=sexes&gt;
&lt;/label&gt;
&lt;datalist id=sexes&gt;
 &lt;label&gt;
  or select from the list:
  &lt;select name=sex&gt;
   &lt;option value=""&gt;
   &lt;option&gt;Female
   &lt;option&gt;Male
  &lt;/select&gt;
 &lt;/label&gt;
&lt;/datalist&gt;</pre>

  </div>

  <p>The <code><a href=#the-datalist-element>datalist</a></code> element is hooked up to an
  <code><a href=#the-input-element>input</a></code> element using the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute on the
  <code><a href=#the-input-element>input</a></code> element.</p>

  <p>Each <code><a href=#the-option-element>option</a></code> element that is a descendant of the
  <code><a href=#the-datalist-element>datalist</a></code> element, that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, and whose <a href=#concept-option-value title=concept-option-value>value</a> is a string that isn't the
  empty string, represents a suggestion. Each suggestion has a <a href=#concept-option-value title=concept-option-value>value</a> and a <a href=#concept-option-label title=concept-option-label>label</a>.

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">datalist</var> . <code title=dom-datalist-options><a href=#dom-datalist-options>options</a></code></dt>

   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the <code>options</code> elements of the
    <code><a href=#the-datalist-element>datalist</a></code> element.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-datalist-options title=dom-datalist-options><code>options</code></dfn>
  IDL attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at
  the <code><a href=#the-datalist-element>datalist</a></code> node, whose filter matches
  <code><a href=#the-option-element>option</a></code> elements.</p>

  <p><strong>Constraint validation</strong>: If an element has a
  <code><a href=#the-datalist-element>datalist</a></code> element ancestor, it is <a href=#barred-from-constraint-validation>barred from
  constraint validation</a>.</p>

  </div>
<!--TOPIC:HTML-->


  <h4 id=the-optgroup-element><span class=secno>4.10.11 </span>The <dfn><code>optgroup</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-select-element>select</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Zero or more <code><a href=#the-option-element>option</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements.</dd>
   
   <dd>An <code><a href=#the-optgroup-element>optgroup</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted
   if the <code><a href=#the-optgroup-element>optgroup</a></code> element <!--has an ancestor <code>select</code> element and--> is
   immediately followed by another <code><a href=#the-optgroup-element>optgroup</a></code> element, or if <!--all of the elements that
   are ancestors of the <code>optgroup</code> element, up to and including the first ancestor element
   that is not an <code>optgroup</code> element, have no more content--> there is no more content in
   the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-optgroup-label><a href=#attr-optgroup-label>label</a></code> &mdash; User-visible label</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmloptgroupelement>HTMLOptGroupElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-optgroup-disabled title=dom-optgroup-disabled>disabled</a>;
           attribute DOMString <a href=#dom-optgroup-label title=dom-optgroup-label>label</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><!-- v2: make optgroups selectable if they have a value. --><p>The <code><a href=#the-optgroup-element>optgroup</a></code> element <a href=#represents>represents</a> a group of
  <code><a href=#the-option-element>option</a></code> elements with a common label.</p>

  <p>The element's group of <code><a href=#the-option-element>option</a></code> elements consists of
  the <code><a href=#the-option-element>option</a></code> elements that are children of the
  <code><a href=#the-optgroup-element>optgroup</a></code> element.</p>

  <div class=impl>

  <p>When showing <code><a href=#the-option-element>option</a></code> elements in <code><a href=#the-select-element>select</a></code>
  elements, user agents should show the <code><a href=#the-option-element>option</a></code> elements
  of such groups as being related to each other and separate from
  other <code><a href=#the-option-element>option</a></code> elements.</p>

  </div>

  <p>The <dfn id=attr-optgroup-disabled title=attr-optgroup-disabled><code>disabled</code></dfn> attribute
  is a <a href=#boolean-attribute>boolean attribute</a> and can be used to <a href=#concept-option-disabled title=concept-option-disabled>disable</a> a group of
  <code><a href=#the-option-element>option</a></code> elements together.</p>

  <p>The <dfn id=attr-optgroup-label title=attr-optgroup-label><code>label</code></dfn>
  attribute must be specified. Its value gives the name of the group,
  for the purposes of the user interface. <span class=impl>User
  agents should use this attribute's value when labeling the group of
  <code><a href=#the-option-element>option</a></code> elements in a <code><a href=#the-select-element>select</a></code>
  element.</span></p>

  <div class=impl>

  <p>The <dfn id=dom-optgroup-disabled title=dom-optgroup-disabled><code>disabled</code></dfn> and <dfn id=dom-optgroup-label title=dom-optgroup-label><code>label</code></dfn> attributes must
  <a href=#reflect>reflect</a> the respective content attributes of the same
  name.</p>

  </div>

  <div class=example>

   <p>The following snippet shows how a set of lessons from three
   courses could be offered in a <code><a href=#the-select-element>select</a></code> drop-down
   widget:</p>

   <pre>&lt;form action="courseselector.dll" method="get"&gt;
 &lt;p&gt;Which course would you like to watch today?
 &lt;p&gt;&lt;label&gt;Course:
  &lt;select name="c"&gt;
   &lt;optgroup label="8.01 Physics I: Classical Mechanics"&gt;
    &lt;option value="8.01.1"&gt;Lecture 01: Powers of Ten
    &lt;option value="8.01.2"&gt;Lecture 02: 1D Kinematics
    &lt;option value="8.01.3"&gt;Lecture 03: Vectors
   &lt;optgroup label="8.02 Electricity and Magnestism"&gt;
    &lt;option value="8.02.1"&gt;Lecture 01: What holds our world together?
    &lt;option value="8.02.2"&gt;Lecture 02: Electric Field
    &lt;option value="8.02.3"&gt;Lecture 03: Electric Flux
   &lt;optgroup label="8.03 Physics III: Vibrations and Waves"&gt;
    &lt;option value="8.03.1"&gt;Lecture 01: Periodic Phenomenon
    &lt;option value="8.03.2"&gt;Lecture 02: Beats
    &lt;option value="8.03.3"&gt;Lecture 03: Forced Oscillations with Damping
  &lt;/select&gt;
 &lt;/label&gt;
 &lt;p&gt;&lt;input type=submit value="&#x25b6; Play"&gt;
&lt;/form&gt;</pre>

  </div>



  <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-select-element>select</a></code> element.</dd>
   <dd>As a child of a <code><a href=#the-datalist-element>datalist</a></code> element.</dd>
   <dd>As a child of an <code><a href=#the-optgroup-element>optgroup</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#text-content title="text content">Text</a>.</dd>
   
   <dd>An <code><a href=#the-option-element>option</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> can be omitted if
   the <code><a href=#the-option-element>option</a></code> element is immediately followed by another <code><a href=#the-option-element>option</a></code> element, or
   if it is immediately followed by an <code><a href=#the-optgroup-element>optgroup</a></code> element, or if there is no more content
   in the parent element.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-option-label><a href=#attr-option-label>label</a></code> &mdash; User-visible label</dd>
   <dd><code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> &mdash; Whether the option is selected by default</dd>
   <dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> &mdash; Value to be used for <a href=#form-submission>form submission</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-option-form title=dom-option-form>form</a>;
           attribute DOMString <a href=#dom-option-label title=dom-option-label>label</a>;
           attribute boolean <a href=#dom-option-defaultselected title=dom-option-defaultSelected>defaultSelected</a>;
           attribute boolean <a href=#dom-option-selected title=dom-option-selected>selected</a>;
           attribute DOMString <a href=#dom-option-value title=dom-option-value>value</a>;

           attribute DOMString <a href=#dom-option-text title=dom-option-text>text</a>;
  readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-option-element>option</a></code> element <a href=#represents>represents</a> an option in a <code><a href=#the-select-element>select</a></code>
  element or as part of a list of suggestions in a <code><a href=#the-datalist-element>datalist</a></code> element.</p>

  <p>In certain circumstances described in the definition of the <code><a href=#the-select-element>select</a></code> element, an
  <code><a href=#the-option-element>option</a></code> element can be a <code><a href=#the-select-element>select</a></code> element's <a href=#placeholder-label-option>placeholder label
  option</a>. A <a href=#placeholder-label-option>placeholder label option</a> does not represent an actual option, but
  instead represents a label for the <code><a href=#the-select-element>select</a></code> control.</p>

  <p>The <dfn id=attr-option-disabled title=attr-option-disabled><code>disabled</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. An <code><a href=#the-option-element>option</a></code> element is <dfn id=concept-option-disabled title=concept-option-disabled>disabled</dfn> if its <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> attribute is present or if it is a child of an
  <code><a href=#the-optgroup-element>optgroup</a></code> element whose <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute
  is present.</p>

  <div class=impl>

  <p>An <code><a href=#the-option-element>option</a></code> element that is <a href=#attr-option-disabled title=attr-option-disabled>disabled</a> must
  prevent any <code title=event-click><a href=#event-click>click</a></code> events that are <a href=#queue-a-task title="queue a
  task">queued</a> on the <a href=#user-interaction-task-source>user interaction task source</a> from being dispatched on the
  element.</p>

  </div>

  <p>The <dfn id=attr-option-label title=attr-option-label><code>label</code></dfn> attribute provides a label for
  element. The <dfn id=concept-option-label title=concept-option-label>label</dfn> of an <code><a href=#the-option-element>option</a></code> element is
  the value of the <code title=attr-option-label><a href=#attr-option-label>label</a></code> content attribute, if there is one,
  or, if there is not, the value of the element's <code title=dom-option-text><a href=#dom-option-text>text</a></code> IDL
  attribute.</p>

  <p>The <code title=attr-option-label><a href=#attr-option-label>label</a></code> content attribute, if specified, must not be
  empty. If the attribute is not specified, then the element itself must not be empty.</p>

  <p>The <dfn id=attr-option-value title=attr-option-value><code>value</code></dfn> attribute provides a value for
  element. The <dfn id=concept-option-value title=concept-option-value>value</dfn> of an <code><a href=#the-option-element>option</a></code> element is
  the value of the <code title=attr-option-value><a href=#attr-option-value>value</a></code> content attribute, if there is one,
  or, if there is not, the value of the element's <code title=dom-option-text><a href=#dom-option-text>text</a></code> IDL
  attribute.</p>

  <p>The <dfn id=attr-option-selected title=attr-option-selected><code>selected</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. It represents the default <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the element.</p>

  <div class=impl>

  <p>The <dfn id=concept-option-selectedness title=concept-option-selectedness>selectedness</dfn> of an <code><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 title=concept-option-selectedness>selectedness</a> must be set to true if
  the element has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
  <code><a href=#the-option-element>option</a></code> element's <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is
  added, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set to true.</p>

  <p class=note>The <code title=dom-option><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 title=concept-option-selectedness>selectedness</a> state to always be false even if the third
  argument is true (implying that a <code title=attr-option-selected><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 title=concept-option-selectedness>selectedness</a> state when using the constructor.</p>

  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/604 -->

  </div>

  <p>A <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
  attribute is not specified must not have more than one descendant <code><a href=#the-option-element>option</a></code> element with
  its <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set.</p>

  <div class=impl>

  <p>An <code><a href=#the-option-element>option</a></code> element's <dfn id=concept-option-index title=concept-option-index>index</dfn> is the number of
  <code><a href=#the-option-element>option</a></code> elements that are in the same <a href=#concept-select-option-list title=concept-select-option-list>list of
  options</a> but that come before it in <a href=#tree-order>tree order</a>. If the <code><a href=#the-option-element>option</a></code>
  element is not in a <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, then the
  <code><a href=#the-option-element>option</a></code> element's <a href=#concept-option-index title=concept-option-index>index</a> is zero.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">option</var> . <code title=dom-option-selected><a href=#dom-option-selected>selected</a></code></dt>

   <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>

   </dd>

   <dt><var title="">option</var> . <code title=dom-option-index><a href=#dom-option-index>index</a></code></dt>

   <dd>

    <p>Returns the index of the element in its <code><a href=#the-select-element>select</a></code>
    element's <code title=dom-select-options><a href=#dom-select-options>options</a></code>
    list.</p>

   </dd>

   <dt><var title="">option</var> . <code title=dom-option-form><a href=#dom-option-form>form</a></code></dt>

   <dd>

    <p>Returns the element's <code><a href=#the-form-element>form</a></code> element, if any, or
    null otherwise.</p>

   </dd>

   <dt><var title="">option</var> . <code title=dom-option-text><a href=#dom-option-text>text</a></code></dt>

   <dd>

    <p>Same as <code><a href=#textcontent>textContent</a></code>, except that spaces are collapsed and <code><a href=#the-script-element>script</a></code> elements are skipped.</p>

   </dd>

   <dt><var title="">option</var> = new <code title=dom-option><a href=#dom-option>Option</a></code>( [ <var title="">text</var> [, <var title="">value</var> [, <var title="">defaultSelected</var> [, <var title="">selected</var> ] ] ] ] )</dt>

   <dd>

    <p>Returns a new <code><a href=#the-option-element>option</a></code> element.</p>

    <p>The <var title="">text</var> argument sets the contents of the element.</p>
    <p>The <var title="">value</var> argument sets the <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute.</p>
    <p>The <var title="">defaultSelected</var> argument sets the <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute.</p>
    <p>The <var title="">selected</var> argument sets whether or not the element is selected. If it is omitted, even if the <var title="">defaultSelected</var> argument is true, the element is not selected.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-option-disabled title=dom-option-disabled><code>disabled</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name. The <dfn id=dom-option-defaultselected title=dom-option-defaultSelected><code>defaultSelected</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> content attribute.</p>

  <p>The <dfn id=dom-option-label title=dom-option-label><code>label</code></dfn> IDL attribute, on getting, must
  return the element's <a href=#concept-option-label title=concept-option-label>label</a>. On setting, the element's
  <code title=attr-option-label><a href=#attr-option-label>label</a></code> content attribute must be set to the new value.</p>

  <p>The <dfn id=dom-option-value title=dom-option-value><code>value</code></dfn> IDL attribute, on getting, must
  return the element's <a href=#concept-option-value title=concept-option-value>value</a>. On setting, the element's
  <code title=attr-option-value><a href=#attr-option-value>value</a></code> content attribute must be set to the new value.</p>

  <p>The <dfn id=dom-option-selected title=dom-option-selected><code>selected</code></dfn> IDL attribute, on getting,
  must return true if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is
  true, and false otherwise. On setting, it must set the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to the new value, and then cause the
  element to <a href=#ask-for-a-reset>ask for a reset</a>.</p>

  <p>The <dfn id=dom-option-index title=dom-option-index><code>index</code></dfn> IDL attribute must return the
  element's <a href=#concept-option-index title=concept-option-index>index</a>.</p>

  <p>The <dfn id=dom-option-text title=dom-option-text><code>text</code></dfn> IDL attribute, on getting, must return
  the result of <a href=#strip-and-collapse-whitespace title="strip and collapse whitespace">stripping and collapsing
  whitespace</a> from the concatenation of <a href=#concept-cd-data title=concept-cd-data>data</a> of all the
  <code><a href=#text>Text</a></code> node descendants of the <code><a href=#the-option-element>option</a></code> element, in <a href=#tree-order>tree order</a>,
  excluding any that are descendants of descendants of the <code><a href=#the-option-element>option</a></code> element that are
  themselves <code><a href=#the-script-element>script</a></code> elements in the <a href=#html-namespace-0>HTML namespace</a> or <code title="">script</code> elements in the <a href=#svg-namespace>SVG namespace</a>.</p>

  <p>On setting, the <code title=dom-option-text><a href=#dom-option-text>text</a></code> attribute must act as if the
  <code><a href=#textcontent>textContent</a></code> IDL attribute on the element had been set to the new value.</p>

  <p>The <dfn id=dom-option-form title=dom-option-form><code>form</code></dfn> IDL attribute's behavior depends on
  whether the <code><a href=#the-option-element>option</a></code> element is in a <code><a href=#the-select-element>select</a></code> element or not. If the
  <code><a href=#the-option-element>option</a></code> has a <code><a href=#the-select-element>select</a></code> element as its parent, or has an
  <code><a href=#the-optgroup-element>optgroup</a></code> element as its parent and that <code><a href=#the-optgroup-element>optgroup</a></code> element has a
  <code><a href=#the-select-element>select</a></code> element as its parent, then the <code title=dom-option-form><a href=#dom-option-form>form</a></code> IDL
  attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute
  on that <code><a href=#the-select-element>select</a></code> element. Otherwise, it must return null.</p>

  <p>A constructor is provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in addition to
  the factory methods from DOM such as <code title="">createElement()</code>): <dfn id=dom-option title=dom-option><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as a
  constructor, it must return a new <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new <code><a href=#the-option-element>option</a></code>
  element). If the first argument is not the empty string, the new object must have as its only
  child a <code><a href=#text>Text</a></code> node whose data is the value of that argument. Otherwise, it must have
  no children. If the <var title="">value</var> argument is present, the new object must have a
  <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute set with the value of the argument as its
  value. If the <var title="">defaultSelected</var> argument is true, the new object must have a
  <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no value. If the <var title="">selected</var> argument is true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true; otherwise the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set to false, even if the <var title="">defaultSelected</var> argument is true. The element's document must be the <a href=#active-document>active
  document</a> of the <a href=#browsing-context>browsing context</a> of the <code><a href=#window>Window</a></code> object on which
  the interface object of the invoked constructor is found.</p>

  </div>
<!--TOPIC:HTML-->



  <h4 id=the-textarea-element><span class=secno>4.10.13 </span>The <dfn><code>textarea</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, <a href=#category-reset title=category-reset>resettable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#text-content title="text content">Text</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> &mdash; Hint for form autofill feature</dd>
   <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> &mdash; Automatically focus the form control when the page is loaded</dd>
   <dd><code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> &mdash; Maximum number of characters per line</dd>
   <dd><code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> &mdash; Name of form field to use for sending the element's <a href=#the-directionality title="the directionality">directionality</a> in <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> &mdash; Hint for selecting an input modality</dd>
   <dd><code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code> &mdash; Maximum length of value</dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dd><code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code> &mdash; User-visible label to be placed within the form control</dd>
   <dd><code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> &mdash; Whether to allow the value to be edited by the user</dd>
   <dd><code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code> &mdash; Whether the control is required for <a href=#form-submission>form submission</a></dd>
   <dd><code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code> &mdash; Number of lines to show</dd>
   <dd><code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> &mdash; How the value of the form control is to be wrapped for <a href=#form-submission>form submission</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmltextareaelement>HTMLTextAreaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-fe-autocomplete title=dom-fe-autocomplete>autocomplete</a>;
           attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
           attribute unsigned long <a href=#dom-textarea-cols title=dom-textarea-cols>cols</a>;
           attribute DOMString <a href=#dom-textarea-dirname title=dom-textarea-dirName>dirName</a>;
           attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-textarea-inputmode title=dom-textarea-inputMode>inputMode</a>;
           attribute long <a href=#dom-textarea-maxlength title=dom-textarea-maxLength>maxLength</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;
           attribute DOMString <a href=#dom-textarea-placeholder title=dom-textarea-placeholder>placeholder</a>;
           attribute boolean <a href=#dom-textarea-readonly title=dom-textarea-readOnly>readOnly</a>;
           attribute boolean <a href=#dom-textarea-required title=dom-textarea-required>required</a>;
           attribute unsigned long <a href=#dom-textarea-rows title=dom-textarea-rows>rows</a>;
           attribute DOMString <a href=#dom-textarea-wrap title=dom-textarea-wrap>wrap</a>;

  readonly attribute DOMString <a href=#dom-textarea-type title=dom-textarea-type>type</a>;
           attribute DOMString <a href=#dom-textarea-defaultvalue title=dom-textarea-defaultValue>defaultValue</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-textarea-value title=dom-textarea-value>value</a>;
  readonly attribute unsigned long <a href=#dom-textarea-textlength title=dom-textarea-textLength>textLength</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;

  void <a href=#dom-textarea/input-select title=dom-textarea/input-select>select</a>();
           attribute unsigned long <a href=#dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart>selectionStart</a>;
           attribute unsigned long <a href=#dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd>selectionEnd</a>;
           attribute DOMString <a href=#dom-textarea/input-selectiondirection title=dom-textarea/input-selectionDirection>selectionDirection</a>;
  void <a href=#dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText>setRangeText</a>(DOMString replacement);
  void <a href=#dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText>setRangeText</a>(DOMString replacement, unsigned long start, unsigned long end, optional <a href=#selectionmode>SelectionMode</a> selectionMode);
  void <a href=#dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange>setSelectionRange</a>(unsigned long start, unsigned long end, optional DOMString direction);
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-textarea-element>textarea</a></code> element <a href=#represents>represents</a> a
  multiline plain text edit control<span class=impl> for the
  element's <dfn id=concept-textarea-raw-value title=concept-textarea-raw-value>raw
  value</dfn></span>. The contents of the control represent the
  control's default value.</p>

  <div class=impl>

  <p>The <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> of
  a <code><a href=#the-textarea-element>textarea</a></code> control must be initially the empty
  string.</p>

  <p>A newline in a <code><a href=#the-textarea-element>textarea</a></code> element, and in its <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a>, should separate
  paragraphs for the purposes of the Unicode bidirectional algorithm.
  This requirement may be implemented indirectly through the style
  layer. For example, an HTML+CSS user agent could implement these
  requirements by implementing the CSS 'unicode-bidi' property. <a href=#refsBIDI>[BIDI]</a> <a href=#refsCSS>[CSS]</a></p>

  </div>

  <p>The <dfn id=attr-textarea-readonly title=attr-textarea-readonly><code>readonly</code></dfn> attribute
  is a <a href=#boolean-attribute>boolean attribute</a> used to control whether the text
  can be edited by the user or not.</p>

  <div class=example>

   <p>In this example, a text field is marked read-only because it
   represents a read-only file:</p>

   <pre>Filename: &lt;code&gt;/etc/bash.bashrc&lt;/code&gt;
&lt;textarea name="buffer" readonly&gt;
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] &amp;amp;&amp;amp; return

...&lt;/textarea&gt;</pre>

  </div>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If the <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute is
  specified on a <code><a href=#the-textarea-element>textarea</a></code> element, the element is
  <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>

  <p>A <code><a href=#the-textarea-element>textarea</a></code> element is <a href=#concept-fe-mutable title=concept-fe-mutable>mutable</a> if it is neither <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> nor has a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute
  specified.</p>

  <p>When a <code><a href=#the-textarea-element>textarea</a></code> is <a href=#concept-fe-mutable title=concept-fe-mutable>mutable</a>, its <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> should be
  editable by the user: the user agent should allow the user to edit,
  insert, and remove text, and to insert and remove line breaks in the
  form of U+000A LINE FEED (LF) characters. Any time the user causes
  the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
  value</a> to change, the user agent must <a href=#queue-a-task>queue a
  task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
  <code title=event-input>input</code> at the <code><a href=#the-textarea-element>textarea</a></code>
  element. User agents may wait for a suitable break in the user's
  interaction before queuing the task; for example, a user agent could
  wait for the user to have not hit a key for 100ms, so as to only
  fire the event when the user pauses, instead of continuously for
  each keystroke.</p> <!-- same text is present in the <input> section
  -->

  <p>A <code><a href=#the-textarea-element>textarea</a></code> element has a <dfn id=concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</dfn>, which must be
  initially set to false, and must be set to true whenever the user
  interacts with the control in a way that changes the <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a>.</p>

  <p>When the <code><a href=#the-textarea-element>textarea</a></code> element's <code><a href=#textcontent>textContent</a></code>
  IDL attribute changes value, if the element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a> is false,
  then the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
  value</a> must be set to the value of the element's
  <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>

  <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
  algorithm</a> for <code><a href=#the-textarea-element>textarea</a></code> elements is to set the
  element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>value</a> to
  the value of the element's <code><a href=#textcontent>textContent</a></code> IDL
  attribute.</p>

  <!-- this next bit is also in the <input> Text/Search section -->
  <!-- and something similar is in the session history section -->
  <p>If the element is <a href=#concept-fe-mutable title=concept-fe-mutable>mutable</a>, the user agent
  should allow the user to change the writing direction of the
  element, setting it either to a left-to-right writing direction or a
  right-to-left writing direction. If the user does so, the user agent
  must then run the following steps:</p>

  <ol><li><p>Set the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code>
   attribute to "<code title=attr-dir-ltr><a href=#attr-dir-ltr>ltr</a></code>" if the user
   selected a left-to-right writing direction, and "<code title=attr-dir-rtl><a href=#attr-dir-rtl>rtl</a></code>" if the user selected a
   right-to-left writing direction.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
   event</a> that bubbles named <code title=event-input>input</code> at the <code><a href=#the-textarea-element>textarea</a></code>
   element.</li>

  </ol></div>

  <p>The <dfn id=attr-textarea-cols title=attr-textarea-cols><code>cols</code></dfn>
  attribute specifies the expected maximum number of characters per
  line. If the <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute
  is specified, its value must be a <a href=#valid-non-negative-integer>valid non-negative
  integer</a> greater than zero. <span class=impl>If applying the
  <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the
  attribute's value results in a number greater than zero, then the
  element's <dfn id=attr-textarea-cols-value title=attr-textarea-cols-value>character
  width</dfn> is that value; otherwise, it is 20.</span></p>

  <div class=impl>

  <p>The user agent may use the <code><a href=#the-textarea-element>textarea</a></code> element's <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character width</a> as a hint to
  the user as to how many characters the server prefers per line
  (e.g. for visual user agents by making the width of the control be
  that many characters). In visual renderings, the user agent should
  wrap the user's input in the rendering so that each line is no wider
  than this number of characters.</p>

  </div>

  <p>The <dfn id=attr-textarea-rows title=attr-textarea-rows><code>rows</code></dfn>
  attribute specifies the number of lines to show. If the <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code> attribute is specified, its
  value must be a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than
  zero. <span class=impl>If applying the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
  non-negative integers</a> to the attribute's value results in a
  number greater than zero, then the element's <dfn id=attr-textarea-rows-value title=attr-textarea-rows-value>character height</dfn> is that
  value; otherwise, it is 2.</span></p>

  <div class=impl>

  <p>Visual user agents should set the height of the control to the
  number of lines given by <a href=#attr-textarea-rows-value title=attr-textarea-rows-value>character height</a>.</p>

  </div>

  <p>The <dfn id=attr-textarea-wrap title=attr-textarea-wrap><code>wrap</code></dfn>
  attribute is an <a href=#enumerated-attribute>enumerated attribute</a> with two keywords
  and states: the <dfn id=attr-textarea-wrap-soft title=attr-textarea-wrap-soft><code>soft</code></dfn> keyword
  which maps to the <a href=#attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</a> state, and the
  <dfn id=attr-textarea-wrap-hard title=attr-textarea-wrap-hard><code>hard</code></dfn> keyword
  which maps to the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</a> state. The
  <i>missing value default</i> is the <a href=#attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</a> state.</p>

  <p>The <dfn id=attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</dfn> state
  indicates that the text in the <code><a href=#the-textarea-element>textarea</a></code> is not to be
  wrapped when it is submitted (though it can still be wrapped in the
  rendering).</p>

  <p>The <dfn id=attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</dfn> state
  indicates that the text in the <code><a href=#the-textarea-element>textarea</a></code> is to have
  newlines added by the user agent so that the text is wrapped when it
  is submitted.</p>

  <p>If the element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code>
  attribute is in the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</a> state, the <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute must be
  specified.</p>

  <!-- attr-textarea-wrap-off (attr-textarea-wrap-off-state): not
  conforming; turns off the rendering of wrapping but otherwise acts
  like 'soft' -->

  <div class=impl>

  <p>For historical reasons, the element's value is normalised in
  three different ways for three different purposes. The <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> is the value as
  it was originally set. It is not normalized. The <a href=#concept-textarea-api-value title=concept-textarea-api-value>API value</a> is the value
  used in the <code title=dom-textarea-value><a href=#dom-textarea-value>value</a></code> IDL
  attribute. It is normalized so that line breaks use U+000A LINE FEED
  (LF) characters. Finally, there is the form submission <a href=#concept-fe-value title=concept-fe-value>value</a>. 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 element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute, additional line
  breaks are inserted to wrap the text at the given width.</p>

  <p>The element's <dfn id=concept-textarea-api-value title=concept-textarea-api-value>API
  value</dfn> is defined to be the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> with the
  following transformation applied:</p>

  <ol><li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF)
   character pair from the <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> with a single
   U+000A LINE FEED (LF) character.</li>

   <li><p>Replace every remaining U+000D CARRIAGE RETURN character from
   the <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> with
   a single U+000A LINE FEED (LF) character.</li>

  </ol><p>The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is
  defined to be the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> with the
  following transformation applied:</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>

   <li><p>If the element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute is in the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>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 title=attr-textarea-cols-value>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.</li>

  </ol></div>

  <p>The <dfn id=attr-textarea-maxlength title=attr-textarea-maxlength><code>maxlength</code></dfn>
  attribute is a <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a> controlled by the
  <code><a href=#the-textarea-element>textarea</a></code> element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a>.</p>

  <p>If the <code><a href=#the-textarea-element>textarea</a></code> element has a <a href=#maximum-allowed-value-length>maximum allowed
  value length</a>, then the element's children must be such that
  the <a href=#code-unit-length>code-unit length</a> of the value of the element's
  <code><a href=#textcontent>textContent</a></code> IDL attribute is equal to or less than the
  element's <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>

  <p>The <dfn id=attr-textarea-required title=attr-textarea-required><code>required</code></dfn> attribute
  is a <a href=#boolean-attribute>boolean attribute</a>. When specified, the user will
  be required to enter a value before submitting the form.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If the element has its
  <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code> attribute
  specified, and the element is <a href=#concept-fe-mutable title=concept-fe-mutable>mutable</a>, and the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a> is the empty string,
  then the element is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p>

  </div>


  <!-- substantially similar text in the <input> section -->

  <p>The <dfn id=attr-textarea-placeholder title=attr-textarea-placeholder><code>placeholder</code></dfn>
  attribute represents a <em>short</em> hint (a word or short phrase)
  intended to aid the user with data entry when the control has no
  value. A hint could be a sample value or a brief description of the
  expected format. The attribute, if specified, must have a value that
  contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)
  characters.</p>

  <p>The <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code>
  attribute should not be used as an alternative to a
  <code><a href=#the-label-element>label</a></code>. For a longer hint or other advisory text, the
  <code title=attr-title><a href=#attr-title>title</a></code> attribute is more
  appropriate.</p>

  <p class=note>These mechanisms are very similar but subtly
  different: the hint given by the control's <code><a href=#the-label-element>label</a></code> is
  shown at all times; the short hint given in the <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code> attribute is
  shown before the user enters a value; and the hint in the <code title=attr-title><a href=#attr-title>title</a></code> attribute is shown when the user
  requests further help.</p>

  <div class=impl>

  <p>User agents should present this hint to the user, after having
  <a href=#strip-line-breaks title="strip line breaks">stripped line breaks</a> from it,
  when the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is
  the empty string and the control is not focused (e.g. by displaying
  it inside a blank unfocused control).</p>

  </div>

  <p>
  The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
  The <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute controls how the element's <a href=#the-directionality title="the directionality">directionality</a> is submitted.
  The <code title=attr-fe-disabled><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 title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the <code><a href=#the-textarea-element>textarea</a></code> element with its <a href=#form-owner>form owner</a>.
  The <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
  The <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute controls the user interface's input modality for the control.
  The <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute controls how the user agent provides autofill behavior.
  </p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">textarea</var> . <code title=attr-textarea-type>type</code></dt>

   <dd>

    <p>Returns the string "<code title="">textarea</code>".</p>

   </dd>

   <dt><var title="">textarea</var> . <code title=attr-textarea-value>value</code></dt>

   <dd>

    <p>Returns the current value of the element.</p>

    <p>Can be set, to change the value.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-textarea-cols title=dom-textarea-cols><code>cols</code></dfn>, <dfn id=dom-textarea-placeholder title=dom-textarea-placeholder><code>placeholder</code></dfn>,
  <dfn id=dom-textarea-required title=dom-textarea-required><code>required</code></dfn>, <dfn id=dom-textarea-rows title=dom-textarea-rows><code>rows</code></dfn>, and <dfn id=dom-textarea-wrap title=dom-textarea-wrap><code>wrap</code></dfn> attributes must
  <a href=#reflect>reflect</a> the respective content attributes of the same
  name. The <code title=dom-textarea-cols><a href=#dom-textarea-cols>cols</a></code> and <code title=dom-textarea-rows><a href=#dom-textarea-rows>rows</a></code> attributes are <a href=#limited-to-only-non-negative-numbers-greater-than-zero>limited
  to only non-negative numbers greater than zero</a>. The <code title=dom-textarea-cols><a href=#dom-textarea-cols>cols</a></code> attribute's default value is
  20. The <code title=dom-textarea-rows><a href=#dom-textarea-rows>rows</a></code> attribute's
  default value is 2. The <dfn id=dom-textarea-dirname title=dom-textarea-dirName><code>dirName</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> content attribute. The
  <dfn id=dom-textarea-inputmode title=dom-textarea-inputMode><code>inputMode</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> content attribute,
  <a href=#limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-textarea-maxlength title=dom-textarea-maxLength><code>maxLength</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code> content attribute,
  <a href=#limited-to-only-non-negative-numbers>limited to only non-negative numbers</a>. The <dfn id=dom-textarea-readonly title=dom-textarea-readOnly><code>readOnly</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-textarea-type title=dom-textarea-type><code>type</code></dfn> IDL
  attribute must return the value "<code title="">textarea</code>".</p>

  <p>The <dfn id=dom-textarea-defaultvalue title=dom-textarea-defaultValue><code>defaultValue</code></dfn>
  IDL attribute must act like the element's <code><a href=#textcontent>textContent</a></code>
  IDL attribute.</p>

  <p>The <dfn id=dom-textarea-value title=dom-textarea-value><code>value</code></dfn>
  attribute must, on getting, return the element's <a href=#concept-textarea-api-value title=concept-textarea-api-value>API value</a>; on setting, it
  must set the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
  value</a> to the new value, set the element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a> to true, and
  should then move the text entry cursor position to the end of the
  text field, unselecting any selected text and resetting the
  selection direction to <i>none</i>.</p>

  <p>The <dfn id=dom-textarea-textlength title=dom-textarea-textLength><code>textLength</code></dfn> IDL
  attribute must return the <a href=#code-unit-length>code-unit length</a> of the
  element's <a href=#concept-textarea-api-value title=concept-textarea-api-value>API
  value</a>.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL
  attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
  methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
  <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a
  list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select()</a></code>, <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  and <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
  methods and IDL attributes expose the element's text selection. The
  <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
  element's forms API.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>Here is an example of a <code><a href=#the-textarea-element>textarea</a></code> being used for
   unrestricted free-form text input in a form:</p>

   <pre>&lt;p&gt;If you have any comments, please let us know: &lt;textarea cols=80 name=comments&gt;&lt;/textarea&gt;&lt;/p&gt;</pre>

   <p>To specify a maximum length for the comments, one can use
   the <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>
   attribute:</p>

   <pre>&lt;p&gt;If you have any short comments, please let us know: &lt;textarea cols=80 name=comments maxlength=200&gt;&lt;/textarea&gt;&lt;/p&gt;</pre>

   <p>To give a default value, text can be included inside the element:</p>

   <pre>&lt;p&gt;If you have any comments, please let us know: &lt;textarea cols=80 name=comments&gt;You rock!&lt;/textarea&gt;&lt;/p&gt;</pre>

   <p>To have the browser submit <a href=#the-directionality>the directionality</a> of
   the element along with the value, the <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute can be
   specified:</p>

   <pre>&lt;p&gt;If you have any comments, please let us know (you may use either English or Hebrew for your comments):
&lt;textarea cols=80 name=comments dirname=comments.dir&gt;&lt;/textarea&gt;&lt;/p&gt;</pre>

  </div>



  <h4 id=the-keygen-element><span class=secno>4.10.14 </span>The <dfn><code>keygen</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-submit title=category-submit>submittable</a>, <a href=#category-reset title=category-reset>resettable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> &mdash; Automatically focus the form control when the page is loaded</dd>
   <dd><code title=attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code> &mdash; String to package with the generated and signed public key</dd>
   <dd><code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code> &mdash; The type of cryptographic key to generate</dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlkeygenelement>HTMLKeygenElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-fe-autofocus title=dom-fe-autofocus>autofocus</a>;
           attribute DOMString <a href=#dom-keygen-challenge title=dom-keygen-challenge>challenge</a>;
           attribute boolean <a href=#dom-fe-disabled title=dom-fe-disabled>disabled</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-keygen-keytype title=dom-keygen-keytype>keytype</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;

  readonly attribute DOMString <a href=#dom-keygen-type title=dom-keygen-type>type</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-keygen-element>keygen</a></code> element <a href=#represents>represents</a> a key
  pair generator control. When the control's form is submitted, the
  private key is stored in the local keystore, and the public key is
  packaged and sent to the server.</p>

  <p>The <dfn id=attr-keygen-challenge title=attr-keygen-challenge><code>challenge</code></dfn> attribute
  may be specified. Its value will be packaged with the submitted
  key.</p>

  <p>The <dfn id=attr-keygen-keytype title=attr-keygen-keytype><code>keytype</code></dfn>
  attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The following
  table lists the keywords and states for the attribute &mdash; the
  keywords in the left column map to the states listed in the cell in
  the second column on the same row as the keyword. User agents are
  not required to support these values, and must only recognize values
  whose corresponding algorithms they support.</p>

  <table><thead><tr><th> Keyword <th> State
   <tbody><tr><td> <code title="">rsa</code>
     <td> <i title="">RSA</i>
<!-- v2 (see below)
    <tr>
     <td> <code title="">ec</code>
     <td> <i title="">EC</i>
-->
  </table><p>The <i>invalid value default</i> state is the <i title="">unknown</i> state. The <i>missing value default</i> state
  is the <i title="">RSA</i> state, if it is supported, or the <i title="">unknown</i> state otherwise.</p>

  <p class=note>This specification does not specify what key types
  user agents are to support &mdash; it is possible for a user agent
  to not support any key types at all.</p>

  <div class=impl>

  <p>The user agent may expose a user interface for each
  <code><a href=#the-keygen-element>keygen</a></code> element to allow the user to configure settings
  of the element's key pair generator, e.g. the key length.</p>

  <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
  algorithm</a> for <code><a href=#the-keygen-element>keygen</a></code> elements is to set these
  various configuration settings back to their defaults.</p>

  <p>The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is the
  string returned from the following algorithm:</p>

  <ol><li>

    <p>Use the appropriate step from the following list:</p>

    <dl class=switch><!-- v2 (see above)

     <dt>If the <code title="attr-keygen-keytype">keytype</code>
     attribute is in the <i title="">EC</i> state</dt>

     <dd>

      <p>...

      http://www.mail-archive.com/dev-tech-crypto@lists.mozilla.org/msg05902.html

     </dd>

     --><dt>If the <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code>
     attribute is in the <i title="">RSA</i> state</dt>

     <dd>

      <p>Generate an RSA key pair using the settings given by the
      user, if appropriate, using the <code title="">md5WithRSAEncryption</code> RSA signature algorithm
      (the signature algorithm with MD5 and the RSA encryption
      algorithm) referenced in section 2.2.1 ("RSA Signature
      Algorithm") of RFC 3279, and defined in RFC 2313. <a href=#refsRFC3279>[RFC3279]</a> <a href=#refsRFC2313>[RFC2313]</a></p>

     </dd>

     <dt>Otherwise, the <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code> attribute is in the <i title="">unknown</i> state</dt>

     <dd>

      <p>The given key type is not supported. Return the empty string
      and abort this algorithm.</p>

     </dd>

    </dl><p>Let <var title="">private key</var> be the generated private key.</p>

    <p>Let <var title="">public key</var> be the generated public key.</p>

    <p>Let <var title="">signature algorithm</var> be the selected
    signature algorithm.</p>

   </li>

   <li>

    <p>If the element has a <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code> attribute, then let
    <var title="">challenge</var> be that attribute's value.
    Otherwise, let <var title="">challenge</var> be the empty
    string.</p>

   </li>

   <li>

    <p>Let <var title="">algorithm</var> be an ASN.1 <code title="">AlgorithmIdentifier</code> structure as defined by
    RFC 5280, with the <code title="">algorithm</code> field giving the
    ASN.1 OID used to identify <var title="">signature
    algorithm</var>, using the OIDs defined in section 2.2 ("Signature
    Algorithms") of RFC 3279, and the <code title="">parameters</code>
    field set up as required by RFC 3279 for <code title="">AlgorithmIdentifier</code> structures for that
    algorithm. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a> <a href=#refsRFC3279>[RFC3279]</a></p>

   </li>

   <li>

    <p>Let <var title="">spki</var> be an ASN.1 <code title="">SubjectPublicKeyInfo</code> structure as defined by
    RFC 5280, with the <code title="">algorithm</code> field set to the
    <var title="">algorithm</var> structure from the previous step,
    and the <code title="">subjectPublicKey</code> field set to the
    BIT STRING value resulting from ASN.1 DER encoding the <var title="">public key</var>. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a></p>

   </li>

   <li>

    <p>Let <var title="">publicKeyAndChallenge</var> be an ASN.1
    <code><a href=#publickeyandchallenge>PublicKeyAndChallenge</a></code> structure as defined below,
    with the <code title="">spki</code> field set to the <var title="">spki</var> structure from the previous step, and the
    <code title="">challenge</code> field set to the string <var title="">challenge</var> obtained earlier. <a href=#refsX690>[X690]</a></p>

   </li>

   <li>

    <p>Let <var title="">signature</var> be the BIT STRING value
    resulting from ASN.1 DER encoding the signature generated by
    applying the <var title="">signature algorithm</var> to the byte
    string obtained by ASN.1 DER encoding the <var title="">publicKeyAndChallenge</var> structure, using <var title="">private key</var> as the signing key. <a href=#refsX690>[X690]</a></p>

   </li>

   <li>

    <p>Let <var title="">signedPublicKeyAndChallenge</var> be an ASN.1
    <code><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> structure as defined
    below, with the <code title="">publicKeyAndChallenge</code> field
    set to the <var title="">publicKeyAndChallenge</var> structure,
    the <code title="">signatureAlgorithm</code> field set to the <var title="">algorithm</var> structure, and the <code title="">signature</code> field set to the BIT STRING <var title="">signature</var> from the previous step. <a href=#refsX690>[X690]</a></p>

   </li>

   <li>

    <p>Return the result of base64 encoding the result of ASN.1 DER
    encoding the <var title="">signedPublicKeyAndChallenge</var>
    structure. <a href=#refsRFC4648>[RFC4648]</a><!--base64--> <a href=#refsX690>[X690]</a></p>

   </li>

  </ol><p>The data objects used by the above algorithm are defined as
  follows. These definitions use the same "ASN.1-like" syntax defined
  by RFC 5280. <a href=#refsRFC5280>[RFC5280]</a></p>

  <pre class=asn><dfn id=publickeyandchallenge>PublicKeyAndChallenge</dfn> ::= SEQUENCE {
    spki <span>SubjectPublicKeyInfo</span>,
    challenge IA5STRING
}

<dfn id=signedpublickeyandchallenge>SignedPublicKeyAndChallenge</dfn> ::= SEQUENCE {
    publicKeyAndChallenge <a href=#publickeyandchallenge>PublicKeyAndChallenge</a>,
    signatureAlgorithm <span>AlgorithmIdentifier</span>,
    signature BIT STRING
}</pre>

  <hr><p><strong>Constraint validation</strong>: The <code><a href=#the-keygen-element>keygen</a></code>
  element is <a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>

  </div>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
  explicitly associate the <code><a href=#the-keygen-element>keygen</a></code> element with its
  <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
  attribute represents the element's name. The <code title=attr-fe-disabled><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 title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>
  attribute controls focus.</p>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">keygen</var> . <code title=attr-keygen-type>type</code></dt>

   <dd>

    <p>Returns the string "<code title="">keygen</code>".</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-keygen-challenge title=dom-keygen-challenge><code>challenge</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name.</p>

  <p>The <dfn id=dom-keygen-keytype title=dom-keygen-keytype><code>keytype</code></dfn>
  IDL attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <dfn id=dom-keygen-type title=dom-keygen-type><code>type</code></dfn> IDL
  attribute must return the value "<code title="">keygen</code>".</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL
  attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
  methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
  <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a
  list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fe-autofocus><a href=#dom-fe-autofocus>autofocus</a></code>, <code title=dom-fe-disabled><a href=#dom-fe-disabled>disabled</a></code>, <code title=dom-fae-form><a href=#dom-fae-form>form</a></code>, and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
  element's forms API.</p>

  </div>
<!--TOPIC:HTML-->

  <p class=note>This specification does not specify how the private
  key generated is to be used. It is expected that after receiving the
  <code><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> (SPKAC) structure, the
  server will generate a client certificate and offer it back to the
  user for download; this certificate, once downloaded and stored in
  the key store along with the private key, can then be used to
  authenticate to services that use TLS and certificate
  authentication.</p>

  <!-- how does the UA know which private key is associated with a
  certificate it gets back after the server has taken the public key
  created by <keygen> and turned it into a client cert? -->

  <div class=example>

   <p>To generate a key pair, add the private key to the user's key
   store, and submit the public key to the server, markup such as the
   following can be used:</p>

   <pre>&lt;form action="processkey.cgi" method="post" enctype="multipart/form-data"&gt;
 &lt;p&gt;&lt;keygen name="key"&gt;&lt;/p&gt;
 &lt;p&gt;&lt;input type=submit value="Submit key..."&gt;&lt;/p&gt;
&lt;/form&gt;</pre>

   <p>The server will then receive a form submission with a packaged
   RSA public key as the value of "<code title="">key</code>". This
   can then be used for various purposes, such as generating a client
   certificate, as mentioned above.</p>

  </div>



  <h4 id=the-output-element><span class=secno>4.10.15 </span>The <dfn><code>output</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#category-listed title=category-listed>Listed</a>, <a href=#category-label title=category-label>labelable</a>, <a href=#category-reset title=category-reset>resettable</a>, and <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-output-for><a href=#attr-output-for>for</a></code> &mdash; Specifies controls from which the output was calculated</dd>
   <dd><code title=attr-fae-form><a href=#attr-fae-form>form</a></code> &mdash; Associates the control with a <code><a href=#the-form-element>form</a></code> element</dd>
   <dd><code title=attr-fe-name><a href=#attr-fe-name>name</a></code> &mdash; Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmloutputelement>HTMLOutputElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  [PutForwards=<span title=dom-DOMSettableTokenList-value>value</span>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-output-htmlfor title=dom-output-htmlFor>htmlFor</a>;
  readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form title=dom-fae-form>form</a>;
           attribute DOMString <a href=#dom-fe-name title=dom-fe-name>name</a>;

  readonly attribute DOMString <a href=#dom-output-type title=dom-output-type>type</a>;
           attribute DOMString <a href=#dom-output-defaultvalue title=dom-output-defaultValue>defaultValue</a>;
           attribute DOMString <a href=#dom-output-value title=dom-output-value>value</a>;

  readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
  readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
  readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>;
  boolean <a href=#dom-cva-checkvalidity title=dom-cva-checkValidity>checkValidity</a>();
  void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(DOMString error);

  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-output-element>output</a></code> element <a href=#represents>represents</a> the result of a
  calculation or user action.</p>

  <p>The <dfn id=attr-output-for title=attr-output-for><code>for</code></dfn> content
  attribute allows an explicit relationship to be made between the
  result of a calculation and the elements that represent the values
  that went into the calculation or that otherwise influenced the
  calculation. The <code title=attr-output-for><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>unordered
  set of unique space-separated tokens</a> that are
  <a href=#case-sensitive>case-sensitive</a>, each of which must have the value of an
  <a href=#concept-id title=concept-id>ID</a> of an element in the same
  <code><a href=#document>Document</a></code>.</p>

  <p>The <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute is used to
  explicitly associate the <code><a href=#the-output-element>output</a></code> element with its
  <a href=#form-owner>form owner</a>. The <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
  attribute represents the element's name.</p>

  <div class=impl>

  <p>The element has a <dfn id=concept-output-mode title=concept-output-mode>value mode
  flag</dfn> which is either <i title=concept-output-mode-value>value</i> or <i title=concept-output-mode-default>default</i>. Initially, the
  <a href=#concept-output-mode title=concept-output-mode>value mode flag</a> must be set
  to <i title=concept-output-mode-default>default</i>.</p>

  <p>The element also has a <dfn id=concept-output-defaultvalue title=concept-output-defaultValue>default value</dfn>. Initially,
  the <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a>
  must be the empty string.</p>

  <p>When the <a href=#concept-output-mode title=concept-output-mode>value mode flag</a>
  is in mode <i title=concept-output-mode-default>default</i>, the
  contents of the element represent both the value of the element and
  its <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default
  value</a>. When the <a href=#concept-output-mode title=concept-output-mode>value mode
  flag</a> is in mode <i title=concept-output-mode-value>value</i>, the contents of the
  element represent the value of the element only, and the <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a> is only
  accessible using the <code title=dom-output-defaultValue><a href=#dom-output-defaultvalue>defaultValue</a></code> IDL
  attribute.</p>

  <p>Whenever the element's descendants are changed in any way, if the
  <a href=#concept-output-mode title=concept-output-mode>value mode flag</a> is in mode
  <i title=concept-output-mode-default>default</i>, the element's
  <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a> must
  be set to the value of the element's <code><a href=#textcontent>textContent</a></code> IDL
  attribute.</p>

  <p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
  algorithm</a> for <code><a href=#the-output-element>output</a></code> elements is to set the
  element's <a href=#concept-output-mode title=concept-output-mode>value mode flag</a>
  to <i title=concept-output-mode-default>default</i> and then to
  set the element's <code><a href=#textcontent>textContent</a></code> IDL attribute to the
  value of the element's <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a> (thus
  replacing the element's child nodes).</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">output</var> . <code title=dom-output-value><a href=#dom-output-value>value</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the element's current value.</p>

    <p>Can be set, to change the value.</p>

   </dd>

   <dt><var title="">output</var> . <code title=dom-output-defaultValue><a href=#dom-output-defaultvalue>defaultValue</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the element's current default value.</p>

    <p>Can be set, to change the default value.</p>

   </dd>

   <dt><var title="">output</var> . <code title=dom-output-type><a href=#dom-output-type>type</a></code></dt>

   <dd>

    <p>Returns the string "<code title="">output</code>".</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-output-value title=dom-output-value><code>value</code></dfn> IDL
  attribute must act like the element's <code><a href=#textcontent>textContent</a></code> IDL
  attribute, except that on setting, in addition, before the child
  nodes are changed, the element's <a href=#concept-output-mode title=concept-output-mode>value mode flag</a> must be set to <i title=concept-output-mode-value>value</i>.</p>

  <p>The <dfn id=dom-output-defaultvalue title=dom-output-defaultValue><code>defaultValue</code></dfn> IDL
  attribute, on getting, must return the element's <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a>. On
  setting, the attribute must set the element's <a href=#concept-output-defaultvalue title=concept-output-defaultValue>default value</a>, and, if
  the element's <a href=#concept-output-mode title=concept-output-mode>value mode
  flag</a> is in the mode <i title=concept-output-mode-default>default</i>, set the element's
  <code><a href=#textcontent>textContent</a></code> IDL attribute as well.</p>

  <p>The <dfn id=dom-output-type title=dom-output-type><code>type</code></dfn>
  attribute must return the string "<code title="">output</code>".</p>

  <p>The <dfn id=dom-output-htmlfor title=dom-output-htmlFor><code>htmlFor</code></dfn>
  IDL attribute must <a href=#reflect>reflect</a> the <code title=attr-output-for><a href=#attr-output-for>for</a></code> content attribute.</p>

  <p>The <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code>, <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code>, and <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL
  attributes, and the <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity()</a></code> and <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code>
  methods, are part of the <a href=#the-constraint-validation-api>constraint validation API</a>. The
  <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a
  list of the element's <code><a href=#the-label-element>label</a></code>s. The <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> and <code title=dom-fe-name><a href=#dom-fe-name>name</a></code> IDL attributes are part of the
  element's forms API.</p>

  </div>
<!--TOPIC:HTML-->

  <div class=example>

   <p>A simple calculator could use <code><a href=#the-output-element>output</a></code> for its
   display of calculated results:</p>

   <pre>&lt;form onsubmit="return false" oninput="o.value = a.valueAsNumber + b.valueAsNumber"&gt;
 &lt;input name=a type=number step=any&gt; +
 &lt;input name=b type=number step=any&gt; =
 &lt;output name=o&gt;&lt;/output&gt;
&lt;/form&gt;</pre>

  </div>



  <h4 id=the-progress-element><span class=secno>4.10.16 </span>The <dfn><code>progress</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#category-label title=category-label>Labelable element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-progress-element>progress</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-progress-value><a href=#attr-progress-value>value</a></code> &mdash; Current value of the element</dd>
   <dd><code title=attr-progress-max><a href=#attr-progress-max>max</a></code> &mdash; Upper bound of range</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlprogresselement>HTMLProgressElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute double <a href=#dom-progress-value title=dom-progress-value>value</a>;
           attribute double <a href=#dom-progress-max title=dom-progress-max>max</a>;
  readonly attribute double <a href=#dom-progress-position title=dom-progress-position>position</a>;
  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-progress-element>progress</a></code> element <a href=#represents>represents</a> the
  completion progress of a task. The progress is either indeterminate,
  indicating that progress is being made but that it is not clear how
  much more work remains to be done before the task is complete (e.g.
  because the task is waiting for a remote host to respond), or the
  progress is a number in the range zero to a maximum, giving the
  fraction of work that has so far been completed.</p>

  <p>There are two attributes that determine the current task
  completion represented by the element. The <dfn id=attr-progress-value title=attr-progress-value><code>value</code></dfn> attribute
  specifies how much of the task has been completed, and the <dfn id=attr-progress-max title=attr-progress-max><code>max</code></dfn> attribute specifies
  how much work the task requires in total. The units are arbitrary
  and not specified.</p>

  <p class=note>To make a determinate progress bar, add a <code title=attr-progress-value><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 title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute is specified, a
  number from 0 to the value of the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute). To make an
  indeterminate progress bar, remove the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute.</p>

  <p>Authors are encouraged to also include the current value and the
  maximum value inline as text inside the element, so that the
  progress is made available to users of legacy user agents.</p>

  <div class=example>
   <p>Here is a snippet of a Web application that shows the progress
   of some automated task:</p>
   <pre>&lt;section&gt;
 &lt;h2&gt;Task Progress&lt;/h2&gt;
 &lt;p&gt;Progress: &lt;progress id="p" max=100&gt;&lt;span&gt;0&lt;/span&gt;%&lt;/progress&gt;&lt;/p&gt;
 &lt;script&gt;
  var progressBar = document.getElementById('p');
  function updateProgress(newValue) {
    progressBar.value = newValue;
    progressBar.getElementsByTagName('span')[0].textContent = newValue;
  }
 &lt;/script&gt;
&lt;/section&gt;</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 title=attr-progress-value><a href=#attr-progress-value>value</a></code> and <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attributes, when present, must
  have values that are <a href=#valid-floating-point-number title="valid floating-point number">valid
  floating-point numbers</a>. The <code title=attr-progress-value><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 title=attr-progress-max><a href=#attr-progress-max>max</a></code>
  attribute, if present, or 1.0, otherwise. The <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, if present, must
  have a value greater than zero.</p>

  <p class=note>The <code><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><a href=#the-progress-element>progress</a></code> would be inappropriate. Instead, the
  <code><a href=#the-meter-element>meter</a></code> element is available for such use cases.</p>

  <div class=impl>

  <p><strong>User agent requirements</strong>: If the <code title=attr-progress-value><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 title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, the user
  agent must parse the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
  attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing
  floating-point number values</a>. If this does not result in an
  error, and if the parsed value is greater than zero, then the <dfn id=concept-progress-maximum title=concept-progress-maximum>maximum value</dfn> of the progress
  bar is that value. Otherwise, if the element has no <code title=attr-progress-max><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 title=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 title=attr-progress-value><a href=#attr-progress-value>value</a></code>
  attribute's value according to the <a href=#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 less than the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a> and greater
  than zero, then the <dfn id=concept-progress-value title=concept-progress-value>current
  value</dfn> of the progress bar is that parsed value. Otherwise, if
  the parsed value was greater than or equal to the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>, then the
  <a href=#concept-progress-value title=concept-progress-value>current value</a> of the
  progress bar is the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum
  value</a> of the progress bar. Otherwise, if parsing the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute's value resulted
  in an error, or a number less than or equal to zero, then the <a href=#concept-progress-value title=concept-progress-value>current value</a> of the progress
  bar is zero.</p>

  <p><strong>UA requirements for showing the progress bar</strong>:
  When representing a <code><a href=#the-progress-element>progress</a></code> element to the user, the
  UA should indicate whether it is a determinate or indeterminate
  progress bar, and in the former case, should indicate the relative
  position of the <a href=#concept-progress-value title=concept-progress-value>current
  value</a> relative to the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>.</p>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">progress</var> . <code title=dom-progress-position><a href=#dom-progress-position>position</a></code></dt>

   <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 &minus;1.</p>

   </dd>

  </dl><div class=impl>

  <p>If the progress bar is an indeterminate progress bar, then the
  <dfn id=dom-progress-position title=dom-progress-position><code>position</code></dfn> IDL
  attribute must return &minus;1. Otherwise, it must return the
  result of dividing the <a href=#concept-progress-value title=concept-progress-value>current value</a> by the <a href=#concept-progress-maximum title=concept-progress-maximum>maximum value</a>.</p>

  <p>If the progress bar is an indeterminate progress bar, then the
  <dfn id=dom-progress-value title=dom-progress-value><code>value</code></dfn> IDL
  attribute, on getting, must return 0. Otherwise, it must return the
  <a href=#concept-progress-value title=concept-progress-value>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>best
  representation of the number as a floating-point number</a> and
  then the <code title=dom-progress-value><a href=#dom-progress-value>value</a></code> content
  attribute must be set to that string.</p>

  <p class=note>Setting the <code title=dom-progress-value><a href=#dom-progress-value>value</a></code> IDL attribute to itself when
  the corresponding content attribute is absent would change the
  progress bar from an indeterminate progress bar to a determinate
  progress bar with no progress.</p>

  <p>The <dfn id=dom-progress-max title=dom-progress-max><code>max</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name, <a href=#limited-to-numbers-greater-than-zero>limited to numbers greater than zero</a>. The
  default value for <code title=dom-progress-max><a href=#dom-progress-max>max</a></code> is
  1.0.</p>

  <p>The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL attribute
  provides a list of the element's <code><a href=#the-label-element>label</a></code>s.</p>

  </div>
<!--TOPIC:HTML-->



  <h4 id=the-meter-element><span class=secno>4.10.17 </span>The <dfn><code>meter</code></dfn> element</h4>
  <!-- Keep this after <progress> and NOT close to <time> -->

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   <dd><a href=#category-label title=category-label>Labelable element</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#phrasing-content>phrasing content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>, but there must be no <code><a href=#the-meter-element>meter</a></code> element descendants.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-meter-value><a href=#attr-meter-value>value</a></code> &mdash; Current value of the element</dd>
   <dd><code title=attr-meter-min><a href=#attr-meter-min>min</a></code> &mdash; Lower bound of range</dd>
   <dd><code title=attr-meter-max><a href=#attr-meter-max>max</a></code> &mdash; Upper bound of range</dd>
   <dd><code title=attr-meter-low><a href=#attr-meter-low>low</a></code> &mdash; High limit of low range</dd>
   <dd><code title=attr-meter-high><a href=#attr-meter-high>high</a></code> &mdash; Low limit of high range</dd>
   <dd><code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> &mdash; Optimum value in gauge</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlmeterelement>HTMLMeterElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute double <a href=#dom-meter-value title=dom-meter-value>value</a>;
           attribute double <a href=#dom-meter-min title=dom-meter-min>min</a>;
           attribute double <a href=#dom-meter-max title=dom-meter-max>max</a>;
           attribute double <a href=#dom-meter-low title=dom-meter-low>low</a>;
           attribute double <a href=#dom-meter-high title=dom-meter-high>high</a>;
           attribute double <a href=#dom-meter-optimum title=dom-meter-optimum>optimum</a>;
  readonly attribute <a href=#nodelist>NodeList</a> <a href=#dom-lfe-labels title=dom-lfe-labels>labels</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-meter-element>meter</a></code> element <a href=#represents>represents</a> a scalar measurement within a known
  range, or a fractional value; for example disk usage, the relevance of a query result, or the
  fraction of a voting population to have selected a particular candidate.</p>

  <p>This is also known as a gauge.</p>

  <p class=note>The <code><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><a href=#the-progress-element>progress</a></code> element.</p>

  <p class=note>The <code><a href=#the-meter-element>meter</a></code> element also does not represent a scalar value of arbitrary
  range &mdash; for example, it would be wrong to use this to report a weight, or height, unless
  there is a known maximum value.</p>

  <p>There are six attributes that determine the semantics of the gauge represented by the
  element.</p>

  <p>The <dfn id=attr-meter-min title=attr-meter-min><code>min</code></dfn> attribute specifies the lower bound of
  the range, and the <dfn id=attr-meter-max title=attr-meter-max><code>max</code></dfn> attribute specifies the
  upper bound. The <dfn id=attr-meter-value title=attr-meter-value><code>value</code></dfn> attribute specifies the
  value to have the gauge indicate as the "measured" value.</p>

  <p>The other three attributes can be used to segment the gauge's range into "low", "medium", and
  "high" parts, and to indicate which part of the gauge is the "optimum" part. The <dfn id=attr-meter-low title=attr-meter-low><code>low</code></dfn> attribute specifies the range that is considered to
  be the "low" part, and the <dfn id=attr-meter-high title=attr-meter-high><code>high</code></dfn> attribute
  specifies the range that is considered to be the "high" part. The <dfn id=attr-meter-optimum title=attr-meter-optimum><code>optimum</code></dfn> attribute gives the position that is
  "optimum"; if that is higher than the "high" value then this indicates that the higher the value,
  the better; if it's lower than the "low" mark then it indicates that lower values are better, and
  naturally if it is in between then it indicates that neither high nor low values are good.</p>

  <p><span class=impl><strong>Authoring requirements</strong>:</span> The <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute must be specified. The <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>, <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, <code title=attr-meter-low><a href=#attr-meter-low>low</a></code>, <code title=attr-meter-high><a href=#attr-meter-high>high</a></code>, <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>, and <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> attributes,
  when present, must have values that are <a href=#valid-floating-point-number title="valid floating-point number">valid
  floating-point numbers</a>.</p>

  <p>In addition, the attributes' values are further constrained:</p>

  <p>Let <var title="">value</var> be the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute's
  number.</p>

  <p>If the <code title=attr-meter-min><a href=#attr-meter-min>min</a></code> attribute is specified, then let <var title="">minimum</var> be that attribute's value; otherwise, let it be zero.</p>

  <p>If the <code title=attr-meter-max><a href=#attr-meter-max>max</a></code> attribute is specified, then let <var title="">maximum</var> be that attribute's value; otherwise, let it be 1.0.</p>

  <p>The following inequalities must hold, as applicable:</p>

  <ul class=brief><li><var title="">minimum</var> &le; <var title="">value</var> &le; <var title="">maximum</var></li>
   <li><var title="">minimum</var> &le; <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> &le; <var title="">maximum</var> (if <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> is specified)</li>
   <li><var title="">minimum</var> &le; <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> &le; <var title="">maximum</var> (if <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> is specified)</li>
   <li><var title="">minimum</var> &le; <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> &le; <var title="">maximum</var> (if <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> is specified)</li>
   <li><code title=attr-meter-low><a href=#attr-meter-low>low</a></code> &le; <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> (if both <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> and <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> are specified)</li>
  </ul><p class=note>If no minimum or maximum is specified, then the range is assumed to be 0..1, and
  the value thus has to be within that range.</p>

  <p>Authors are encouraged to include a textual representation of the gauge's state in the
  element's contents, for users of user agents that do not support the <code><a href=#the-meter-element>meter</a></code>
  element.</p>

  <p>When used with <a href=#microdata>microdata</a>, the <code><a href=#the-meter-element>meter</a></code> element's <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute provides the element's machine-readable value.</p>

  <div class=example>

   <p>The following examples show three gauges that would all be
   three-quarters full:</p>

   <pre>Storage space usage: &lt;meter value=6 max=8&gt;6 blocks used (out of 8 total)&lt;/meter&gt;
Voter turnout: &lt;meter value=0.75&gt;&lt;img alt="75%" src="graph75.png"&gt;&lt;/meter&gt;
Tickets sold: &lt;meter min="0" max="100" value="75"&gt;&lt;/meter&gt;</pre>

   <p>The following example is incorrect use of the element, because it doesn't give a range (and
   since the default maximum is 1, both of the gauges would end up looking maxed out):</p>

   <pre class=bad>&lt;p&gt;The grapefruit pie had a radius of &lt;meter value=12&gt;12cm&lt;/meter&gt;
and a height of &lt;meter value=2&gt;2cm&lt;/meter&gt;.&lt;/p&gt; &lt;!-- <strong>BAD!</strong> --&gt;</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>&lt;p&gt;The grapefruit pie had a radius of 12cm and a height of
2cm.&lt;/p&gt;
&lt;dl&gt;
 &lt;dt&gt;Radius: &lt;dd&gt; &lt;meter min=0 max=20 value=12&gt;12cm&lt;/meter&gt;
 &lt;dt&gt;Height: &lt;dd&gt; &lt;meter min=0 max=10 value=2&gt;2cm&lt;/meter&gt;
&lt;/dl&gt;</pre>

  </div>

  <p>There is no explicit way to specify units in the <code><a href=#the-meter-element>meter</a></code> element, but the units may
  be specified in the <code title=attr-title><a href=#attr-title>title</a></code> attribute in free-form text.</p>

  <div class=example>

   <p>The example above could be extended to mention the units:</p>

   <pre>&lt;dl&gt;
 &lt;dt&gt;Radius: &lt;dd&gt; &lt;meter min=0 max=20 value=12 title="centimeters"&gt;12cm&lt;/meter&gt;
 &lt;dt&gt;Height: &lt;dd&gt; &lt;meter min=0 max=10 value=2 title="centimeters"&gt;2cm&lt;/meter&gt;
&lt;/dl&gt;</pre>

  </div>

  <div class=impl>

  <p><strong>User agent requirements</strong>: User agents must parse the <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>, <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>, <code title=attr-meter-low><a href=#attr-meter-low>low</a></code>, <code title=attr-meter-high><a href=#attr-meter-high>high</a></code>, and <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code>
  attributes using the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a>.</p>

  <p>User agents must then use all these numbers to obtain values for six points on the gauge, as
  follows. (The order in which these are evaluated is important, as some of the values refer to
  earlier ones.)</p>

  <dl><dt>The <dfn id=concept-meter-minimum title=concept-meter-minimum>minimum value</dfn></dt>

   <dd>

    <p>If the <code title=attr-meter-min><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>

   </dd>

   <dt>The <dfn id=concept-meter-maximum title=concept-meter-maximum>maximum value</dfn></dt>

   <dd>

    <p>If the <code title=attr-meter-max><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>

   </dd>

   <dt>The <dfn id=concept-meter-actual title=concept-meter-actual>actual value</dfn></dt>

   <dd>

    <p>If the <code title=attr-meter-value><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>

   </dd>

   <dt>The <dfn id=concept-meter-low title=concept-meter-low>low boundary</dfn></dt>

   <dd>

    <p>If the <code title=attr-meter-low><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>

   </dd>

   <dt>The <dfn id=concept-meter-high title=concept-meter-high>high boundary</dfn></dt>

   <dd>

    <p>If the <code title=attr-meter-high><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>

   </dd>

   <dt>The <dfn id=concept-meter-optimum title=concept-meter-optimum>optimum point</dfn></dt>

   <dd>

    <p>If the <code title=attr-meter-optimum><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>

   </dd>

  </dl><p>All of which will result in the following inequalities all being true:</p>

  <ul class=brief><li>minimum value &le; actual value &le; maximum value</li>
   <li>minimum value &le; low boundary &le; high boundary &le; maximum value</li>
   <li>minimum value &le; optimum point &le; maximum value</li>
  </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><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>

  <div class=example>
   <p>The following markup:</p>
   <pre>&lt;h3&gt;Suggested groups&lt;/h3&gt;
&lt;menu type="toolbar"&gt;
 &lt;a href="?cmd=hsg" onclick="hideSuggestedGroups()"&gt;Hide suggested groups&lt;/a&gt;
&lt;/menu&gt;
&lt;ul&gt;
 &lt;li&gt;
  &lt;p&gt;&lt;a href="/group/comp.infosystems.www.authoring.stylesheets/view"&gt;comp.infosystems.www.authoring.stylesheets&lt;/a&gt; -
     &lt;a href="/group/comp.infosystems.www.authoring.stylesheets/subscribe"&gt;join&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;Group description: &lt;strong&gt;Layout/presentation on the WWW.&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;<strong>&lt;meter value="0.5"&gt;Moderate activity,&lt;/meter&gt;</strong> Usenet, 618 subscribers&lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
  &lt;p&gt;&lt;a href="/group/netscape.public.mozilla.xpinstall/view"&gt;netscape.public.mozilla.xpinstall&lt;/a&gt; -
     &lt;a href="/group/netscape.public.mozilla.xpinstall/subscribe"&gt;join&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;Group description: &lt;strong&gt;Mozilla XPInstall discussion.&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;<strong>&lt;meter value="0.25"&gt;Low activity,&lt;/meter&gt;</strong> Usenet, 22 subscribers&lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
  &lt;p&gt;&lt;a href="/group/mozilla.dev.general/view"&gt;mozilla.dev.general&lt;/a&gt; -
     &lt;a href="/group/mozilla.dev.general/subscribe"&gt;join&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;<strong>&lt;meter value="0.25"&gt;Low activity,&lt;/meter&gt;</strong> Usenet, 66 subscribers&lt;/p&gt;
 &lt;/li&gt;
&lt;/ul&gt;</pre>
   <p>Might be rendered as follows:</p>
   <p><img src=http://images.whatwg.org/sample-meter.png width=332 alt="With the <meter> elements rendered as inline green bars of varying lengths." height=178></p>
  </div>

  <p>User agents <span class=impl>may</span> combine the value of the <code title=attr-title><a href=#attr-title>title</a></code> attribute and the other attributes to provide context-sensitive
  help or inline text detailing the actual values.</p>

  <div class=example>
   <p>For example, the following snippet:</p>
   <pre>&lt;meter min=0 max=60 value=23.2 title=seconds&gt;&lt;/meter&gt;</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>

  <div class=impl>

  <p>The <dfn id=dom-meter-value title=dom-meter-value><code>value</code></dfn> IDL attribute, on getting, must
  return the <a href=#concept-meter-actual title=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>best representation of the number as a floating-point number</a>
  and then the <code title=dom-meter-value><a href=#dom-meter-value>value</a></code> content attribute must be set to that
  string.</p>

  <p>The <dfn id=dom-meter-min title=dom-meter-min><code>min</code></dfn> IDL attribute, on getting, must return
  the <a href=#concept-meter-minimum title=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>best representation of the number as a floating-point number</a> and
  then the <code title=dom-meter-min><a href=#dom-meter-min>min</a></code> content attribute must be set to that string.</p>

  <p>The <dfn id=dom-meter-max title=dom-meter-max><code>max</code></dfn> IDL attribute, on getting, must return
  the <a href=#concept-meter-maximum title=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>best representation of the number as a floating-point number</a> and
  then the <code title=dom-meter-max><a href=#dom-meter-max>max</a></code> content attribute must be set to that string.</p>

  <p>The <dfn id=dom-meter-low title=dom-meter-low><code>low</code></dfn> IDL attribute, on getting, must return
  the <a href=#concept-meter-low title=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>best representation of the number as a floating-point number</a> and
  then the <code title=dom-meter-low><a href=#dom-meter-low>low</a></code> content attribute must be set to that string.</p>

  <p>The <dfn id=dom-meter-high title=dom-meter-high><code>high</code></dfn> IDL attribute, on getting, must return
  the <a href=#concept-meter-high title=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>best representation of the number as a floating-point number</a> and
  then the <code title=dom-meter-high><a href=#dom-meter-high>high</a></code> content attribute must be set to that
  string.</p>

  <p>The <dfn id=dom-meter-optimum title=dom-meter-optimum><code>optimum</code></dfn> IDL attribute, on getting, must
  return the <a href=#concept-meter-optimum title=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>best representation of the number as a floating-point number</a>
  and then the <code title=dom-meter-optimum><a href=#dom-meter-optimum>optimum</a></code> content attribute must be set to that
  string.</p>

  <p>The <code title=dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a list of the element's
  <code><a href=#the-label-element>label</a></code>s.</p>

  </div>

  <div class=example>

   <p>The following example shows how a gauge could fall back to localized or pretty-printed
   text.</p>

   <pre>&lt;p&gt;Disk usage: &lt;meter min=0 value=170261928 max=233257824&gt;170&thinsp;261&thinsp;928 bytes used
out of 233&thinsp;257&thinsp;824 bytes available&lt;/meter&gt;&lt;/p&gt;</pre>

  </div>



  <h4 id=form-control-infrastructure><span class=secno>4.10.18 </span>Form control infrastructure</h4>

  <h5 id="a-form-control's-value"><span class=secno>4.10.18.1 </span>A form control's value</h5>

  <p>Form controls have a <dfn id=concept-fe-value title=concept-fe-value>value</dfn>
  and a <dfn id=concept-fe-checked title=concept-fe-checked>checkedness</dfn>. (The latter
  is only used by <code><a href=#the-input-element>input</a></code> elements.) These are used to
  describe how the user interacts with the control.</p>

  <p>To define the behaviour of constraint validation in the face of
  the <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute,
  <code><a href=#the-input-element>input</a></code> elements can also have separately defined <dfn id=concept-fe-values title=concept-fe-values>value<em>s</em></dfn>.</p>


  <h5 id=mutability><span class=secno>4.10.18.2 </span>Mutability</h5>

  <p>A form control can be designated as <dfn id=concept-fe-mutable title=concept-fe-mutable><i>mutable</i></dfn>.</p>

  <p class=note>This determines (by means of definitions and
  requirements in this specification that rely on whether an element
  is so designated) whether or not the user can modify the <a href=#concept-fe-value title=concept-fe-value>value</a> or <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of a form control, or
  whether or not a control can be automatically prefilled.</p>


  <h5 id=association-of-controls-and-forms><span class=secno>4.10.18.3 </span>Association of controls and forms</h5>

  <p>A <a href=#form-associated-element>form-associated element</a> can have a relationship with a <code><a href=#the-form-element>form</a></code>
  element, which is called the element's <dfn id=form-owner>form owner</dfn>. If a <a href=#form-associated-element>form-associated
  element</a> is not associated with a <code><a href=#the-form-element>form</a></code> element, its <a href=#form-owner>form owner</a> is
  said to be null.</p>

  <p>A <a href=#form-associated-element>form-associated element</a> is, by default, associated with its <span class=impl>nearest</span> ancestor <code><a href=#the-form-element>form</a></code> element<span class=impl> (as described
  below)</span>, but, if it is <a href=#category-form-attr title=category-form-attr>reassociateable</a>, may have a
  <dfn id=attr-fae-form title=attr-fae-form><code>form</code></dfn> attribute specified to override this.</p>

  <p class=note>This feature allows authors to work around the lack of support for nested
  <code><a href=#the-form-element>form</a></code> elements.</p>

  <p>If a <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a> has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>
  attribute specified, then that attribute's value must be the <a href=#concept-id title=concept-id>ID</a> of
  a <code><a href=#the-form-element>form</a></code> element in the element's owner <code><a href=#document>Document</a></code>.</p>

  <div class=impl>

  <p class=note>The rules in this section are complicated by the fact that although conforming
  documents will never contain nested <code><a href=#the-form-element>form</a></code> elements, it is quite possible (e.g. using a
  script that performs DOM manipulation) to generate documents that have such nested elements. They
  are also complicated by rules in the HTML parser that, for historical reasons, can result in a
  <a href=#form-associated-element>form-associated element</a> being associated with a <code><a href=#the-form-element>form</a></code> element that is not
  its ancestor.</p>

  <p>When a <a href=#form-associated-element>form-associated element</a> is created, its <a href=#form-owner>form owner</a> must be
  initialized to null (no owner).</p>

  <p>When a <a href=#form-associated-element>form-associated element</a> is to be <dfn id=concept-form-association title=concept-form-association>associated</dfn> with a form, its <a href=#form-owner>form owner</a> must be
  set to that form.</p>

  <p>When a <a href=#form-associated-element>form-associated element</a> or one of its ancestors is <a href=#insert-an-element-into-a-document title="insert an
  element into a document">inserted into a <code>Document</code></a>, then the user agent must
  <a href=#reset-the-form-owner>reset the form owner</a> of that <a href=#form-associated-element>form-associated element</a>. <span class=note>The <a href=#html-parser>HTML parser</a> overrides this requirement when inserting form
  controls.</span></p>

  <p>When an element is <a href=#remove-an-element-from-a-document title="remove an element from a document">removed from a
  <code>Document</code></a> resulting in a <a href=#form-associated-element>form-associated element</a> and its
  <a href=#form-owner>form owner</a> (if any) no longer being in the same <a href=#home-subtree>home subtree</a>, then the
  user agent must <a href=#reset-the-form-owner>reset the form owner</a> of that <a href=#form-associated-element>form-associated
  element</a>.</p>

  <p>When a <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a>'s <code title=attr-fae-form><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>reset the form owner</a> of that
  element.</p>

  <p>When a <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a> has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>
  attribute and the <a href=#concept-id title=concept-id>ID</a> of any of the elements in the
  <code><a href=#document>Document</a></code> changes, then the user agent must <a href=#reset-the-form-owner>reset the form owner</a> of that
  <a href=#form-associated-element>form-associated element</a>.</p>

  <p>When a <a href=#category-form-attr title=category-form-attr>reassociateable</a> <a href=#form-associated-element>form-associated element</a> has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>
  attribute and an element with an <a href=#concept-id title=concept-id>ID</a> is <a href=#insert-an-element-into-a-document title="insert an
  element into a document">inserted into</a> or <a href=#remove-an-element-from-a-document title="remove an element from a
  document">removed from</a> the <code><a href=#document>Document</a></code>, then the user agent must <a href=#reset-the-form-owner>reset the
  form owner</a> of that <a href=#form-associated-element>form-associated element</a>.</p>

  <p>When the user agent is to <dfn id=reset-the-form-owner>reset the form owner</dfn> of a <a href=#form-associated-element>form-associated
  element</a>, it must run the following steps:</p>

  <ol><li><p>If the element's <a href=#form-owner>form owner</a> is not null, and either the element is not <a href=#category-form-attr title=category-form-attr>reassociateable</a> or its <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute is not present, and the element's <a href=#form-owner>form
   owner</a> is its nearest <code><a href=#the-form-element>form</a></code> element ancestor after the change to the ancestor
   chain, then do nothing, and abort these steps.</li>

   <li><p>Let the element's <a href=#form-owner>form owner</a> be null.</li>

   <li>

    <p>If the element is <a href=#category-form-attr title=category-form-attr>reassociateable</a>, has a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute, and is itself
    <a href=#in-a-document title="in a Document">in a <code>Document</code></a>, then run these substeps:</p>

    <ol><!-- note that this ignores the name="" attribute and is unaffected by quirks mode (it's always
     case sensitive) --><li><p>If the first element <a href=#in-a-document title="in a Document">in the <code>Document</code></a> to
     have an <a href=#concept-id title=concept-id>ID</a> that is <a href=#case-sensitive title=case-sensitive>case-sensitively</a> equal to the element's <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute's value is a <code><a href=#the-form-element>form</a></code> element,
     then <a href=#concept-form-association title=concept-form-association>associate</a> the <a href=#form-associated-element>form-associated
     element</a> with that <code><a href=#the-form-element>form</a></code> element.</li>

     <li><p>Abort the "reset the form owner" steps.</li>

    </ol></li>

   <li><p>Otherwise, if the <a href=#form-associated-element>form-associated element</a> in question has an ancestor
   <code><a href=#the-form-element>form</a></code> element, then <a href=#concept-form-association title=concept-form-association>associate</a> the
   <a href=#form-associated-element>form-associated element</a> with the nearest such ancestor <code><a href=#the-form-element>form</a></code>
   element.</li>

   <li><p>Otherwise, the element is left unassociated.</li>

  </ol><div class=example>

   <p>In the following non-conforming snippet:</p>

   <pre class=bad>...
 &lt;form id="a"&gt;
  &lt;div id="b"&gt;&lt;/div&gt;
 &lt;/form&gt;
 &lt;script&gt;
  document.getElementById('b').innerHTML =
     '&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;form id="c"&gt;&lt;input id="d"&gt;&lt;/table&gt;' +
     '&lt;input id="e"&gt;';
 &lt;/script&gt;
...</pre>

   <p>The <a href=#form-owner>form owner</a> of "d" would be the inner nested form "c", while the <a href=#form-owner>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>HTML
   parser</a>. Then, the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> algorithm moves the nodes
   from the temporary document to the "b" element. At this point, the nodes see their ancestor chain
   change, and thus all the "magic" associations done by the parser are reset to normal ancestor
   associations.</p>

   <p>This example is a non-conforming document, though, as it is a violation of the content models
   to nest <code><a href=#the-form-element>form</a></code> elements.</p>

  </div>

  </div>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">element</var> . <code title=dom-fae-form><a href=#dom-fae-form>form</a></code></dt>

   <dd>

    <p>Returns the element's <a href=#form-owner>form owner</a>.</p>

    <p>Returns null if there isn't one.</p>

   </dd>

  </dl><div class=impl>

  <p><a href=#category-form-attr title=category-form-attr>Reassociateable</a> <a href=#form-associated-element title="form-associated element">form-associated elements</a> have a <dfn id=dom-fae-form title=dom-fae-form><code>form</code></dfn> IDL attribute, which, on getting, must return the
  element's <a href=#form-owner>form owner</a>, or null if there isn't one.</p>

  </div>
<!--TOPIC:HTML-->



  <h4 id=attributes-common-to-form-controls><span class=secno>4.10.19 </span><dfn>Attributes common to form controls</dfn></h4>

  <h5 id=naming-form-controls:-the-name-attribute><span class=secno>4.10.19.1 </span>Naming form controls: the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute</h5>

  <p>The <dfn id=attr-fe-name title=attr-fe-name><code>name</code></dfn> content
  attribute gives the name of the form control, as used in <a href=#form-submission>form
  submission</a> and in the <code><a href=#the-form-element>form</a></code> element's <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> object. If the attribute
  is specified, its value must not be the empty string.</p>

  <p>Any non-empty value for <code title=attr-form-name><a href=#attr-form-name>name</a></code>
  is allowed, but the names "<code title=attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and "<code title=attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code>" are special:</p>

  <dl><dt><dfn id=attr-fe-name-isindex title=attr-fe-name-isindex><code>isindex</code></dfn></dt>
   <dd>
    <p>This value, if used as the name of a <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> control that is the first
    control in a form that is submitted using the <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>
    mechanism, causes the submission to only include the value of this
    control, with no name.</p>
   </dd>

   <dt><dfn id=attr-fe-name-charset title=attr-fe-name-charset><code>_charset_</code></dfn></dt>
   <dd>
    <p>This value, if used as the name of a <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> control with no <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, is automatically
    given a value during submission consisting of the submission
    character encoding.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-fe-name title=dom-fe-name><code>name</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> content attribute.</p>

  </div>


  <h5 id=submitting-element-directionality:-the-dirname-attribute><span class=secno>4.10.19.2 </span>Submitting element directionality: the <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute</h5>

  <p>The <dfn id=attr-fe-dirname title=attr-fe-dirname><code>dirname</code></dfn> attribute
  on a form control element enables the submission of <a href=#the-directionality>the
  directionality</a> of the element, and gives the name of the
  field that contains this value during <a href=#form-submission>form submission</a>.
  If such an attribute is specified, its value must not be the empty
  string.</p>

  <div class=example>

   <p>In this example, a form contains a text field and a submission
   button:</p>

   <pre>&lt;form action="addcomment.cgi" method=post&gt;
 &lt;p&gt;&lt;label&gt;Comment: &lt;input type=text name="comment" dirname="comment.dir" required&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;button name="mode" type=submit value="add"&gt;Post Comment&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;</pre>

   <p>When the user submits the form, the user agent includes three
   fields, one called "comment", one called "comment.dir", and one
   called "mode"; so if the user types "Hello", the submission body
   might be something like:</p>

   <pre>comment=Hello&amp;<strong>comment.dir=ltr</strong>&amp;mode=add</pre>

   <p>If the user manually switches to a right-to-left writing
   direction and enters "<span dir=rtl lang=ar title="">&#x645;&#x631;&#x62d;&#x628;&#x627;</span>", the
   submission body might be something like:</p>

   <pre>comment=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7&amp;<strong>comment.dir=rtl</strong>&amp;mode=add</pre>

  </div>



  <h5 id=limiting-user-input-length:-the-maxlength-attribute><span class=secno>4.10.19.3 </span>Limiting user input length: the <code title=attr-fe-maxlength><a href=#attr-fe-maxlength>maxlength</a></code> attribute</h5>

  <p>A <dfn id=attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</dfn>, controlled by a <var title="">dirty value flag</var>, declares a limit on the number of
  characters a user can input.</p>

  <p>If an element has its <a href=#attr-fe-maxlength title=attr-fe-maxlength>form
  control <code title="">maxlength</code> attribute</a> specified,
  the attribute's value must be a <a href=#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>rules for parsing non-negative integers</a> to its value
  results in a number, then that number is the element's <dfn id=maximum-allowed-value-length>maximum
  allowed value length</dfn>. If the attribute is omitted or parsing
  its value results in an error, then there is no <a href=#maximum-allowed-value-length>maximum
  allowed value length</a>.</p>

  <div class=impl>

  <p><strong>Constraint validation</strong>: If an element has a
  <a href=#maximum-allowed-value-length>maximum allowed value length</a>, its <var title="">dirty
  value flag</var> is true, its <a href=#concept-fe-value title=concept-fe-value>value</a> was last changed by a user
  edit (as opposed to a change made by a script), and the
  <a href=#code-unit-length>code-unit length</a> of the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is greater than the element's
  <a href=#maximum-allowed-value-length>maximum allowed value length</a>, then the element is
  <a href=#suffering-from-being-too-long>suffering from being too long</a>.</p>

  <p>User agents may prevent the user from causing the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to be set to a value whose
  <a href=#code-unit-length>code-unit length</a> is greater than the element's
  <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>

  </div>


  <h5 id=enabling-and-disabling-form-controls:-the-disabled-attribute><span class=secno>4.10.19.4 </span>Enabling and disabling form controls: the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute</h5>

  <p>The <dfn id=attr-fe-disabled title=attr-fe-disabled><code>disabled</code></dfn>
  content attribute is a <a href=#boolean-attribute>boolean attribute</a>.</p>

  <p>A form control is <dfn id=concept-fe-disabled title=concept-fe-disabled>disabled</dfn>
  if its <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is
  set, or if it is a descendant of a <code><a href=#the-fieldset-element>fieldset</a></code> element
  whose <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> attribute
  is set and is <em>not</em> a descendant of that
  <code><a href=#the-fieldset-element>fieldset</a></code> element's first <code><a href=#the-legend-element>legend</a></code> element
  child, if any.</p>

  <div class=impl>

  <p>A form control that is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> must prevent any <code title=event-click><a href=#event-click>click</a></code> events that are <a href=#queue-a-task title="queue
  a task">queued</a> on the <a href=#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 title=concept-fe-disabled>disabled</a>, it is <a href=#barred-from-constraint-validation>barred from
  constraint validation</a>.</p>

  <p>The <dfn id=dom-fe-disabled title=dom-fe-disabled><code>disabled</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> content attribute.</p>

  </div>


  <h5 id=form-submission-0><span class=secno>4.10.19.5 </span>Form submission</h5>

  <p><dfn id=attributes-for-form-submission>Attributes for form submission</dfn> can be specified both
  on <code><a href=#the-form-element>form</a></code> elements and on <a href=#concept-submit-button title=concept-submit-button>submit buttons</a> (elements that
  represent buttons that submit forms, e.g. an <code><a href=#the-input-element>input</a></code>
  element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is
  in the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a>
  state).

  <p>The <a href=#attributes-for-form-submission>attributes for form submission</a> that may be
  specified on <code><a href=#the-form-element>form</a></code> elements are <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>, <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>, <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>, <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>, and <code title=attr-fs-target><a href=#attr-fs-target>target</a></code>.</p>

  <p>The corresponding <a href=#attributes-for-form-submission>attributes for form submission</a>
  that may be specified on <a href=#concept-submit-button title=concept-submit-button>submit
  buttons</a> are <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code title=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><a href=#the-form-element>form</a></code> element.</p>

  <hr><p>The <dfn id=attr-fs-action title=attr-fs-action><code>action</code></dfn> and
  <dfn id=attr-fs-formaction title=attr-fs-formaction><code>formaction</code></dfn>
  content attributes, if specified, must have a value that is a
  <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
  spaces</a>.</p>

  <p>The <dfn id=concept-fs-action title=concept-fs-action>action</dfn> of an element is
  the value of the element's <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> attribute, if the
  element is a <a href=#concept-submit-button title=concept-submit-button>submit
  button</a> and has such an attribute, or the value of its
  <a href=#form-owner>form owner</a>'s <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>
  attribute, if <em>it</em> has one, or else the empty string.</p>

  <hr><p>The <dfn id=attr-fs-method title=attr-fs-method><code>method</code></dfn> and
  <dfn id=attr-fs-formmethod title=attr-fs-formmethod><code>formmethod</code></dfn>
  content attributes are <a href=#enumerated-attribute title="enumerated attribute">enumerated
  attributes</a> with the following keywords and states:</p>

  <ul><li>The keyword <dfn id=attr-fs-method-get-keyword title=attr-fs-method-GET-keyword><code>get</code></dfn>, mapping
   to the state <dfn id=attr-fs-method-get title=attr-fs-method-GET>GET</dfn>, indicating
   the HTTP GET method.</li>

   <li>The keyword <dfn id=attr-fs-method-post-keyword title=attr-fs-method-POST-keyword><code>post</code></dfn>, mapping
   to the state <dfn id=attr-fs-method-post title=attr-fs-method-POST>POST</dfn>, indicating
   the HTTP POST method.</li>

   <li>The keyword <dfn id=attr-fs-method-dialog-keyword title=attr-fs-method-dialog-keyword><code>dialog</code></dfn>,
   mapping to the state <dfn id=attr-fs-method-dialog title=attr-fs-method-dialog>dialog</dfn>, indicating that
   submitting the <code><a href=#the-form-element>form</a></code> is intended to close the
   <code><a href=#the-dialog-element>dialog</a></code> box in which the form finds itself, if any, and
   otherwise not submit.</li>

  </ul><p>The <i>invalid value default</i> for these attributes is the <a href=#attr-fs-method-get title=attr-fs-method-GET>GET</a> state. The <i>missing value default</i> for the <code title=attr-fs-method><a href=#attr-fs-method>method</a></code> attribute is also the <a href=#attr-fs-method-get title=attr-fs-method-GET>GET</a> state. (There is no <i>missing value default</i> for the
  <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> attribute.)</p>

  <p>The <dfn id=concept-fs-method title=concept-fs-method>method</dfn> of an element is
  one of those states. If the element is a <a href=#concept-submit-button title=concept-submit-button>submit button</a> and has a <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> attribute, then the
  element's <a href=#concept-fs-method title=concept-fs-method>method</a> is that
  attribute's state; otherwise, it is the <a href=#form-owner>form owner</a>'s
  <code title=attr-fs-method><a href=#attr-fs-method>method</a></code> attribute's state.</p>

  <hr><p>The <dfn id=attr-fs-enctype title=attr-fs-enctype><code>enctype</code></dfn> and
  <dfn id=attr-fs-formenctype title=attr-fs-formenctype><code>formenctype</code></dfn>
  content attributes are <a href=#enumerated-attribute title="enumerated attribute">enumerated
  attributes</a> with the following keywords and states:</p>

  <ul><li>The "<dfn id=attr-fs-enctype-urlencoded title=attr-fs-enctype-urlencoded><code>application/x-www-form-urlencoded</code></dfn>" keyword and corresponding state.</li>
   <li>The "<dfn id=attr-fs-enctype-formdata title=attr-fs-enctype-formdata><code>multipart/form-data</code></dfn>" keyword and corresponding state.</li>
   <li>The "<dfn id=attr-fs-enctype-text title=attr-fs-enctype-text><code>text/plain</code></dfn>" keyword and corresponding state.</li>
  </ul><p>The <i>invalid value default</i> for these attributes is the <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code> state. The <i>missing
  value default</i> for the <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code> attribute is also the <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code> state. (There is no
  <i>missing value default</i> for the <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>
  attribute.)</p>

  <p>The <dfn id=concept-fs-enctype title=concept-fs-enctype>enctype</dfn> of an element
  is one of those three states. If the element is a <a href=#concept-submit-button title=concept-submit-button>submit button</a> and has a <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> attribute, then the
  element's <a href=#concept-fs-enctype title=concept-fs-enctype>enctype</a> is that
  attribute's state; otherwise, it is the <a href=#form-owner>form owner</a>'s
  <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code> attribute's state.</p>

  <hr><p>The <dfn id=attr-fs-target title=attr-fs-target><code>target</code></dfn> and
  <dfn id=attr-fs-formtarget title=attr-fs-formtarget><code>formtarget</code></dfn>
  content attributes, if specified, must have values that are <a href=#valid-browsing-context-name-or-keyword title="valid browsing context name or keyword">valid browsing
  context names or keywords</a>.</p>

  <p>The <dfn id=concept-fs-target title=concept-fs-target>target</dfn> of an element is
  the value of the element's <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> attribute, if the
  element is a <a href=#concept-submit-button title=concept-submit-button>submit
  button</a> and has such an attribute; or the value of its
  <a href=#form-owner>form owner</a>'s <code title=attr-fs-target><a href=#attr-fs-target>target</a></code>
  attribute, if <em>it</em> has such an attribute; or, if the
  <code><a href=#document>Document</a></code> contains a <code><a href=#the-base-element>base</a></code> element with a
  <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, then the
  value of the <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute
  of the first such <code><a href=#the-base-element>base</a></code> element; or, if there is no such
  element, the empty string.</p> <!-- c.f. hyperlink following -->

  <hr><p>The <dfn id=attr-fs-novalidate title=attr-fs-novalidate><code>novalidate</code></dfn>
  and <dfn id=attr-fs-formnovalidate title=attr-fs-formnovalidate><code>formnovalidate</code></dfn>
  content attributes are <a href=#boolean-attribute title="boolean attribute">boolean
  attributes</a>. If present, they indicate that the form is not to
  be validated during submission.</p>

  <p>The <dfn id=concept-fs-novalidate title=concept-fs-novalidate>no-validate state</dfn> of
  an element is true if the element is a <a href=#concept-submit-button title=concept-submit-button>submit button</a> and the element's
  <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute
  is present, or if the element's <a href=#form-owner>form owner</a>'s <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code> attribute is present,
  and false otherwise.</p>

  <div class=example>

   <p>This attribute is useful to include "save" buttons on forms that
   have validation constraints, to allow users to save their progress
   even though they haven't fully entered the data in the form. The
   following example shows a simple form that has two required
   fields. There are three buttons: one to submit the form, which
   requires both fields to be filled in; one to save the form so that
   the user can come back and fill it in later; and one to cancel the
   form altogether.</p>

   <pre>&lt;form action="editor.cgi" method="post"&gt;
 &lt;p&gt;&lt;label&gt;Name: &lt;input required name=fn&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label&gt;Essay: &lt;textarea required name=essay&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;input type=submit name=submit value="Submit essay"&gt;&lt;/p&gt;
 &lt;p&gt;&lt;input type=submit formnovalidate name=save value="Save essay"&gt;&lt;/p&gt;
 &lt;p&gt;&lt;input type=submit formnovalidate name=cancel value="Cancel"&gt;&lt;/p&gt;
&lt;/form&gt;</pre>

  </div>

  <div class=impl>

  <hr><p>The <dfn id=dom-fs-action title=dom-fs-action><code>action</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name, except that on getting, when the content attribute is
  missing or its value is the empty string, <a href="#the-document's-address">the document's
  address</a> must be returned instead. The <dfn id=dom-fs-target title=dom-fs-target><code>target</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name. The
  <dfn id=dom-fs-method title=dom-fs-method><code>method</code></dfn> and <dfn id=dom-fs-enctype title=dom-fs-enctype><code>enctype</code></dfn> IDL attributes
  must <a href=#reflect>reflect</a> the respective content attributes of the
  same name, <a href=#limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-fs-encoding title=dom-fs-encoding><code>encoding</code></dfn> IDL attribute
  must <a href=#reflect>reflect</a> the <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code> content attribute,
  <a href=#limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-fs-novalidate title=dom-fs-noValidate><code>noValidate</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code> content attribute. The
  <dfn id=dom-fs-formaction title=dom-fs-formAction><code>formAction</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> content attribute,
  except that on getting, when the content attribute is missing or its
  value is the empty string, <a href="#the-document's-address">the document's address</a> must
  be returned instead. The <dfn id=dom-fs-formenctype title=dom-fs-formEnctype><code>formEnctype</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> content attribute,
  <a href=#limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-fs-formmethod title=dom-fs-formMethod><code>formMethod</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> content attribute,
  <a href=#limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-fs-formnovalidate title=dom-fs-formNoValidate><code>formNoValidate</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> content
  attribute. The <dfn id=dom-fs-formtarget title=dom-fs-formTarget><code>formTarget</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> content attribute.

  </div>


  <h5 id=autofocusing-a-form-control:-the-autofocus-attribute><span class=secno>4.10.19.6 </span>Autofocusing a form control: the <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute</h5>

  <!-- v2: Apply this to contentEditable elements -->

  <p>The <dfn id=attr-fe-autofocus title=attr-fe-autofocus><code>autofocus</code></dfn>
  content attribute allows the author to indicate that a control is to
  be focused as soon as the page is loaded or as soon as the
  <code><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 title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute is
  a <a href=#boolean-attribute>boolean attribute</a>.</p>

  <p>An element's <dfn id=nearest-ancestor-autofocus-scoping-root-element>nearest ancestor autofocus scoping root
  element</dfn> is the element itself if the element is a
  <code><a href=#the-dialog-element>dialog</a></code> element, or else is the element's nearest
  ancestor <code><a href=#the-dialog-element>dialog</a></code> element, if any, or else is the
  element's <a href=#root-element>root element</a>.</p>

  <p>There must not be two elements with the same <a href=#nearest-ancestor-autofocus-scoping-root-element>nearest
  ancestor autofocus scoping root element</a> that both have the
  <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute
  specified.</p>

  <div class=impl>

  <p>When an element with the <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute specified is
  <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into a
  document</a>, user agents should run the following steps:</p>

  <ol><li><p>Let <var title="">target</var> be the element's
   <code><a href=#document>Document</a></code>.</li>

   <li><p>If <var title="">target</var> has no <a href=#browsing-context>browsing
   context</a>, abort these steps.</li>

   <li><p>If <var title="">target</var>'s <a href=#browsing-context>browsing
   context</a> has no <a href=#top-level-browsing-context>top-level browsing context</a> (e.g.
   it is a <a href=#nested-browsing-context>nested browsing context</a> with no <a href=#parent-browsing-context>parent
   browsing context</a>), abort these steps.</li>

   <li><p>If <var title="">target</var>'s <a href=#active-sandboxing-flag-set>active sandboxing
   flag set</a> has the <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features
   browsing context flag</a>, abort these steps.</li>

   <li><p>If <var title="">target</var>'s <a href=#origin>origin</a> is not
   the <a href=#same-origin title="same origin">same</a> as the
   <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> of the currently
   focused element in <var title="">target</var>'s <a href=#top-level-browsing-context>top-level
   browsing context</a>, abort these steps.</li>

   <li><p>If <var title="">target</var>'s <a href=#origin>origin</a> is not
   the <a href=#same-origin title="same origin">same</a> as the
   <a href=#origin>origin</a> of the <a href=#active-document>active document</a> of <var title="">target</var>'s <a href=#top-level-browsing-context>top-level browsing context</a>,
   abort these steps.</li>

   <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 title="insert
   an element into a document">inserted</a> into a
   <code><a href=#document>Document</a></code> whose <a href=#top-level-browsing-context>top-level browsing
   context</a>'s <a href=#active-document>active document</a> is the same as <var title="">target</var>'s <a href=#top-level-browsing-context>top-level browsing context</a>'s
   <a href=#active-document>active document</a>, abort these steps.</li>

   <li><p>If the user has indicated (for example, by starting to type
   in a form control) that he does not wish focus to be changed, then
   optionally abort these steps.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> that checks to see if the element
   is <a href=#focusable>focusable</a>, and if so, runs the <a href=#focusing-steps>focusing
   steps</a> for that element. User agents may also change the
   scrolling position of the document, or perform some other action
   that brings the element to the user's attention. The <a href=#task-source>task
   source</a> for this task is the <a href=#dom-manipulation-task-source>DOM manipulation task
   source</a>.</li>

  </ol><p class=note>This handles the automatic focusing during document
  load. The <code title=dom-dialog-showModal><a href=#dom-dialog-showmodal>showModal()</a></code>
  method of <code><a href=#the-dialog-element>dialog</a></code> elements also processes the <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute.</p>

  <p class=note>Focusing the control does not imply that the user
  agent must focus the browser window if it has lost focus.</p>

  <p>The <dfn id=dom-fe-autofocus title=dom-fe-autofocus><code>autofocus</code></dfn>
  IDL attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name.</p>

  </div>

  <div class=example>
   <p>In the following snippet, the text control would be focused when
   the document was loaded.</p>
   <pre>&lt;input maxlength="256" name="q" value="" autofocus&gt;
&lt;input type="submit" value="Search"&gt;</pre>
  </div>


  <h5 id=input-modalities:-the-inputmode-attribute><span class=secno>4.10.19.7 </span>Input modalities: the <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute</h5>

  <!-- v2: Apply this to contentEditable elements -->

  <p>The <dfn id=attr-fe-inputmode title=attr-fe-inputmode><code>inputmode</code></dfn>
  content attribute is an <a href=#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>

  <div class=impl>

  <p>User agents must recognise all the keywords and corresponding
  states given below, but need not support all of the corresponding
  states. If a keyword's state is not supported, the user agent must
  act as if the keyword instead mapped to the given state's fallback
  state, as defined below. This fallback behaviour is transitive.</p>

  <p class=note>For example, if a user agent with a QWERTY keyboard
  layout does not support text prediction and automatic
  capitalization, then it could treat the <code title=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 title=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 title=attr-fe-inputmode-state-latin-prose>Latin Prose</a> &srarr;
  <a href=#attr-fe-inputmode-state-latin title=attr-fe-inputmode-state-latin>Latin Text</a> &srarr;
  <a href=#attr-fe-inputmode-state-verbatim title=attr-fe-inputmode-state-verbatim>Latin
  Verbatim</a>.</p>

  </div>

  <p>The possible keywords and states for the attributes are listed in
  the following table. The keywords are listed in the first column.
  Each maps to the state given in the cell in the second column of
  that keyword's row, and that state has the fallback state given in
  the cell in the third column of that row.</p>

  <table class=three-column-nowrap><thead><tr><th> Keyword
     <th> State
     <th> Fallback state
     <th> Description

   <tbody><tr><td> <dfn id=attr-fe-inputmode-keyword-verbatim title=attr-fe-inputmode-keyword-verbatim><code>verbatim</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-verbatim title=attr-fe-inputmode-state-verbatim>Latin Verbatim</dfn>
     <td> <a href=#attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>Default</a>
     <td> Alphanumeric Latin-script input of non-prose content, e.g. usernames, passwords, product codes.

    <tr><td> <dfn id=attr-fe-inputmode-keyword-latin title=attr-fe-inputmode-keyword-latin><code>latin</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-latin title=attr-fe-inputmode-state-latin>Latin Text</dfn>
     <td> <a href=#attr-fe-inputmode-state-verbatim title=attr-fe-inputmode-state-verbatim>Latin Verbatim</a>
     <td> Latin-script input in the user's preferred language(s), with some typing aids enabled (e.g. text prediction). Intended for human-to-computer communications, e.g. free-form text search fields.

    <tr><td> <dfn id=attr-fe-inputmode-keyword-latin-name title=attr-fe-inputmode-keyword-latin-name><code>latin-name</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-latin-name title=attr-fe-inputmode-state-latin-name>Latin Name</dfn>
     <td> <a href=#attr-fe-inputmode-state-latin title=attr-fe-inputmode-state-latin>Latin Text</a>
     <td> Latin-script input in the user's preferred language(s), with typing aids intended for entering human names enabled (e.g. text prediction from the user's contact list and automatic capitalisation at every word). Intended for situations such as customer name fields.

    <tr><td> <dfn id=attr-fe-inputmode-keyword-latin-prose title=attr-fe-inputmode-keyword-latin-prose><code>latin-prose</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-latin-prose title=attr-fe-inputmode-state-latin-prose>Latin Prose</dfn>
     <td> <a href=#attr-fe-inputmode-state-latin title=attr-fe-inputmode-state-latin>Latin Text</a>
     <td> Latin-script input in the user's preferred language(s), with aggressive typing aids intended for human-to-human communications enabled (e.g. text prediction and automatic capitalisation at the start of sentences). Intended for situations such as e-mails and instant messaging.

    <tr><td> <dfn id=attr-fe-inputmode-keyword-full-width-latin title=attr-fe-inputmode-keyword-full-width-latin><code>full-width-latin</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-full-width-latin title=attr-fe-inputmode-state-full-width-latin>Full-width Latin</dfn>
     <td> <a href=#attr-fe-inputmode-state-latin title=attr-fe-inputmode-state-latin>Latin Prose</a>
     <td> Latin-script input in the user's secondary language(s), using full-width characters, with aggressive typing aids intended for human-to-human communications enabled (e.g. text prediction and automatic capitalisation at the start of sentences). Intended for latin text embedded inside CJK text.

    <tr><td> <dfn id=attr-fe-inputmode-keyword-kana title=attr-fe-inputmode-keyword-kana><code>kana</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-kana title=attr-fe-inputmode-state-kana>Kana</dfn>
     <td> <a href=#attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>Default</a>
     <td> Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.

    <tr><td> <dfn id=attr-fe-inputmode-keyword-katakana title=attr-fe-inputmode-keyword-katakana><code>katakana</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-katakana title=attr-fe-inputmode-state-katakana>Katakana</dfn>
     <td> <a href=#attr-fe-inputmode-state-kana title=attr-fe-inputmode-state-kana>Kana</a>
     <td> Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.

<!-- See comment on https://plus.google.com/u/0/107429617152575897589/posts/WwVmKNjcZ4p
    <tr>
     <td> <dfn title="attr-fe-inputmode-keyword-half-width-katakana"><code>half-width-katakana</code></dfn>
     <td> <dfn title="attr-fe-inputmode-state-half-width-katakana">Half-width Katakana</dfn>
     <td> <span title="attr-fe-inputmode-state-katakana">Katakana</span>
     <td> Katakana input, using half-width characters, with support for converting to kanji. Intended for Japanese text input.
-->

    <tr><td> <dfn id=attr-fe-inputmode-keyword-numeric title=attr-fe-inputmode-keyword-numeric><code>numeric</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-numeric title=attr-fe-inputmode-state-numeric>Numeric</dfn>
     <td> <a href=#attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>Default</a>
     <td> Numeric input, including keys for the digits 0 to 9, the user's preferred thousands separator character, and the character for indicating negative numbers. Intended for numeric codes, e.g. credit card numbers. (For numbers, prefer "<code title=attr-input-type-number><a href="#number-state-(type=number)">&lt;input type=number&gt;</a></code>".)

    <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-tel title=attr-fe-inputmode-keyword-tel><code>tel</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-telephone title=attr-fe-inputmode-state-telephone>Telephone</dfn>
     <td> <a href=#attr-fe-inputmode-state-numeric title=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 title=attr-input-type-tel><a href="#telephone-state-(type=tel)">&lt;input type=tel&gt;</a></code>" instead.

    <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-email title=attr-fe-inputmode-keyword-email><code>email</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-email title=attr-fe-inputmode-state-email>E-mail</dfn>
     <td> <a href=#attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>Default</a>
     <td> Text input in the user's locale, with keys for aiding in the input of e-mail addresses, such as that for the "@" character and the "." character. <a href=#avoid-inputmode>Rarely necessary</a>; use "<code title=attr-input-type-email><a href="#e-mail-state-(type=email)">&lt;input type=email&gt;</a></code>" instead.

    <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-url title=attr-fe-inputmode-keyword-url><code>url</code></dfn>
     <td> <dfn id=attr-fe-inputmode-state-url title=attr-fe-inputmode-state-url>URL</dfn>
     <td> <a href=#attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>Default</a>
     <td> Text input in the user's locale, with keys for aiding in the input of Web addresses, such as that for the "/" and "." characters and for quick input of strings commonly found in domain names such as "www." or ".co.uk". <a href=#avoid-inputmode>Rarely necessary</a>; use "<code title=attr-input-type-url><a href="#url-state-(type=url)">&lt;input type=url&gt;</a></code>" instead.

  </table><p id=avoid-inputmode>The last three keywords listed above are
  only provided for completeness, and are rarely necessary, as
  dedicated input controls exist for their usual use cases (as
  described in the table above).</p>

  <p>User agents <span class=impl>must</span> all support the <dfn id=attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>Default</dfn> input mode
  state, which corresponds to the user agent's default input modality.
  <span class=impl>This specification does not define how the user
  agent's default modality is to operate.</span> The <i>missing value
  default</i> is the <a href=#attr-fe-inputmode-state-default title=attr-fe-inputmode-state-default>default input mode</a>
  state.</p>

  <div class=impl>

  <p>User agents should use the input modality corresponding to the
  state of the <code title=attr-fe-inputmode><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 title=concept-input-apply>applies</a>. An input modality
  corresponding to a state is one designed to fit the description of
  the state in the table above. This value can change dynamically;
  user agents should update their interface as the attribute changes
  state, unless that would go against the user's wishes.</p>

  </div>


  <h5 id=autofilling-form-controls:-the-autocomplete-attribute><span class=secno>4.10.19.8 </span>Autofilling form controls: the <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute</h5>

  <p>User agents sometimes have features for helping users fill forms
  in, for example prefilling the user's address based on earlier user
  input. The <dfn id=attr-fe-autocomplete title=attr-fe-autocomplete><code>autocomplete</code></dfn> content
  attribute can be used to hint to the user agent how to, or indeed
  whether to, provide such a feature.</p>

  <p>The attribute, if present, must have a value that is a <a href=#set-of-space-separated-tokens>set
  of space-separated tokens</a> consisting of either a single token
  that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
  "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>", or a single
  token that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
  string "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>", or the
  following, in the order given below:</p>

  <ol><li>

    <p>Optionally, a token whose first eight characters are an
    <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title=attr-fe-autocomplete-section>section-</code>", meaning
    that the field belongs to the named group.</p>

    <div class=note>

     <p>For example, if there are two shipping addresses in the form,
     then they could be marked up as:</p>

     <pre>&lt;fieldset&gt;
 &lt;legend&gt;Ship the blue gift to...&lt;/legend&gt;
 &lt;p&gt; &lt;label&gt; Address:     &lt;input name=ba autocomplete="section-blue shipping street-address"&gt; &lt;/label&gt;
 &lt;p&gt; &lt;label&gt; City:        &lt;input name=bc autocomplete="section-blue shipping region"&gt; &lt;/label&gt;
 &lt;p&gt; &lt;label&gt; Postal Code: &lt;input name=bp autocomplete="section-blue shipping postal-code"&gt; &lt;/label&gt;
&lt;/fieldset&gt;
&lt;fieldset&gt;
 &lt;legend&gt;Ship the red gift to...&lt;/legend&gt;
 &lt;p&gt; &lt;label&gt; Address:     &lt;input name=ra autocomplete="section-red shipping street-address"&gt; &lt;/label&gt;
 &lt;p&gt; &lt;label&gt; City:        &lt;input name=rc autocomplete="section-red shipping region"&gt; &lt;/label&gt;
 &lt;p&gt; &lt;label&gt; Postal Code: &lt;input name=rp autocomplete="section-red shipping country"&gt; &lt;/label&gt;
&lt;/fieldset&gt;</pre>

    </div>

   </li>

   <li>

    <p>Optionally, a token that is an <a href=#ascii-case-insensitive>ASCII
    case-insensitive</a> match for one of the following
    strings:</p>

    <ul class=brief><li>"<dfn id=attr-fe-autocomplete-shipping title=attr-fe-autocomplete-shipping><code>shipping</code></dfn>", meaning the field is part of the shipping address or contact information
     <li>"<dfn id=attr-fe-autocomplete-billing title=attr-fe-autocomplete-billing><code>billing</code></dfn>", meaning the field is part of the billing address or contact information
    </ul></li>

   <li>

    <p>Either of the following two options:</p>

    <ul><li>

      <p>A token that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match
      for one of the following <a href=#autofill-field>autofill field</a> strings:</p>

      <ul class=brief><li>"<code title=attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>"
       <li>"<code title=attr-fe-autocomplete-honorific-prefix><a href=#attr-fe-autocomplete-honorific-prefix>honorific-prefix</a></code>"
       <li>"<code title=attr-fe-autocomplete-given-name><a href=#attr-fe-autocomplete-given-name>given-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-additional-name><a href=#attr-fe-autocomplete-additional-name>additional-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-family-name><a href=#attr-fe-autocomplete-family-name>family-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-honorific-suffix><a href=#attr-fe-autocomplete-honorific-suffix>honorific-suffix</a></code>"
       <li>"<code title=attr-fe-autocomplete-nickname><a href=#attr-fe-autocomplete-nickname>nickname</a></code>"
       <li>"<code title=attr-fe-autocomplete-organization-title><a href=#attr-fe-autocomplete-organization-title>organization-title</a></code>"
       <li>"<code title=attr-fe-autocomplete-organization><a href=#attr-fe-autocomplete-organization>organization</a></code>"
       <li>"<code title=attr-fe-autocomplete-street-address><a href=#attr-fe-autocomplete-street-address>street-address</a></code>"
       <li>"<code title=attr-fe-autocomplete-address-line1><a href=#attr-fe-autocomplete-address-line1>address-line1</a></code>"
       <li>"<code title=attr-fe-autocomplete-address-line2><a href=#attr-fe-autocomplete-address-line2>address-line2</a></code>"
       <li>"<code title=attr-fe-autocomplete-address-line3><a href=#attr-fe-autocomplete-address-line3>address-line3</a></code>"
       <li>"<code title=attr-fe-autocomplete-locality><a href=#attr-fe-autocomplete-locality>locality</a></code>"
       <li>"<code title=attr-fe-autocomplete-region><a href=#attr-fe-autocomplete-region>region</a></code>"
       <li>"<code title=attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>"
       <li>"<code title=attr-fe-autocomplete-country-name><a href=#attr-fe-autocomplete-country-name>country-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-postal-code><a href=#attr-fe-autocomplete-postal-code>postal-code</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-name><a href=#attr-fe-autocomplete-cc-name>cc-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-given-name><a href=#attr-fe-autocomplete-cc-given-name>cc-given-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-additional-name><a href=#attr-fe-autocomplete-cc-additional-name>cc-additional-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-family-name><a href=#attr-fe-autocomplete-cc-family-name>cc-family-name</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-number><a href=#attr-fe-autocomplete-cc-number>cc-number</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-exp-month><a href=#attr-fe-autocomplete-cc-exp-month>cc-exp-month</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-exp-year><a href=#attr-fe-autocomplete-cc-exp-year>cc-exp-year</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-csc><a href=#attr-fe-autocomplete-cc-csc>cc-csc</a></code>"
       <li>"<code title=attr-fe-autocomplete-cc-type><a href=#attr-fe-autocomplete-cc-type>cc-type</a></code>"
       <li>"<code title=attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>"
       <li>"<code title=attr-fe-autocomplete-bday><a href=#attr-fe-autocomplete-bday>bday</a></code>"
       <li>"<code title=attr-fe-autocomplete-bday-day><a href=#attr-fe-autocomplete-bday-day>bday-day</a></code>"
       <li>"<code title=attr-fe-autocomplete-bday-month><a href=#attr-fe-autocomplete-bday-month>bday-month</a></code>"
       <li>"<code title=attr-fe-autocomplete-bday-year><a href=#attr-fe-autocomplete-bday-year>bday-year</a></code>"
       <li>"<code title=attr-fe-autocomplete-sex><a href=#attr-fe-autocomplete-sex>sex</a></code>"
       <li>"<code title=attr-fe-autocomplete-url><a href=#attr-fe-autocomplete-url>url</a></code>"
       <li>"<code title=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>

     <li>

      <p>The following, in the given order:</p>

      <ol><li>

        <p>Optionally, a token that is an <a href=#ascii-case-insensitive>ASCII
        case-insensitive</a> match for one of the following
        strings:</p>

        <ul class=brief><li>"<dfn id=attr-fe-autocomplete-home title=attr-fe-autocomplete-home><code>home</code></dfn>", meaning the field is for contacting someone at their residence
         <li>"<dfn id=attr-fe-autocomplete-work title=attr-fe-autocomplete-work><code>work</code></dfn>", meaning the field is for contacting someone at their workplace
         <li>"<dfn id=attr-fe-autocomplete-mobile title=attr-fe-autocomplete-mobile><code>mobile</code></dfn>"<!-- or "cell"? -->, meaning the field is for contacting someone regardless of location
         <li>"<dfn id=attr-fe-autocomplete-fax title=attr-fe-autocomplete-fax><code>fax</code></dfn>", meaning the field describes a fax machine's contact details
         <li>"<dfn id=attr-fe-autocomplete-pager title=attr-fe-autocomplete-pager><code>pager</code></dfn>", meaning the field describes a pager's or beeper's contact details
        </ul></li>

       <li>

        <p>A token that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match
        for one of the following <a href=#autofill-field>autofill field</a> strings:</p>

        <ul class=brief><li>"<code title=attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-country-code><a href=#attr-fe-autocomplete-tel-country-code>tel-country-code</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-area-code><a href=#attr-fe-autocomplete-tel-area-code>tel-area-code</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-local><a href=#attr-fe-autocomplete-tel-local>tel-local</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-local-prefix><a href=#attr-fe-autocomplete-tel-local-prefix>tel-local-prefix</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-local-suffix><a href=#attr-fe-autocomplete-tel-local-suffix>tel-local-suffix</a></code>"
         <li>"<code title=attr-fe-autocomplete-tel-extension><a href=#attr-fe-autocomplete-tel-extension>tel-extension</a></code>"
         <li>"<code title=attr-fe-autocomplete-email><a href=#attr-fe-autocomplete-email>email</a></code>"
         <li>"<code title=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>

       </li>

      </ol></li>

    </ul></li>

  </ol><p>The "<dfn id=attr-fe-autocomplete-off title=attr-fe-autocomplete-off><code>off</code></dfn>" keyword
  indicates either that the control's input data is particularly
  sensitive (for example the activation code for a nuclear weapon); or
  that it is a value that will never be reused (for example a
  one-time-key for a bank login) and the user will therefore have to
  explicitly enter the data each time, instead of being able to rely
  on the UA to prefill the value for him; or that the document
  provides its own autocomplete mechanism and does not want the user
  agent to provide autocompletion values.</p>

  <p>The "<dfn id=attr-fe-autocomplete-on title=attr-fe-autocomplete-on><code>on</code></dfn>"
  keyword indicates that the user agent is allowed to provide the user
  with autocompletion values, but does not provide any further
  information about what kind of data the user might be expected to
  enter. User agents would have to use heuristics to decide what
  autocompletion values to suggest.</p>

  <p>The <dfn id=autofill-field title="autofill field">autofill fields</dfn> names
  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 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 title=attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"), or as
  two fields, one giving the month ("<code title=attr-fe-autocomplete-cc-exp-month><a href=#attr-fe-autocomplete-cc-exp-month>cc-exp-month</a></code>") and
  one the year ("<code title=attr-fe-autocomplete-cc-exp-year><a href=#attr-fe-autocomplete-cc-exp-year>cc-exp-year</a></code>"). In
  such cases, the names of the broader fields cover multiple rows, in
  which the narrower fields are defined.</p>

  <p class=note>Generally, authors are encouraged to use the broader
  fields rather than the narrower fields, as the narrower fields tend
  to expose Western biases. For example, while it is common in some
  Western cultures to have a given name and a family name, in that
  order (and thus often referred to as a <i>first name</i> and a
  <i>surname</i>), many cultures put the family name first and the
  given name second, and many others simply have one name (a
  <i>mononym</i>). Having a single field is therefore more
  flexible.</p>

  <table><thead><tr><th colspan=4> Field name
     <th> Meaning
     <th> Canonical Format
     <th> Canonical Format Example
   <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-name title=attr-fe-autocomplete-name><code>name</code></dfn>"
     <td>Full name
     <td>Free-form text, no newlines
     <td>Sir Timothy John Berners-Lee, OM, KBE, FRS, FREng, FRSA
    <tr><td rowspan=5 class=non-rectangular-cell-indentation>
      <td colspan=3>"<dfn id=attr-fe-autocomplete-honorific-prefix title=attr-fe-autocomplete-honorific-prefix><code>honorific-prefix</code></dfn>"
      <td>Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "<span lang=fr title="">M<sup>lle</sup></span>")
      <td>Free-form text, no newlines
      <td>Sir
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-given-name title=attr-fe-autocomplete-given-name><code>given-name</code></dfn>"
      <td>Given name (in some Western cultures, also known as the <i>first name</i>)
      <td>Free-form text, no newlines
      <td>Timothy
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-additional-name title=attr-fe-autocomplete-additional-name><code>additional-name</code></dfn>"
      <td>Additional names (in some Western cultures, also known as <i>middle names</i>, forenames other than the first name)
      <td>Free-form text, no newlines
      <td>John
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-family-name title=attr-fe-autocomplete-family-name><code>family-name</code></dfn>"
      <td>Family name (in some Western cultures, also known as the <i>last name</i> or <i>surname</i>)
      <td>Free-form text, no newlines
      <td>Berners-Lee
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-honorific-suffix title=attr-fe-autocomplete-honorific-suffix><code>honorific-suffix</code></dfn>"
      <td>Suffix (e.g. "Jr.", "B.Sc.", "MBASW", "II")
      <td>Free-form text, no newlines
      <td>OM, KBE, FRS, FREng, FRSA
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-nickname title=attr-fe-autocomplete-nickname><code>nickname</code></dfn>"
     <td>Nickname, screen name, handle: a typically short name used instead of the full name
     <td>Free-form text, no newlines
     <td>Tim
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-organization-title title=attr-fe-autocomplete-organization-title><code>organization-title</code></dfn>"
     <td>Job title (e.g. "Software Engineer", "Senior Vice President", "Deputy Managing Director")
     <td>Free-form text, no newlines
     <td>Professor
   <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-organization title=attr-fe-autocomplete-organization><code>organization</code></dfn>"
     <td>Company name corresponding to the person, address, or contact information in the other fields associated with this field
     <td>Free-form text, no newlines
     <td>World Wide Web Consortium
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-street-address title=attr-fe-autocomplete-street-address><code>street-address</code></dfn>"
     <td>Street address (multiple lines, newlines preserved)
     <td>Free-form text
     <td>32 Vassar Street<br>
MIT Room 32-G524
    <tr><td rowspan=3 class=non-rectangular-cell-indentation>
      <td colspan=3>"<dfn id=attr-fe-autocomplete-address-line1 title=attr-fe-autocomplete-address-line1><code>address-line1</code></dfn>"
      <td rowspan=3>Street address (one line per field)
      <td>Free-form text, no newlines
      <td>32 Vassar Street
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-address-line2 title=attr-fe-autocomplete-address-line2><code>address-line2</code></dfn>"
      <td>Free-form text, no newlines
      <td>MIT Room 32-G524
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-address-line3 title=attr-fe-autocomplete-address-line3><code>address-line3</code></dfn>"
      <td>Free-form text, no newlines
      <td>
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-locality title=attr-fe-autocomplete-locality><code>locality</code></dfn>"
     <td>City, town, village, post town, or other locality within which the relevant street address is found
     <td>Free-form text, no newlines
     <td>Cambridge
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-region title=attr-fe-autocomplete-region><code>region</code></dfn>"
     <td>Province such as a state, county, or canton within which the locality is found
     <td>Free-form text, no newlines
     <td>MA
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-country title=attr-fe-autocomplete-country><code>country</code></dfn>"
     <td>Country code
     <td>Valid <a href=http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm>ISO 3166-1-alpha-2 country code</a> <a href=#refsISO3166>[ISO3166]</a>
     <td>US
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-country-name title=attr-fe-autocomplete-country-name><code>country-name</code></dfn>"
     <td>Country name
     <td>Free-form text, no newlines; <a href=#autofill-country>derived from <code title=attr-fe-autocomplete-country>country</code> in some cases</a>
     <td>US
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-postal-code title=attr-fe-autocomplete-postal-code><code>postal-code</code></dfn>"
     <td>Postal code, post code, ZIP code, CEDEX code (if CEDEX, append "CEDEX", and the <i lang=fr>arrondissement</i> if relevant, to the <code title=attr-fe-autocomplete-locality><a href=#attr-fe-autocomplete-locality>locality</a></code> field)
     <td>Free-form text, no newlines
     <td>02139
   <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-name title=attr-fe-autocomplete-cc-name><code>cc-name</code></dfn>"
     <td>Full name as given on the payment instrument
     <td>Free-form text, no newlines
     <td>Tim Berners-Lee
    <tr><td rowspan=3 class=non-rectangular-cell-indentation>
      <td colspan=3>"<dfn id=attr-fe-autocomplete-cc-given-name title=attr-fe-autocomplete-cc-given-name><code>cc-given-name</code></dfn>"
      <td>Given name as given on the payment instrument (in some Western cultures, also known as the <i>first name</i>)
      <td>Free-form text, no newlines
      <td>Tim
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-additional-name title=attr-fe-autocomplete-cc-additional-name><code>cc-additional-name</code></dfn>"
      <td>Additional names given on the payment instrument (in some Western cultures, also known as <i>middle names</i>, forenames other than the first name)
      <td>Free-form text, no newlines
      <td>
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-family-name title=attr-fe-autocomplete-cc-family-name><code>cc-family-name</code></dfn>"
      <td>Family name given on the payment instrument (in some Western cultures, also known as the <i>last name</i> or <i>surname</i>)
      <td>Free-form text, no newlines
      <td>Berners-Lee
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-number title=attr-fe-autocomplete-cc-number><code>cc-number</code></dfn>"
     <td>Code identifying the payment instrument (e.g. the credit card number, bank account number)
     <td><a href=#ascii-digits>ASCII digits</a>
     <td>4114360123456785 <!-- http://www.auricsystems.com/support-center/sample-credit-card-numbers -->
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-exp title=attr-fe-autocomplete-cc-exp><code>cc-exp</code></dfn>"
     <td>Expiration date of the payment instrument
     <td><a href=#valid-month-string>Valid month string</a>
     <td>2014-12
    <tr><td rowspan=2 class=non-rectangular-cell-indentation>
      <td colspan=3>"<dfn id=attr-fe-autocomplete-cc-exp-month title=attr-fe-autocomplete-cc-exp-month><code>cc-exp-month</code></dfn>"
      <td>Month component of the expiration date of the payment instrument
      <td><a href=#valid-integer>Valid integer</a> in the range 1..12
      <td>12
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-exp-year title=attr-fe-autocomplete-cc-exp-year><code>cc-exp-year</code></dfn>"
      <td>Year component of the expiration date of the payment instrument
      <td><a href=#valid-integer>Valid integer</a> greater than zero
      <td>2014
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-csc title=attr-fe-autocomplete-cc-csc><code>cc-csc</code></dfn>"
     <td>Security code for the payment instrument (also known as the card security code (CSC), card validation code (CVC), card verification value (CVV), signature panel code (SPC), credit card ID (CCID), etc)
     <td><a href=#ascii-digits>ASCII digits</a>
     <td>419
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-type title=attr-fe-autocomplete-cc-type><code>cc-type</code></dfn>"
     <td>Type of payment instrument
     <td>Free-form text, no newlines
     <td>Visa
   <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-language title=attr-fe-autocomplete-language><code>language</code></dfn>"
     <td>Preferred language
     <td>Valid BCP 47 language tag <a href=#refsBCP47>[BCP47]</a>
     <td>en
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-bday title=attr-fe-autocomplete-bday><code>bday</code></dfn>"
     <td>Birthday
     <td><a href=#valid-date-string>Valid date string</a>
     <td>1955-06-08
    <tr><td rowspan=3 class=non-rectangular-cell-indentation>
      <td colspan=3>"<dfn id=attr-fe-autocomplete-bday-day title=attr-fe-autocomplete-bday-day><code>bday-day</code></dfn>"
      <td>Day component of birthday
      <td><a href=#valid-integer>Valid integer</a> in the range 1..31
      <td>8
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-bday-month title=attr-fe-autocomplete-bday-month><code>bday-month</code></dfn>"
      <td>Month component of birthday
      <td><a href=#valid-integer>Valid integer</a> in the range 1..12
      <td>6
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-bday-year title=attr-fe-autocomplete-bday-year><code>bday-year</code></dfn>"
      <td>Year component of birthday
      <td><a href=#valid-integer>Valid integer</a> greater than zero
      <td>1955
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-sex title=attr-fe-autocomplete-sex><code>sex</code></dfn>"
     <td>Gender identity (e.g. Female, Fa'afafine)
     <td>Free-form text, no newlines
     <td>Male
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-url title=attr-fe-autocomplete-url><code>url</code></dfn>"
     <td>Home page or other Web page corresponding to the company, person, address, or contact information in the other fields associated with this field
     <td><a href=#valid-url>Valid URL</a>
     <td>http://www.w3.org/People/Berners-Lee/
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-photo title=attr-fe-autocomplete-photo><code>photo</code></dfn>"
     <td>Photograph, icon, or other image corresponding to the company, person, address, or contact information in the other fields associated with this field
     <td>File or <a href=#valid-url>Valid URL</a>
     <td>http://www.w3.org/Press/Stock/Berners-Lee/2001-europaeum-eighth.jpg
   <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-tel title=attr-fe-autocomplete-tel><code>tel</code></dfn>"
     <td>Full telephone number, including country code
     <td><a href=#ascii-digits>ASCII digits</a> and U+0020 SPACE characters, prefixed by a U+002B PLUS SIGN character (+)
     <td>+1 617 253 5702
    <tr><td rowspan=6 class=non-rectangular-cell-indentation>
      <td colspan=3>"<dfn id=attr-fe-autocomplete-tel-country-code title=attr-fe-autocomplete-tel-country-code><code>tel-country-code</code></dfn>"
      <td>Country code component of the telephone number
     <td><a href=#ascii-digits>ASCII digits</a> prefixed by a U+002B PLUS SIGN character (+)
      <td>+1
    <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-tel-national title=attr-fe-autocomplete-tel-national><code>tel-national</code></dfn>"
      <td>Telephone number without the county code component
      <td><a href=#ascii-digits>ASCII digits</a> and U+0020 SPACE characters
      <td>617 253 5702
    <tr><td rowspan=4 class=non-rectangular-cell-indentation>
       <td colspan=2>"<dfn id=attr-fe-autocomplete-tel-area-code title=attr-fe-autocomplete-tel-area-code><code>tel-area-code</code></dfn>"
       <td>Area code component of the telephone number
       <td><a href=#ascii-digits>ASCII digits</a>
       <td>617
    <tr><td colspan=2>"<dfn id=attr-fe-autocomplete-tel-local title=attr-fe-autocomplete-tel-local><code>tel-local</code></dfn>"
       <td>Telephone number without the country code and area code components
       <td><a href=#ascii-digits>ASCII digits</a>
       <td>2535702
    <tr><td rowspan=2 class=non-rectangular-cell-indentation>
        <td>"<dfn id=attr-fe-autocomplete-tel-local-prefix title=attr-fe-autocomplete-tel-local-prefix><code>tel-local-prefix</code></dfn>"
        <td>First part of the component of the telephone number that follows the area code, when that component is split into two components
        <td><a href=#ascii-digits>ASCII digits</a>
        <td>253
    <tr><td>"<dfn id=attr-fe-autocomplete-tel-local-suffix title=attr-fe-autocomplete-tel-local-suffix><code>tel-local-suffix</code></dfn>"
        <td>Second part of the component of the telephone number that follows the area code, when that component is split into two components
        <td><a href=#ascii-digits>ASCII digits</a>
        <td>5702
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-tel-extension title=attr-fe-autocomplete-tel-extension><code>tel-extension</code></dfn>"
     <td>Telephone number internal extension code
     <td><a href=#ascii-digits>ASCII digits</a>
     <td>1000
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-email title=attr-fe-autocomplete-email><code>email</code></dfn>"
     <td>E-mail address
     <td><a href=#valid-e-mail-address>Valid e-mail address</a>
     <td>timbl@w3.org
    <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-impp title=attr-fe-autocomplete-impp><code>impp</code></dfn>"
     <td>URL representing an instant messaging protocol endpoint (for example, "<code title="">aim:goim?screenname=example</code>" or "<code title="">xmpp:fred@example.net</code>")
     <td><a href=#valid-url>Valid URL</a>
     <td>irc://example.org/timbl,isuser
  </table><p>If the <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
  attribute is omitted, the default value corresponding to the state
  of the element's <a href=#form-owner>form owner</a>'s <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is used
  instead (either "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>" or
  "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>"). If there is no
  <a href=#form-owner>form owner</a>, then the value "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>" is used.</p>

  <div class=impl>

  <p>Each <code><a href=#the-input-element>input</a></code>, <code><a href=#the-select-element>select</a></code>, and <code><a href=#the-textarea-element>textarea</a></code> element has an
  <dfn id=autofill-hint-set>autofill hint set</dfn>, an <dfn id=autofill-scope>autofill scope</dfn>, an <dfn id=autofill-field-name>autofill field name</dfn>, and
  an <dfn id=idl-exposed-autofill-value>IDL-exposed autofill value</dfn>.</p>

  <p>The <a href=#autofill-field-name>autofill field name</a> specifies the specific kind of data expected in the field,
  e.g. "<code title=attr-fe-autocomplete-street-address><a href=#attr-fe-autocomplete-street-address>street-address</a></code>" or "<code title=attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>".</p>

  <p>The <a href=#autofill-hint-set>autofill hint set</a> identifies what address or contact information type the user
  agent is to look at, e.g. "<code title=attr-fe-autocomplete-shipping><a href=#attr-fe-autocomplete-shipping>shipping</a></code> <code title=attr-fe-autocomplete-fax><a href=#attr-fe-autocomplete-fax>fax</a></code>" or "<code title=attr-fe-autocomplete-billing><a href=#attr-fe-autocomplete-billing>billing</a></code>".</p>

  <p>The <a href=#autofill-scope>autofill scope</a> identifies the group of fields that are to be filled with the
  information from the same source, and consists of the <a href=#autofill-hint-set>autofill hint set</a> with, if
  applicable, the "<code title="">section-*</code>" prefix, e.g. "billing", "<code title="">section-parent shipping</code>", or "<code title="">section-child home
  shipping</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 title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute, then
   jump to the step labeled <i>default</i>.</li>

   <li><p>Let <var title="">tokens</var> be the result of <a href=#split-a-string-on-spaces title="split a string on spaces">splitting the attribute's value on
   spaces</a>.</li>

   <li><p>If <var title="">tokens</var> is empty, then jump to the
   step labeled <i>default</i>.</li>

   <li><p>Let <var title="">index</var> be the index of the last token
   in <var title="">tokens</var>.</li>

   <li>

    <p>If the <var title="">index</var>th token in <var title="">tokens</var> is not an <a href=#ascii-case-insensitive>ASCII
    case-insensitive</a> match for one of the tokens given in the
    first column of the following table, or if the number of tokens in
    <var title="">tokens</var> is greater than the maximum number
    given in the cell in the second column of that token's row, then
    jump to the step labeled <i>default</i>. Otherwise, let <var title="">field</var> be the string given in the cell of the first
    column of the matching row, and let <var title="">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 title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>"
       <td>1
       <td>Off
      <tr><td>"<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>"
       <td>1
       <td>Automatic
     <tbody><tr><td>"<code title=attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-honorific-prefix><a href=#attr-fe-autocomplete-honorific-prefix>honorific-prefix</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-given-name><a href=#attr-fe-autocomplete-given-name>given-name</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-additional-name><a href=#attr-fe-autocomplete-additional-name>additional-name</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-family-name><a href=#attr-fe-autocomplete-family-name>family-name</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-honorific-suffix><a href=#attr-fe-autocomplete-honorific-suffix>honorific-suffix</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-nickname><a href=#attr-fe-autocomplete-nickname>nickname</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-organization-title><a href=#attr-fe-autocomplete-organization-title>organization-title</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-organization><a href=#attr-fe-autocomplete-organization>organization</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-street-address><a href=#attr-fe-autocomplete-street-address>street-address</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-address-line1><a href=#attr-fe-autocomplete-address-line1>address-line1</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-address-line2><a href=#attr-fe-autocomplete-address-line2>address-line2</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-address-line3><a href=#attr-fe-autocomplete-address-line3>address-line3</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-locality><a href=#attr-fe-autocomplete-locality>locality</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-region><a href=#attr-fe-autocomplete-region>region</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-country-name><a href=#attr-fe-autocomplete-country-name>country-name</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-postal-code><a href=#attr-fe-autocomplete-postal-code>postal-code</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-cc-name><a href=#attr-fe-autocomplete-cc-name>cc-name</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=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 title=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 title=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 title=attr-fe-autocomplete-cc-number><a href=#attr-fe-autocomplete-cc-number>cc-number</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=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 title=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 title=attr-fe-autocomplete-cc-csc><a href=#attr-fe-autocomplete-cc-csc>cc-csc</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-cc-type><a href=#attr-fe-autocomplete-cc-type>cc-type</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-bday><a href=#attr-fe-autocomplete-bday>bday</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-bday-day><a href=#attr-fe-autocomplete-bday-day>bday-day</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-bday-month><a href=#attr-fe-autocomplete-bday-month>bday-month</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-bday-year><a href=#attr-fe-autocomplete-bday-year>bday-year</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-sex><a href=#attr-fe-autocomplete-sex>sex</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-url><a href=#attr-fe-autocomplete-url>url</a></code>"
       <td>3
       <td>Normal
      <tr><td>"<code title=attr-fe-autocomplete-photo><a href=#attr-fe-autocomplete-photo>photo</a></code>"
       <td>3
       <td>Normal
     <tbody><tr><td>"<code title=attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>"
       <td>4
       <td>Contact
      <tr><td>"<code title=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 title=attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code>"
       <td>4
       <td>Contact
      <tr><td>"<code title=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 title=attr-fe-autocomplete-tel-local><a href=#attr-fe-autocomplete-tel-local>tel-local</a></code>"
       <td>4
       <td>Contact
      <tr><td>"<code title=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 title=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 title=attr-fe-autocomplete-tel-extension><a href=#attr-fe-autocomplete-tel-extension>tel-extension</a></code>"
       <td>4
       <td>Contact
      <tr><td>"<code title=attr-fe-autocomplete-email><a href=#attr-fe-autocomplete-email>email</a></code>"
       <td>4
       <td>Contact
      <tr><td>"<code title=attr-fe-autocomplete-impp><a href=#attr-fe-autocomplete-impp>impp</a></code>"      
       <td>4
       <td>Contact
    </table></li>

   <li><p>If <var title="">category</var> is Off, let the element's
   <a href=#autofill-field-name>autofill field name</a> be the string "<code title="">off</code>", let its <a href=#autofill-hint-set>autofill hint set</a> be
   empty, and let its <a href=#idl-exposed-autofill-value>IDL-exposed autofill value</a> be the
   string "<code title="">off</code>". Then, abort these steps.</p>

   <li><p>If <var title="">category</var> is Automatic, let the
   element's <a href=#autofill-field-name>autofill field name</a> be the string "<code title="">on</code>", let its <a href=#autofill-hint-set>autofill hint set</a> be
   empty, and let its <a href=#idl-exposed-autofill-value>IDL-exposed autofill value</a> be the
   string "<code title="">on</code>". Then, abort these steps.</p>

   <li><p>Let <var title="">scope tokens</var> be an empty list.</li>

   <li><p>Let <var title="">hint tokens</var> be an empty set.</li>

   <li><p>Let <var title="">IDL value</var> have the same value as
   <var title="">field</var>.</li>

   <li><p>If the <var title="">index</var>th token in <var title="">tokens</var> is the first entry, then skip to the step
   labeled <i>done</i>.</li>

   <li><p>Decrement <var title="">index</var> by one.</li>

   <li>

    <p>If <var title="">category</var> is Contact and the <var title="">index</var>th token in <var title="">tokens</var> is an
    <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the strings
    in the following list, then run the substeps that follow:</p>

    <ul class=brief><li>"<code title=attr-fe-autocomplete-home><a href=#attr-fe-autocomplete-home>home</a></code>"
     <li>"<code title=attr-fe-autocomplete-work><a href=#attr-fe-autocomplete-work>work</a></code>"
     <li>"<code title=attr-fe-autocomplete-mobile><a href=#attr-fe-autocomplete-mobile>mobile</a></code>"
     <li>"<code title=attr-fe-autocomplete-fax><a href=#attr-fe-autocomplete-fax>fax</a></code>"
     <li>"<code title=attr-fe-autocomplete-pager><a href=#attr-fe-autocomplete-pager>pager</a></code>"
    </ul><p>The substeps are:</p>

    <ol><li><p>Let <var title="">contact</var> be the matching
     string from the list above.</li>

     <li><p>Insert <var title="">contact</var> at the start of <var title="">scope tokens</var>.</li>

     <li><p>Add <var title="">contact</var> to <var title="">hint
     tokens</var>.</li>

     <li><p>Let <var title="">IDL value</var> be the concatenation of
     <var title="">contact</var>, a U+0020 SPACE character, and the
     previous value of <var title="">IDL value</var> (which at this
     point will always be <var title="">field</var>).</li>

     <li><p>If the <var title="">index</var>th entry in <var title="">tokens</var> is the first entry, then skip to the step
     labeled <i>done</i>.</li>

     <li><p>Decrement <var title="">index</var> by one.</li>

    </ol></li>

   <li>

    <p>If the <var title="">index</var>th token in <var title="">tokens</var> is an
    <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of the strings
    in the following list, then run the substeps that follow:</p>

    <ul class=brief><li>"<code title=attr-fe-autocomplete-shipping><a href=#attr-fe-autocomplete-shipping>shipping</a></code>"
     <li>"<code title=attr-fe-autocomplete-billing><a href=#attr-fe-autocomplete-billing>billing</a></code>"
    </ul><p>The substeps are:</p>

    <ol><li><p>Let <var title="">mode</var> be the matching
     string from the list above.</li>

     <li><p>Insert <var title="">mode</var> at the start of <var title="">scope tokens</var>.</li>

     <li><p>Add <var title="">mode</var> to <var title="">hint
     tokens</var>.</li>

     <li><p>Let <var title="">IDL value</var> be the concatenation of
     <var title="">mode</var>, a U+0020 SPACE character, and the
     previous value of <var title="">IDL value</var> (which at this
     point will either be <var title="">field</var> or the concatenation of
     <var title="">contact</var>, a space, and <var title="">field</var>).</li>

     <li><p>If the <var title="">index</var>th entry in <var title="">tokens</var> is the first entry, then skip to the step
     labeled <i>done</i>.</li>

     <li><p>Decrement <var title="">index</var> by one.</li>

    </ol></li>

   <li><p>If the <var title="">index</var>th entry in <var title="">tokens</var> is not the first entry, then jump to the step
   labeled <i>default</i>.</li>

   <li><p>If the first eight characters of the <var title="">index</var>th
   token in <var title="">tokens</var> are not an <a href=#ascii-case-insensitive>ASCII
   case-insensitive</a> match for the string "<code title=attr-fe-autocomplete-section>section-</code>", then jump to
   the step labeled <i>default</i>.</li>

   <li><p>Let <var title="">section</var> be the <var title="">index</var>th token in <var title="">tokens</var>,
   <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>

   <li><p>Insert <var title="">section</var> at the start of <var title="">scope tokens</var>.</li>

   <li><p>Let <var title="">IDL value</var> be the concatenation of
   <var title="">section</var>, a U+0020 SPACE character, and the
   previous value of <var title="">IDL value</var>.</li>

   <li><p><i>Done</i>: Let the element's <a href=#autofill-hint-set>autofill hint
   set</a> be <var title="">hint tokens</var>.</p>

   <li><p>Let the element's <a href=#autofill-scope>autofill scope</a> be <var title="">scope tokens</var>.</p>

   <li><p>Let the element's <a href=#autofill-field-name>autofill field name</a> be
   <var title="">field</var>.</p>

   <li><p>Let the element's <a href=#idl-exposed-autofill-value>IDL-exposed autofill value</a> be
   <var title="">IDL value</var>.</p>

   <li><p>Abort these steps.</li>

   <li><p><i>Default</i>: Let the element's <a href=#idl-exposed-autofill-value>IDL-exposed autofill value</a> be the empty
   string, and its <a href=#autofill-hint-set>autofill hint set</a> and <a href=#autofill-scope>autofill scope</a> be empty.</li>

   <li><p>Let <var title="">form</var> be the element's <a href=#form-owner>form
   owner</a>, if any, or null otherwise.</li>

   <li>

    <p>If <var title="">form</var> is not null and <var title="">form</var>'s <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is in
    the <a href=#attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</a>
    state, then let the element's <a href=#autofill-field-name>autofill field name</a> be
    "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>".</p>

    <p>Otherwise, let the element's <a href=#autofill-field-name>autofill field name</a>
    be "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>".</p>

   </li>

  </ol><p>When an element's <a href=#autofill-field-name>autofill field name</a> is "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>", the user agent should
  not remember the control's <a href=#concept-fe-value title=concept-fe-value>value</a>, and should not offer past
  values to the user.</p>

  <p class=note>In addition, when an element's <a href=#autofill-field-name>autofill field
  name</a> is "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>",
  <a href=#history-autocomplete>values are reset</a> when <a href=#traverse-the-history title="traverse the history">traversing the history</a>.</p>

  <div class=example>

   <p>Banks frequently do not want UAs to prefill login
   information:</p>

   <pre>&lt;p&gt;&lt;label&gt;Account: &lt;input type="text" name="ac" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;label&gt;PIN: &lt;input type="password" name="pin" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;</pre>

  </div>

  <p>When an element's <a href=#autofill-field-name>autofill field name</a> is
  <em>not</em> "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>",
  the user agent may store the control's <a href=#concept-fe-value title=concept-fe-value>value</a>, and may offer previously
  stored values to the user.</p>

  <p>When the <a href=#autofill-field-name>autofill field name</a> is "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>", the user agent should
  attempt to use heuristics to determine the most appropriate values
  to offer the user, e.g. based on the element's <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> value, the position of the element
  in the document's DOM, what other fields exist in the form, and so
  forth.</p>

  <p>When the <a href=#autofill-field-name>autofill field name</a> is one of the names of
  the <a href=#autofill-field title="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>autofill hint set</a> should be used to select
  amongst multiple possible suggestions.</p>

  <p class=example>For example, if a user once entered one address
  into fields that used the "<code title=attr-fe-autocomplete-shipping><a href=#attr-fe-autocomplete-shipping>shipping</a></code>" keyword, and
  another address into fields that used the "<code title=attr-fe-autocomplete-billing><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>autofill hint set</a> contains the
  keyword "<code title=attr-fe-autocomplete-shipping><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>autofill hint set</a> does not contain
  either keyword.</p>

  <p>When the user agent autofills form controls, elements with the same <a href=#form-owner>form owner</a> and
  the same <a href=#autofill-scope>autofill scope</a> must use data relating to the same person, address, payment
  instrument, and contact details. <span id=autofill-country title="">When a user agent autofills
  "<code title=attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>" and "<code title=attr-fe-autocomplete-country-name><a href=#attr-fe-autocomplete-country-name>country-name</a></code>" fields with the same <a href=#form-owner>form
  owner</a> and <a href=#autofill-scope>autofill scope</a>, and the user agent has a value for the <code title=attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>" field(s), then the "<code title=attr-fe-autocomplete-country-name><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>autofill field name</a>, <a href=#form-owner>form owner</a> and
  <a href=#autofill-scope>autofill scope</a> must be filled with the same value.</p>

  <p class=example>Suppose a user agent knows of two phone numbers,
  +1 555 123 1234 and +1 555 666 7777. It would not be conforming for
  the user agent to fill a field with <code title="">autocomplete="shipping tel-local-prefix"</code> with the
  value "123" and another field in the same form with <code title="">autocomplete="shipping tel-local-suffix"</code> with the
  value "7777". The only valid prefilled values given the
  aforementioned information would be "123" and "1234", or "666" and
  "7777", respectively.</p>

  <p class=example>Similarly, if a form for some reason contained
  both a "<code title=attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"
  field and a "<code title=attr-fe-autocomplete-cc-exp-month><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>

  <p>The autocompletion mechanism must be implemented by the user
  agent acting as if the user had modified the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, and must be done at a time
  where the element is <i title=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 title="stop parsing">stops parsing</a>).
  User agents must only prefill controls using values that the user
  could have entered.</p>

  <p class=example>For example, if a <code><a href=#the-select-element>select</a></code> element
  only has <code><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>autofill field
  name</a> "<code title=attr-fe-autocomplete-given-name><a href=#attr-fe-autocomplete-given-name>given-name</a></code>", but the
  user agent's only idea for what to prefill the field with is "Evan",
  then the user agent cannot prefill the field. It would not be
  conforming to somehow set the <code><a href=#the-select-element>select</a></code> element to the
  value "Evan", since the user could not have done so themselves.</p>

  <p>A user agent prefilling a form control's <a href=#concept-fe-value title=concept-fe-value>value</a> must not cause that control to
  <a href=#suffering-from-a-type-mismatch title="suffering from a type mismatch">suffer from a type
  mismatch</a>, <a href=#suffering-from-a-pattern-mismatch title="suffering from a pattern
  mismatch">suffer from a pattern mismatch</a>, <a href=#suffering-from-being-too-long title="suffering from being too long">suffer from being too
  long</a>, <a href=#suffering-from-an-underflow title="suffering from an underflow">suffer from
  an underflow</a>, <a href=#suffering-from-an-overflow title="suffering from an overflow">suffer
  from an overflow</a>, or <a href=#suffering-from-a-step-mismatch title="suffering from a step
  mismatch">suffer from a step mismatch</a>. Where possible given the control's constraints, user
  agents must use the format given as canonical in the aforementioned table. Where it's not possible
  for the canonical format to be used, user agents should use heuristics to attempt to convert values so that
  they can be used.</p>

  <div class=example>

   <p>For example, if the user agent knows that the user's middle name
   is "Ines", and attempts to prefill a form control that looks like this:</p>

   <pre>&lt;input name=middle-initial maxlength=1 autocomplete="additional-name"&gt;</pre>

   <p>...then the user agent could convert "Ines" to "I" and prefill
   it that way.</p>

  </div>

  <div class=example>

   <p>A more elaborate example would be with month values. If the user
   agent knows that the user's birthday is the 27th of July 2012, then
   it might try to prefill all of the following controls with slightly
   different values, all driven from this information:</p>

   <table><tr><td>
      <pre>&lt;input name=b type=month autocomplete="bday"&gt;</pre>
     <td>
      2012-07
     <td>
      The day is dropped since the <a href="#month-state-(type=month)" title=attr-input-type-month>Month</a> state only accepts a
      month/year combination.
    <tr><td>
      <pre>&lt;select name=c autocomplete="bday"&gt;
 &lt;option&gt;Jan
 &lt;option&gt;Feb
 <em>...</em>
 &lt;option&gt;Jul
 &lt;option&gt;Aug
 <em>...</em>
&lt;/select&gt;</pre>
     <td>
      July
     <td>
      The user agent picks the month from the listed options, either
      by noticing there are twelve options and picking the 7th, or by
      recognising that one of the strings (three characters "Jul"
      followed by a newline and a space) is a close match for the name
      of the month (July) in one of the user agent's supported
      languages, or through some other similar mechanism.
    <tr><td>
      <pre>&lt;input name=a type=number min=1 max=12 autocomplete="bday-month"&gt;</pre>
     <td>
      7
     <td>
      User agent converts "July" to a month number in the range 1..12, like the field.
    <tr><td>
      <pre>&lt;input name=a type=number min=0 max=11 autocomplete="bday-month"&gt;</pre>
     <td>
      6
     <td>
      User agent converts "July" to a month number in the range 0..11, like the field.
    <tr><td>
      <pre>&lt;input name=a type=number min=1 max=11 autocomplete="bday-month"&gt;</pre>
     <td>
     <td>
      User agent doesn't fill in the field, since it can't make a good guess as to what the form expects.
   </table></div>

  <p>A user agent may allow the user to override an element's
  <a href=#autofill-field-name>autofill field name</a>, e.g. to change it from "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>" to "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>" to allow values to be
  remembered and prefilled despite the page author's objections, or to
  always "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>", never
  remembering values. However, user agents should not allow users to
  trivially override the <a href=#autofill-field-name>autofill field name</a> from "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>" to "<code title=attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>" or other values, as there
  are significant security implications for the user if all values are
  always remembered, regardless of the site's preferences.</p>

  <p>The <dfn id=dom-fe-autocomplete title=dom-fe-autocomplete><code>autocomplete</code></dfn> IDL
  attribute, on getting, must return the element's <a href=#idl-exposed-autofill-value>IDL-exposed
  autofill value</a>, and on setting, must <a href=#reflect>reflect</a> the
  content attribute of the same name.</p>

  </div>



<!--TOPIC:DOM APIs-->
  <h4 id=textFieldSelection><span class=secno>4.10.20 </span>APIs for the text field selections</h4>

  <!-- v2 idea: DOM Range APIs to expose the textarea/input edited
  value (ack martijnw) -->

  <p>The <code><a href=#the-input-element>input</a></code> and <code><a href=#the-textarea-element>textarea</a></code> elements define
  the following members in their DOM interfaces for handling their
  selection:</p>

  <pre class="idl extract">  void <a href=#dom-textarea/input-select title=dom-textarea/input-select>select</a>();
           attribute unsigned long <a href=#dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart>selectionStart</a>;
           attribute unsigned long <a href=#dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd>selectionEnd</a>;
           attribute DOMString <a href=#dom-textarea/input-selectiondirection title=dom-textarea/input-selectionDirection>selectionDirection</a>;
  void <a href=#dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText>setRangeText</a>(DOMString replacement);
  void <a href=#dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText>setRangeText</a>(DOMString replacement, unsigned long start, unsigned long end, optional <a href=#selectionmode>SelectionMode</a> selectionMode);
  void <a href=#dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange>setSelectionRange</a>(unsigned long start, unsigned long end, optional DOMString direction = "preserve");</pre>
  <!-- v2: also add textLength? it seems to be widely used -->

  <p>The <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText</a></code> method
  uses the following enumeration:</p>

  <pre class=idl>enum <dfn id=selectionmode>SelectionMode</dfn> {
  "<a href=#dom-selectionmode-select title=dom-SelectionMode-select>select</a>",
  "<a href=#dom-selectionmode-start title=dom-SelectionMode-start>start</a>",
  "<a href=#dom-selectionmode-end title=dom-SelectionMode-end>end</a>",
  "<a href=#dom-selectionmode-preserve title=dom-SelectionMode-preserve>preserve</a>",
};</pre>

  <p>These methods and attributes expose and control the selection of
  <code><a href=#the-input-element>input</a></code> and <code><a href=#the-textarea-element>textarea</a></code> text fields.</p>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-textarea/input-select><a href=#dom-textarea/input-select>select</a></code>()</dt>

   <dd>

    <p>Selects everything in the text field.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-textarea/input-selecionStart>selectionStart</code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the offset to the start of the selection.</p>

    <p>Can be set, to change the start of the selection.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-textarea/input-selecionEnd>selectionEnd</code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the offset to the end of the selection.</p>

    <p>Can be set, to change the end of the selection.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-textarea/input-selecionDirection>selectionDirection</code> [ = <var title="">value</var> ]</dt>

   <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 title="">forward</code>", "<code title="">backward</code>", and "<code title="">none</code>".</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange</a></code>(<var title="">start</var>, <var title="">end</var> [, <var title="">direction</var>] )</dt>

   <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>

   </dd>

   <dt><var title="">element</var> . <code title=dom-textarea/input-setRangeText><a href=#dom-textarea/input-setrangetext>setRangeText</a></code>(<var title="">replacement</var> [, <var title="">start</var>, <var title="">end</var> [, <var title="">selectionMode</var> ] ] )</dt>

   <dd>

    <p>Replaces a range of text with the new text. If the <var title="">start</var> and <var title="">end</var> arguments are not
    provided, the range is assumed to be the selection.</p>

    <p>The final argument determines how the selection should be set
    after the text has been replaced. The possible values are:</p>

    <dl><dt>"<code title=dom-SelectionMode-select><a href=#dom-selectionmode-select>select</a></code>"</dt>

     <dd>Selects the newly inserted text.</dd>


     <dt>"<code title=dom-SelectionMode-start><a href=#dom-selectionmode-start>start</a></code>"</dt>

     <dd>Moves the selection to just before the inserted text.</dd>


     <dt>"<code title=dom-SelectionMode-end><a href=#dom-selectionmode-end>end</a></code>"</dt>

     <dd>Moves the selection to just after the selected text.</dd>


     <dt>"<code title=dom-SelectionMode-preserve><a href=#dom-selectionmode-preserve>preserve</a></code>"</dt>

     <dd>Attempts to preserve the selection. This is the default.</dd>


    </dl></dd>

  </dl><div class=impl>

  <p>For <code><a href=#the-input-element>input</a></code> elements, calling these methods while they <a href=#do-not-apply title="do not
  apply">don't apply</a>, and getting or setting these attributes while they <a href=#do-not-apply title="do not
  apply">don't apply</a>, must throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, they
  must act as described below.</p>

  <p>For <code><a href=#the-input-element>input</a></code> elements, these methods and attributes must operate on the element's
  <a href=#concept-fe-value title=concept-fe-value>value</a>. For <code><a href=#the-textarea-element>textarea</a></code> elements, these methods and
  attributes must operate on the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
  value</a>.</p>

  <p>Where possible, user interface features for changing the text selection in <code><a href=#the-input-element>input</a></code>
  and <code><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><a href=#the-input-element>input</a></code> and <code><a href=#the-textarea-element>textarea</a></code> elements have a
  <i>direction</i>, which is either <i>forward</i>, <i>backward</i>, or <i>none</i>. This direction
  is set when the user manipulates the selection. The exact meaning of the selection direction
  depends on the platform.</p>

  <p class=note>On Windows, the direction indicates the position of the caret relative to the
  selection: a <i>forward</i> selection has the caret at the end of the selection and a
  <i>backward</i> selection has the caret at the start of the selection. Windows has no <i>none</i>
  direction. On Mac, the direction indicates which end of the selection is affected when the user
  adjusts the size of the selection using the arrow keys with the Shift modifier: the forward
  direction means the end of the selection is modified, and the backwards direction means the start
  of the selection is modified. The none direction is the default on Mac, it indicates that no
  particular direction has yet been selected. The user sets the direction implicitly when first
  adjusting the selection, based on which directional arrow key was used.</p>


  <p>The <dfn id=dom-textarea/input-select title=dom-textarea/input-select><code>select()</code></dfn> method must cause the
  contents of the text field to be fully selected, with the selection direction being none, if the
  platform support selections with the direction <i>none</i>, or otherwise <i>forward</i>. The user
  agent must then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
  <code title=event-select>select</code> at the element, using the <a href=#user-interaction-task-source>user interaction task
  source</a> as the task source.</p>


  <p>The <dfn id=dom-textarea/input-selectionstart title=dom-textarea/input-selectionStart><code>selectionStart</code></dfn> attribute
  must, on getting, return the offset (in logical order) to the character that immediately follows
  the start of the selection. If there is no selection, then it must return the offset (in logical
  order) to the character that immediately follows the text entry cursor.</p>

  <p>On setting, it must act as if the <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> method had been called,
  with the new value as the first argument; the current value of the <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> attribute as the second argument,
  unless the current value of the <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
  is less than the new value, in which case the second argument must also be the new value; and the
  current value of the <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>
  as the third argument.</p>


  <p>The <dfn id=dom-textarea/input-selectionend title=dom-textarea/input-selectionEnd><code>selectionEnd</code></dfn> attribute
  must, on getting, return the offset (in logical order) to the character that immediately follows
  the end of the selection. If there is no selection, then it must return the offset (in logical
  order) to the character that immediately follows the text entry cursor.</p>

  <p>On setting, it must act as if the <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> method had been called,
  with the current value of the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute as the first argument,
  the new value as the second argument, and the current value of the <code title=dom-textarea/input-selectionDirection><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> as the third argument.</p>


  <p>The <dfn id=dom-textarea/input-selectiondirection title=dom-textarea/input-selectionDirection><code>selectionDirection</code></dfn>
  attribute must, on getting, return the string corresponding to the current selection direction: if
  the direction is <i>forward</i>, "<code title="">forward</code>"; if the direction is
  <i>backward</i>, "<code title="">backward</code>"; and otherwise, "<code title="">none</code>".</p>

  <p>On setting, it must act as if the <code title=dom-textarea/input-setSelectionRange><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> method had been called,
  with the current value of the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute as the first argument,
  the current value of the <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
  attribute as the second argument, and the new value as the third argument.</p>


  <p>The <dfn id=dom-textarea/input-setselectionrange title=dom-textarea/input-setSelectionRange><code>setSelectionRange(<var title="">start</var>, <var title="">end</var>, <var title="">direction</var>)</code></dfn> method
  must set the selection of the text field to the sequence of characters starting with the character
  at the <var title="">start</var>th position (in logical order) and ending with the character at
  the <span title="">(<var title="">end</var>-1)</span>th position. Arguments greater than the
  length of the value of the text field must be treated as pointing at the end of the text field. If
  <var title="">end</var> is less than or equal to <var title="">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 title="">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 title="">end</var>. The direction
  of the selection must be set to <i>backward</i> if <var title="">direction</var> is a
  <a href=#case-sensitive>case-sensitive</a> match for the string "<code title="">backward</code>", <i>forward</i>
  if <var title="">direction</var> is a <a href=#case-sensitive>case-sensitive</a> match for the string "<code title="">forward</code>" or if the platform does not support selections with the direction
  <i>none</i>, and <i>none</i> otherwise (including if the argument is omitted). The user agent must
  then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-select>select</code> at the element, using the <a href=#user-interaction-task-source>user interaction task
  source</a> as the task source.</p>


  <p>The <dfn id=dom-textarea/input-setrangetext title=dom-textarea/input-setRangeText><code>setRangeText(<var title="">replacement</var>, <var title="">start</var>, <var title="">end</var>, <var title="">selectMode</var>)</code></dfn> method must run the following steps:</p>

  <ol><li>

    <p>If the method has only one argument, then let <var title="">start</var> and <var title="">end</var> have the values of the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute and the <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> attribute respectively.</p>

    <p>Otherwise, let <var title="">start</var>, <var title="">end</var> have the values of the
    second and third arguments respectively.</p>

   </li>

   <li><p>If <var title="">start</var> is greater than <var title="">end</var>, then throw an
   <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

   <li><p>If <var title="">start</var> is greater than the length of the value of the text field,
   then set it to the length of the value of the text field.</li>

   <li><p>If <var title="">end</var> is greater than the length of the value of the text field,
   then set it to the length of the value of the text field.</li>

   <li><p>Let <var title="">selection start</var> be the current value of the <code title=dom-textarea/input-selectionStart><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute.</li>

   <li><p>Let <var title="">selection end</var> be the current value of the <code title=dom-textarea/input-selectionEnd><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> attribute.</li>

   <li><p>If <var title="">start</var> is less than <var title="">end</var>, delete the sequence of
   characters starting with the character at the <var title="">start</var>th position (in logical
   order) and ending with the character at the <span title="">(<var title="">end</var>-1)</span>th
   position.</li>

   <li><p>Insert the value of the first argument into the text of the value of the text field,
   immediately before the <var title="">start</var>th character.</li>

   <li><p>Let <var title="">new length</var> be the length of the value of the first argument.</li>

   <li><p>Let <var title="">new end</var> be the sum of <var title="">start</var> and <var title="">new length</var>.</li>

   <li>

    <p>Run the appropriate set of substeps from the following list:</p>

    <dl class=switch><dt>If the fourth argument's value is "<dfn id=dom-selectionmode-select title=dom-SelectionMode-select><code>select</code></dfn>"</dt>

     <dd>

      <p>Let <var title="">selection start</var> be <var title="">start</var>.</p>

      <p>Let <var title="">selection end</var> be <var title="">new end</var>.</p>

     </dd>

     <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-start title=dom-SelectionMode-start><code>start</code></dfn>"</dt>

     <dd>

      <p>Let <var title="">selection start</var> and <var title="">selection end</var> be <var title="">start</var>.</p>

     </dd>

     <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-end title=dom-SelectionMode-end><code>end</code></dfn>"</dt>

     <dd>

      <p>Let <var title="">selection start</var> and <var title="">selection end</var> be <var title="">new end</var>.</p>

     </dd>

     <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-preserve title=dom-SelectionMode-preserve><code>preserve</code></dfn>", or if the argument was omitted</dt>

     <dd>

      <ol><li><p>Let <var title="">old length</var> be <var title="">end</var> minus <var title="">start</var>.</p>

       <li><p>Let <var title="">delta</var> be <var title="">new length</var> minus <var title="">old length</var>.</p>

       <li>

        <p>If <var title="">selection start</var> is greater than <var title="">end</var>, then
        increment it by <var title="">delta</var>. (If <var title="">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 title="">selection start</var>.)</p>

        <p>Otherwise: if <var title="">selection start</var> is greater than <var title="">start</var>, then set it to <var title="">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>

       <li>

        <p>If <var title="">selection end</var> is greater than <var title="">end</var>, then
        increment it by <var title="">delta</var> in the same way.</p>

        <p>Otherwise: if <var title="">selection end</var> is greater than <var title="">start</var>, then set it to <var title="">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>

       </li>

      </ol></dd>

    </dl></li>

   <li>

    <p>Set the selection of the text field to the sequence of characters starting with the character
    at the <var title="">selection start</var>th position (in logical order) and ending with the
    character at the <span title="">(<var title="">selection end</var>-1)</span>th position. In UAs
    where there is no concept of an empty selection, this must set the cursor to be just before the
    character with offset <var title="">end</var>. The direction of the selection must be set to
    <i>forward</i> if the platform does not support selections with the direction <i>none</i>, and
    <i>none</i> otherwise.</p>

   </li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-select>select</code> at the element, using the <a href=#user-interaction-task-source>user interaction task
   source</a> as the task source.</li>

  </ol><p>All elements to which this API <a href=#concept-input-apply title=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>being rendered</a>). User agents should
  follow platform conventions to determine their initial state.</p>

  </div>


  <p>Characters with no visible rendering, such as U+200D ZERO WIDTH JOINER, still count as
  characters. Thus, for instance, the selection can include just an invisible character, and the
  text insertion cursor can be placed to one side or another of such a character.</p>

  <div class=example>

   <p>To obtain the currently selected text, the following JavaScript suffices:</p>

   <pre>var selectionText = control.value.substring(control.selectionStart, control.selectionEnd);</pre>

   <p>...where <var title="">control</var> is the <code><a href=#the-input-element>input</a></code> or <code><a href=#the-textarea-element>textarea</a></code>
   element.</p>

  </div>

  <div class=example>

   <p>To add some text at the start of a text control, while maintaining the text selection, the
   three attributes must be preserved:</p>

   <pre>var oldStart = control.selectionStart;
var oldEnd = control.selectionEnd;
var oldDirection = control.selectionDirection;
var prefix = "http://";
control.value = prefix + control.value;
control.setSelectionRange(oldStart + prefix.length, oldEnd + prefix.length, oldDirection);</pre>

   <p>...where <var title="">control</var> is the <code><a href=#the-input-element>input</a></code> or <code><a href=#the-textarea-element>textarea</a></code>
   element.</p>

  </div>
<!--TOPIC:HTML-->



  <h4 id=constraints><span class=secno>4.10.21 </span>Constraints</h4>

  <h5 id=definitions><span class=secno>4.10.21.1 </span>Definitions</h5>

  <div class=impl>

  <p>A <a href=#category-submit title=category-submit>submittable element</a> is a <dfn id=candidate-for-constraint-validation>candidate for constraint
  validation</dfn> except when a condition has <dfn id=barred-from-constraint-validation title="barred from constraint validation">barred
  the element from constraint validation</dfn>. (For example, an element is <a href=#barred-from-constraint-validation>barred from
  constraint validation</a> if it is an <code><a href=#the-object-element>object</a></code> element.)</p>

  <p>An element can have a <dfn id=custom-validity-error-message>custom validity error message</dfn> defined. Initially, an element
  must have its <a href=#custom-validity-error-message>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>suffering from a custom error</a>. It can be set
  using the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method. The user
  agent should use the <a href=#custom-validity-error-message>custom validity error message</a> when alerting the user to the
  problem with the control.</p>

  <p>An element can be constrained in various ways. The following is the list of <dfn id=validity-states>validity
  states</dfn> that a form control can be in, making the control invalid for the purposes of
  constraint validation. (The definitions below are non-normative; other parts of this specification
  define more precisely when each state applies or does not.)</p>

  <dl><dt> <dfn id=suffering-from-being-missing>Suffering from being missing</dfn> </dt>

   <dd> <p>When a control has no <a href=#concept-fe-value title=concept-fe-value>value</a> but has a <code title="">required</code> attribute (<code><a href=#the-input-element>input</a></code> <code title=attr-input-required><a href=#attr-input-required>required</a></code>, <code><a href=#the-select-element>select</a></code> <code title=attr-select-required><a href=#attr-select-required>required</a></code>, <code><a href=#the-textarea-element>textarea</a></code> <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>), or, in the case of an element in a <i><a href=#radio-button-group>radio
   button group</a></i>, any of the other elements in the group has a <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute. </dd>

   <dt> <dfn id=suffering-from-a-type-mismatch>Suffering from a type mismatch</dfn> </dt>

   <dd> <p>When a control that allows arbitrary user input has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is not in the correct syntax (<a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a>, <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>).
   </dd>

   <dt> <dfn id=suffering-from-a-pattern-mismatch>Suffering from a pattern mismatch</dfn> </dt>

   <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that doesn't satisfy the
   <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute.</dd>

   <dt> <dfn id=suffering-from-being-too-long>Suffering from being too long</dfn> </dt>

   <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is too long for the
   <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a>
   (<code><a href=#the-input-element>input</a></code> <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>, <code><a href=#the-textarea-element>textarea</a></code>
   <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>). </dd>

   <dt> <dfn id=suffering-from-an-underflow>Suffering from an underflow</dfn> </dt>

   <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is too low for the
   <code title=attr-input-min><a href=#attr-input-min>min</a></code> attribute.</dd>

   <dt> <dfn id=suffering-from-an-overflow>Suffering from an overflow</dfn> </dt>

   <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that is too high for the
   <code title=attr-input-max><a href=#attr-input-max>max</a></code> attribute.</dd>

   <dt> <dfn id=suffering-from-a-step-mismatch>Suffering from a step mismatch</dfn> </dt>

   <dd> <p>When a control has a <a href=#concept-fe-value title=concept-fe-value>value</a> that doesn't fit the
   rules given by the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute.</dd>

   <dt> <dfn id=suffering-from-bad-input>Suffering from bad input</dfn> </dt>

   <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.</dd>

   <dt> <dfn id=suffering-from-a-custom-error>Suffering from a custom error</dfn> </dt>

   <dd> <p>When a control's <a href=#custom-validity-error-message>custom validity error message</a> (as set by the element's
   <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method) is not the empty
   string.</p> </dd>

  </dl><p class=note>An element can still suffer from these states even when the element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>; thus these states can be represented in the DOM even
  if validating the form during submission wouldn't indicate a problem to the user.</p>

  <p>An element <dfn id=concept-fv-valid title=concept-fv-valid>satisfies its constraints</dfn> if it is not suffering
  from any of the above <a href=#validity-states>validity states</a>.</p>

  </div>



  <div class=impl>

  <h5 id=constraint-validation><span class=secno>4.10.21.2 </span>Constraint validation</h5>

  <p>When the user agent is required to <dfn id=statically-validate-the-constraints>statically validate the constraints</dfn> of
  <code><a href=#the-form-element>form</a></code> element <var title="">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 title="">controls</var> be a list of all the <a href=#category-submit title=category-submit>submittable elements</a> whose <a href=#form-owner>form owner</a> is <var title="">form</var>, in <a href=#tree-order>tree order</a>.</li>

   <li><p>Let <var title="">invalid controls</var> be an initially empty list of elements.</li>

   <li>

    <p>For each element <var title="">field</var> in <var title="">controls</var>, in <a href=#tree-order>tree
    order</a>, run the following substeps:</p>

    <ol><li><p>If <var title="">field</var> is not a <a href=#candidate-for-constraint-validation>candidate for constraint validation</a>,
     then move on to the next element.</li>

     <li><p>Otherwise, if <var title="">field</var> <a href=#concept-fv-valid title=concept-fv-valid>satisfies its
     constraints</a>, then move on to the next element.</li>

     <li><p>Otherwise, add <var title="">field</var> to <var title="">invalid
     controls</var>.</li>

    </ol></li>

   <li><p>If <var title="">invalid controls</var> is empty, then return a <i>positive</i> result and
   abort these steps.</li>

   <li><p>Let <var title="">unhandled invalid controls</var> be an initially empty list of
   elements.</li>

   <li>

    <p>For each element <var title="">field</var> in <var title="">invalid controls</var>, if any,
    in <a href=#tree-order>tree order</a>, run the following substeps:</p>

    <ol><li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-invalid>invalid</code> that
     is cancelable at <var title="">field</var>.</li>

     <li><p>If the event was not canceled, then add <var title="">field</var> to <var title="">unhandled invalid controls</var>.</li>

    </ol></li>

   <li><p>Return a <i>negative</i> result with the list of elements in the <var title="">unhandled
   invalid controls</var> list.</li>

  </ol><p>If a user agent is to <dfn id=interactively-validate-the-constraints>interactively validate the constraints</dfn> of <code><a href=#the-form-element>form</a></code>
  element <var title="">form</var>, then the user agent must run the following steps:</p>

  <ol><li><p><a href=#statically-validate-the-constraints>Statically validate the constraints</a> of <var title="">form</var>, and let <var title="">unhandled invalid controls</var> be the list of elements returned if the result was
   <i>negative</i>.</li>

   <li><p>If the result was <i>positive</i>, then return that result and abort these steps.</li>

   <li><p>Report the problems with the constraints of at least one of the elements given in <var title="">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>focusing steps</a> for that element, and may
   change the scrolling position of the document, or perform some other action that brings the
   element to the user's attention. User agents may report more than one constraint violation. User
   agents may coalesce related constraint violation reports if appropriate (e.g. if multiple radio
   buttons in a <a href=#radio-button-group title="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>being rendered</a> (e.g. it has the
   <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute set) then user agents may report a script
   error.</li>

   <li><p>Return a <i>negative</i> result.</li>

  </ol></div>



<!--TOPIC:DOM APIs-->
  <h5 id=the-constraint-validation-api><span class=secno>4.10.21.3 </span>The <dfn>constraint validation API</dfn></h5>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-cva-willValidate><a href=#dom-cva-willvalidate>willValidate</a></code></dt>

   <dd>

    <p>Returns true if the element will be validated when the form is submitted; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity</a></code>(<var title="">message</var>)</dt>

   <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>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-valueMissing><a href=#dom-validitystate-valuemissing>valueMissing</a></code></dt>

   <dd>

    <p>Returns true if the element has no value but is a required field; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-typeMismatch><a href=#dom-validitystate-typemismatch>typeMismatch</a></code></dt>

   <dd>

    <p>Returns true if the element's value is not in the correct syntax; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-patternMismatch><a href=#dom-validitystate-patternmismatch>patternMismatch</a></code></dt>

   <dd>

    <p>Returns true if the element's value doesn't match the provided pattern; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-tooLong><a href=#dom-validitystate-toolong>tooLong</a></code></dt>

   <dd>

    <p>Returns true if the element's value is longer than the provided maximum length; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-rangeUnderflow><a href=#dom-validitystate-rangeunderflow>rangeUnderflow</a></code></dt>

   <dd>

    <p>Returns true if the element's value is lower than the provided minimum; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-rangeOverflow><a href=#dom-validitystate-rangeoverflow>rangeOverflow</a></code></dt>

   <dd>

    <p>Returns true if the element's value is higher than the provided maximum; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-stepMismatch><a href=#dom-validitystate-stepmismatch>stepMismatch</a></code></dt>

   <dd>

    <p>Returns true if the element's value doesn't fit the rules given by the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-badInput><a href=#dom-validitystate-badinput>badInput</a></code></dt>

   <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>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-customError><a href=#dom-validitystate-customerror>customError</a></code></dt>

   <dd>

    <p>Returns true if the element has a custom error; false otherwise.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code title=dom-validitystate-valid><a href=#dom-validitystate-valid>valid</a></code></dt>

   <dd>

    <p>Returns true if the element's value has no validity problems; false otherwise.</p>

   </dd>

   <dt><var title="">valid</var> = <var title="">element</var> . <code title=dom-cva-checkValidity><a href=#dom-cva-checkvalidity>checkValidity</a></code>()</dt>

   <dd>

    <p>Returns true if the element's value has no validity problems;
    false otherwise. Fires an <code title=event-invalid>invalid</code> event at the element in the
    latter case.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-cva-validationMessage><a href=#dom-cva-validationmessage>validationMessage</a></code></dt>

   <dd>

    <p>Returns the error message that would be shown to the user if
    the element was to be checked for validity.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-cva-willvalidate title=dom-cva-willValidate><code>willValidate</code></dfn>
  attribute must return true if an element is a <a href=#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 title="barred from constraint
  validation">barring it from constraint validation</a>).</p>

  <p>The <dfn id=dom-cva-setcustomvalidity title=dom-cva-setCustomValidity><code>setCustomValidity(<var title="">message</var>)</code></dfn>, when invoked, must set the
  <a href=#custom-validity-error-message>custom validity error message</a> to the value of the given
  <var title="">message</var> argument.</p>

  </div>

  <div class=example>

   <p>In the following example, a script checks the value of a form
   control each time it is edited, and whenever it is not a valid
   value, uses the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method
   to set an appropriate message.</p>

   <pre>&lt;label&gt;Feeling: &lt;input name=f type="text" oninput="check(this)"&gt;&lt;/label&gt;
&lt;script&gt;
 function check(input) {
   if (input.value == "good" ||
       input.value == "fine" ||
       input.value == "tired") {
     input.setCustomValidity('"' + input.value + '" is not a feeling.');
<!--   } else if (input.value == "...") {
     input.setCustomValidity('...');
-->   } else {
     // input is fine -- reset the error message
     input.setCustomValidity('');
   }
 }
&lt;/script&gt;</pre>

  </div>

  <div class=impl>

  <p>The <dfn id=dom-cva-validity title=dom-cva-validity><code>validity</code></dfn>
  attribute must return a <code><a href=#validitystate>ValidityState</a></code> object that
  represents the <a href=#validity-states>validity states</a> of the element. This
  object is <a href=#live>live</a>, and the same object must be returned
  each time the element's <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> attribute is retrieved.</p>

<pre class=idl>interface <dfn id=validitystate>ValidityState</dfn> {
  readonly attribute boolean <a href=#dom-validitystate-valuemissing title=dom-ValidityState-valueMissing>valueMissing</a>;
  readonly attribute boolean <a href=#dom-validitystate-typemismatch title=dom-ValidityState-typeMismatch>typeMismatch</a>;
  readonly attribute boolean <a href=#dom-validitystate-patternmismatch title=dom-ValidityState-patternMismatch>patternMismatch</a>;
  readonly attribute boolean <a href=#dom-validitystate-toolong title=dom-ValidityState-tooLong>tooLong</a>;
  readonly attribute boolean <a href=#dom-validitystate-rangeunderflow title=dom-ValidityState-rangeUnderflow>rangeUnderflow</a>;
  readonly attribute boolean <a href=#dom-validitystate-rangeoverflow title=dom-ValidityState-rangeOverflow>rangeOverflow</a>;
  readonly attribute boolean <a href=#dom-validitystate-stepmismatch title=dom-ValidityState-stepMismatch>stepMismatch</a>;
  readonly attribute boolean <a href=#dom-validitystate-badinput title=dom-ValidityState-badInput>badInput</a>;
  readonly attribute boolean <a href=#dom-validitystate-customerror title=dom-ValidityState-customError>customError</a>;
  readonly attribute boolean <a href=#dom-validitystate-valid title=dom-ValidityState-valid>valid</a>;
};</pre>

  <p>A <code><a href=#validitystate>ValidityState</a></code> object has the following
  attributes. On getting, they must return true if the corresponding
  condition given in the following list is true, and false
  otherwise.</p>

  <dl><dt><dfn id=dom-validitystate-valuemissing title=dom-ValidityState-valueMissing><code>valueMissing</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-typemismatch title=dom-ValidityState-typeMismatch><code>typeMismatch</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-patternmismatch title=dom-ValidityState-patternMismatch><code>patternMismatch</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-toolong title=dom-ValidityState-tooLong><code>tooLong</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-being-too-long>suffering from being too long</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-rangeunderflow title=dom-ValidityState-rangeUnderflow><code>rangeUnderflow</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-an-underflow>suffering from an underflow</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-rangeoverflow title=dom-ValidityState-rangeOverflow><code>rangeOverflow</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-stepmismatch title=dom-ValidityState-stepMismatch><code>stepMismatch</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-badinput title=dom-ValidityState-badInput><code>badInput</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-bad-input>suffering from bad input</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-customerror title=dom-ValidityState-customError><code>customError</code></dfn></dt>
   <dd> <p>The control is <a href=#suffering-from-a-custom-error>suffering from a custom error</a>.</p> </dd>

   <dt><dfn id=dom-validitystate-valid title=dom-ValidityState-valid><code>valid</code></dfn></dt>
   <dd> <p>None of the other conditions are true.</p> </dd>

  </dl><p>When the <dfn id=dom-cva-checkvalidity title=dom-cva-checkValidity><code>checkValidity()</code></dfn>
  method is invoked, if the element is a <a href=#candidate-for-constraint-validation>candidate for
  constraint validation</a> and does not <a href=#concept-fv-valid title=concept-fv-valid>satisfy its constraints</a>, the user
  agent must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-invalid>invalid</code> that is cancelable (but in this
  case has no default action) at the element and return
  false. Otherwise, it must only return true without doing anything
  else.</p>

  <p>The <dfn id=dom-cva-validationmessage title=dom-cva-validationMessage><code>validationMessage</code></dfn>
  attribute must return the empty string if the element is not a
  <a href=#candidate-for-constraint-validation>candidate for constraint validation</a> or if it is one but
  it <a href=#concept-fv-valid title=concept-fv-valid>satisfies its constraints</a>;
  otherwise, it must 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 the attribute must 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>candidate for constraint validation</a> and is
  <a href=#suffering-from-a-custom-error>suffering from a custom error</a>, then the <a href=#custom-validity-error-message>custom
  validity error message</a> should be present in the return
  value.</p>

  </div>
<!--TOPIC:HTML-->


<!--ADD-TOPIC:Security-->
  <h5 id=security-forms><span class=secno>4.10.21.4 </span>Security</h5>

  <p id=security-0>Servers should not rely on client-side
  validation. Client-side validation can be intentionally bypassed by
  hostile users, and unintentionally bypassed by users of older user
  agents or automated tools that do not implement these features. The
  constraint validation features are only intended to improve the user
  experience, not to provide any kind of security mechanism.</p>
<!--REMOVE-TOPIC:Security-->




  <h4 id=form-submission><span class=secno>4.10.22 </span><dfn>Form submission</dfn></h4>

  <div class=impl>

  <h5 id=introduction-2><span class=secno>4.10.22.1 </span>Introduction</h5>

  </div>

  <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 title=concept-fs-enctype>enctype</a>, and then sent to the
  destination specified by the <a href=#concept-fs-action title=concept-fs-action>action</a> using the given <a href=#concept-fs-method title=concept-fs-method>method</a>.</p>

  <p>For example, take the following form:</p>

  <pre>&lt;form action="/find.cgi" method=get&gt;
 &lt;input type=text name=t&gt;
 &lt;input type=search name=q&gt;
 &lt;input type=submit&gt;
&lt;/form&gt;</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 title="">/find.cgi?t=cats&amp;q=fur</code>.</p>

  <p>On the other hand, consider this form:</p>

  <pre>&lt;form action="/find.cgi" method=post enctype="multipart/form-data"&gt;
 &lt;input type=text name=t&gt;
 &lt;input type=search name=q&gt;
 &lt;input type=submit&gt;
&lt;/form&gt;</pre>

  <p>Given the same user input, the result on submission is quite
  different: the user agent instead does an HTTP POST to the given
  URL, with as the entity body something like the following text:</p>

  <pre>------kYFrd4jNJEgCervE
Content-Disposition: form-data; name="t"

cats
------kYFrd4jNJEgCervE
Content-Disposition: form-data; name="q"

fur
------kYFrd4jNJEgCervE--</pre>



  <div class=impl>

  <h5 id=implicit-submission><span class=secno>4.10.22.2 </span>Implicit submission</h5>

  <p>A <code><a href=#the-form-element>form</a></code> element's <dfn id=default-button>default button</dfn> is the
  first <a href=#concept-submit-button title=concept-submit-button>submit button</a> in
  <a href=#tree-order>tree order</a> whose <a href=#form-owner>form owner</a> is that
  <code><a href=#the-form-element>form</a></code> element.</p>

  <p>If the user agent supports letting the user submit a form
  implicitly (for example, on some platforms hitting the "enter" key
  while a text field is focused implicitly submits the form), then
  doing so for a form whose <a href=#default-button>default button</a> has a defined
  <a href=#activation-behavior>activation behavior</a> must cause the user agent to
  <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> on that
  <a href=#default-button>default button</a>.</p>

  <p class=note>Consequently, if the <a href=#default-button>default button</a> is
  <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, the form is not
  submitted when such an implicit submission mechanism is used. (A
  button has no <a href=#activation-behavior>activation behavior</a> when disabled.)</p>

  <p class=note>There are pages on the Web that are only usable if
  there is a way to implicitly submit forms, so user agents are
  strongly encouraged to support this.</p>

  <p><!-- For Web compatibility reasons caused by obscure historical
  accidents, -->If the form has no <a href=#concept-submit-button title=concept-submit-button>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 title=concept-form-submit>submit</a> the
  <code><a href=#the-form-element>form</a></code> element from the <code><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><a href=#the-form-element>form</a></code>
  element if it is an <code><a href=#the-input-element>input</a></code> element whose <a href=#form-owner>form
  owner</a> is that <code><a href=#the-form-element>form</a></code> element and whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the
  following states:
  <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>,
  <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>,
  <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>,
  <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a>,
  <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a>,
  <a href="#password-state-(type=password)" title=attr-input-type-password>Password</a>,
  <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a>,
  <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a>,
  <a href="#month-state-(type=month)" title=attr-input-type-month>Month</a>,
  <a href="#week-state-(type=week)" title=attr-input-type-week>Week</a>,
  <a href="#time-state-(type=time)" title=attr-input-type-time>Time</a>,
  <a href="#local-date-and-time-state-(type=datetime-local)" title=attr-input-type-datetime-local>Local Date and Time</a>,
  <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a>
  </p>

  </div>


  <div class=impl>

  <h5 id=form-submission-algorithm><span class=secno>4.10.22.3 </span>Form submission algorithm</h5>

  <p>When a <code><a href=#the-form-element>form</a></code> element <var title="">form</var> is <dfn id=concept-form-submit title=concept-form-submit>submitted</dfn> from an element <var title="">submitter</var>
  (typically a button), optionally with a <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code> method</var> flag set, the user agent must run the
  following steps:</p>

  <ol><li><p>Let <var title="">form document</var> be the <var title="">form</var>'s
   <code><a href=#document>Document</a></code>.</li>

   <li id=sandboxSubmitBlocked><p>If <var title="">form document</var> has no associated
   <a href=#browsing-context>browsing context</a> or its <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its
   <a href=#sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a> set, then abort these steps without doing
   anything.</li>

   <li><p>Let <var title="">form browsing context</var> be the <a href=#browsing-context>browsing context</a> of <var title="">form document</var>.</li>

   <!-- lock (all the following steps are skipped if called from submit() - see unlock step below) -->

   <li><p>If the <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code>
   method</var> flag is not set, and the <var title="">submitter</var> element's <a href=#concept-fs-novalidate title=concept-fs-novalidate>no-validate state</a> is false, then <a href=#interactively-validate-the-constraints>interactively
   validate the constraints</a> of <var title="">form</var> and examine the result: if the result
   is negative (the constraint validation concluded that there were invalid fields and probably
   informed the user of this) then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-invalid>invalid</code> at the <var title="">form</var> element and then abort these
   steps.</li>

   <li><p>If the <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code>
   method</var> flag is not set, then <a href=#fire-a-simple-event>fire a simple event</a> that bubbles and is
   cancelable named <code title=event-submit>submit</code>, at <var title="">form</var>. If the
   event's default action is prevented (i.e. if the event is canceled) then abort these steps.
   Otherwise, continue (effectively the default action is to perform the submission).</li>

   <!-- if you add any steps between the "lock" and "unlock" lines, make sure to update the step
   immediately before the "lock" line -->

   <!-- unlock -->

   <li><p>Let <var title="">form data set</var> be the result of <a href=#constructing-the-form-data-set>constructing the form data
   set</a> for <var title="">form</var> in the context of <var title="">submitter</var>.</li>

   <li><p>Let <var title="">action</var> be the <var title="">submitter</var> element's <a href=#concept-fs-action title=concept-fs-action>action</a>.</li>

   <li>

    <p>If <var title="">action</var> is the empty string, let <var title="">action</var> be
    <a href="#the-document's-address">the document's address</a> of the <var title="">form document</var>.</p>

    <!-- Don't ask me why. But that's what IE does. It even treats action="" differently from
    action=" " or action="#" (the latter two resolve to the base URL, the first one resolves to the
    doc URL). And other browsers concur. It is even required, see e.g.
      http://bugs.webkit.org/show_bug.cgi?id=7763
      https://bugzilla.mozilla.org/show_bug.cgi?id=297761
    -->

   </li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> <var title="">action</var>, relative to the <var title="">submitter</var> element. If this fails,
   abort these steps.</li>

   <li><p>Let <var title="">action</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>

   <li><p>Let <var title="">action components</var> be the resulting <a href=#parsed-url>parsed
   URL</a>.</li>

   <li><p>Let <var title="">scheme</var> be the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> of
   the resulting <a href=#parsed-url>parsed URL</a>.</li>

   <li><p>Let <var title="">enctype</var> be the <var title="">submitter</var> element's <a href=#concept-fs-enctype title=concept-fs-enctype>enctype</a>.</li>

   <li><p>Let <var title="">method</var> be the <var title="">submitter</var> element's <a href=#concept-fs-method title=concept-fs-method>method</a>.</li>

   <li><p>Let <var title="">target</var> be the <var title="">submitter</var> element's <a href=#concept-fs-target title=concept-fs-target>target</a>.</li>

   <li><p>If the user indicated a specific <a href=#browsing-context>browsing context</a> to use when submitting the
   form, then let <var title="">target browsing context</var> be that <a href=#browsing-context>browsing context</a>.
   Otherwise, apply <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a browsing context
   name</a> using <var title="">target</var> as the name and <var title="">form browsing
   context</var> as the context in which the algorithm is executed, and let <var title="">target
   browsing context</var> be the resulting <a href=#browsing-context>browsing context</a>.</li>

   <li><p>If <var title="">target browsing context</var> was created in the previous step, or,
   alternatively, if the <var title="">form document</var> has not yet <a href=#completely-loaded>completely
   loaded</a> and the <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code>
   method</var> is set, then let <var title="">replace</var> be true. Otherwise, let it be
   false.</li>

   <li>

    <p>If the value of <var title="">method</var> is <a href=#attr-fs-method-dialog title=attr-fs-method-dialog>dialog</a> then jump to the <a href=#submit-dialog title=submit-dialog>submit
    dialog</a> steps.</p>

    <p>Otherwise, select the appropriate row in the table below based on the value of <var title="">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 title="">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 title=attr-fs-method-GET>GET</a>
      <th> <a href=#attr-fs-method-post title=attr-fs-method-POST>POST</a>
     <tbody><tr><th> <code title="">http</code>
      <td> <a href=#submit-mutate-action title=submit-mutate-action>Mutate action URL</a>
      <td> <a href=#submit-body title=submit-body>Submit as entity body</a>
     <tr><th> <code title="">https</code>
      <td> <a href=#submit-mutate-action title=submit-mutate-action>Mutate action URL</a>
      <td> <a href=#submit-body title=submit-body>Submit as entity body</a>
     <tr><th> <code title="">ftp</code>
      <td> <a href=#submit-get-action title=submit-get-action>Get action URL</a>
      <td> <a href=#submit-get-action title=submit-get-action>Get action URL</a>
     <tr><th> <code title="">javascript</code>
      <td> <a href=#submit-get-action title=submit-get-action>Get action URL</a>
      <td> <a href=#submit-get-action title=submit-get-action>Get action URL</a>
     <tr><th> <code title="">data</code>
      <td> <a href=#submit-get-action title=submit-get-action>Get action URL</a>
      <td> <a href=#submit-data-post title=submit-data-post>Post to data:</a>
     <tr><th> <code title="">mailto</code>
      <td> <a href=#submit-mailto-headers title=submit-mailto-headers>Mail with headers</a>
      <td> <a href=#submit-mailto-body title=submit-mailto-body>Mail as body</a>
    </table><p>If <var title="">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><a href=#the-form-element>form</a></code> element has a <dfn id=planned-navigation>planned navigation</dfn>, which is either null or a
    <a href=#concept-task title=concept-task>task</a>; when the <code><a href=#the-form-element>form</a></code> is first created, its
    <a href=#planned-navigation>planned navigation</a> must be set to null. In the behaviours described below, when the
    user agent is required to <dfn id=plan-to-navigate>plan to navigate</dfn> to a particular resource <var title="">destination</var>, it must run the following steps:</p>

    <ol><li><p>If the <code><a href=#the-form-element>form</a></code> has a non-null <a href=#planned-navigation>planned navigation</a>, remove it from
     its <a href=#task-queue>task queue</a>.</li>

     <li>

      <p>Let the <code><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation>planned navigation</a> be a new <a href=#concept-task title=concept-task>task</a> that consists of running the following steps:</p>

      <ol><li><p>Let the <code><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation>planned navigation</a> be null.</li>

       <li><p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to
       the particular resource <var title="">destination</var>. If <var title="">replace</var> is
       true, then <var title="">target browsing context</var> must be navigated with
       <a href=#replacement-enabled>replacement enabled</a>.</p>

      </ol><p>For the purposes of this task, <var title="">target browsing context</var> and <var title="">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>planned navigation</a>
      was <a href=#queue-a-task title="queue a task">queued</a>.</p>

     </li>

     <li>

      <p><a href=#queue-a-task title="queue a task">Queue the task</a> that is the <code><a href=#the-form-element>form</a></code>'s new
      <a href=#planned-navigation>planned navigation</a>.</p>

      <p>The <a href=#task-source>task source</a> for this task is the <a href=#dom-manipulation-task-source>DOM manipulation task
      source</a>.</p>

     </li>

    </ol><p>The behaviors are as follows:</p>

    <dl><dt><dfn id=submit-mutate-action title=submit-mutate-action>Mutate action URL</dfn>
     <dd>

      <p>Let <var title="">query</var> be the result of encoding the <var title="">form data
      set</var> using the <a href=#application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
      algorithm</a>, interpreted as a US-ASCII string.</p>

      <!-- by this point we've already tried to resolve the URL, so we know we can parse it -->

      <p>Set <var title="">parsed action</var>'s <a href=#concept-url-query title=concept-url-query>query</a>
      component to <var title="">query</var>.</p>

      <p>Let <var title="">destination</var> be a new <a href=#url>URL</a> formed by applying the
      <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a> algorithm to <var title="">parsed action</var>.</p>

      <p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

     </dd>

     <dt><dfn id=submit-body title=submit-body>Submit as entity body</dfn>
     <dd>

      <p>Let <var title="">entity body</var> be the result of encoding the <var title="">form data
      set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate form encoding algorithm</a>.</p>

      <p>Let <var title="">MIME type</var> be determined as follows:</p>

      <dl><dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code></dt>

       <dd>Let <var title="">MIME type</var> be "<code title="">application/x-www-form-urlencoded</code>".</dd>

       <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code></dt>

       <dd>Let <var title="">MIME type</var> be the concatenation of the string "<code title="">multipart/form-data;</code>", a U+0020 SPACE character, the string "<code title="">boundary=</code>", and the <a href=#multipart/form-data-boundary-string><code title="">multipart/form-data</code> boundary
       string</a> generated by the <a href=#multipart/form-data-encoding-algorithm><code title="">multipart/form-data</code> encoding
       algorithm</a>.</dd>

       <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code></dt>

       <dd>Let <var title="">MIME type</var> be "<code title="">text/plain</code>".</dd>

      </dl><!--<p>If <var title="">method</var> is anything but (GET or) POST, and the
      <span>origin</span> of <var title="">action</var> is not the <span>same origin</span> as that
      of <var title="">form document</var>, then abort these steps.</p> [or do CORS] (this is
      commented out since only POST can trigger this now, and that's historically unrestricted)--><p>Otherwise, <a href=#plan-to-navigate>plan to navigate</a> to <var title="">action</var> using the HTTP
      method given by <var title="">method</var> and with <var title="">entity body</var> as the
      entity body, of type <var title="">MIME type</var>.</p>

     </dd>

     <dt><dfn id=submit-get-action title=submit-get-action>Get action URL</dfn>
     <dd>

      <p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">action</var>.</p>

      <p class=note>The <var title="">form data set</var> is discarded.</p>

     </dd>

     <dt><dfn id=submit-data-post title=submit-data-post>Post to data:</dfn>
     <dd>

      <p>Let <var title="">data</var> be the result of encoding the <var title="">form data
      set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate form encoding algorithm</a>.</p>

      <p>If <var title="">action</var> contains the string "<code title="">%%%%</code>" (four U+0025
      PERCENT SIGN characters), then <a href=#percent-encode>percent encode</a> all bytes in <var title="">data</var> that, if interpreted as US-ASCII, are not characters in the URL
      <a href=#default-encode-set>default encode set</a>, and then, treating the result as a US-ASCII string,
      <a href=#utf-8-percent-encode>UTF-8 percent encode</a> all the U+0025 PERCENT SIGN characters in the resulting
      string and replace the first occurrence of "<code title="">%%%%</code>" in <var title="">action</var> with the resulting doubly-escaped string. <a href=#refsURL>[URL]</a></p>

      <p>Otherwise, if <var title="">action</var> contains the string "<code title="">%%</code>"
      (two U+0025 PERCENT SIGN characters in a row, but not four), then <a href=#utf-8-percent-encode>UTF-8 percent
      encode</a> all characters in <var title="">data</var> that, if interpreted as US-ASCII, are
      not characters in the URL <a href=#default-encode-set>default encode set</a>, and then, treating the result as a
      US-ASCII string, replace the first occurrence of "<code title="">%%</code>" in <var title="">action</var> with the resulting escaped string. <a href=#refsURL>[URL]</a></p>

      <p><a href=#plan-to-navigate>Plan to navigate</a> to the potentially modified <var title="">action</var> (which
      will be a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>).</p>

     </dd>

     <dt><dfn id=submit-mailto-headers title=submit-mailto-headers>Mail with headers</dfn>
     <dd>

      <p>Let <var title="">headers</var> be the resulting encoding the <var title="">form data
      set</var> using the <a href=#application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
      algorithm</a>, interpreted as a US-ASCII string.</p>

      <p>Replace occurrences of U+002B PLUS SIGN characters (+) in <var title="">headers</var> with
      the string "<code title="">%20</code>".</p>

      <p>Let <var title="">destination</var> consist of all the characters from the first character
      in <var title="">action</var> to the character immediately before the first U+003F QUESTION
      MARK character (?), if any, or the end of the string if there are none.</p>

      <p>Append a single U+003F QUESTION MARK character (?) to <var title="">destination</var>.</p>

      <p>Append <var title="">headers</var> to <var title="">destination</var>.</p>

      <p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

     </dd>

     <dt><dfn id=submit-mailto-body title=submit-mailto-body>Mail as body</dfn>
     <dd>

      <p>Let <var title="">body</var> be the resulting of encoding the <var title="">form data
      set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate form encoding algorithm</a> and then <a href=#percent-encode title="percent encode">percent encoding</a> all the bytes in the resulting byte string
      that, when interpreted as US-ASCII, are not characters in the URL <a href=#default-encode-set>default encode
      set</a>. <a href=#refsURL>[URL]</a></p>

      <p>Let <var title="">destination</var> have the same value as <var title="">action</var>.</p>

      <p>If <var title="">destination</var> does not contain a U+003F QUESTION MARK character (?),
      append a single U+003F QUESTION MARK character (?) to <var title="">destination</var>.
      Otherwise, append a single U+0026 AMPERSAND character (&amp;).</p>

      <p>Append the string "<code title="">body=</code>" to <var title="">destination</var>.</p>

      <p>Append <var title="">body</var>, interpreted as a US-ASCII string, to <var title="">destination</var>.</p>

      <p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

     </dd>


     <dt><dfn id=submit-dialog title=submit-dialog>Submit dialog</dfn>
     <dd>

      <p>Let <var title="">subject</var> be the nearest ancestor <code><a href=#the-dialog-element>dialog</a></code> element of <var title="">form</var>, if any.</p>

      <p>If there isn't one, do nothing. Otherwise, proceed as follows:</p>

      <p>If <var title="">submitter</var> is an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, then let <var title="">result</var>
      be the string formed by concatenating the <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>selected coordinate</a>'s <var title="">x</var>-component, expressed as a base-ten number using <a href=#ascii-digits>ASCII digits</a>, a
      U+002C COMMA character (,), and the <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>selected
      coordinate</a>'s <var title="">y</var>-component, expressed in the same way as the <var title="">x</var>-component.</p>

      <p>Otherwise, if <var title="">submitter</var> has a <a href=#concept-fe-value title=concept-fe-value>value</a>, then let <var title="">result</var> be that <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

      <p>Otherwise, there is no <var title="">result</var>.</p>

      <p>Then, <a href=#close-the-dialog>close the dialog</a> <var title="">subject</var>. If there is a <var title="">result</var>, let that be the return value.</p>

     </dd>

    </dl><p>The <dfn id=appropriate-form-encoding-algorithm>appropriate form encoding algorithm</dfn> is
    determined as follows:</p>

    <dl><dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code></dt>

     <dd>Use the <a href=#application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
     algorithm</a>.</dd>

     <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code></dt>

     <dd>Use the <a href=#multipart/form-data-encoding-algorithm><code title="">multipart/form-data</code> encoding algorithm</a>.</dd>

     <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code></dt>

     <dd>Use the <a href=#text/plain-encoding-algorithm><code title="">text/plain</code> encoding algorithm</a>.</dd>

    </dl></li>

  </ol><h5 id=constructing-form-data-set><span class=secno>4.10.22.4 </span>Constructing the form data set</h5>

  <p>The algorithm to <dfn id=constructing-the-form-data-set title="constructing the form data set">construct the form data set</dfn>
  for a form <var title="">form</var> optionally in the context of a submitter <var title="">submitter</var> is as follows. If not specified otherwise, <var title="">submitter</var>
  is null.</p>

  <ol><li><p>Let <var title="">controls</var> be a list of all the <a href=#category-submit title=category-submit>submittable elements</a> whose <a href=#form-owner>form owner</a> is <var title="">form</var>, in <a href=#tree-order>tree order</a>.</li>

   <li><p>Let the <var title="">form data set</var> be a list of name-value-type tuples, initially
   empty.</li>

   <li>

    <p><i>Loop</i>: For each element <var title="">field</var> in <var title="">controls</var>, in
    <a href=#tree-order>tree order</a>, run the following substeps:</p>

    <ol><li>

      <p>If any of the following conditions are met, then skip these substeps for this element:</p>

      <ul><li>The <var title="">field</var> element has a <code><a href=#the-datalist-element>datalist</a></code> element ancestor.</li>

       <li>The <var title="">field</var> element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</li>

       <li>The <var title="">field</var> element is a <a href=#concept-button title=concept-button>button</a> but
       it is not <var title="">submitter</var>.</li>

       <li>The <var title="">field</var> element is an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state and whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is false.</li>

       <li>The <var title="">field</var> element is an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state and whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> is false.</li>

       <li>The <var title="">field</var> element is not an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, and either the <var title="">field</var> element does not have a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute
       specified, or its <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute's value is the empty
       string.</li>

       <li>The <var title="">field</var> element is an <code><a href=#the-object-element>object</a></code> element that is not using
       a <a href=#plugin>plugin</a>.</li>

      </ul><p>Otherwise, process <var title="">field</var> as follows:</p>

     </li>

     <li><p>Let <var title="">type</var> be the value of the <code title="">type</code> IDL
     attribute of <var title="">field</var>.</li> <!-- if the field is an <object> element, this
     will get ignored. -->

     <li>

      <p>If the <var title="">field</var> element is an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, then run these further nested
      substeps:</p>

      <ol><li><p>If the <var title="">field</var> element has a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
       attribute specified and its value is not the empty string, let <var title="">name</var> be
       that value followed by a single U+002E FULL STOP character (.). Otherwise, let <var title="">name</var> be the empty string.</li>

       <li><p>Let <var title="">name<sub title="">x</sub></var> be the string consisting of the
       concatenation of <var title="">name</var> and a single U+0078 LATIN SMALL LETTER X character
       (x).</li>

       <li><p>Let <var title="">name<sub title="">y</sub></var> be the string consisting of the
       concatenation of <var title="">name</var> and a single U+0079 LATIN SMALL LETTER Y character
       (y).</li>

       <li><p>The <var title="">field</var> element is <var title="">submitter</var>, and before
       this algorithm was invoked the user <a href=#concept-input-type-image-coordinate title=concept-input-type-image-coordinate>indicated a coordinate</a>. Let <var title="">x</var> be the <var title="">x</var>-component of the coordinate selected by the
       user, and let <var title="">y</var> be the <var title="">y</var>-component of the coordinate
       selected by the user.</li>

       <li><p>Append an entry to the <var title="">form data set</var> with the name <var title="">name<sub title="">x</sub></var>, the value <var title="">x</var>, and the type <var title="">type</var>.</li>

       <li><p>Append an entry to the <var title="">form data set</var> with the name <var title="">name<sub title="">y</sub></var> and the value <var title="">y</var>, and the type
       <var title="">type</var>.</li>

       <li><p>Skip the remaining substeps for this element: if there are any more elements in <var title="">controls</var>, return to the top of the <i>loop</i> step, otherwise, jump to the
       <i>end</i> step below.</li>

      </ol></li>

     <li><p>Let <var title="">name</var> be the value of the <var title="">field</var> element's
     <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute.</li>

     <li><p>If the <var title="">field</var> element is a <code><a href=#the-select-element>select</a></code> element, then for each
     <code><a href=#the-option-element>option</a></code> element in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true and that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, append an entry to the <var title="">form data
     set</var> with the <var title="">name</var> as the name, the <a href=#concept-option-value title=concept-option-value>value</a> of the <code><a href=#the-option-element>option</a></code> element as the value, and
     <var title="">type</var> as the type.</li>

     <li>

      <p>Otherwise, if the <var title="">field</var> element is an <code><a href=#the-input-element>input</a></code> element whose
      <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state or the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state, then run these further nested
      substeps:</p>

      <ol><li><p>If the <var title="">field</var> element has a <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute specified, then let <var title="">value</var>
       be the value of that attribute; otherwise, let <var title="">value</var> be the string "<code title="">on</code>".</li>

       <li><p>Append an entry to the <var title="">form data set</var> with <var title="">name</var>
       as the name, <var title="">value</var> as the value, and <var title="">type</var> as the
       type.</li>

      </ol></li>

     <li><p>Otherwise, if the <var title="">field</var> element is an <code><a href=#the-input-element>input</a></code> element
     whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a> state, then for each file <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected</a> in the <code><a href=#the-input-element>input</a></code> element,
     append an entry to the <var title="">form data set</var> with the <var title="">name</var> as
     the name, the file (consisting of the name, the type, and the body) as the value, and <var title="">type</var> as the type. If there are no <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>, then append an entry to the
     <var title="">form data set</var> with the <var title="">name</var> as the name, the empty
     string as the value, and <code>application/octet-stream</code> as the type.</li> <!--
     https://bugzilla.mozilla.org/show_bug.cgi?id=529859 -->

     <li><p>Otherwise, if the <var title="">field</var> element is an <code><a href=#the-object-element>object</a></code> element:
     try to obtain a form submission value from the <a href=#plugin>plugin</a><!-- using NPAPI's
     NPP_GetValue() entry point with the NPPVformValue variable -->, and if that is successful,
     append an entry to the <var title="">form data set</var> with <var title="">name</var> as the
     name, the returned form submission value as the value, and the string "<code title="">object</code>" as the type.</li>

     <li><p>Otherwise, append an entry to the <var title="">form data set</var> with <var title="">name</var> as the name, the <a href=#concept-fe-value title=concept-fe-value>value</a> of the <var title="">field</var> element as the value, and <var title="">type</var> as the type.</li>

     <li>

      <p>If the element has a <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute, and that
      attribute's value is not the empty string, then run these substeps:</p>

      <ol><li><p>Let <var title="">dirname</var> be the value of the element's <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute.</li>

       <li><p>Let <var title="">dir</var> be the string "<code title="">ltr</code>" if <a href=#the-directionality>the
       directionality</a> of the element is '<a href=#concept-ltr title=concept-ltr>ltr</a>', and "<code title="">rtl</code>" otherwise (i.e. when <a href=#the-directionality>the directionality</a> of the element is
       '<a href=#concept-rtl title=concept-rtl>rtl</a>').</li>

       <li><p>Append an entry to the <var title="">form data set</var> with <var title="">dirname</var> as the name, <var title="">dir</var> as the value, and the string
       "<code title="">direction</code>" as the type.</li>

      </ol><p class=note>An element can only have a <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>
      attribute if it is a <code><a href=#the-textarea-element>textarea</a></code> element or an <code><a href=#the-input-element>input</a></code> element whose
      <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in either the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state or the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a> state.</p>

     </li>

    </ol></li>

   <li>

    <p><i>End</i>: For the name of each entry in the <var title="">form data set</var>, and for the
    value of each entry in the <var title="">form data set</var> whose type is not "<code title="">file</code>" or "<code title="">textarea</code>", replace every occurrence of a U+000D
    CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character, and every
    occurrence of a U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR)
    character, by a two-character string consisting of a U+000D CARRIAGE RETURN U+000A LINE FEED
    (CRLF) character pair.</p>

    <p class=note>In the case of the <a href=#concept-fe-value title=concept-fe-value>value</a> of
    <code><a href=#the-textarea-element>textarea</a></code> elements, this newline normalization is already performed during the
    conversion of the control's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> into the
    control's <a href=#concept-fe-value title=concept-fe-value>value</a> (which also performs any necessary line
    wrapping). In the case of <code><a href=#the-input-element>input</a></code> elements <code title=attr-input-type><a href=#attr-input-type>type</a></code>
    attributes in the <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a> state, the value is not
    normalized.</p>

   </li>

   <li><p>Return the <var title="">form data set</var>.</li>

  </ol></div>


  <div class=impl>

  <h5 id=selecting-a-form-submission-encoding><span class=secno>4.10.22.5 </span>Selecting a form submission encoding</h5>

  <p>If the user agent is to <dfn id=picking-an-encoding-for-the-form title="picking an encoding for the form">pick an encoding for a
  form</dfn>, optionally with an <i>allow non-ASCII-compatible encodings</i> flag set, it must run
  the following substeps:</p>

  <ol><li><p>Let <var title="">input</var> be the value of the <code><a href=#the-form-element>form</a></code> element's <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute.</li>

   <li><p>Let <var title="">candidate encoding labels</var> be the result of <a href=#split-a-string-on-spaces title="split a
   string on spaces">splitting <var title="">input</var> on spaces</a>.</li>

   <li><p>Let <var title="">candidate encodings</var> be an empty list of <a href=#encoding title=encoding>character encodings</a>.</li>

   <li><p>For each token in <var title="">candidate encoding labels</var> in turn (in the order in
   which they were found in <var title="">input</var>), <a href=#getting-an-encoding title="getting an encoding">get an
   encoding</a> for the token and, if this does not result in failure, append the
   <a href=#encoding>encoding</a> to <var title="">candidate encodings</var>.</li>

   <li><p>If the <i>allow non-ASCII-compatible encodings</i> flag is not set, remove any encodings
   that are not <a href=#ascii-compatible-character-encoding title="ASCII-compatible character encoding">ASCII-compatible character
   encodings</a> from <var title="">candidate encodings</var>.</li>

   <li><p>If <var title="">candidate encodings</var> is empty, return UTF-8 and abort these
   steps.</li>

   <li>

    <p>Each character encoding in <var title="">candidate encodings</var> can represent a finite
    number of characters. (For example, UTF-8 can represent all 1.1 million or so Unicode code
    points, while Windows-1252 can only represent 256.)</p>

    <p>For each encoding in <var title="">candidate encodings</var>, determine how many of the
    characters in the names and values of the entries in the <var title="">form data set</var> the
    encoding can represent (without ignoring duplicates). Let <var title="">max</var> be the
    highest such count. (For UTF-8, <var title="">max</var> would equal the number of characters
    in the names and values of the entries in the <var title="">form data set</var>.)</p>

    <p>Return the first encoding in <var title="">candidate encodings</var> that can encode <var title="">max</var> characters in the names and values of the entries in the <var title="">form
    data set</var>.</p>

   </li>

  </ol></div>


  <h5 id=url-encoded-form-data><span class=secno>4.10.22.6 </span>URL-encoded form data</h5>

  <p class=note>This form data set encoding is in many ways an aberrant monstrosity, the result of
  many years of implementation accidents and compromises leading to a set of requirements necessary
  for interoperability, but in no way representing good design practices. In particular, readers are
  cautioned to pay close attention to the twisted details involving repeated (and in some cases
  nested) conversions between character encodings and byte sequences.</p>

  <div class=impl>

  <p>The <dfn id=application/x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding algorithm</dfn> is as
  follows:</p>

  <ol><!-- the first few steps of this are the same as in the next section --><li><p>Let <var title="">result</var> be the empty string.</li>

   <li>

    <p>If the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, let the selected character
    encoding be the result of <a href=#picking-an-encoding-for-the-form>picking an encoding for the form</a>.</p>

    <p>Otherwise, if the <code><a href=#the-form-element>form</a></code> element has no <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, but the <a href="#document's-character-encoding">document's
    character encoding</a> is an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, then that is
    the selected character encoding.</p>

    <p>Otherwise, let the selected character encoding be UTF-8.</p>

   </li>

   <li><p>Let <var title="">charset</var> be the <a href=#encoding-name title="encoding name">name</a> of the
   selected <a href=#encoding title=encoding>character encoding</a>.</li>

   <li>

    <p>For each entry in the <var title="">form data set</var>, perform these substeps:</p>

    <ol><li><p>If the entry's name is "<code title=attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and its
     type is "<code title="">hidden</code>", replace its value with <var title="">charset</var>.</li>

     <li><p>If the entry's type is "<code title="">file</code>", replace its value with the file's
     name only.</li> <!-- this is not present in the next section -->

     <li><p>For each character in the entry's name and value that cannot be expressed using the
     selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND
     character (&amp;), a U+0023 NUMBER SIGN character (#), one or more <a href=#ascii-digits>ASCII digits</a>
     representing the Unicode code point of the character in base ten, and finally a U+003B
     SEMICOLON character (;).</li><!-- we should say it should be the shortest possible string,
     no leading zeros. this whole step is asinine, though, so... -->

     <!-- this is where the similarities with the next section end -->

     <li>

      <p>Encode the entry's name and value using the <a href=#encoder>encoder</a> for the selected character
      encoding. The entry's name and value are now byte strings.</p>

     </li>

     <li>

      <p>For each byte in the entry's name and value, apply the appropriate subsubsteps from the
      following list:</p>

      <dl class=switch><dt>If the byte is 0x20 (U+0020 SPACE if interpreted as ASCII)</dt>

       <dd>Replace the byte with a single 0x2B byte (U+002B PLUS SIGN character (+) if interpreted
       as ASCII).</dd>


       <!-- * - . 0-9 a-z _ A-Z -->

       <dt>If the byte is in the range 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to
       0x7A</dt>

       <dd><p>Leave the byte as is.</dd>


       <dt>Otherwise</dt>

       <dd>

        <ol><li><p>Let <var title="">s</var> be a string consisting of a U+0025 PERCENT SIGN character
         (%) followed by <a href=#uppercase-ascii-hex-digits>uppercase ASCII hex digits</a> representing the hexadecimal value
         of the byte in question (zero-padded if necessary).</li>

         <li><p>Encode the string <var title="">s</var> as US-ASCII, so that it is now a byte
         string.</p>

         <li><p>Replace the byte in question in the name or value being processed by the bytes in
         <var title="">s</var>, preserving their relative order.</li>

        </ol></dd>

      </dl></li>

     <li>

      <p>Interpret the entry's name and value as Unicode strings encoded in US-ASCII. (All of the
      bytes in the string will be in the range 0x00 to 0x7F; the high bit will be zero throughout.)
      The entry's name and value are now Unicode strings again.</p>

     </li>

     <li><p>If the entry's name is "<code title=attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code>", its type is
     "<code title="">text</code>", and this is the first entry in the <var title="">form data
     set</var>, then append the value to <var title="">result</var> and skip the rest of the
     substeps for this entry, moving on to the next entry, if any, or the next step in the overall
     algorithm otherwise.</li>

     <li><p>If this is not the first entry, append a single U+0026 AMPERSAND character (&amp;) to
     <var title="">result</var>.</li>

     <li><p>Append the entry's name to <var title="">result</var>.</li>

     <li><p>Append a single U+003D EQUALS SIGN character (=) to <var title="">result</var>.</li>

     <li><p>Append the entry's value to <var title="">result</var>.</li>

    </ol></li>

   <li><p>Encode <var title="">result</var> as US-ASCII and return the resulting byte
   stream.</li>

  </ol></div>

  <p>To <dfn id=application/x-www-form-urlencoded-decoding-algorithm title="application/x-www-form-urlencoded decoding algorithm">decode
  <code>application/x-www-form-urlencoded</code> payloads</dfn>, the following algorithm should be
  used. This algorithm uses as inputs the payload itself, <var title="">payload</var>, consisting of
  a Unicode string using only characters in the range U+0000 to U+007F; a default character encoding
  <var title="">encoding</var>; and optionally an <var title="">isindex</var> flag indicating that
  the payload is to be processed as if it had been generated for a form containing an <code title=attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code> control. The output of this algorithm is a sorted list
  of name-value pairs. If the <var title="">isindex</var> flag is set and the first control really
  was an <code title=attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code> control, then the first name-value pair
  will have as its name the empty string.</p>

  <ol><li><p>Let <var title="">strings</var> be the result of <a href=#strictly-split-a-string title="strictly split a string">strictly splitting the
   string</a> <var title="">payload</var> on U+0026 AMPERSAND
   characters (&amp;).</li>

   <li><p>If the <var title="">isindex</var> flag is set and the first string in <var title="">strings</var> does not contain a U+003D EQUALS SIGN character (=), insert a U+003D
   EQUALS SIGN character (=) at the start of the first string in <var title="">strings</var>.</li>

   <li><p>Let <var title="">pairs</var> be an empty list of name-value pairs.</li>

   <li>

    <p>For each string <var title="">string</var> in <var title="">strings</var>, run these
    substeps:</p>

    <ol><li>

      <p>If <var title="">string</var> contains a U+003D EQUALS SIGN character (=), then let <var title="">name</var> be the substring of <var title="">string</var> from the start of <var title="">string</var> up to but excluding its first U+003D EQUALS SIGN character (=), and let
      <var title="">value</var> be the substring from the first character, if any, after the first
      U+003D EQUALS SIGN character (=) up to the end of <var title="">string</var>. If the first
      U+003D EQUALS SIGN character (=) is the first character, then <var title="">name</var> will be
      the empty string. If it is the last character, then <var title="">value</var> will be the
      empty string.</p>

      <p>Otherwise, <var title="">string</var> contains no U+003D EQUALS SIGN characters (=). Let
      <var title="">name</var> have the value of <var title="">string</var> and let <var title="">value</var> be the empty string.</p>

     </li>

     <li>

      <p>Replace any U+002B PLUS SIGN characters (+) in <var title="">name</var> and <var title="">value</var> with U+0020 SPACE characters.</p>

     </li>

     <li>

      <p>Replace any escape in <var title="">name</var> and <var title="">value</var> with the
      character represented by the escape. This replacement must not be recursive.</p>

      <p>An escape is a U+0025 PERCENT SIGN character (%) followed by two <a href=#ascii-hex-digits>ASCII hex
      digits</a>.</p>

      <p>The character represented by an escape is the Unicode character whose code point is equal
      to the value of the two characters after the U+0025 PERCENT SIGN character (%), interpreted as
      a hexadecimal number (in the range 0..255).</p>

      <p class=example>So for instance the string "<code title="">A%2BC</code>" would become
      "<code title="">A+C</code>". Similarly, the string "<code title="">100%25AA%21</code>" becomes
      the string "<code title="">100%AA!</code>".</p>

     </li>

     <li><p>Convert the <var title="">name</var> and <var title="">value</var> strings to their byte
     representation in ISO-8859-1 (i.e. convert the Unicode string to a byte string, mapping code
     points to byte values directly).</li>

     <li><p>Add a pair consisting of <var title="">name</var> and <var title="">value</var> to <var title="">pairs</var>.</li>

    </ol></li>

   <li><p>If any of the name-value pairs in <var title="">pairs</var> have a name component
   consisting of the string "<code title="">_charset_</code>" encoded in US-ASCII, and the value
   component of the first such pair, when decoded as US-ASCII, is the name of a supported character
   encoding, then let <var title="">encoding</var> be that character encoding (replacing the default
   passed to the algorithm).</li> <!-- XXX -->

   <li><p>Convert the name and value components of each name-value pair in <var title="">pairs</var>
   to Unicode by interpreting the bytes according to the encoding <var title="">encoding</var>.</li>

   <li><p>Return <var title="">pairs</var>.</li>

  </ol><p class=note>Parameters on the <code><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> MIME type are
  ignored. In particular, this MIME type does not support the <code title="">charset</code>
  parameter.</p>



  <h5 id=multipart-form-data><span class=secno>4.10.22.7 </span>Multipart form data</h5>

  <div class=impl>

  <!-- http://hixie.ch/tests/adhoc/html/forms/submission/multipart_form-data/ -->

  <!-- NOTE: This algorithm is also used by the XHR spec -->

  <p>The <dfn id=multipart/form-data-encoding-algorithm><code title="">multipart/form-data</code> encoding
  algorithm</dfn> is as follows:</p>

  <ol><!-- the first few steps of this are the same as in the previous section --><li><p>Let <var title="">result</var> be the empty string.</li>

   <li>

<!--CLEANUP-->
    <p>If the algorithm was invoked with an explicit character
    encoding, let the selected character encoding be that encoding.
    (This algorithm is used by other specifications, which provide an
    explicit character encoding to avoid the dependency on the
    <code><a href=#the-form-element>form</a></code> element described in the next paragraph.)</p>

    <p>Otherwise, if the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, let the selected character
    encoding be the result of <a href=#picking-an-encoding-for-the-form>picking an encoding for the form</a>.</p>

    <p>Otherwise, if the <code><a href=#the-form-element>form</a></code> element has no <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, but the <a href="#document's-character-encoding">document's
    character encoding</a> is an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, then that is
    the selected character encoding.</p>

    <p>Otherwise, let the selected character encoding be UTF-8.</p>

   </li>

   <li><p>Let <var title="">charset</var> be the <a href=#encoding-name title="encoding name">name</a> of the
   selected <a href=#encoding title=encoding>character encoding</a>.</li>

   <li>

<!--CLEANUP-->
    <p>For each entry in the <var title="">form data set</var>,
    perform these substeps:</p>

    <ol><li><p>If the entry's name is "<code title=attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and its type is
     "<code title="">hidden</code>", replace its value with <var title="">charset</var>.</li>

     <!-- the step that replaces a file with its name is missing in
     this version of the algorithm -->

     <li><p>For each character in the entry's name and value that
     cannot be expressed using the selected character encoding,
     replace the character by a string consisting of a U+0026
     AMPERSAND character (&amp;), a U+0023 NUMBER SIGN character (#),
     one or more <a href=#ascii-digits>ASCII digits</a> representing the Unicode code point of the
     character in base ten, and finally a U+003B SEMICOLON character
     (;).</li><!-- we should say it should be the shortest
     possible string, no leading zeros. this whole step is asinine,
     though, so... -->

     <!-- this is where the similarities with the previous section end -->

    </ol></li>

   <li>

    <p>Encode the (now mutated) <var title="">form data set</var>
    using the rules described by RFC 2388, <cite>Returning Values from
    Forms: <code title="">multipart/form-data</code></cite>, and
    return the resulting byte stream. <a href=#refsRFC2388>[RFC2388]</a></p>

    <p>Each entry in the <var title="">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 title="">form data set</var>. Multiple entries with the
    same name must be treated as distinct fields.</p>

    <p class=note>In particular, this means that multiple files
    submitted as part of a single <code title="">&lt;input&nbsp;type=file&nbsp;multiple&gt;</code> element
    will result in each file having its own field; the "sets of files"
    feature ("<code title="">multipart/mixed</code>") of RFC 2388 is
    not used.</p>

    <p>The parts of the generated <code title="">multipart/form-data</code> resource that correspond to
    non-file fields must not have a <code><a href=#content-type>Content-Type</a></code> header
    specified. Their names and values must be encoded using the
    character encoding selected above (field names in particular do
    not get converted to a 7-bit safe encoding as suggested in RFC
    2388).</p>

    <p>File names included in the generated <code title="">multipart/form-data</code> resource (as part of file
    fields) must use the character encoding selected above, though the
    precise name may be approximated if necessary (e.g. newlines could
    be removed from file names, quotes could be changed to "%22", and
    characters not expressible in the selected character encoding
    could be replaced by other characters). User agents must not use
    the RFC 2231 encoding suggested by RFC 2388.</p> <!-- this isn't a
    willful violation since 2388 doesn't make it a requirement, it
    just vaguely suggests it -->

    <p>The boundary used by the user agent in generating the return
    value of this algorithm is the <dfn id=multipart/form-data-boundary-string><code title="">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>

   </li>

  </ol></div>

  <p>For details on how to interpret <code>multipart/form-data</code>
  payloads, see RFC 2388. <a href=#refsRFC2388>[RFC2388]</a></p>



  <h5 id=plain-text-form-data><span class=secno>4.10.22.8 </span>Plain text form data</h5>

<!--CLEANUP-->
  <div class=impl>

  <p>The <dfn id=text/plain-encoding-algorithm><code title="">text/plain</code> encoding
  algorithm</dfn> is as follows:</p>

  <ol><li><p>Let <var title="">result</var> be the empty string.</li>

   <li>

    <!-- this is different from application/x-www-form-urlencoded in
    that it isn't limited to ASCII-compatible encodings -->

    <p>If the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, let the selected character
    encoding be the result of <a href=#picking-an-encoding-for-the-form>picking an encoding for the form</a>, with the <i>allow
    non-ASCII-compatible encodings</i> flag unset.</p>

    <p>Otherwise, if the <code><a href=#the-form-element>form</a></code> element has no <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, then that is the selected
    character encoding.</p>

   </li>

   <li><p>Let <var title="">charset</var> be the <a href=#encoding-name title="encoding name">name</a> of the
   selected <a href=#encoding title=encoding>character encoding</a>.</li>

   <li><p>If the entry's name is "<code title=attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and its type is
   "<code title="">hidden</code>", replace its value with <var title="">charset</var>.</li>

   <li><p>If the entry's type is "<code title="">file</code>", replace
   its value with the file's name only.</li>

   <li>

    <p>For each entry in the <var title="">form data set</var>,
    perform these substeps:</p>

    <ol><li><p>Append the entry's name to <var title="">result</var>.</li>

     <li><p>Append a single U+003D EQUALS SIGN character (=) to <var title="">result</var>.</li>

     <li><p>Append the entry's value to <var title="">result</var>.</li>

     <li><p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF)
     character pair to <var title="">result</var>.</li>

    </ol></li>

   <li><p>Encode <var title="">result</var> using the <a href=#encoder>encoder</a> for the selected
   character encoding and return the resulting byte stream.</li>

  </ol></div>

  <p>Payloads using the <code>text/plain</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>



  <div class=impl>

  <h4 id=resetting-a-form><span class=secno>4.10.23 </span>Resetting a form</h4>

  <p>When a <code><a href=#the-form-element>form</a></code> element <var title="">form</var> is <dfn id=concept-form-reset title=concept-form-reset>reset</dfn>, the user agent must <a href=#fire-a-simple-event>fire a simple event</a> named
  <code title=event-reset>reset</code>, that bubbles and is cancelable, at <var title="">form</var>, and then, if that event is not canceled, must invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each <a href=#category-reset title=category-reset>resettable element</a> whose <a href=#form-owner>form owner</a> is <var title="">form</var>.</p>

  <p>Each <a href=#category-reset title=category-reset>resettable element</a>
  defines its own <dfn id=concept-form-reset-control title=concept-form-reset-control>reset
  algorithm</dfn>. Changes made to form controls as part of these
  algorithms do not count as changes caused by the user (and thus,
  e.g., do not cause <code title=event-input>input</code> events to
  fire).</p>

  </div>



  <h3 id=interactive-elements><span class=secno>4.11 </span>Interactive elements</h3>

  <h4 id=the-details-element><span class=secno>4.11.1 </span>The <dfn><code>details</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dd><a href=#interactive-content>Interactive content</a>.</dd>
   <dd><a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>One <code><a href=#the-summary-element>summary</a></code> element followed by <a href=#flow-content>flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-details-open><a href=#attr-details-open>open</a></code> &mdash; Whether the details are visible</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmldetailselement>HTMLDetailsElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-details-open title=dom-details-open>open</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-details-element>details</a></code> element <a href=#represents>represents</a> a
  disclosure widget from which the user can obtain additional
  information or controls.</p>

  <p class=note>The <code><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 <span class=impl>first</span> <code><a href=#the-summary-element>summary</a></code> element
  child of the element, if any, <a href=#represents>represents</a> the summary or
  legend of the details. <span class=impl>If there is no child
  <code><a href=#the-summary-element>summary</a></code> element, the user agent should provide its own
  legend (e.g. "Details").</span></p>

  <p>The rest of the element's contents <a href=#represents>represents</a> the
  additional information or controls.</p>

  <p>The <dfn id=attr-details-open title=attr-details-open><code>open</code></dfn>
  content attribute is a <a href=#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>

  <div class=impl>

  <p>When the element is created, if the attribute is absent, the
  additional information should be hidden; if the attribute is
  present, that information should be shown. Subsequently, if the
  attribute is removed, then the information should be hidden; if the
  attribute is added, the information should be shown.</p>

  <p>The user agent should allow the user to request that the
  additional information be shown or hidden. To honor a request for
  the details to be shown, the user agent must set the <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute on the element to
  the value <code title="">open</code>. To honor a request for the
  information to be hidden, the user agent must remove the <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute from the
  element.</p>

  <p>The <dfn id=dom-details-open title=dom-details-open><code>open</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-details-open><a href=#attr-details-open>open</a></code> content attribute.</p>

  </div>

  <div class=example>

   <p>The following example shows the <code><a href=#the-details-element>details</a></code> element
   being used to hide technical details in a progress report.</p>

   <pre>&lt;section class="progress window"&gt;
 &lt;h1&gt;Copying "Really Achieving Your Childhood Dreams"&lt;/h1&gt;
 &lt;details&gt;
  &lt;summary&gt;Copying... &lt;progress max="375505392" value="97543282"&gt;&lt;/progress&gt; 25%&lt;/summary&gt;
  &lt;dl&gt;
   &lt;dt&gt;Transfer rate:&lt;/dt&gt; &lt;dd&gt;452KB/s&lt;/dd&gt;
   &lt;dt&gt;Local filename:&lt;/dt&gt; &lt;dd&gt;/home/rpausch/raycd.m4v&lt;/dd&gt;
   &lt;dt&gt;Remote filename:&lt;/dt&gt; &lt;dd&gt;/var/www/lectures/raycd.m4v&lt;/dd&gt;
   &lt;dt&gt;Duration:&lt;/dt&gt; &lt;dd&gt;01:16:27&lt;/dd&gt;
   &lt;dt&gt;Color profile:&lt;/dt&gt; &lt;dd&gt;SD (6-1-6)&lt;/dd&gt;
   &lt;dt&gt;Dimensions:&lt;/dt&gt; &lt;dd&gt;320&times;240&lt;/dd&gt;
  &lt;/dl&gt;
 &lt;/details&gt;
&lt;/section&gt;</pre>

  </div>

  <div class=example>

   <p>The following shows how a <code><a href=#the-details-element>details</a></code> element can be
   used to hide some controls by default:</p>

   <pre>&lt;details&gt;
 &lt;summary&gt;&lt;label for=fn&gt;Name &amp; Extension:&lt;/label&gt;&lt;/summary&gt;
 &lt;p&gt;&lt;input type=text id=fn name=fn value="Pillar Magazine.pdf"&gt;
 &lt;p&gt;&lt;label&gt;&lt;input type=checkbox name=ext checked&gt; Hide extension&lt;/label&gt;
&lt;/details&gt;</pre>

   <p>One could use this in conjunction with other <code><a href=#the-details-element>details</a></code>
   in a list to allow the user to collapse a set of fields down to a
   small set of headings, with the ability to open each one.</p>

   <p class=details-example><img src=http://images.whatwg.org/sample-details-1.png width=345 alt="" height=611><img src=http://images.whatwg.org/sample-details-2.png width=345 alt="" height=666></p>

   <p>In these examples, the summary really just summarises what the
   controls can change, and not the actual values, which is less than
   ideal.</p>

  </div>

  <div class=example>

   <p>Because the <code title=attr-details-open><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>&lt;style&gt;
 details &gt; summary { transition: color 1s; color: black; }
 details[open] &gt; summary { color: red; }
&lt;/style&gt;
&lt;details&gt;
 &lt;summary&gt;Automated Status: Operational&lt;/summary&gt;
 &lt;p&gt;Velocity: 12m/s&lt;/p&gt;
 &lt;p&gt;Direction: North&lt;/p&gt;
&lt;/details&gt;</pre>

  </div>


  <h4 id=the-summary-element><span class=secno>4.11.2 </span>The <dfn><code>summary</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As the first child of a <code><a href=#the-details-element>details</a></code> element.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#phrasing-content>Phrasing content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>Uses <code><a href=#htmlelement>HTMLElement</a></code>.</dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-summary-element>summary</a></code> element <a href=#represents>represents</a> a
  summary, caption, or legend for the rest of the contents of the
  <code><a href=#the-summary-element>summary</a></code> element's parent <code><a href=#the-details-element>details</a></code>
  element<span class=impl>, if any</span>.</p>



  <h4 id=the-menu-element><span class=secno>4.11.3 </span>The <dfn id=menus><code>menu</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd>If the element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state: <a href=#palpable-content>Palpable content</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dd>If the element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state: as the child of a <code><a href=#the-menu-element>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>If the element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state: either zero or more <code><a href=#the-li-element>li</a></code> and <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements, or, <a href=#flow-content>flow content</a>.</dd>
   <dd>If the element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state: in any order, zero or more <code><a href=#the-menuitem-element>menuitem</a></code> elements, zero or more <code><a href=#the-hr-element>hr</a></code> elements, zero or more <code><a href=#the-menu-element>menu</a></code> elements whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attributes are in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state, and zero or more <a href=#script-supporting-elements title="script-supporting elements">script-supporting</a> elements.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-menu-type><a href=#attr-menu-type>type</a></code> &mdash; Type of menu</dd>
   <dd><code title=attr-menu-label><a href=#attr-menu-label>label</a></code> &mdash; User-visible label</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlmenuelement>HTMLMenuElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-menu-type title=dom-menu-type>type</a>;
           attribute DOMString <a href=#dom-menu-label title=dom-menu-label>label</a>;

  // <a href="#HTMLMenuElement-partial">also has obsolete members</a>
};</pre>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-menu-element>menu</a></code> element represents a list of commands.</p>

  <!-- v2 idea: <menu> should get an icon, like <command> -->

  <p>The <dfn id=attr-menu-type title=attr-menu-type><code>type</code></dfn> attribute is an <a href=#enumerated-attribute>enumerated
  attribute</a> indicating the kind of menu being declared. The attribute has two states. The
  <code title=attr-menu-type-popup>popup</code> keyword maps to the <dfn id=popup-menu-state title="popup menu
  state">popup menu</dfn> state, in which the element is declaring a context menu or the menu for a
  <a href=#attr-button-type-menu-state title=attr-button-type-menu-state>menu button</a>. The <code title=attr-menu-type-toolbar>toolbar</code> keyword maps to the <dfn id=toolbar-state title="toolbar
  state">toolbar</dfn> state, in which the element is declaring a toolbar. The attribute may also be
  omitted. The <i>missing value default</i> is the <a href=#popup-menu-state title="popup menu state">popup menu</a>
  state if the parent element is a <code><a href=#the-menu-element>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup
  menu</a> state; otherwise, it is the <a href=#toolbar-state title="toolbar state">toolbar</a> state.</p>

  <p>If a <code><a href=#the-menu-element>menu</a></code> element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the
  <a href=#popup-menu-state title="popup menu state">popup menu</a> state, then the element <a href=#represents>represents</a>
  the commands of a popup menu, and the user can only examine and interact with the commands if that
  popup menu is activated through some other element, either via the <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute or the <code><a href=#the-button-element>button</a></code> element's <code title=attr-button-menu><a href=#attr-button-menu>menu</a></code> attribute.</p>

  <p>If a <code><a href=#the-menu-element>menu</a></code> element's <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the
  <a href=#toolbar-state title="toolbar state">toolbar</a> state, then the element <a href=#represents>represents</a> a
  toolbar consisting of its contents, in the form of either an unordered list of items (represented
  by <code><a href=#the-li-element>li</a></code> elements), each of which represents a command that the user can perform or
  activate, or, if the element has no <code><a href=#the-li-element>li</a></code> element children, <a href=#flow-content>flow content</a>
  describing available commands.</p>

  <p>The <dfn id=attr-menu-label title=attr-menu-label><code>label</code></dfn> attribute gives the label of the
  menu. It is used by user agents to display nested menus in the UI: a context menu containing
  another menu would use the nested menu's <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute for
  the submenu's menu label. The <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute must only be
  specified on <code><a href=#the-menu-element>menu</a></code> elements whose parent element is a <code><a href=#the-menu-element>menu</a></code> element whose
  <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup
  menu</a> state.</p>

  <div class=impl>

  <hr><p>A <code><a href=#the-menu-element>menu</a></code> is a <dfn id=currently-relevant-menu-element>currently relevant <code>menu</code> element</dfn> if it is the
  child of a <a href=#currently-relevant-menu-element>currently relevant <code>menu</code> element</a>, or if it is the
  <a href=#designated-pop-up-menu>designated pop-up menu</a> of a <code><a href=#the-button-element>button</a></code> element that is not
  <a href=#inert>inert</a>, does not have a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and is not
  the descendant of an element with a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute.</p>

  <hr><p>A pop-up menu consists of a list of zero or more menu items, which can be any of:</p>

  <ul class=brief><li><a href=#concept-command title=concept-command>Commands</a>, which can be marked as default commands (<code><a href=#the-menuitem-element>menuitem</a></code>)</li>
   <li>Separators (<code><a href=#the-hr-element>hr</a></code>)</li>
   <li>Other menus, which allows the list to be nested (<code><a href=#the-menu-element>menu</a></code>)</li>
  </ul><p>To <dfn id=construct-and-show-a-menu>construct and show a menu</dfn> for a particular <code><a href=#the-menu-element>menu</a></code> element and with a
  particular element as a subject, the user agent must run the following steps:</p>

  <ol><li><p>Let the menu be an empty list of the type described above.</li>

   <li>

    <p>Run the <a href=#menu-builder>menu builder</a> steps for the <code><a href=#the-menu-element>menu</a></code> element using the menu
    prepared in the previous list as the output.</p>

    <p>The <dfn id=menu-builder>menu builder</dfn> steps for a <code><a href=#the-menu-element>menu</a></code> element using a specific menu as
    output are as follows: For each child node of the <code><a href=#the-menu-element>menu</a></code> in <a href=#tree-order>tree order</a>,
    run the appropriate steps from the following list:</p>

    <dl class=switch><dt>If the child is a <code><a href=#the-menuitem-element>menuitem</a></code> element that <a href=#concept-command title=concept-command>defines
     a command</a></dt>

     <dd>Append the command to the menu, respecting its <a href=#concept-facet title=concept-facet>facets</a><!-- we might need to be explicit about what this means for
     each facet, if testing shows this isn't well-implemented. e.g.: If there's an Icon facet for
     the command, it should be <span title="fetch">fetched</span><!- -FETCH- -> (this would be
     http-origin privacy-sensitive), and then that image should be associated with the command, such
     that each command only has its image fetched once, to prevent changes to the base URL from
     having effects after the image has been fetched once. (no need to resolve the Icon facet, it's
     an absolute URL) -->. If the <code><a href=#the-menuitem-element>menuitem</a></code> element has a <code title=attr-menuitem-default><a href=#attr-menuitem-default>default</a></code> attribute, mark the command as being a default
     command.</dd>


     <dt>If the child is an <code><a href=#the-hr-element>hr</a></code> element</dt>

     <dd>Append a separator to the menu.</dd>


     <dt>If the child is a <code><a href=#the-menu-element>menu</a></code> element with no <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute</dt>

     <dd>Append a separator to the menu, then run the <a href=#menu-builder>menu builder</a> steps using this
     child <code><a href=#the-menu-element>menu</a></code> element for the same menu, then append another separator to the
     menu.</dd>


     <dt>If the child is a <code><a href=#the-menu-element>menu</a></code> element with a <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute</dt>

     <dd>Create a new submenu as an empty list of the type described above, and construct it by
     running the <a href=#menu-builder>menu builder</a> steps for the child <code><a href=#the-menu-element>menu</a></code> element using the
     new submenu as the output. Then, append the submenu to the menu, using the value of the child
     <code><a href=#the-menu-element>menu</a></code> element's <code title=attr-menu-label><a href=#attr-menu-label>label</a></code> attribute as the label
     of the submenu.</dd>


     <dt>Otherwise</dt>

     <dd><a href=#ignore>Ignore</a> the child node.</dd>

    </dl></li>

   <li><p>Remove any submenu with no label, or whose label is the empty string, in the menu or any
   submenus.</li>

   <li><p>Remove any menu item with no label, or whose label is the empty string, in the menu or any
   submenus.</li>

   <li><p>Collapse all sequences of two or more adjacent separators in the menu or any submenus to a
   single separator.</li>

   <li><p>Remove all separators at the start or end of the menu and any submenus.</li>

   <li>

    <p>Display the menu to the user, and let the algorithm that invoked this one continue.</p>

    <p>If the user selects a menu item that corresponds to an element that still represents a <a href=#concept-command title=concept-command>command</a> when the user selects it, then the UA must invoke that
    command's <a href=#command-facet-action title=command-facet-Action>Action</a>. If the command's <a href=#command-facet-action title=command-facet-Action>Action</a> is defined as <a href=#fire-a-click-event title="fire a click event">firing
    a <code title=event-click>click</code> event</a>, either directly or via the <a href=#run-synthetic-click-activation-steps>run
    synthetic click activation steps</a> algorithm, then the <code title=dom-MouseEvent-relatedTarget>relatedTarget</code> attribute of that <code title=event-click><a href=#event-click>click</a></code> event must be initialized to the subject passed to this
    <a href=#construct-and-show-a-menu>construct and show a menu</a> algorithm.</p>

    <p>Pop-up menus must not, while being shown, reflect changes in the DOM. The menu is constructed
    from the DOM before being shown, and is then immutable.</p>

   </li>

  </ol><hr><p>The <dfn id=dom-menu-type title=dom-menu-type><code>type</code></dfn> IDL attribute must <a href=#reflect>reflect</a>
  the content attribute of the same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

  <p>The <dfn id=dom-menu-label title=dom-menu-label><code>label</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  </div>

  <div class=example>

   <p>In this example, the <code><a href=#the-menu-element>menu</a></code> element is used to describe a toolbar with three menu
   buttons on it, each of which has a dropdown menu with a series of options:</p>

  <pre>&lt;menu&gt; <!-- type="toolbar" implied -->
 &lt;li&gt;
  &lt;button type=menu value="File" menu="filemenu"&gt;
  &lt;menu id="filemenu" type="popup"&gt;
   &lt;menuitem onclick="fnew()" label="New..."&gt;
   &lt;menuitem onclick="fopen()" label="Open..."&gt;
   &lt;menuitem onclick="fsave()" label="Save"&gt;
   &lt;menuitem onclick="fsaveas()" label="Save as..."&gt;
  &lt;/menu&gt;
 &lt;/li&gt;
 &lt;li&gt;
  &lt;button type=menu value="Edit" menu="editmenu"&gt;
  &lt;menu id="editmenu" type="popup"&gt;
   &lt;menuitem onclick="ecopy()" label="Copy"&gt;
   &lt;menuitem onclick="ecut()" label="Cut"&gt;
   &lt;menuitem onclick="epaste()" label="Paste"&gt;
  &lt;/menu&gt;
 &lt;/li&gt;
 &lt;li&gt;
  &lt;button type=menu value="Help" menu="helpmenu"&gt;
  &lt;menu id="helpmenu" type="popup"&gt;
   &lt;menuitem onclick="location='help.html'" label="Help"&gt;
   &lt;menuitem onclick="location='about.html'" label="About"&gt;
  &lt;/menu&gt;
 &lt;/li&gt;
&lt;/menu&gt;</pre>

   <p>In a supporting user agent, this might look like this (assuming the user has just activated the
   second button):</p>

   <p><img src=http://images.whatwg.org/sample-toolbar-1.png width=303 alt="A toolbar with three buttons, labeled 'File', 'Edit', and 'Help'; where if you select the 'Edit' button you get a drop-down menu with three more options, 'Copy', 'Cut', and 'Paste'." height=101></p>

  </div>



  <h4 id=the-menuitem-element><span class=secno>4.11.4 </span>The <dfn><code>menuitem</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd>None.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>As a child of a <code><a href=#the-menu-element>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd>Empty.</dd>
   
   <dd>No <a href=#syntax-end-tag title=syntax-end-tag>end tag</a>.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> &mdash; Type of command</dd>
   <dd><code title=attr-menuitem-label><a href=#attr-menuitem-label>label</a></code> &mdash; User-visible label</dd>
   <dd><code title=attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code> &mdash; Icon for the command</dd>
   <dd><code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> &mdash; Whether the form control is disabled</dd>
   <dd><code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> &mdash; Whether the command or control is checked</dd>
   <dd><code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code> &mdash; Name of group of commands to treat as a radio button group</dd>
   <dd><code title=attr-menuitem-default><a href=#attr-menuitem-default>default</a></code> &mdash; Mark the command as being a default command</dd>
   <dd><code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> &mdash; Command definition</dd>
   <dd>Also, the <code title=attr-menuitem-title><a href=#attr-menuitem-title>title</a></code> attribute has special semantics on this element. &mdash; Hint describing the command</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmlmenuitemelement>HTMLMenuItemElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-menuitem-type title=dom-menuitem-type>type</a>;
           attribute DOMString <a href=#dom-menuitem-label title=dom-menuitem-label>label</a>;
           attribute DOMString <a href=#dom-menuitem-icon title=dom-menuitem-icon>icon</a>;
           attribute boolean <a href=#dom-menuitem-disabled title=dom-menuitem-disabled>disabled</a>;
           attribute boolean <a href=#dom-menuitem-checked title=dom-menuitem-checked>checked</a>;
           attribute DOMString <a href=#dom-menuitem-radiogroup title=dom-menuitem-radiogroup>radiogroup</a>;
           attribute boolean <a href=#dom-menuitem-default title=dom-menuitem-default>default</a>;
  readonly attribute <a href=#htmlelement>HTMLElement</a>? <a href=#dom-menuitem-command title=dom-menuitem-command>command</a>;
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-menuitem-element>menuitem</a></code> element represents a command that the user can invoke from a popup
  menu (either a <a href=#attr-contextmenu title=attr-contextmenu>context menu</a> or the menu of a <a href=#attr-button-type-menu-state title=attr-button-type-menu-state>menu button</a>).</p>

  <p>A <code><a href=#the-menuitem-element>menuitem</a></code> element that uses one or more of the
   <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code>,
   <code title=attr-menuitem-label><a href=#attr-menuitem-label>label</a></code>,
   <code title=attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code>,
   <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code>,
   <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>, and
   <code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code>
  attributes defines a new command.</p>

  <p>A <code><a href=#the-menuitem-element>menuitem</a></code> element that uses the <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute defines a command by reference to another
  one. This allows authors to define a command once, and set its state (e.g. whether it is active or
  disabled) in one place, and have all references to that command in the user interface change at
  the same time.</p>

  <p>If the <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute is specified, the element
  is in the <dfn id=indirect-command>indirect command</dfn> mode. If it is not specified, it is in the <dfn id=explicit-command>explicit
  command</dfn> mode. When the element is in the <a href=#indirect-command>indirect command</a> mode, the element
  must not have any of the following attributes specified:
   <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code>,
   <code title=attr-menuitem-label><a href=#attr-menuitem-label>label</a></code>,
   <code title=attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code>,
   <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code>,
   <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>,
   <code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code>.
  </p>

  <hr><p>The <dfn id=attr-menuitem-type title=attr-menuitem-type><code>type</code></dfn> attribute indicates the kind of
  command: either a normal command with an associated action, or a state or option that can be
  toggled, or a selection of one item from a list of items.</p>

  <p>The attribute is an <a href=#enumerated-attribute>enumerated attribute</a> with three keywords and states. The "<dfn id=attr-menuitem-type-keyword-command title=attr-menuitem-type-keyword-command><code>command</code></dfn>" keyword maps to the <a href=#attr-menuitem-type-state-command title=attr-menuitem-type-state-command>Command</a> state, the "<dfn id=attr-menuitem-type-keyword-checkbox title=attr-menuitem-type-keyword-checkbox><code>checkbox</code></dfn>" keyword maps to the <a href=#attr-menuitem-type-state-checkbox title=attr-menuitem-type-state-checkbox>Checkbox</a> state, and the "<dfn id=attr-menuitem-type-keyword-radio title=attr-menuitem-type-keyword-radio><code>radio</code></dfn>" keyword maps to the <a href=#attr-menuitem-type-state-radio title=attr-menuitem-type-state-radio>Radio</a> state. The <i>missing value default</i> is the
  <a href=#attr-menuitem-type-state-command title=attr-menuitem-type-state-command>Command</a> state.</p>

  <dl><dt>The <dfn id=attr-menuitem-type-state-command title=attr-menuitem-type-state-command>Command</dfn> state</dt>

   <dd><p>The element <a href=#represents>represents</a> a normal command with an associated action.</dd>

   <dt>The <dfn id=attr-menuitem-type-state-checkbox title=attr-menuitem-type-state-checkbox>Checkbox</dfn> state</dt>

   <dd><p>The element <a href=#represents>represents</a> a state or option that can be toggled.</dd>

   <dt>The <dfn id=attr-menuitem-type-state-radio title=attr-menuitem-type-state-radio>Radio</dfn> state</dt>

   <dd><p>The element <a href=#represents>represents</a> a selection of one item from a list of items.</dd>

  </dl><p>The <dfn id=attr-menuitem-label title=attr-menuitem-label><code>label</code></dfn> attribute gives the name of the
  command, as shown to the user. The <code title=attr-menuitem-label><a href=#attr-menuitem-label>label</a></code> attribute must
  be specified if the element is in the <a href=#explicit-command>explicit command</a> mode. If the attribute is
  specified, it must have a value that is not the empty string.</p>

  <p>The <dfn id=attr-menuitem-icon title=attr-menuitem-icon><code>icon</code></dfn> attribute gives a picture that
  represents the command. If the attribute is specified, the attribute's value must contain a
  <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>. <span class=impl>To obtain
  the <a href=#absolute-url>absolute URL</a> of the icon when the attribute's value is not the empty string, the
  attribute's value must be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element.
  When the attribute is absent, or its value is the empty string, or <a href=#resolve-a-url title="resolve a
  url">resolving</a> its value fails, there is no icon.</span></p> <!-- this is affected by the
  base URL being changed, so users of this should cache the image once they've fetched it once, at
  least until the relative url changes again -->

  <p>The <dfn id=attr-menuitem-disabled title=attr-menuitem-disabled><code>disabled</code></dfn> attribute is a
  <a href=#boolean-attribute>boolean attribute</a> that, if present, indicates that the command is not available in
  the current state.</p>

  <p class=note>The distinction between <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> and
  <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> is subtle. A command would be disabled if, in the same
  context, it could be enabled if only certain aspects of the situation were changed. A command
  would be marked as hidden if, in that situation, the command will never be enabled. For example,
  in the context menu for a water faucet, the command "open" might be disabled if the faucet is
  already open, but the command "eat" would be marked hidden since the faucet could never be
  eaten.</p>

  <p>The <dfn id=attr-menuitem-checked title=attr-menuitem-checked><code>checked</code></dfn> attribute is a <a href=#boolean-attribute>boolean
  attribute</a> that, if present, indicates that the command is selected. The attribute must be
  omitted unless the <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is in either the <a href=#attr-menuitem-type-state-checkbox title=attr-menuitem-type-state-checkbox>Checkbox</a> state or the <a href=#attr-menuitem-type-state-radio title=attr-menuitem-type-state-radio>Radio</a> state.</p>

  <p>The <dfn id=attr-menuitem-radiogroup title=attr-menuitem-radiogroup><code>radiogroup</code></dfn> attribute gives the
  name of the group of commands that will be toggled when the command itself is toggled, for
  commands whose <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute has the value "<code title="">radio</code>". The scope of the name is the child list of the parent element. The
  attribute must be omitted unless the <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is in
  the <a href=#attr-menuitem-type-state-radio title=attr-menuitem-type-state-radio>Radio</a> state. When specified, the
  attribute's value must be a non-empty string.</p>

  <hr><p>If a <code><a href=#the-menuitem-element>menuitem</a></code> element <var title="">slave</var> has a <dfn id=attr-menuitem-command title=attr-menuitem-command><code>command</code></dfn> attribute, and there is an element in <var title="">slave</var>'s <a href=#home-subtree>home subtree</a>
  whose <a href=#concept-id title=concept-id>ID</a> has a value equal to the value of <var title="">slave</var>'s <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute, and the first
  such element in <a href=#tree-order>tree order</a>, hereafter <var title="">master</var>, itself <a href=#concept-command title=concept-command>defines a command</a> and either is not a <code><a href=#the-menuitem-element>menuitem</a></code> element
  or does not itself have a <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute, then the
  <dfn id=master-command>master command</dfn> of <var title="">slave</var> is <var title="">master</var>.</p>

  <p>A <code><a href=#the-menuitem-element>menuitem</a></code> element with a <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute must have a
  <a href=#master-command>master command</a>.</p>

  <p class=note>This effectively defines the syntax of the attribute's value as being the ID of
  another element that <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <hr><p>The <dfn id=attr-menuitem-title title=attr-menuitem-title><code>title</code></dfn> attribute gives a hint describing
  the command, which might be shown to the user to help him.</p>

  <p>The <dfn id=attr-menuitem-default title=attr-menuitem-default><code>default</code></dfn> attribute indicates, if
  present, that the command is the one that would have been invoked if the user had directly
  activated the menu's subject instead of using the menu. The <code title=attr-menuitem-default><a href=#attr-menuitem-default>default</a></code> attribute is a <a href=#boolean-attribute>boolean attribute</a>.</p>

  <div class=example>

   <p>In this trivial example, a submit button is given a context menu that has two options, one to
   reset the form, and one to submit the form. The submit command is marked as being the default.</p>

   <pre>&lt;form action="dosearch.pl"&gt;
 &lt;p&gt;&lt;label&gt;Enter search terms: &lt;input type="text" name="terms"&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;input type=submit contextmenu=formmenu id="submitbutton"&gt;&lt;/p&gt;
 &lt;p hidden&gt;&lt;input type=reset id="resetbutton"&gt;&lt;/p&gt;
 &lt;menu type=popup id=formmenu&gt;
  &lt;menuitem command="submitbutton" default&gt;
  &lt;menuitem command="resetbutton"&gt;
 &lt;/menu&gt;
&lt;/form&gt;</pre>

  </div>

  <div class=impl>

  <hr><p>The <dfn id=dom-menuitem-type title=dom-menuitem-type><code>type</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values>limited to only known
  values</a>.</p>

  <p>The <dfn id=dom-menuitem-label title=dom-menuitem-label><code>label</code></dfn>, <dfn id=dom-menuitem-icon title=dom-menuitem-icon><code>icon</code></dfn>, <dfn id=dom-menuitem-disabled title=dom-menuitem-disabled><code>disabled</code></dfn>, <dfn id=dom-menuitem-checked title=dom-menuitem-checked><code>checked</code></dfn>, and <dfn id=dom-menuitem-radiogroup title=dom-menuitem-radiogroup><code>radiogroup</code></dfn>, and <dfn id=dom-menuitem-default title=dom-menuitem-default><code>default</code></dfn> IDL attributes must <a href=#reflect>reflect</a>
  the respective content attributes of the same name.</p>

  <p>The <dfn id=dom-menuitem-command title=dom-menuitem-command><code>command</code></dfn> IDL attribute must return the
  <a href=#master-command>master command</a>, if any, or null otherwise.</p>

  <hr><p>If the element's <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> is false
  (enabled) then the element's <a href=#activation-behavior>activation behavior</a> depends on the element's <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> and <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code>
  attributes, as follows:</p>

  <dl class=switch><dt>If the element has a <a href=#master-command>master command</a> set by its <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute</dt>

   <dd><p>The user agent must <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the element's
   <a href=#master-command>master command</a>.</dd>
   <!-- we know it has a defined <span>activation behavior</span> if we get here -->


   <dt>If the <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is in the <a href=#attr-menuitem-type-state-checkbox title=attr-menuitem-type-state-checkbox>Checkbox</a> state</dt>

   <dd><p>If the element has a <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute, the UA
   must remove that attribute. Otherwise, the UA must add a <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute, with the literal value <code title="">checked</code>.</dd>


   <dt>If the <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is in the <a href=#attr-menuitem-type-state-radio title=attr-menuitem-type-state-radio>Radio</a> state</dt>

   <dd><p>If the element has a parent, then the UA must walk the list of child nodes of that parent
   element, and for each node that is a <code><a href=#the-menuitem-element>menuitem</a></code> element, if that element has a <code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code> attribute whose value exactly matches the
   current element's (treating missing <code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code>
   attributes as if they were the empty string), and has a <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute, must remove that attribute.</p>

   <p>Then, the element's <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute must be set
   to the literal value <code title="">checked</code>.</dd>


   <dt>Otherwise</dt>

   <dd><p>The element's <a href=#activation-behavior>activation behavior</a> is to do nothing.</dd>

  </dl><p class=note>Firing a synthetic <code title=event-click><a href=#event-click>click</a></code> event at the element
  does not cause any of the actions described above to happen.</p>

  <!-- v2COMMAND: Expose the Triggers facet again. -->

  <p>If the element's <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> is true
  (disabled) then the element has no <a href=#activation-behavior>activation behavior</a>.</p>

  </div>

  <p class=note>The <code><a href=#the-menuitem-element>menuitem</a></code> element is not rendered except as <a href=#the-menu-element title=menu>part of a popup menu</a>.</p>

  <div class=example>

   <p>Here is an example of a pop-up menu button with three options that let the user toggle between
   left, center, and right alignment. One could imagine such a toolbar as part of a text editor. The
   menu also has a separator followed by another menu item labeled "Publish", though that menu item
   is disabled.</p>

   <pre>&lt;button type=menu menu=editmenu&gt;Commands...&lt;/button&gt;
&lt;menu type="popup" id="editmenu"&gt;
 &lt;menuitem type="radio" radiogroup="alignment" checked="checked"
          label="Left" icon="icons/alL.png" onclick="setAlign('left')"&gt;
 &lt;menuitem type="radio" radiogroup="alignment"
          label="Center" icon="icons/alC.png" onclick="setAlign('center')"&gt;
 &lt;menuitem type="radio" radiogroup="alignment"
          label="Right" icon="icons/alR.png" onclick="setAlign('right')"&gt;
 &lt;hr&gt;
 &lt;menuitem type="command" disabled
          label="Publish" icon="icons/pub.png" onclick="publish()"&gt;
&lt;/menu&gt;</pre>

  </div>


  <h4 id=context-menus><span class=secno>4.11.5 </span>Context menus</h4>

  <h5 id=declaring-a-context-menu><span class=secno>4.11.5.1 </span>Declaring a context menu</h5>

  <p>The <dfn id=attr-contextmenu title=attr-contextmenu><code>contextmenu</code></dfn> attribute gives the element's
  context menu. The value must be the <a href=#concept-id title=concept-id>ID</a> of a <code><a href=#the-menu-element>menu</a></code>
  element in the same <a href=#home-subtree>home subtree</a> whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code>
  attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state.</p>

  <p class=note>When a user right-clicks on an element with a <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute, the user agent will first fire a <code title=event-contextmenu>contextmenu</code> event at the element, and then, if that event is not
  canceled, a <code title=event-show>show</code> event at the <code><a href=#the-menu-element>menu</a></code> element.</p>

  <div class=example>

   <p>Here is an example of a context menu for an input control:</p>

   <pre>&lt;form name="npc"&gt;
 &lt;label&gt;Character name: &lt;input name=char type=text contextmenu=namemenu required&gt;&lt;/label&gt;
 &lt;menu type=popup id=namemenu&gt;
  &lt;menuitem label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()"&gt;
  &lt;menuitem label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)"&gt;
 &lt;/menu&gt;
&lt;/form&gt;</pre>

   <p>This adds two items to the control's context menu, one called "Pick random name", and one
   called "Prefill other fields based on name". They invoke scripts that are not shown in the
   example above.</p>

  </div>



  <div class=impl>

  <h5 id=processing-model-2><span class=secno>4.11.5.2 </span>Processing model</h5>

  <p>Each element has an <dfn id=assigned-context-menu>assigned context menu</dfn>, which can be null. If an element <var title="">A</var> has a <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute, and there is
  an element with the ID given by <var title="">A</var>'s <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute's value in <var title="">A</var>'s
  <a href=#home-subtree>home subtree</a>, and the first such element in <a href=#tree-order>tree order</a> is a
  <code><a href=#the-menu-element>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state, then <var title="">A</var>'s <a href=#assigned-context-menu>assigned
  context menu</a> is that element. Otherwise, if <var title="">A</var> has a parent element,
  then <var title="">A</var>'s <a href=#assigned-context-menu>assigned context menu</a> is the <a href=#assigned-context-menu>assigned context
  menu</a> of its parent element. Otherwise, <var title="">A</var>'s <a href=#assigned-context-menu>assigned context
  menu</a> is null.</p>

  <p>When an element's context menu is requested (e.g. by the user right-clicking the element, or
  pressing a context menu key), the user agent must apply the appropriate rules from the following
  list:</p>

  <dl class=switch><dt>If the user requested a context menu using a pointing device</dt>

   <dd><p>The user agent must <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-contextmenu>contextmenu</code>, that bubbles and is cancelable, and that uses the
   <code><a href=#mouseevent>MouseEvent</a></code> interface, at the element for which the menu was requested. The context
   information of the event must be initialized to the same values as the last
   <code><a href=#mouseevent>MouseEvent</a></code> user interaction event that was fired as part of the gesture that
   was interpreted as a request for the context menu.</dd>

   <dt>Otherwise</dt>

   <dd><p>The user agent must <a href=#fire-a-synthetic-mouse-event title="fire a synthetic mouse event">fire a synthetic mouse
   event named <code title=event-contextmenu>contextmenu</code></a> that bubbles and is
   cancelable at the element for which the menu was requested.</dd>

  </dl><p class=note>Typically, therefore, the firing of the <code title=event-contextmenu>contextmenu</code> event will be the default action of a <code title=mouseup>mouseup</code> or <code title=event-keyup>keyup</code> event. The exact sequence
  of events is UA-dependent, as it will vary based on platform conventions.</p>

  <p>The default action of the <code title=event-contextmenu>contextmenu</code> event depends on
  whether or not the element for which the menu was requested has a non-null <a href=#assigned-context-menu>assigned context
  menu</a> when the event dispatch has completed, as follows.</p>

  <p>If the <a href=#assigned-context-menu>assigned context menu</a> of the element for which the menu was requested is
  null, the default action must be for the user agent to show its default context menu, if it has
  one.</p>

  <p>Otherwise, let <var title="">subject</var> be the element for which the menu was requested, and
  let <var title="">menu</var> be the <a href=#assigned-context-menu>assigned context menu</a> of <var title="">target</var> immediately after the <code title=event-contextmenu>contextmenu</code>
  event's dispatch has completed. The user agent must <a href=#concept-event-fire title=concept-event-fire>fire</a> a
  <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-show>show</code> at <var title="">menu</var>, using the <code><a href=#relatedevent>RelatedEvent</a></code>
  interface, with the <code title=dom-RelatedEvent-relatedTarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute
  initialized to <var title="">subject</var>. The event must be cancelable. <!-- v2: include
  modifier key information --></p>

  <p>If <em>this</em> event (the <code title=event-show>show</code> event) is not canceled, then
  the user agent must <a href=#construct-and-show-a-menu title="construct and show a menu">construct and show</a> the menu for
  <var title="">menu</var> with <var title="">subject</var> as the subject.</p>

  <p>The user agent may also provide access to its default context menu, if any, with the context
  menu shown. For example, it could merge the menu items from the two menus together, or provide the
  page's context menu as a submenu of the default menu. In general, user agents are encouraged to
  de-emphasize their own contextual menu items, so as to give the author's context menu the
  appearance of legitimacy &mdash; to allow documents to feel like "applications" rather than "mere
  Web pages".</p>

  <p>User agents may provide means for bypassing the context menu processing model, ensuring that
  the user can always access the UA's default context menus. For example, the user agent could
  handle right-clicks that have the Shift key depressed in such a way that it does not fire the
  <code title=event-contextmenu>contextmenu</code> event and instead always shows the default
  context menu.</p>

  <hr><p>The <dfn id=dom-contextmenu title=dom-contextMenu><code>contextMenu</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> content attribute.</p>

  </div>

  <div class=example>

   <p>In this example, an image of cats is given a context menu with four possible commands:</p>

   <pre>&lt;img src="cats.jpeg" alt="Cats" contextmenu=catsmenu&gt;
&lt;menu type="popup" id="catsmenu"&gt;
 &lt;menuitem label="Pet the kittens" onclick="kittens.pet()"&gt;
 &lt;menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()"&gt;
 &lt;menu label="Feed the kittens"&gt;<!-- note: contents of this submenu aren't visible in the pictures below -->
  &lt;menuitem label="Fish" onclick="kittens.feed(fish)"&gt;
  &lt;menuitem label="Chicken" onclick="kittens.feed(chicken)"&gt;
 &lt;/menu&gt;
&lt;/menu&gt;</pre>

   <p>When a user of a mouse-operated visual Web browser right-clicks on the image, the browser
   might pop up a context menu like this:</p>

   <p><img src=http://images.whatwg.org/contextmenu-collapsed.png alt="A context menu, shown over a picture of cats, with four lines: the first two offering the menu items described in the markup above ('Pet the kittens' and 'Cuddle with the kittens'), the third giving a submenu labeled 'Feed the kittens', and the fourth, after a horizontal splitter, consisting of only a downwards-pointing disclosure triangle."><p>When the user clicks the disclosure triangle, such a user agent would expand the context menu
   in place, to show the browser's own commands:</p>

   <p><img src=http://images.whatwg.org/contextmenu-expanded.png alt="This would result in the same basic interface, but with a longer menu; the disclosure triangle having been replaced by items such as 'View Image', 'Copy Image', 'Copy Image Location', and so forth."></div>


  <h5 id=event-definitions-0><span class=secno>4.11.5.3 </span>Event definitions</h5>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#relatedeventinit>RelatedEventInit</a> eventInitDict)]
interface <dfn id=relatedevent>RelatedEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute <a href=#eventtarget>EventTarget</a>? <a href=#dom-relatedevent-relatedtarget title=dom-RelatedEvent-relatedTarget>relatedTarget</a>;
};

dictionary <dfn id=relatedeventinit>RelatedEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  <a href=#eventtarget>EventTarget</a>? relatedTarget;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-RelatedEvent-relatedTarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code></dt>

   <dd>

    <p>Returns the other event target involved in this event. For example, when a <code title=event-show>show</code> event fires on a <code><a href=#the-menu-element>menu</a></code> element, the other event
    target involved in the event would be the element for which the menu is being shown.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-relatedevent-relatedtarget title=dom-RelatedEvent-relatedTarget><code>relatedTarget</code></dfn> attribute must
  return the value it was initialized to. When the object is created, this attribute must be
  initialized to null. It represents the other event target that is related to the event.</p>

  </div>




  <h4 id=commands><span class=secno>4.11.6 </span>Commands</h4>

  <h5 id=facets-0><span class=secno>4.11.6.1 </span>Facets</h5>

  <p>A <dfn id=concept-command title=concept-command>command</dfn> is the abstraction
  behind menu items, buttons, and links. Once a command is defined,
  other parts of the interface can refer to the same command, allowing
  many access points to a single feature to share facets such as the
  <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a>.</p>

  <p id=facets>Commands are defined to have the following
  <dfn id=concept-facet title=concept-facet>facets</dfn>:</p>

  <dl><dt><dfn id=command-facet-type title=command-facet-Type>Type</dfn></dt>

   <dd>The kind of command: "command", meaning it is a normal command;
   "radio", meaning that triggering the command will, amongst other
   things, set the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked
   State</a> to true (and probably uncheck some other commands); or
   "checkbox", meaning that triggering the command will, amongst other
   things, toggle the value of the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>.</dd>

   <dt><dfn id=command-facet-id title=command-facet-ID>ID</dfn></dt>

   <dd>The name of the command, for referring to the command from the
   markup or from script. If a command has no ID, it is an
   <dfn id=anonymous-command>anonymous command</dfn>.</dd>

   <dt><dfn id=command-facet-label title=command-facet-Label>Label</dfn></dt>

   <dd>The name of the command as seen by the user.</dd>

   <dt><dfn id=command-facet-hint title=command-facet-Hint>Hint</dfn></dt>

   <dd>A helpful or descriptive string that can be shown to the
   user.</dd>

   <dt><dfn id=command-facet-icon title=command-facet-Icon>Icon</dfn></dt>

   <dd>An <a href=#absolute-url>absolute URL</a> identifying a graphical image that
   represents the action. A command might not have an Icon.</dd> <!--
   changing base URLs might change the icon -->

   <dt><dfn id=command-facet-accesskey title=command-facet-AccessKey>Access Key</dfn></dt>

   <dd>A key combination selected by the user agent that triggers the
   command. A command might not have an Access Key.</dd>

   <dt><dfn id=command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</dfn></dt>

   <dd>Whether the command is hidden or not (basically, whether it
   should be shown in menus).</dd>

   <dt><dfn id=command-facet-disabledstate title=command-facet-DisabledState>Disabled State</dfn></dt>

   <dd>Whether the command is relevant and can be triggered or not.</dd>

   <dt><dfn id=command-facet-checkedstate title=command-facet-CheckedState>Checked State</dfn></dt>

   <dd>Whether the command is checked or not.</dd>

   <dt><dfn id=command-facet-action title=command-facet-Action>Action</dfn></dt>

   <dd>The actual effect that triggering the command will have. This
   could be a scripted event handler, a <a href=#url>URL</a> to which to
   <a href=#navigate>navigate</a>, or a form submission.</dd>

<!-- v2COMMAND
   <dt><dfn title="command-facet-Triggers">Triggers</dfn></dt>

   <dd>The list of elements that can trigger the command. The element
   defining a command is always in the list of elements that can
   trigger the command. For anonymous commands, only the element
   defining the command is on the list, since other elements have no
   way to refer to it.</dd>
-->

  </dl><!--TOPIC:DOM APIs--><p>These facets are exposed on elements using the <dfn id=command-api>command
  API</dfn>:</p>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-command-ro-commandType><a href=#dom-command-ro-commandtype>commandType</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-type title=command-facet-Type>Type</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-Element-id><a href=#dom-element-id>id</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-id title=command-facet-ID>ID</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-command-ro-commandLabel><a href=#dom-command-ro-commandlabel>commandLabel</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-label title=command-facet-Label>Label</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-title><a href=#dom-title>title</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-command-ro-commandIcon><a href=#dom-command-ro-commandicon>commandIcon</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-icon title=command-facet-Icon>Icon</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-accesskey title=command-facet-AccessKey>Access Key</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-command-ro-commandHidden><a href=#dom-command-ro-commandhidden>commandHidden</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-command-ro-commandDisabled><a href=#dom-command-ro-commanddisabled>commandDisabled</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-command-ro-commandChecked><a href=#dom-command-ro-commandchecked>commandChecked</a></code></dt>

   <dd>

    <p>Exposes the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> facet of the command.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-click><a href=#dom-click>click</a></code>()</dt>

   <dd>

    <p>Triggers the <a href=#command-facet-action title=command-facet-Action>Action</a> of the command.</p>

   </dd>

<!--v2COMMAND
   <dt><var title="">element</var> . <code title="dom-command-ro-commandTriggers">commandTriggers</code></dt>

   <dd>

    <p>Exposes the <span title="command-facet-Triggers">Triggers</span> facet of the command.</p>

   </dd>
-->

  </dl><div class=impl>

  <p>The <dfn id=dom-command-ro-commandtype title=dom-command-ro-commandType><code>commandType</code></dfn>
  attribute must return a string whose value is either "<code title="">command</code>", "<code title="">radio</code>", or "<code title="">checkbox</code>", depending on whether the <a href=#command-facet-type title=command-facet-Type>Type</a> of the command defined by the
  element is "command", "radio", or "checkbox" respectively. If the
  element does not define a command, it must return null.</p>

  <p>The <dfn id=dom-command-ro-commandlabel title=dom-command-ro-commandLabel><code>commandLabel</code></dfn>
  attribute must return the command's <a href=#command-facet-label title=command-facet-Label>Label</a>, or null if the element
  does not define a command or does not specify a <a href=#command-facet-label title=command-facet-Label>Label</a>.</p>

  <p>The <dfn id=dom-command-ro-commandicon title=dom-command-ro-commandIcon><code>commandIcon</code></dfn>
  attribute must return the <a href=#absolute-url>absolute URL</a> of the command's
  <a href=#command-facet-icon title=command-facet-Icon>Icon</a>. If the element does
  not specify an icon, or if the element does not define a command,
  then the attribute must return null.</p>

  <p>The <dfn id=dom-command-ro-commandhidden title=dom-command-ro-commandHidden><code>commandHidden</code></dfn>
  attribute must return true if the command's <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> is that the
  command is hidden, and false if the command is not hidden. If the
  element does not define a command, the attribute must return
  null.</p>

  <p>The <dfn id=dom-command-ro-commanddisabled title=dom-command-ro-commandDisabled><code>commandDisabled</code></dfn>
  attribute must return true if the command's <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> is that
  the command is disabled, and false if the command is not disabled.
  This attribute is not affected by the command's <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>. If the
  element does not define a command, the attribute must return
  null.</p>

  <p>The <dfn id=dom-command-ro-commandchecked title=dom-command-ro-commandChecked><code>commandChecked</code></dfn>
  attribute must return true if the command's <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> is that the
  command is checked, and false if it is that the command is not
  checked. If the element does not define a command, the attribute
  must return null.</p>

<!--v2COMMAND
  <p>The <dfn
  title="dom-command-ro-commandTriggers"><code>commandTriggers</code></dfn>
  attribute must return a list containing the elements that can
  trigger the command (the command's <span
  title="command-facet-Triggers">Triggers</span>). The list must be
  <span>live</span>. The same object must be returned each time. While
  the element does not define a command, the list must be empty.</p>
-->

  <p class=note>The <a href=#command-facet-id title=command-facet-ID>ID</a> facet
  is exposed by the <code title=dom-Element-id><a href=#dom-element-id>id</a></code> IDL attribute, the
  <a href=#command-facet-hint title=command-facet-Hint>Hint</a> facet is exposed by the
  <code title=dom-title><a href=#dom-title>title</a></code> IDL attribute, and the <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> facet is exposed by
  the <code title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL
  attribute.</p>

  </div>

  <hr><dl class=domintro><dt><var title="">document</var> . <code title=dom-document-commands><a href=#dom-document-commands>commands</a></code></dt>
   <dd>
    <p>Returns an <code><a href=#htmlcollection>HTMLCollection</a></code> of the elements in the
    <code><a href=#document>Document</a></code> that define commands and have IDs.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-commands title=dom-document-commands><code>commands</code></dfn> attribute
  of the document's <code><a href=#document>Document</a></code> interface must return an
  <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code><a href=#document>Document</a></code>
  node, whose filter matches only elements that <a href=#concept-command title=concept-command>define commands</a> and have <a href=#command-facet-id title=command-facet-ID>IDs</a>.</p>

  </div>
<!--TOPIC:HTML-->

  <hr><p id=expose-commands-in-ui>User agents may expose the <a href=#concept-command title=concept-command>commands</a> that match the following criteria:</p>

  <ul class=brief><li>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> facet is false (visible)</li>

   <li>The element is <a href=#in-a-document>in a <code>Document</code></a> that has an associated <a href=#browsing-context>browsing
   context</a>.</li>

   <li>Neither the element nor any of its ancestors has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>
   attribute specified.</li>

   <li>The element is not a <code><a href=#the-menuitem-element>menuitem</a></code> element, or it is a child of a <a href=#currently-relevant-menu-element>currently
   relevant <code>menu</code> element</a>, or it has an <a href=#command-facet-accesskey title=command-facet-accesskey>Access Key</a>.</li>

  </ul><p>User agents are encouraged to do this especially for commands that have <a href=#command-facet-accesskey title=command-facet-AccessKey>Access Keys</a>, as a way to advertise those keys to the
  user.</p>

  <p class=example>For example, such commands could be listed in the user agent's menu bar.</p>


  <div class=impl>

  <h5 id=using-the-a-element-to-define-a-command><span class=secno>4.11.6.2 </span><dfn title=a-command>Using the <code>a</code> element to define a command</dfn></h5>

  <p>An <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
  is "command".</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
  the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
  element, if the attribute is present and not empty. Otherwise the
  command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
  is the string given by the element's <code><a href=#textcontent>textContent</a></code> IDL
  attribute.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
  is the value of the <code title=attr-title><a href=#attr-title>title</a></code> attribute
  of the element. If the attribute is not present, the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> is the empty string.</p>

  <p>The <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the command
  is the <a href=#absolute-url>absolute URL</a> obtained from <a href=#resolve-a-url title="resolve
  a url">resolving</a> the value of the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of the first
  <code><a href=#the-img-element>img</a></code> element descendant of the element in <a href=#tree-order>tree
  order</a>, relative to that element, if there is such an element
  and resolving its attribute is successful. Otherwise, there is no
  <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
  command is the element's <a href=#assigned-access-key>assigned access key</a>, if
  any.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
  of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
  otherwise.</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
  State</a> facet of the command is true if the element or one of
  its ancestors is <a href=#inert>inert</a>, and false otherwise.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
  of the command is always false. (The command is never checked.)</p>

  <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
  command, if the element has a defined <a href=#activation-behavior>activation
  behavior</a>, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
  steps</a> on the element. Otherwise, it is just to <a href=#fire-a-click-event>fire a
  <code title=event-click>click</code> event</a> at the
  element.</p>


  <h5 id=using-the-button-element-to-define-a-command><span class=secno>4.11.6.3 </span><dfn title=button-command>Using the <code>button</code> element to define a command</dfn></h5>

  <p>A <code><a href=#the-button-element>button</a></code> element always <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a>, <a href=#command-facet-id title=command-facet-ID>ID</a>, <a href=#command-facet-label title=command-facet-Label>Label</a>, <a href=#command-facet-hint title=command-facet-Hint>Hint</a>, <a href=#command-facet-icon title=command-facet-Icon>Icon</a>, <a href=#command-facet-accesskey title=command-facet-AccessKey>Access Key</a>, <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>, <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>, and <a href=#command-facet-action title=command-facet-Action>Action</a> facets of the command are
  determined <a href=#using-the-a-element-to-define-a-command title=a-command>as for <code>a</code>
  elements</a> (see the previous section).</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
  State</a> of the command is true if the element or one of its
  ancestors is <a href=#inert>inert</a>, or if the element's <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> state is set, and false
  otherwise.</p>


  <h5 id=using-the-input-element-to-define-a-command><span class=secno>4.11.6.4 </span><dfn title=input-command>Using the <code>input</code> element to define a command</dfn></h5>

  <p>An <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a>, <a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset Button</a>, <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a>, <a href="#button-state-(type=button)" title=attr-input-type-button>Button</a>, <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a>, or <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> states <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
  is "radio" if the <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio
  Button</a> state, "checkbox" if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state, and
  "command" otherwise.</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
  the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
  element, if the attribute is present and not empty. Otherwise the
  command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
  depends on the Type of the command:</p>

  <p>If the <a href=#command-facet-type title=command-facet-Type>Type</a> is "command",
  then it is the string given by the <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if any, and a
  UA-dependent, locale-dependent value that the UA uses to label the
  button itself if the attribute is absent.</p>

  <p>Otherwise, the <a href=#command-facet-type title=command-facet-Type>Type</a> is
  "radio" or "checkbox". If the element is a <a href=#labeled-control>labeled
  control</a>, the <code><a href=#textcontent>textContent</a></code> of the first
  <code><a href=#the-label-element>label</a></code> element in <a href=#tree-order>tree order</a> whose
  <a href=#labeled-control>labeled control</a> is the element in question is the <a href=#command-facet-label title=command-facet-Label>Label</a> (in DOM terms, this is the
  string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise,
  the value of the <code title=attr-input-value><a href=#attr-input-value>value</a></code>
  attribute, if present, is the <a href=#command-facet-label title=command-facet-Label>Label</a>. Otherwise, the <a href=#command-facet-label title=command-facet-Label>Label</a> is the empty string.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command
  is the value of the <code title=attr-title><a href=#attr-title>title</a></code> attribute
  of the <code><a href=#the-input-element>input</a></code> element. If the attribute is not present, the
  <a href=#command-facet-hint title=command-facet-Hint>Hint</a> is the empty
  string.</p>

  <p>If the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image
  Button</a> state, and the element has a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, and that attribute's
  value can be successfully <a href=#resolve-a-url title="resolve a
  url">resolved</a> relative to the element, then the <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the command is the
  <a href=#absolute-url>absolute URL</a> obtained from resolving that attribute
  that way. Otherwise, there is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
  command is the element's <a href=#assigned-access-key>assigned access key</a>, if
  any.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
  of the command is true (hidden) if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false
  otherwise.</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
  State</a> of the command is true if the element or one of its
  ancestors is <a href=#inert>inert</a>, or if the element's <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> state is set, and false
  otherwise.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a>
  of the command is true if the command is of <a href=#command-facet-type title=command-facet-Type>Type</a> "radio" or "checkbox" and the
  element is <a href=#concept-fe-checked title=concept-fe-checked>checked</a>
  attribute, and false otherwise.</p>

  <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
  command, if the element has a defined <a href=#activation-behavior>activation
  behavior</a>, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
  steps</a> on the element. Otherwise, it is just to <a href=#fire-a-click-event>fire a
  <code title=event-click>click</code> event</a> at the
  element.</p>


  <h5 id=using-the-option-element-to-define-a-command><span class=secno>4.11.6.5 </span><dfn title=option-command>Using the <code>option</code> element to define a command</dfn></h5>

  <p>An <code><a href=#the-option-element>option</a></code> element with an ancestor <code><a href=#the-select-element>select</a></code> element and either no <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute or a <code title=attr-option-value><a href=#attr-option-value>value</a></code>
  attribute that is not the empty string <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command is "radio" if the
  <code><a href=#the-option-element>option</a></code>'s nearest ancestor <code><a href=#the-select-element>select</a></code> element has no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute, and "checkbox" if it does.</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
  Otherwise the command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command is the value of the
  <code><a href=#the-option-element>option</a></code> element's <code title=attr-option-label><a href=#attr-option-label>label</a></code> attribute, if there is
  one, or else the value of <code><a href=#the-option-element>option</a></code> element's <code><a href=#textcontent>textContent</a></code> IDL attribute,
  with <a href=#strip-leading-and-trailing-whitespace title="strip leading and trailing whitespace">leading and trailing whitespace
  stripped</a>, and with any sequences of two or more <a href=#space-character title="space character">space
  characters</a> replaced by a single U+0020 SPACE character.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the string given by the
  element's <code title=attr-title><a href=#attr-title>title</a></code> attribute, if any, and the empty string if the
  attribute is absent.</p>

  <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the command is the element's
  <a href=#assigned-access-key>assigned access key</a>, if any.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> of the command is true (hidden)
  if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> of the command is true if
  the element is <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, or if its nearest ancestor
  <code><a href=#the-select-element>select</a></code> element is <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, or if it or one
  of its ancestors is <a href=#inert>inert</a>, and false otherwise.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the command is true
  (checked) if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true,
  and false otherwise.</p>

  <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the command depends on its <a href=#command-facet-type title=command-facet-Type>Type</a>. If the command is of <a href=#command-facet-type title=command-facet-Type>Type</a> "radio" then it must <a href=#concept-select-pick title=concept-select-pick>pick</a> the <code><a href=#the-option-element>option</a></code> element. Otherwise, it must <a href=#concept-select-toggle title=concept-select-toggle>toggle</a> the <code><a href=#the-option-element>option</a></code> element.</p>



  <h5 id=using-the-menuitem-element-to-define-a-command><span class=secno>4.11.6.6 </span>Using the <dfn title=command-element><code>menuitem</code></dfn> element to define a
  command</h5>

  <p>A <code><a href=#the-menuitem-element>menuitem</a></code> element that does not have a <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute <a href=#concept-command title=concept-command>defines a
  command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command is "radio" if the
  <code><a href=#the-menuitem-element>menuitem</a></code>'s <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is
  "<code>radio</code>", "checkbox" if the attribute's value is "<code>checkbox</code>", and
  "command" otherwise.</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
  Otherwise the command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command is the value of the element's
  <code title=attr-menuitem-label><a href=#attr-menuitem-label>label</a></code> attribute, if there is one, or the empty string if
  it doesn't.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the string given by the
  element's <code title=attr-menuitem-title><a href=#attr-menuitem-title>title</a></code> attribute, if any, and the empty string
  if the attribute is absent.</p>

  <p>The <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command is the <a href=#absolute-url>absolute
  URL</a> obtained from <a href=#resolve-a-url title="resolve a url">resolving</a> the value of the element's
  <code title=attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code> attribute, relative to the element, if it has such an
  attribute and resolving it is successful. Otherwise, there is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the command is the element's
  <a href=#assigned-access-key>assigned access key</a>, if any.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> of the command is true (hidden)
  if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> of the command is true if
  the element or one of its ancestors is <a href=#inert>inert</a>, or if the element has a <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute, and false otherwise.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the command is true
  (checked) if the element has a <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute, and
  false otherwise.</p>

  <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the command, if the element has a
  defined <a href=#activation-behavior>activation behavior</a><!-- it doesn't if the element is disabled -->, is to
  <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the element. Otherwise, it is just to
  <a href=#fire-a-click-event>fire a <code title=event-click>click</code> event</a> at the element.</p>



  <h5 id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly><span class=secno>4.11.6.7 </span><dfn title=command-menuitem-command>Using the <code title=attr-menuitem-command>command</code> attribute on <code>menuitem</code> elements to define
  a command indirectly</dfn></h5>

  <p>A <code><a href=#the-menuitem-element>menuitem</a></code> element with a <a href=#master-command>master command</a> <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command is the <a href=#command-facet-type title=command-facet-Type>Type</a> of the <a href=#master-command>master command</a>.</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
  Otherwise the command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command is the <a href=#command-facet-label title=command-facet-Label>Label</a> of the <a href=#master-command>master command</a>.</p>

  <p>If the element has a <code title=attr-title><a href=#attr-title>title</a></code> attribute, then the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the value of that <code title=attr-title><a href=#attr-title>title</a></code> attribute. Otherwise, the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the <a href=#master-command>master command</a>.</p>

  <p>The <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the command is the <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the <a href=#master-command>master command</a>.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the command is the element's
  <a href=#assigned-access-key>assigned access key</a>, if any.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> of the command is the <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> of the <a href=#master-command>master command</a>.</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> of the command is the <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> of the <a href=#master-command>master command</a>.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the command is the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the <a href=#master-command>master command</a>.</p>

  <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the command is to invoke the <a href=#command-facet-action title=command-facet-Action>Action</a> of the <a href=#master-command>master command</a>.</p>



  <h5 id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.6.8 </span><dfn title=label-command>Using the <code title=attr-accesskey>accesskey</code> attribute
  on a <code>label</code> element to define a command</dfn></h5>

  <p>A <code><a href=#the-label-element>label</a></code> element that has an <a href=#assigned-access-key>assigned access key</a> and a <a href=#labeled-control>labeled
  control</a> and whose <a href=#labeled-control>labeled control</a> <a href=#concept-command title=concept-command>defines a
  command</a>, itself <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command is "command".</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
  Otherwise the command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command is the string given by the
  element's <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the value of the <code title=attr-title><a href=#attr-title>title</a></code> attribute of the element.</p>

  <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the command is the element's
  <a href=#assigned-access-key>assigned access key</a>.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>, <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a>, and <a href=#command-facet-action title=command-facet-Action>Action</a> facets of the command are the same as the respective
  facets of the element's <a href=#labeled-control>labeled control</a>.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the command is always
  false. (The command is never checked.)</p>



  <h5 id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.6.9 </span><dfn title=legend-command>Using the <code title=attr-accesskey>accesskey</code> attribute
  on a <code>legend</code> element to define a command</dfn></h5>

  <p>A <code><a href=#the-legend-element>legend</a></code> element that has an <a href=#assigned-access-key>assigned access key</a> and is a child of a
  <code><a href=#the-fieldset-element>fieldset</a></code> element that has a descendant that is not a descendant of the
  <code><a href=#the-legend-element>legend</a></code> element and is neither a <code><a href=#the-label-element>label</a></code> element nor a <code><a href=#the-legend-element>legend</a></code>
  element but that <a href=#concept-command title=concept-command>defines a command</a>, itself <a href=#concept-command title=concept-command>defines a command</a>.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command is "command".</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
  Otherwise the command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command is the string given by the
  element's <code><a href=#textcontent>textContent</a></code> IDL attribute.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the value of the <code title=attr-title><a href=#attr-title>title</a></code> attribute of the element.</p>

  <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the command is the element's
  <a href=#assigned-access-key>assigned access key</a>.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>, <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a>, and <a href=#command-facet-action title=command-facet-Action>Action</a> facets of the command are the same as the respective
  facets of the first element in <a href=#tree-order>tree order</a> that is a descendant of the parent of the
  <code><a href=#the-legend-element>legend</a></code> element that <a href=#concept-command title=concept-command>defines a command</a> but is not
  a descendant of the <code><a href=#the-legend-element>legend</a></code> element and is neither a <code><a href=#the-label-element>label</a></code> nor a
  <code><a href=#the-legend-element>legend</a></code> element.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the command is always
  false. (The command is never checked.)</p>



  <h5 id=using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.6.10 </span><dfn title=accesskey-command>Using the <code title=attr-accesskey>accesskey</code>
  attribute to define a command on other elements</dfn></h5>

  <p>An element that has an <a href=#assigned-access-key>assigned access key</a> <a href=#concept-command title=concept-command>defines a
  command</a>.</p>

  <p>If one of the earlier sections that define elements that <a href=#concept-command title=concept-command>define
  commands</a> define that this element <a href=#concept-command title=concept-command>defines a command</a>,
  then that section applies to this element, and this section does not. Otherwise, this section
  applies to that element.</p>

  <p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command is "command".</p>

  <p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
  Otherwise the command is an <a href=#anonymous-command>anonymous command</a>.</p>

  <p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command depends on the element. If
  the element is a <a href=#labeled-control>labeled control</a>, the <code><a href=#textcontent>textContent</a></code> of the first
  <code><a href=#the-label-element>label</a></code> element in <a href=#tree-order>tree order</a> whose <a href=#labeled-control>labeled control</a> is the
  element in question is the <a href=#command-facet-label title=command-facet-Label>Label</a> (in DOM terms, this is
  the string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise,
  the <a href=#command-facet-label title=command-facet-Label>Label</a> is the <code><a href=#textcontent>textContent</a></code> of the element
  itself.</p>

  <p>The <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the value of the <code title=attr-title><a href=#attr-title>title</a></code> attribute of the element. If the attribute is not present, the
  <a href=#command-facet-hint title=command-facet-Hint>Hint</a> is the empty string.</p>

  <p>There is no <a href=#command-facet-icon title=command-facet-Icon>Icon</a> for the command.</p>

  <p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the command is the element's
  <a href=#assigned-access-key>assigned access key</a>.</p>

  <p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> of the command is true (hidden)
  if the element has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>

  <p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> of the command is true if
  the element or one of its ancestors is <a href=#inert>inert</a>, and false otherwise.</p>

  <p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the command is always
  false. (The command is never checked.)</p>

  <p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the command is to run the following
  steps:</p>

  <ol><li>If the element is <a href=#focusable>focusable</a>, run the <a href=#focusing-steps>focusing steps</a> for the
   element.</li>

   <li>If the element has a defined <a href=#activation-behavior>activation behavior</a>, <a href=#run-synthetic-click-activation-steps>run synthetic click
   activation steps</a> on the element.</li>

   <li>Otherwise, if the element does not have a defined <a href=#activation-behavior>activation behavior</a>,
   <a href=#fire-a-click-event>fire a <code title=event-click>click</code> event</a> at the element.</li>

  </ol></div>


  <h4 id=the-dialog-element><span class=secno>4.11.7 </span>The <dfn><code>dialog</code></dfn> element</h4>

  <dl class=element><dt><a href=#element-dfn-categories title=element-dfn-categories>Categories</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   <dd><a href=#sectioning-root>Sectioning root</a>.</dd>
   <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
   <dd>Where <a href=#flow-content>flow content</a> is expected.</dd>
   <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
   <dd><a href=#flow-content>Flow content</a>.</dd>
   
   <dd>Neither tag is omissible.</dd>
   <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
   <dd><a href=#global-attributes>Global attributes</a></dd>
   <dd><code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code> &mdash; Whether the dialog box is showing</dd>
   <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
   <dd>
<pre class=idl>interface <dfn id=htmldialogelement>HTMLDialogElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-dialog-open title=dom-dialog-open>open</a>;
           attribute DOMString <a href=#dom-dialog-returnvalue title=dom-dialog-returnValue>returnValue</a>;
  void <a href=#dom-dialog-show title=dom-dialog-show>show</a>(optional (<a href=#mouseevent>MouseEvent</a> or <a href=#element>Element</a>) anchor);
  void <a href=#dom-dialog-showmodal title=dom-dialog-showModal>showModal</a>(optional (<a href=#mouseevent>MouseEvent</a> or <a href=#element>Element</a>) anchor);
  void <a href=#dom-dialog-close title=dom-dialog-close>close</a>(optional DOMString returnValue);
};</pre>
   </dd>
  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-dialog-element>dialog</a></code> element represents a part of an
  application that a user interacts with to perform a task, for
  example a dialog box, inspector, or window.</p>

  <p>The <dfn id=attr-dialog-open title=attr-dialog-open><code>open</code></dfn>
  attribute is a <a href=#boolean-attribute>boolean attribute</a>. When specified, it
  indicates that the <code><a href=#the-dialog-element>dialog</a></code> element is active and that
  the user can interact with it.</p>

  <div class=impl>

  <p>A <code><a href=#the-dialog-element>dialog</a></code> element without an <code title=attr-dialog-open><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>

<!--TOPIC:DOM APIs-->

  <dl class=domintro><dt><var title="">dialog</var> . <code title=dom-dialog-show><a href=#dom-dialog-show>show</a></code>( [ <var title="">anchor</var> ] )</dt>

   <dd>

    <p>Displays the <code><a href=#the-dialog-element>dialog</a></code> element.</p>

    <p>The argument, if provided, provides an anchor point to which
    the element will be fixed.</p>

   </dd>

   <dt><var title="">dialog</var> . <code title=dom-dialog-showModal><a href=#dom-dialog-showmodal>showModal</a></code>( [ <var title="">anchor</var> ] )</dt>

   <dd>

    <p>Displays the <code><a href=#the-dialog-element>dialog</a></code> element and makes it the top-most modal dialog.</p>

    <p>The argument, if provided, provides an anchor point to which
    the element will be fixed.</p>

    <p>This method honors the <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute.</p>

   </dd>

   <dt><var title="">dialog</var> . <code title=dom-dialog-close><a href=#dom-dialog-close>close</a></code>( [ <var title="">result</var> ] )</dt>

   <dd>

    <p>Closes the <code><a href=#the-dialog-element>dialog</a></code> element.</p>

    <p>The argument, if provided, provides a return value.</p>

   </dd>

   <dt><var title="">dialog</var> . <code title=dom-dialog-returnValue><a href=#dom-dialog-returnvalue>returnValue</a></code> [ = <var title="">result</var> ]</dt>

   <dd>

    <p>Returns the <code><a href=#the-dialog-element>dialog</a></code>'s return value.</p>

    <p>Can be set, to update the return value.</p>

   </dd>

  </dl><!--ADD-TOPIC:CSS--><div class=impl>

  <p>When the <dfn id=dom-dialog-show title=dom-dialog-show><code>show()</code></dfn> method is invoked, the user
  agent must run the following steps:</p>

  <ol><li><p>If the element already has an <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code> attribute, then
   abort these steps.</li>

   <li><p>Add an <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code> attribute to the <code><a href=#the-dialog-element>dialog</a></code>
   element, whose value is the empty string.</li>

   <li><p>If the <code title=dom-dialog-show><a href=#dom-dialog-show>show()</a></code> method was invoked with an argument,
   <a href=#set-up-the-position>set up the position</a> of the <code><a href=#the-dialog-element>dialog</a></code> element, using that argument as the
   anchor. Otherwise, <a href=#set-up-the-default-static-position>set up the default static position</a> of the dialog
   element.</li>

  </ol><hr><p>Each <code><a href=#document>Document</a></code> has a stack of <code><a href=#the-dialog-element>dialog</a></code> elements known as the
  <dfn id=pending-dialog-stack>pending dialog stack</dfn>. When a <code><a href=#document>Document</a></code> is created, this stack must be
  initialized to be empty.</p>

  <p>When an element is added to the <a href=#pending-dialog-stack>pending dialog stack</a>, it must also be added to the
  <a href=#top-layer>top layer</a> layer. When an element is removed from the <a href=#pending-dialog-stack>pending dialog
  stack</a>, it must be removed from the <a href=#top-layer>top layer</a>. <a href=#refsFULLSCREEN>[FULLSCREEN]</a></p>

  <p>When the <dfn id=dom-dialog-showmodal title=dom-dialog-showModal><code>showModal()</code></dfn> method is invoked,
  the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">subject</var> be the <code><a href=#the-dialog-element>dialog</a></code> element on which the method was
   invoked.</li>

   <li><p>If <var title="">subject</var> already has an <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code>
   attribute, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>If <var title="">subject</var> is not <a href=#in-a-document>in a <code>Document</code></a>, then throw
   an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>Add an <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code> attribute to <var title="">subject</var>, whose value is the empty string.</li>

   <li><p>If the <code title=dom-dialog-showModal><a href=#dom-dialog-showmodal>showModal()</a></code> method was invoked with an
   argument, <a href=#set-up-the-position>set up the position</a> of <var title="">subject</var>, using that argument as
   the anchor. Otherwise, <a href=#set-up-the-default-static-position>set up the default static position</a> of the dialog
   element.</li>

   <li><p>Let <var title="">subject</var>'s <code><a href=#document>Document</a></code> be <a href=#blocked-by-a-modal-dialog title="blocked by a modal
   dialog">blocked by the modal dialog</a> <var title="">subject</var>.</li>

   <li><p>Push <var title="">subject</var> onto <var title="">subject</var>'s
   <code><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack>pending dialog stack</a>.</li>

   <li><p>Let <var title="">control</var> be the first element in tree order whose nearest ancestor
   <code><a href=#the-dialog-element>dialog</a></code> element is <var title="">subject</var> and that has an <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute specified, if any.</li>

   <li><p>If there is no <var title="">control</var>, then abort these steps.</li>

   <li><p>Run the <a href=#focusing-steps>focusing steps</a> for <var title="">control</var>.</li>

  </ol><p>If at any time a <code><a href=#the-dialog-element>dialog</a></code> element is <a href=#remove-an-element-from-a-document title="remove an element from a
  document">removed from a <code>Document</code></a>, then if that <code><a href=#the-dialog-element>dialog</a></code> is in that
  <code><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack>pending dialog stack</a>, the following steps must be run:</p>

  <ol><li><p>Let <var title="">subject</var> be that <code><a href=#the-dialog-element>dialog</a></code> element and <var title="">document</var> be the <code><a href=#document>Document</a></code> from which it is being removed.</li>

   <li><p>Remove <var title="">subject</var> from <var title="">document</var>'s <a href=#pending-dialog-stack>pending
   dialog stack</a>.</li>

   <li><p>If <var title="">document</var>'s <a href=#pending-dialog-stack>pending dialog stack</a> is not empty, then let
   <var title="">document</var> be <a href=#blocked-by-a-modal-dialog title="blocked by a modal dialog">blocked by the modal
   dialog</a> that is at the top of <var title="">document</var>'s <a href=#pending-dialog-stack>pending dialog
   stack</a>. Otherwise, let <var title="">document</var> be no longer <a href=#blocked-by-a-modal-dialog>blocked by a modal
   dialog</a> at all.</li>

  </ol><p>When the <dfn id=dom-dialog-close title=dom-dialog-close><code>close()</code></dfn> method is invoked, the user
  agent must <a href=#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>

<!--TOPIC:HTML-->

  <p>When a <code><a href=#the-dialog-element>dialog</a></code> element <var title="">subject</var> is to be <dfn id=close-the-dialog title="close the
  dialog">closed</dfn>, optionally with a return value <var title="">result</var>, the user agent
  must run the following steps:</p>

  <ol><li><p>If <var title="">subject</var> does not have an <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code>
   attribute, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

   <li><p>Remove <var title="">subject</var>'s <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code>
   attribute.</li>

   <li><p>If the argument was passed a <var title="">result</var>, then set the <code title=dom-dialog-returnValue><a href=#dom-dialog-returnvalue>returnValue</a></code> attribute to the value of <var title="">result</var>.</li>

   <li>

    <p>If <var title="">subject</var> is in its <code><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack>pending dialog
    stack</a>, then run these substeps:</p>

    <ol><li><p>Remove <var title="">subject</var> from that <a href=#pending-dialog-stack>pending dialog stack</a>.</li>

     <li><p>If that <a href=#pending-dialog-stack>pending dialog stack</a> is not empty, then let <var title="">subject</var>'s <code><a href=#document>Document</a></code> be <a href=#blocked-by-a-modal-dialog title="blocked by a modal
     dialog">blocked by the modal dialog</a> that is at the top of the <a href=#pending-dialog-stack>pending dialog
     stack</a>. Otherwise, let <var title="">document</var> be no longer <a href=#blocked-by-a-modal-dialog>blocked by a modal
     dialog</a> at all.</li>

    </ol></li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <dfn id=event-close title=event-close><code>close</code></dfn> at <var title="">subject</var>.</li>

  </ol><!--TOPIC:DOM APIs--><p>The <dfn id=dom-dialog-returnvalue title=dom-dialog-returnValue><code>returnValue</code></dfn> IDL attribute, on
  getting, must return the last value to which it was set. On setting, it must be set to the new
  value. When the element is created, it must be set to the empty string.</p>
<!--TOPIC:HTML-->

  <hr><p><strong>Canceling dialogs</strong>: When a <code><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack>pending dialog
  stack</a> is not empty, user agents may provide a user interface that, upon activation, <a href=#queue-a-task title="queue a task">queues a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <dfn id=event-cancel title=event-cancel><code>cancel</code></dfn> that is cancelable at the top <code><a href=#the-dialog-element>dialog</a></code>
  element on the <code><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack>pending dialog stack</a>. The default action of
  this event must be to <a href=#close-the-dialog>close the dialog</a> with no return value.</p>

  <p class=note>An example of such a UI mechanism would be the user pressing the "Escape" key.</p>

  <hr><p>The containing block of all <code><a href=#the-dialog-element>dialog</a></code> elements that are <i>absolutely positioned</i>
  must be the initial containing block.</p>

  <p>All <code><a href=#the-dialog-element>dialog</a></code> elements are always in one of two modes: <dfn id=mundanely-aligned>mundanely aligned</dfn>,
  or <dfn id=magically-aligned>magically aligned</dfn>. When a <code><a href=#the-dialog-element>dialog</a></code> element is created, it must be placed
  in the <a href=#mundanely-aligned>mundanely aligned</a> mode and the user agent must <a href=#set-up-the-default-static-position>set up the default static
  position</a> for that element, without an anchor.</p>

  <p>When a user agent is to <dfn id=set-up-the-default-static-position>set up the default static position</dfn> of an element <var title="">subject</var> without an anchor, if that element is <a href=#being-rendered>being rendered</a>, it must
  set up the element such that its top static position, for the purposes of calculating the used
  value of the 'top' property, is the value that would place the element's top margin edge as far
  from the top of the viewport as the element's bottom margin edge from the bottom of the viewport,
  if the element's height is less than the height of the viewport, and otherwise is the value that
  would place the element's top margin edge at the top of the viewport.</p>

  <p>If there is a <code><a href=#the-dialog-element>dialog</a></code> element that is <a href=#mundanely-aligned>mundanely aligned</a> and that is
  <a href=#being-rendered>being rendered</a> when its <a href=#browsing-context>browsing context</a> changes viewport width (as
  measured in CSS pixels), then the user agent must <a href=#set-up-the-default-static-position>set up the default static position</a>
  of all such elements in that <a href=#browsing-context>browsing context</a> again, still without anchors.</p>

  <p>When a <code><a href=#the-dialog-element>dialog</a></code> element that is <a href=#mundanely-aligned>mundanely aligned</a> starts <a href=#being-rendered>being
  rendered</a>, the user agent must <a href=#set-up-the-default-static-position>set up the default static position</a> of that
  element, without an anchor.</p>

  <p>This top static position of a <a href=#mundanely-aligned>mundanely aligned</a> <code><a href=#the-dialog-element>dialog</a></code> element must
  remain the element's top static position until the <a href=#set-up-the-default-static-position>set up the default static position</a>
  algorithm is once again invoked for that element. (The element's static position is only used in
  calculating the used value of the 'top' property in certain situations; it's not used, for
  instance, to position the element if its 'position' property is set to 'static'.)</p>

  <p>When a user agent is to <dfn id=set-up-the-position>set up the position</dfn> of an element <var title="">subject</var> using an anchor <var title="">anchor</var>, it must run the following
  steps:</p>

  <ol><li>

    <p>If <var title="">anchor</var> is a <code><a href=#mouseevent>MouseEvent</a></code> object, then run these
    substeps:</p>

    <ol><li><p>If <var title="">anchor</var>'s target element does not have a rendered box, or is in a
     different document than <var title="">subject</var>, then let <var title="">subject</var> be
     <a href=#mundanely-aligned>mundanely aligned</a>, <a href=#set-up-the-default-static-position>set up the default static position</a> of <var title="">subject</var> without an anchor, and abort the <a href=#set-up-the-position>set up the position</a>
     steps.</li>

     <li><p>Let <var title="">anchor element</var> be an anonymous element rendered as a box with
     zero height and width (so its margin and border boxes both just form a point), positioned so
     that its top and left are at the coordinate identified by the event, and whose properties all
     compute to their initial values.</li>

    </ol><p>Otherwise, let <var title="">anchor element</var> be <var title="">anchor</var>.</p>

   </li>

   <li><p>Let <var title="">subject</var> be <a href=#magically-aligned>magically aligned</a> to <var title="">anchor
   element</var>.</li>

  </ol><p>While an element <var title="">A</var> is <a href=#magically-aligned>magically aligned</a> to an element <var title="">B</var>, the following requirements apply:</p>

  <ul><li>

    <p>If at any time either <var title="">A</var> or <var title="">B</var> cease having rendered
    boxes, <var title="">A</var> and <var title="">B</var> cease being in the same
    <code><a href=#document>Document</a></code>, or <var title="">B</var> ceases being earlier than <var title="">A</var>
    in <a href=#tree-order>tree order</a>, let <var title="">subject</var> be <a href=#mundanely-aligned>mundanely aligned</a>,
    and <a href=#set-up-the-default-static-position>set up the default static position</a> of <var title="">subject</var> without an
    anchor.</p>

   </li>

   <li>

    <p><var title="">A</var>'s 'position' property must compute to the keyword '<a href=#css-position-absolute-anchored title=css-position-absolute-anchored>absolute-anchored</a>' rather than whatever it would
    otherwise compute to (i.e. the 'position' property's specified value is ignored).</p>

    <p class=note>The '<a href=#css-position-absolute-anchored title=css-position-absolute-anchored>absolute-anchored</a>'
    keyword's requirements are described below.</p>

   </li>

   <li>

    <p>The anchor points for <var title="">A</var> and <var title="">B</var> are defined as per the
    appropriate entry in the following list:</p>

    <dl class=switch><dt>If the computed value of 'anchor-point' is 'none' on both <var title="">A</var> and <var title="">B</var>

     <dd>
      <p>The anchor points of <var title="">A</var> and <var title="">B</var> are the center points
      of their respective first boxes' border boxes.


     <dt>If the computed value of 'anchor-point' is 'none' on <var title="">A</var> and a specific
     point on <var title="">B</var>

     <dd>
      <p>The anchor point of <var title="">B</var> is the point given by its 'anchor-point'
      property.

      <p>If the anchor point of <var title="">B</var> is the center point of <var title="">B</var>'s
      first box's border box, then <var title="">A</var>'s anchor point is the center point of its
      first box's margin box.

      <p>Otherwise, <var title="">A</var>'s anchor point is on one of its margin edges. Consider
      four hypothetical half-infinite lines L1, L2, L3, and L4 that each start in the center of <var title="">B</var>'s first box's border box, and that extend respectively through the top left
      corner, top right corner, bottom right corner, and bottom left corner of <var title="">B</var>'s first box's border box. <var title="">A</var>'s anchor point is determined
      by the location of <var title="">B</var>'s anchor point relative to these four hypothetical
      lines, as follows:

      <p>If the anchor point of <var title="">B</var> lies on L1 or L2, or inside the area bounded
      by L1 and L2 that also contains the points above <var title="">B</var>'s first box's border
      box, then let <var title="">A</var>'s anchor point be the horizontal center of <var title="">A</var>'s bottom margin edge.</p>

      <p>Otherwise, if the anchor point of <var title="">B</var> lies on L3 or L4, or inside the
      area bounded by L4 and L4 that also contains the points below <var title="">B</var>'s first
      box's border box, then let <var title="">A</var>'s anchor point be the horizontal center of
      <var title="">A</var>'s top margin edge.</p>

      <p>Otherwise, if the anchor point of <var title="">B</var> lies inside the area bounded by L4
      and L1 that also contains the points to the left of <var title="">B</var>'s first box's border
      box, then let <var title="">A</var>'s anchor point be the vertical center of <var title="">A</var>'s right margin edge.</p>

      <p>Otherwise, the anchor point of <var title="">B</var> lies inside the area bounded by L2 and
      L3 that also contains the points to the right of <var title="">B</var>'s first box's border
      box; let <var title="">A</var>'s anchor point be the vertical center of <var title="">A</var>'s left margin edge.</p>


     <dt>If the computed value of 'anchor-point' is a specific point on <var title="">A</var> and
     'none' on <var title="">B</var>

     <dd>
      <p>The anchor point of <var title="">A</var> is the point given by its 'anchor-point'
      property.

      <p>If the anchor point of <var title="">A</var> is the center point of <var title="">A</var>'s
      first box's margin box, then <var title="">B</var>'s anchor point is the center point of its
      first box's border box.

      <p>Otherwise, <var title="">B</var>'s anchor point is on one of its border edges. Consider
      four hypothetical half-infinite lines L1, L2, L3, and L4 that each start in the center of <var title="">A</var>'s first box's margin box, and that extend respectively through the top left
      corner, top right corner, bottom right corner, and bottom left corner of <var title="">A</var>'s first box's margin box. <var title="">B</var>'s anchor point is determined
      by the location of <var title="">A</var>'s anchor point relative to these four hypothetical
      lines, as follows:

      <p>If the anchor point of <var title="">A</var> lies on L1 or L2, or inside the area bounded
      by L1 and L2 that also contains the points above <var title="">A</var>'s first box's margin
      box, then let <var title="">B</var>'s anchor point be the horizontal center of <var title="">B</var>'s bottom border edge.</p>

      <p>Otherwise, if the anchor point of <var title="">A</var> lies on L3 or L4, or inside the
      area bounded by L4 and L4 that also contains the points below <var title="">A</var>'s first
      box's margin box, then let <var title="">B</var>'s anchor point be the horizontal center of
      <var title="">B</var>'s top border edge.</p>

      <p>Otherwise, if the anchor point of <var title="">A</var> lies inside the area bounded by L4
      and L1 that also contains the points to the left of <var title="">A</var>'s first box's margin
      box, then let <var title="">B</var>'s anchor point be the vertical center of <var title="">B</var>'s right border edge.</p>

      <p>Otherwise, the anchor point of <var title="">A</var> lies inside the area bounded by L2 and
      L3 that also contains the points to the right of <var title="">A</var>'s first box's margin
      box; let <var title="">B</var>'s anchor point be the vertical center of <var title="">B</var>'s left border edge.</p>


     <dt>If the computed value of 'anchor-point' is a specific point on both <var title="">A</var>
     and <var title="">B</var>

     <dd>
      <p>The anchor points of <var title="">A</var> and <var title="">B</var> are the points given
      by their respective 'anchor-point' properties.

    </dl><p class=note>The rules above generally use <var title="">A</var>'s <em>margin</em> box, but
    <var title="">B</var>'s <em>border</em> box. This is because while <var title="">A</var> always
    has a margin box, and using the margin box allows for the dialog to be positioned offset from
    the box it is annotating, <var title="">B</var> sometimes does not have a margin box (e.g. if it
    is a table-cell), or has a margin box whose position may be not entirely clear (e.g. in the face
    of margin collapsing and 'clear' handling of in-flow blocks).</p>

    <p>In cases where <var title="">B</var> does not have a border box but its border box is used by
    the algorithm above, user agents must use its first box's content area instead. (This is in
    particular an issue with boxes in tables that have 'border-collapse' set to 'collapse'.)</p>

   </li>

   <li>

    <p>When an element's 'position' property computes to '<dfn id=css-position-absolute-anchored title=css-position-absolute-anchored>absolute-anchored</dfn>', the 'float' property does not
    apply and must compute to 'none', the 'display' property must compute to a value as described by
    the table in <a href=http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo>the section of CSS
    2.1 describing the <cite>relationships between 'display', 'position', and 'float'</cite></a>,
    and the element's box must be positioned using the rules for absolute positioning but with its
    static position set such that if the box is positioned in its static position, its anchor point
    is exactly aligned over the anchor point of the element to which it is <a href=#magically-aligned>magically
    aligned</a>. Elements aligned in this way are <i>absolutely positioned</i>. For the purposes
    of determining the containing block of other elements, the '<a href=#css-position-absolute-anchored title=css-position-absolute-anchored>absolute-anchored</a>' keyword must be treated like
    the 'absolute' keyword.</p>

   </li>

  </ul><p class=note>The trivial example of an element that does not have a rendered box is one whose
  'display' property computes to 'none'. However, there are many other cases; e.g. table columns do
  not have boxes (their properties merely affect other boxes).</p>

  <p class=note>If an element to which another element is anchored changes rendering, the anchored
  element will be be repositioned accordingly. (In other words, the requirements above are live,
  they are not just calculated once per anchored element.)</p>

  <p class=note>The '<a href=#css-position-absolute-anchored title=css-position-absolute-anchored>absolute-anchored</a>'
  keyword is not a keyword that can be specified in CSS; the 'position' property can only compute to
  this value if the <code><a href=#the-dialog-element>dialog</a></code> element is positioned via the APIs described above.</p>

  <p class=note>Elements positioned in this way are not clipped by the 'overflow' property of
  ancestors (nor moved by the resulting scrolling mechanisms), since the containing block is the
  initial containing block. Anchoring to an element that <em>is</em> so clipped (and shifted) can
  therefore result in unexpected effects (where the anchored element moves along with the clipped
  element, but isn't itself clipped).</p>

  <hr><!--TOPIC:DOM APIs--><p>The <dfn id=dom-dialog-open title=dom-dialog-open><code>open</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code> content attribute.</p>
<!--TOPIC:HTML-->

  </div>


  <h5 id=anchor-points><span class=secno>4.11.7.1 </span>Anchor points</h5>

  <p class=critical>This section will eventually be moved to a CSS specification; it is specified
  here only on an interim basis until an editor can be found to own this.</p>

  <table class=css-property><caption>'anchor-point'</caption>
   <tr><th>Value:
    <td> none | &lt;position&gt;
   <tr><th>Initial:
    <td> none
   <tr><th>Applies to:
    <td> all elements
   <tr><th>Inherited:
    <td> no
   <tr><th>Percentages:
    <td> refer to width or height of box; see prose
   <tr><th>Media:
    <td> visual
   <tr><th>Computed value:
    <td> The specified value, but with any lengths replaced by their corresponding absolute length
   <tr><th>Animatable:
    <td> no
   <tr><th>Canonical order:
    <td> per grammar
  </table><p>The 'anchor-point' property specifies a point to which dialog boxes are to be aligned.</p>

  <p>If the value is a &lt;position&gt;, the alignment point is the point given by the value, which
  must be interpreted relative to the element's first rendered box's margin box. Percentages must be
  calculated relative to the element's first rendered box's margin box (specifically, its width for
  the horizontal position and its height for the vertical position). <a href=#refsCSSVALUES>[CSSVALUES]</a> <a href=#refsCSS>[CSS]</a></p>

  <p>If the value is the keyword 'none', then no explicit alignment point is defined. The user agent
  will pick an alignment point automatically if necessary (as described in the definition of the
  <code title=dom-dialog-open><a href=#dom-dialog-open>open()</a></code> method above).</p>

<!--REMOVE-TOPIC:CSS-->


  <h3 id=links><span class=secno>4.12 </span>Links</h3>

  <h4 id=introduction-3><span class=secno>4.12.1 </span>Introduction</h4>

  <p>Links are a conceptual construct, created by <code><a href=#the-a-element>a</a></code>,
  <code><a href=#the-area-element>area</a></code>, and <code><a href=#the-link-element>link</a></code> elements, that <a href=#represents title=represents>represent</a> a connection between two
  resources, one of which is the current <code><a href=#document>Document</a></code>. There
  are two kinds of links in HTML:</p>

  <dl><dt><dfn id=external-resource-link title="external resource link">Links to external
   resources</dfn></dt>

   <dd><p>These are links to resources that are to be used to augment
   the current document, generally automatically processed by the user
   agent.</dd>

   <dt><dfn id=hyperlink title=hyperlink>Hyperlinks</dfn></dt>

   <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>navigate</a> to those resources, e.g. to
   visit them in a browser or download them.</dd>

  </dl><p>For <code><a href=#the-link-element>link</a></code> elements with an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute and a <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute, links must be created
  for the keywords of the <code title=attr-link-rel><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><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements with
  an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute and a
  <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute, links must be
  created for the keywords of the <code title=attr-hyperlink-rel><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><a href=#the-link-element>link</a></code> elements, however, <code><a href=#the-a-element>a</a></code> and
  <code><a href=#the-area-element>area</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute that either do not
  have a <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute, or
  whose <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute has no
  keywords that are defined as specifying <a href=#hyperlink title=hyperlink>hyperlinks</a>, must also create a
  <a href=#hyperlink>hyperlink</a>. This implied hyperlink has no special
  meaning (it has no <a href=#linkTypes>link type</a>) beyond
  linking the element's document to the resource given by the
  element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
  attribute.</p>

  <p>A <a href=#hyperlink>hyperlink</a> can have one or more <dfn id=hyperlink-annotation title="hyperlink annotation">hyperlink annotations</dfn> that modify
  the processing semantics of that hyperlink.</p>


  <h4 id=links-created-by-a-and-area-elements><span class=secno>4.12.2 </span>Links created by <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements</h4>

  <p>The <dfn id=attr-hyperlink-href title=attr-hyperlink-href><code>href</code></dfn>
  attribute on <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements must have
  a value that is a <a href=#valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
  spaces</a>.</p>

  <p class=note>The <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
  attribute on <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements is not
  required; when those elements do not have <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attributes they do not
  create hyperlinks.</p>

  <p>The <dfn id=attr-hyperlink-target title=attr-hyperlink-target><code>target</code></dfn>
  attribute, if present, must be a <a href=#valid-browsing-context-name-or-keyword>valid browsing context name
  or keyword</a>. It gives the name of the <a href=#browsing-context>browsing
  context</a> that will be used. <span class=impl>User agents use
  this name when <a href=#following-hyperlinks>following hyperlinks</a>.</span></p>

  <p>When an <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> element's
  <a href=#activation-behavior>activation behavior</a> is invoked, the user agent may
  allow the user to indicate a preference regarding whether the
  hyperlink is to be used for <a href=#navigate title=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 title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute, and
  should be to download the specified resource if it does.</p>

  <p>Whether determined by the user's preferences or via the presence
  or absence of the attribute, if the decision is to use the hyperlink
  for <a href=#navigate title=navigate>navigation</a> then the user agent
  must <a href=#following-hyperlinks title="following hyperlinks">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 title="downloading hyperlinks">download
  the hyperlink</a>. These terms are defined in subsequent sections
  below.</p>

  <p>The <dfn id=attr-hyperlink-download title=attr-hyperlink-download><code>download</code></dfn>
  attribute, if present, indicates that the author intends the
  hyperlink to be used for downloading a resource. The attribute may
  have a value; the value, if any, specifies the default file name that
  the author recommends for use in labeling the resource in a local
  file system. There are no restrictions on allowed values, but
  authors are cautioned that most file systems have limitations with
  regard to what punctuation is supported in file names, and user
  agents are likely to adjust file names accordingly.</p>


  <p>The <dfn id=ping title=attr-hyperlink-ping><code>ping</code></dfn> attribute, if
  present, gives the URLs of the resources that are interested in
  being notified if the user follows the hyperlink. The value must be
  a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>, each of which must be
  a <a href=#valid-non-empty-url>valid non-empty URL</a>. <span class=impl>The value is
  used by the user agent for <a href=#hyperlink-auditing>hyperlink
  auditing</a>.</span></p>

  <p>The <dfn id=attr-hyperlink-rel title=attr-hyperlink-rel><code>rel</code></dfn>
  attribute on <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements controls
  what kinds of links the elements create. The attribute's value must
  be a <a href=#set-of-space-separated-tokens>set of space-separated tokens</a>. The <a href=#linkTypes>allowed keywords and their meanings</a> are
  defined below.</p>

  <p>The <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute has
  no default value. If the attribute is omitted or if none of the
  values in the attribute are 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 id=attr-hyperlink-hreflang title=attr-hyperlink-hreflang><code>hreflang</code></dfn>
  attribute on <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements that
  create <a href=#hyperlink title=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> <span class=impl>User agents must
  not consider this attribute authoritative &mdash; 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.</span></p>

  <p>The <dfn id=attr-hyperlink-type title=attr-hyperlink-type><code>type</code></dfn>
  attribute, if present, gives the <a href=#mime-type>MIME type</a> of the
  linked resource. It is purely advisory. The value must be a
  <a href=#valid-mime-type>valid MIME type</a>. <span class=impl>User agents must
  not consider the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
  attribute authoritative &mdash; upon fetching the resource, user
  agents must not use metadata included in the link to the resource to
  determine its type.</span></p>


  <div class=impl>

  <h4 id=following-hyperlinks-0><span class=secno>4.12.3 </span>Following hyperlinks</h4>

  <p>When a user <dfn id=following-hyperlinks title="following hyperlinks">follows a hyperlink</dfn> created by an element
  <var title="">subject</var>, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">replace</var> be false.</li>

   <li><p>Let <var title="">source</var> be the <a href=#browsing-context>browsing context</a> that contains the
   <code><a href=#document>Document</a></code> object with which <var title="">subject</var> in question is
   associated.</li>

   <li>

    <p>If the user indicated a specific <a href=#browsing-context>browsing context</a> when following the hyperlink,
    or if the user agent is configured to follow hyperlinks by navigating a particular browsing
    context, then let <var title="">target</var> be that <a href=#browsing-context>browsing context</a>.</p>

    <p>Otherwise, if <var title="">subject</var> is an <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> element
    that has a <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, then let <var title="">target</var> be the <a href=#browsing-context>browsing context</a> that is chosen by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the
    rules for choosing a browsing context given a browsing context name</a>, using the value of
    the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name. If
    these rules result in the creation of a new <a href=#browsing-context>browsing context</a>, set <var title="">replace</var> to true.</p>

    <p>Otherwise, if the hyperlink is a <a href=#rel-sidebar-hyperlink title=rel-sidebar-hyperlink>sidebar
    hyperlink</a>, the user agent implements a feature that can be considered a <a href=#secondary-browsing-context>secondary
    browsing context</a>, and the user agent intends to use this feature in this instance, let
    <var title="">target</var> be such a <a href=#secondary-browsing-context>secondary browsing context</a>.</p>

    <p>Otherwise, if <var title="">target</var> is an <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> element
    with no <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, but the
    <code><a href=#document>Document</a></code> contains a <code><a href=#the-base-element>base</a></code> element with a <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute, then let <var title="">target</var> be the
    <a href=#browsing-context>browsing context</a> that is chosen by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing
    context given a browsing context name</a>, using the value of the <code title=attr-base-target><a href=#attr-base-target>target</a></code> attribute of the first such <code><a href=#the-base-element>base</a></code> element as
    the browsing context name. If these rules result in the creation of a new <a href=#browsing-context>browsing
    context</a>, set <var title="">replace</var> to true.</p> <!-- c.f. concept-fs-target -->

    <p>Otherwise, let <var title="">target</var> be the <a href=#browsing-context>browsing context</a> that <var title="">subject</var> itself is in.</p>

   </li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> given by the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute of that element, relative to that
   element.</li>

   <li>

    <p>If that is successful, let <var title="">URL</var> be the <a href=#resulting-absolute-url>resulting absolute
    URL</a>.</p>

    <p>Otherwise, if <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>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>queue a
    task</a> to <a href=#navigate>navigate</a><!--DONAV hyperlink--> the <var title="">target</var>
    <a href=#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>

   <li><p>In the case of server-side image maps, append the <var><a href=#hyperlink-suffix>hyperlink suffix</a></var> to <var title="">URL</var>.</li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> to <a href=#navigate>navigate</a><!--DONAV hyperlink--> the <var title="">target</var> <a href=#browsing-context>browsing context</a> to <var title="">URL</var>. If <var title="">replace</var> is true, the navigation must be performed with <a href=#replacement-enabled>replacement
    enabled</a>. The <a href=#source-browsing-context>source browsing context</a> must be <var title="">source</var>.</p>

   </li>

  </ol><p>The <a href=#task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>

  </div>


<!--DOWNLOAD-->

  <h4 id=downloading-resources><span class=secno>4.12.4 </span>Downloading resources</h4>

  <p>In some cases, resources are intended for later use rather than
  immediate viewing. To indicate that a resource is intended to be
  downloaded for use later, rather than immediately used, the <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute can be
  specified on the <code><a href=#the-a-element>a</a></code> or <code><a href=#the-area-element>area</a></code> element that
  creates the <a href=#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 title=http-content-disposition>Content-Disposition</code> HTTP
  header's filename parameters. <a href=#refsRFC6266>[RFC6266]</a></p>

  <p>In cross-origin situations, the <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute has to be
  combined with the <code title=http-content-disposition>Content-Disposition</code> HTTP
  header, specifically with the <code title="">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>

  <div class=impl>

  <hr><p>When a user <dfn id=downloading-hyperlinks title="downloading hyperlinks">downloads a
  hyperlink</dfn> created by an element, the user agent must run the
  following steps:</p>

  <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
   <a href=#url>URL</a> given by the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute of that element,
   relative to that element.</li>

   <li><p>If <a href=#resolve-a-url title="resolve a url">resolving</a> the
   <a href=#url>URL</a> fails, the user agent may report the error to the
   user in a user-agent-specific manner, may
   <a href=#navigate>navigate</a><!--DONAV download error--> 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 title="">URL</var> be the resulting
   <a href=#absolute-url>absolute URL</a>.</li>

   <li><p>In the case of server-side image maps, append the
   <var><a href=#hyperlink-suffix>hyperlink suffix</a></var> to <var title="">URL</var>.</li>

   <li><p>Return to whatever algorithm invoked these steps and continue
   these steps asynchronously.</li>

   <li><p><a href=#fetch>Fetch</a><!--FETCH--> <var title="">URL</var> and
   handle the resulting resource <a href=#as-a-download>as a download</a>.</li>
   <!-- http-origin privacy sensitive -->

  </ol><p>When a user agent is to handle a resource obtained from a
  <a href=#fetch>fetch</a> algorithm <dfn id=as-a-download>as a download</dfn>, it should
  provide the user with a way to save the resource for later use, if a
  resource is successfully obtained; or otherwise should report any
  problems downloading the file to the user.</p>

  <p>If the user agent needs a file name for a resource being handled
  <a href=#as-a-download>as a download</a>, it should select one using the following
  algorithm.</p>

  <p class=warning>This algorithm is intended to mitigate security dangers involved in downloading
  files from untrusted sites, and user agents are strongly urged to follow it.</p> <!-- but it's
  optional, since it's not really an interoperability issue -->

  <ol><li><p>Let <var title="">filename</var> be the void value.</li>

   <li><p>If the resource has a <code title=http-content-disposition>Content-Disposition</code> header,      <!-- Content-Disposition: attachment; filename="" is always honoured, even cross-origin -->
   that header specifies the <code title="">attachment</code>
   disposition type, and the header includes file name information,
   then let <var title="">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>

   <li><p>Let <var title="">interface origin</var> be the <a href=#origin>origin</a> of the
   <code><a href=#document>Document</a></code> in which the <a href=#downloading-hyperlinks title="downloading hyperlinks">download</a> or
   <a href=#navigate>navigate</a> action resulting in the download was initiated, if any.</li>

   <li><p>Let <var title="">resource origin</var> be the <a href=#origin>origin</a> of the URL of the
   resource being downloaded, unless that URL's <a href=#concept-url-scheme title=concept-url-scheme>scheme</a>
   component is <code title="">data</code>, in which case let <var title="">resource origin</var> be
   the same as the <var title="">interface origin</var>, if any.</li>

   <li><p>If there is no <var title="">interface origin</var>, then let <var title="">trusted
   operation</var> be true. Otherwise, let <var title="">trusted operation</var> be true if <var title="">resource origin</var> is the <a href=#same-origin>same origin</a> as <var title="">interface
   origin</var>, and false otherwise.</li>

   <li><p>If <var title="">trusted operation</var> is true and the          <!-- Content-Disposition: *; filename="" overrides download="" for same-origin -->
   resource has a <code title=http-content-disposition>Content-Disposition</code> header
   and that header includes file name information, then let <var title="">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>

   <li><p>If the download was not initiated from a
   <a href=#hyperlink>hyperlink</a> created by an <code><a href=#the-a-element>a</a></code> or
   <code><a href=#the-area-element>area</a></code> element, or if the element of the
   <a href=#hyperlink>hyperlink</a> from which it was initiated did not have a
   <code title=attr-hyperlink-download><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>

   <li><p>Let <var title="">proposed filename</var> have the value of
   the <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute
   of the element of the <a href=#hyperlink>hyperlink</a> that initiated the
   download at the time the download was initiated.</li>

   <li><p>If <var title="">trusted operation</var> is true, let <var title="">filename</var> have the value of <var title="">proposed
   filename</var>, and jump to the step labeled <i>sanitize</i>             <!-- download="" works for all links when same-origin -->
   below.</li>                                                          <!-- it is not used cross-origin, though, even for explicit user gestures -->
                                                                            <!-- except: -->
   <li><p>If the resource has a <code title=http-content-disposition>Content-Disposition</code> header       <!-- Content-Disposition: attachment with no filename="" allows download="" cross-origin -->
   and that header specifies the <code title="">attachment</code>
   disposition type, let <var title="">filename</var> have the value
   of <var title="">proposed filename</var>, and jump to the step
   labeled <i>sanitize</i> below. <a href=#refsRFC6266>[RFC6266]</a></li>

   <li><p><i>No proposed file name</i>: If <var title="">trusted            <!-- fallback for same-origin resources or explicit downloads: use the resource's file name -->
   operation</var> is true, or if the user indicated a preference for
   having the resource in question downloaded, let <var title="">filename</var> have a value derived from the
   <a href=#url>URL</a> of the resource in a user-agent-defined manner,
   and jump to the step labeled <i>sanitize</i> below.</li>

   <li>

    <p>Act in a user-agent-defined manner to safeguard the user from a      <!-- no C-D: a header on cross-origin raises red flags -->
    potentially hostile cross-origin download. If the download is not
    to be aborted, then let <var title="">filename</var> be set to the
    user's preferred file name or to a file name selected by the user
    agent, and jump to the step labeled <i>sanitize</i> below.</p>

    <div class=warning>

     <p>If the algorithm reaches this step, then a download was begun
     from a different origin than the resource being downloaded, and
     the origin did not mark the file as suitable for downloading, and
     the download was not initiated by the user. This could be because
     a <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute
     was used to trigger the download, or because the resource in
     question is not of a type that the user agent supports.</p>

     <p>This could be dangerous, because, for instance, a hostile
     server could be trying to get a user to unknowingly download
     private information and then re-upload it to the hostile server,
     by tricking the user into thinking the data is from the hostile
     server.</p>

     <p>Thus, it is in the user's interests that the user be somehow
     notified that the resource in question comes from quite a
     different source, and to prevent confusion, any suggested
     file name from the potentially hostile <var title="">interface
     origin</var> should be ignored.</p>

    </div>

   </li>

   <li><p><i>Sanitize</i>: Optionally, allow the user to influence <var title="">filename</var>. For example, a user agent could prompt the
   user for a file name, potentially providing the value of <var title="">filename</var> as determined above as a default
   value.</li>

   <li>

    <p>Adjust <var title="">filename</var> to be suitable for the
    local file system.</p>

    <p class=example>For example, this could involve removing
    characters that are not legal in file names, or trimming leading
    and trailing whitespace.</p>

   </li>

   <li><p>If the platform conventions do not in any way use <a href=#concept-extension title=concept-extension>extensions</a> to determine the types
   of file on the file system, then return <var title="">filename</var> as the file name and abort these
   steps.</li>

   <li><p>Let <var title="">claimed type</var> be the type given by
   the resource's <a href=#content-type title=Content-Type>Content-Type
   metadata</a>, if any is known. Let <var title="">named
   type</var> be the type given by <var title="">filename</var>'s
   <a href=#concept-extension title=concept-extension>extension</a>, if any is known.
   For the purposes of this step, a <i>type</i> is a mapping of a
   <a href=#mime-type>MIME type</a> to an <a href=#concept-extension title=concept-extension>extension</a>.</li>

   <li><p>If <var title="">named type</var> is consistent with the
   user's preferences (e.g. because the value of <var title="">filename</var> was determined by prompting the user), then
   return <var title="">filename</var> as the file name and abort
   these steps.</li>

   <li><p>If <var title="">claimed type</var> and <var title="">named
   type</var> are the same type (i.e. the type given by the resource's
   <a href=#content-type title=Content-Type>Content-Type metadata</a> is
   consistent with the type given by <var title="">filename</var>'s
   <a href=#concept-extension title=concept-extension>extension</a>), then return <var title="">filename</var> as the file name and abort these
   steps.</li>

   <li>

    <p>If the <var title="">claimed type</var> is known, then alter
    <var title="">filename</var> to add an <a href=#concept-extension title=concept-extension>extension</a> corresponding to <var title="">claimed type</var>.</p>

    <p>Otherwise, if <var title="">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 title="">filename</var> to add a known-safe <a href=#concept-extension title=concept-extension>extension</a> (e.g. "<code title="">.txt</code>").</p>

    <p class=note>This last step would make it impossible to
    download executables, which might not be desirable. As always,
    implementors are forced to balance security and usability in this
    matter.</p>

   </li>

   <li><p>Return <var title="">filename</var> as the file
   name.</li>

  </ol><p>For the purposes of this algorithm, a file <dfn id=concept-extension title=concept-extension>extension</dfn> consists of any part of
  the file name that platform conventions dictate will be used for
  identifying the type of the file. For example, many operating
  systems use the part of the file name following the last dot ("<code title="">.</code>") in the file name to determine the type of the
  file, and from that the manner in which the file is to be opened or
  executed.</p>

  <p>User agents should ignore any directory or path information
  provided by the resource itself, its <a href=#url>URL</a>, and any <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute, in
  deciding where to store the resulting file in the user's file
  system.</p>

  </div>


<!--PING-->

  <div class=impl>

  <h5 id=hyperlink-auditing><span class=secno>4.12.4.1 </span><dfn>Hyperlink auditing</dfn></h5>

  <p>If a <a href=#hyperlink>hyperlink</a> created by an <code><a href=#the-a-element>a</a></code> or
  <code><a href=#the-area-element>area</a></code> element has a <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute, and the user
  follows the hyperlink, and the value of the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute can be <a href=#resolve-a-url title="resolve a url">resolved</a>, relative to the element,
  without failure, then the user agent must take the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute's value, <a href=#split-a-string-on-spaces title="split a string on spaces">split that string on spaces</a>,
  <a href=#resolve-a-url title="resolve a url">resolve</a> each resulting token
  relative to the element, and then each of the resulting <a href=#absolute-url title="absolute URL">absolute URLs</a> should be <a href=#fetch title=fetch>fetched</a><!--FETCH--> from the
  <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> containing the
  <a href=#hyperlink>hyperlink</a> <!-- not http-origin privacy sensitive -->
  (as described below). (Tokens that fail to resolve are ignored.)
  This may be done in parallel with the primary request, and is
  independent of the result of that request.</p>

  <p>User agents should allow the user to adjust this behavior, for
  example in conjunction with a setting that disables the sending of
  HTTP <code title=http-referer>Referer</code> (sic) headers. Based
  on the user's preferences, UAs may either <a href=#ignore>ignore</a> the
  <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute altogether,
  or selectively ignore URLs in the list (e.g. ignoring any
  third-party URLs).</p>

  <p>For URLs that are HTTP URLs, the requests must be performed using
  the POST method, with an entity body with the <a href=#mime-type>MIME type</a>
  <code><a href=#text/ping>text/ping</a></code> consisting of the four-character string
  "<code title="">PING</code>". All relevant cookie and HTTP
  authentication headers must be included in the request. Which other
  headers are required depends on the URLs involved.</p>

  <dl class=switch><dt>If both the <a href="#the-document's-address" title="the document's address">address</a>
   of the <code><a href=#document>Document</a></code> object containing the hyperlink being
   audited and the ping URL have the <a href=#same-origin>same origin</a></dt>

   <dd>The request must include a <code title=http-ping-from><a href=#ping-from>Ping-From</a></code> HTTP header with, as its
   value, the <a href="#the-document's-address" title="the document's address">address</a> of
   the document containing the hyperlink, and a <code title=http-ping-to><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value,
   the address of the <a href=#absolute-url>absolute URL</a> of the target of the
   hyperlink. The request must not include a <code title=http-referer>Referer</code> (sic) HTTP header. <!-- because
   otherwise it would look like a trustable same-origin POST --></dd>

   <dt>Otherwise, if the origins are different, but the document
   containing the hyperlink being audited was not retrieved over an
   encrypted connection</dt>

   <dd>The request must include a <code title=http-referer>Referer</code> (sic) HTTP header with, as its
   value, the <a href="#the-document's-address" title="the document's address">address</a> of
   the document containing the hyperlink, a <code title=http-ping-from><a href=#ping-from>Ping-From</a></code> HTTP header with the same
   value, and a <code title=http-ping-to><a href=#ping-to>Ping-To</a></code> HTTP header
   with, as its value, the address of the target of the
   hyperlink.</dd>

   <dt>Otherwise, the origins are different and the document
   containing the hyperlink being audited was retrieved over an
   encrypted connection</dt>

   <dd>The request must include a <code title=http-ping-to><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value,
   the address of the target of the hyperlink. The request must
   neither include a <code title=http-referer>Referer</code> (sic)
   HTTP header nor include a <code title=http-ping-from><a href=#ping-from>Ping-From</a></code> HTTP header.</dd>

  </dl><p class=note>To save bandwidth, implementors might also wish to
  consider omitting optional headers such as <code>Accept</code> from
  these requests.</p>

  <p>User agents must, unless otherwise specified by the user, honor
  the HTTP headers (including, in particular, redirects and HTTP
  cookie headers), but must ignore any entity bodies returned in the
  responses. User agents may close the connection prematurely once
  they start receiving an entity body. <a href=#refsCOOKIES>[COOKIES]</a></p>

  <p>When the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute is
  present, user agents should clearly indicate to the user that
  following the hyperlink will also cause secondary requests to be
  sent in the background, possibly including listing the actual target
  URLs.</p>

  <p class=example>For example, a visual user agent could include
  the hostnames of the target ping URLs along with the hyperlink's
  actual URL in a status bar or tooltip.</p>

  </div>

  <div class=note>

   <p>The <code title=attr-hyperlink-ping><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 title=attr-hyperlink-ping><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>

    <li>It allows the UA to inform the user about the out-of-band
    notifications.</li>

    <li>It allows the user to disable the notifications without losing
    the underlying link functionality.</li>

    <li>It allows the UA to optimize the use of available network
    bandwidth so that the target page loads faster.</li>

   </ul><p>Thus, while it is possible to track users without this feature,
   authors are encouraged to use the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute so that the user
   agent can make the user experience more transparent.</p>

  </div>

  <!-- resolving ping urls happens at audit time, so base URL changes
  affect the values of ping attributes -->



  <h4 id=linkTypes><span class=secno>4.12.5 </span>Link types</h4>

  <p>The following table summarizes the link types that are defined by
  this specification. This table is non-normative; the actual
  definitions for the link types are given in the next few
  sections.</p>

  <p>In this section, the term <i>referenced document</i> refers to
  the resource identified by the element representing the link, and
  the term <i>current document</i> refers to the resource within
  which the element representing the link finds itself.</p>

  <div class=impl>

  <p>To determine which link types apply to a <code><a href=#the-link-element>link</a></code>,
  <code><a href=#the-a-element>a</a></code>, or <code><a href=#the-area-element>area</a></code> element, the element's <code title="">rel</code> attribute must be <a href=#split-a-string-on-spaces title="split a string on
  spaces">split on spaces</a>. The resulting tokens are the link
  types that apply to that element.</p>

  </div>

  <p>Except where otherwise specified, a keyword must not be specified
  more than once per <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>
  attribute.</p>

  <p>Link types are always <a href=#ascii-case-insensitive>ASCII case-insensitive</a><span class=impl>, and must be compared as such</span>.</p>

  <p class=example>Thus, <code title="">rel="next"</code> is the
  same as <code title="">rel="NEXT"</code>.</p>

  <table><thead><tr><th rowspan=2>Link type</th>
     <th colspan=2>Effect on...</th>
     <th rowspan=2>Brief description</th>
    <tr><th><code><a href=#the-link-element>link</a></code></th>
     <th><code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code></th>
    <tbody><tr><td><code title=rel-alternate><a href=#rel-alternate>alternate</a></code></td> <!-- second most used <link rel> value -->
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Gives alternate representations of the current document.</td>
    <tr><td><code title=rel-author><a href=#link-type-author>author</a></code></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Gives a link to the author of the current document or article.</td>
    <tr><td><code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code></td> <!-- fourth most used <a rel> value -->
     <td><em>not allowed</em></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Gives the permalink for the nearest ancestor section.</td>
    </tr><!-- (commented out on the assumption that rel=contact is really XFN)
    <tr>
     <td><code title="rel-contact">contact</code></td> <!- 8th most used <a rel> value ->
     <td><span>Hyperlink</span></td>
     <td><span>Hyperlink</span></td>
     <td>Gives a link to contact information for the current document.</td>
    </tr>
--><!-- fifth and sixth most used <a rel> value (sixth is "external nofollow"), but moved to the wiki because of http://www.w3.org/Bugs/Public/show_bug.cgi?id=11181 --><!--!--><!--
    <tr>
     <td><code title="rel-external">external</code></td>
     <td><em>not allowed</em></td>
     <td><span>Hyperlink</span></td>
     <td>Indicates that the referenced document is not part of the same site as the current document.</td>
    </tr>
--><tr><td><code title=rel-help><a href=#link-type-help>help</a></code></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Provides a link to context-sensitive help.</td>
    <tr><td><code title=rel-icon><a href=#rel-icon>icon</a></code></td> <!-- link rel="shortcut icon" and its ilk are the fourth, sixth, and ninth most used values -->
     <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
     <td><em>not allowed</em></td>
     <td>Imports an icon to represent the current document.</td>
    <tr><td><code title=rel-license><a href=#link-type-license>license</a></code></td> <!-- seventh most used <a rel> value -->
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Indicates that the main content of the current document is covered by the copyright license described by the referenced document.</td>
    <tr><td><code title=rel-next><a href=#link-type-next>next</a></code></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Indicates that the current document is a part of a series, and that the next document in the series is the referenced document.</td>
    <tr><td><code title=rel-nofollow><a href=#link-type-nofollow>nofollow</a></code></td> <!-- most used <a rel> value (and sixth most used is "external nofollow") -->
     <td><em>not allowed</em></td>
     <td><a href=#hyperlink-annotation title="hyperlink annotation">Annotation</a></td>
     <td>Indicates that the current document's original author or publisher does not endorse the referenced document.</td>
    <tr><td><code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code></td>
     <td><em>not allowed</em></td>
     <td><a href=#hyperlink-annotation title="hyperlink annotation">Annotation</a></td>
     <td>Requires that the user agent not send an HTTP <code title=http-referer>Referer</code> (sic) header if the user follows the hyperlink.</td>
    </tr><!-- used quite a bit; removed for http://www.w3.org/Bugs/Public/show_bug.cgi?id=12224 --><!-- now registered in http://microformats.org/wiki/existing-rel-values#formats --><!--
    <tr>
     <td><code title="rel-pingback">pingback</code></td>
     <td><span title="external resource link">External Resource</span></td>
     <td><em>not allowed</em></td>
     <td>Gives the address of the pingback server that handles pingbacks to the current document.</td>
    </tr>
--><tr><td><code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code></td>
     <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
     <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
     <td>Specifies that the target resource should be preemptively cached.</td>
    <tr><td><code title=rel-prev><a href=#link-type-prev>prev</a></code></td> <!-- prev is used more than previous -->
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document.</td>
    <tr><td><code title=rel-search><a href=#link-type-search>search</a></code></td> <!-- used quite a bit -->
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Gives a link to a resource that can be used to search through the current document and its related pages.</td>
    <tr><td><code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code></td> <!-- used quite a bit -->
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one).</td>
    <tr><td><code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code></td> <!-- most commonly used <link rel> value, variants came in 7th, 8th, 12th, 17th... -->
     <td><a href=#external-resource-link title="external resource link">External Resource</a></td>
     <td><em>not allowed</em></td>
     <td>Imports a stylesheet.</td>
    <tr><td><code title=rel-tag><a href=#link-type-tag>tag</a></code></td> <!-- second and third most used <a rel> value (third is technically "category tag"). -->
     <td><em>not allowed</em></td>
     <td><a href=#hyperlink>Hyperlink</a></td>
     <td>Gives a tag (identified by the given address) that applies to the current document.</td>
    </table><div class=impl>

  <p>Some of the types described below list synonyms for these
  values. These <!--<span class="impl">-->are to be handled as
  specified by user agents, but<!--</span>--> must not be used in
  documents.</p>

  </div>

  <!-- v2 ideas:
   * rel="related" // see also
   * http://microformats.org/wiki/rel-enclosure
  -->


  <h5 id=rel-alternate><span class=secno>4.12.5.1 </span>Link type "<dfn title=rel-alternate><code>alternate</code></dfn>"</h5>

  <p>The <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword may be
  used with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements.</p>

  <p>The meaning of this keyword depends on the values of the other
  attributes.</p>

  <dl class=switch><dt>If the element is a <code><a href=#the-link-element>link</a></code> element and the <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute also contains the
   keyword <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code></dt>

   <dd>

    <p>The <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword
    modifies the meaning of the <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword in the way
    described for that keyword. The <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword does not create a
    link of its own.</p>

   </dd>


   <dt>If the <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword is
   used with the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code>
   attribute set to the value <code title="">application/rss+xml</code> or the value <code title="">application/atom+xml</code></dt>

   <dd>

    <p>The keyword creates a <a href=#hyperlink>hyperlink</a> referencing a
    syndication feed (though not necessarily syndicating exactly the
    same content as the current page).</p>

    <div class=impl>

    <p>The first <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, or <code><a href=#the-area-element>area</a></code>
    element in the document (in tree order) with the <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword used with the <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attribute set to the value
    <code title="">application/rss+xml</code> or the value <code title="">application/atom+xml</code> must be treated as the default
    syndication feed for the purposes of feed autodiscovery.</p>

    <div class=example>
     <p>The following <code><a href=#the-link-element>link</a></code> element gives the syndication
     feed for the current page:</p>
     <pre>&lt;link rel="alternate" type="application/atom+xml" href="data.xml"&gt;</pre>
     <p>The following extract offers various different syndication
     feeds:</p>
     <pre>&lt;p&gt;You can access the planets database using Atom feeds:&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="recently-visited-planets.xml" rel="alternate" type="application/atom+xml"&gt;Recently Visited Planets&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="known-bad-planets.xml" rel="alternate" type="application/atom+xml"&gt;Known Bad Planets&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="unexplored-planets.xml" rel="alternate" type="application/atom+xml"&gt;Unexplored Planets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
    </div>

    </div>

   </dd>


   <dt>Otherwise</dt>

   <dd>

    <p>The keyword creates a <a href=#hyperlink>hyperlink</a> referencing an
    alternate representation of the current document.</p>

    <p>The nature of the referenced document is given by the <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes.</p>

    <p>If the <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword is
    used with the <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>
    attribute, and that attribute's value differs from the <a href=#root-element>root
    element</a>'s <a href=#language>language</a>, it indicates that the
    referenced document is a translation.</p>

    <p>If the <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword is
    used with the <code title=attr-hyperlink-type><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 title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code> and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes can be combined when specified with the <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword.</p>

    <div class=example>

     <p>For example, the following link is a French translation that
     uses the PDF format:</p>

     <pre>&lt;link rel=alternate type=application/pdf hreflang=fr href=manual-fr&gt;</pre>

    </div>

    <p>This relationship is transitive &mdash; that is, if a document
    links to two other documents with the link type "<code title=rel-alternate><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>

   </dd>

  </dl><h5 id=link-type-author><span class=secno>4.12.5.2 </span>Link type "<dfn title=rel-author><code>author</code></dfn>"</h5>

  <p>The <code title=rel-author><a href=#link-type-author>author</a></code> keyword may be
  used with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>For <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements, the <code title=rel-author><a href=#link-type-author>author</a></code> keyword indicates that the
  referenced document provides further information about the author of
  the nearest <code><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><a href=#the-link-element>link</a></code> elements, the <code title=rel-author><a href=#link-type-author>author</a></code> keyword indicates that the
  referenced document provides further information about the author
  for the page as a whole.</p>

  <p class=note>The "referenced document" can be, and often is, a
  <code title="">mailto:</code> URL giving the e-mail address of the
  author. <a href=#refsMAILTO>[MAILTO]</a></p>

  <div class=impl>

  <p><strong>Synonyms</strong>: For historical reasons, user agents
  must also treat <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and
  <code><a href=#the-area-element>area</a></code> elements that have a <code title="">rev</code>
  attribute with the value "<code>made</code>" as having the <code title=rel-author><a href=#link-type-author>author</a></code> keyword specified as a link
  relationship.</p>

  </div>


  <h5 id=link-type-bookmark><span class=secno>4.12.5.3 </span>Link type "<dfn title=rel-bookmark><code>bookmark</code></dfn>"</h5>

  <p>The <code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code> keyword may be
  used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements. This
  keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-bookmark><a href=#link-type-bookmark>bookmark</a></code> keyword gives a
  permalink for the nearest ancestor <code><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><a href=#the-article-element>article</a></code> elements.</p>

  <div class=example>
   <p>The following snippet has three permalinks. A user agent could
   determine which permalink applies to which part of the spec by
   looking at where the permalinks are given.</p>
   <pre> ...
 &lt;body&gt;
  &lt;h1&gt;Example of permalinks&lt;/h1&gt;
  &lt;div id="a"&gt;
   &lt;h2&gt;First example&lt;/h2&gt;
   &lt;p&gt;&lt;a href="a.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
   only the content from the first H2 to the second H2. The DIV isn't
   exactly that section, but it roughly corresponds to it.&lt;/p&gt;
  &lt;/div&gt;
  &lt;h2&gt;Second example&lt;/h2&gt;
  &lt;article id="b"&gt;
   &lt;p&gt;&lt;a href="b.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
   the outer ARTICLE element (which could be, e.g., a blog post).&lt;/p&gt;
   &lt;article id="c"&gt;
    &lt;p&gt;&lt;a href="c.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
    the inner ARTICLE element (which could be, e.g., a blog comment).&lt;/p&gt;
   &lt;/article&gt;
  &lt;/article&gt;
 &lt;/body&gt;
 ...</pre>
  </div>

<!-- (commented out on the assumption that rel=contact is really XFN)
  <h5>Link type "<dfn title="rel-contact"><code>contact</code></dfn>"</h5>

  <p>The <code title="rel-contact">contact</code> keyword may be used
  with <code>link</code>, <code>a</code>, and <code>area</code>
  elements. This keyword creates a <span>hyperlink</span>.</p>

  <p>For <code>a</code> and <code>area</code> elements, the <code
  title="rel-contact">contact</code> keyword indicates that the
  referenced document provides further contact information for the
  author of the nearest <code>article</code> element ancestor of the
  element defining the hyperlink, if there is one, or of the page as a
  whole, otherwise.</p>

  <div class="impl">

  <p>User agents must treat any hyperlink in an <code>address</code>
  element as having the <code title="rel-contact">contact</code> link
  type specified.</p>

  </div>

  <p>For <code>link</code> elements, the <code
  title="rel-contact">contact</code> keyword indicates that the
  referenced document provides further contact information for the
  page as a whole.</p>
-->

<!-- fifth and sixth most used <a rel> value (sixth is "external nofollow"), but moved to the wiki because of http://www.w3.org/Bugs/Public/show_bug.cgi?id=11181 --> <!--!-->
<!--
  <h5>Link type "<dfn title="rel-external"><code>external</code></dfn>"</h5>

  <p>The <code title="rel-external">external</code> keyword may be
  used with <code>a</code> and <code>area</code> elements. This
  keyword creates a <span>hyperlink</span>.</p>

  <p>The <code title="rel-external">external</code> keyword indicates
  that the link is leading to a document that is not part of the site
  that the current document forms a part of.</p>
-->

  <h5 id=link-type-help><span class=secno>4.12.5.4 </span>Link type "<dfn title=rel-help><code>help</code></dfn>"</h5>

  <p>The <code title=rel-help><a href=#link-type-help>help</a></code> keyword may be used with
  <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>For <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements, the <code title=rel-help><a href=#link-type-help>help</a></code> keyword indicates that the referenced
  document provides further help information for the parent of the
  element defining the hyperlink, and its children.</p>

  <div class=example>

   <p>In the following example, the form control has associated
   context-sensitive help. The user agent could use this information,
   for example, displaying the referenced document if the user presses
   the "Help" or "F1" key.</p>

   <pre> &lt;p&gt;&lt;label&gt; Topic: &lt;input name=topic&gt; &lt;a href="help/topic.html" rel="help"&gt;(Help)&lt;/a&gt;&lt;/label&gt;&lt;/p&gt;</pre>

  </div>

  <p>For <code><a href=#the-link-element>link</a></code> elements, the <code title=rel-help><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><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements, on some
  browsers, the <code title=rel-help><a href=#link-type-help>help</a></code> keyword causes the
  link to use a different cursor.</p>


  <h5 id=rel-icon><span class=secno>4.12.5.5 </span>Link type "<dfn title=rel-icon><code>icon</code></dfn>"</h5>

  <p>The <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword may be used with
  <code><a href=#the-link-element>link</a></code> elements. This keyword creates an <a href=#external-resource-link title="external resource link">external resource link</a>.</p>

  <div class=impl>

  <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>

  </div>

  <p>Icons could be auditory icons, visual icons, or other kinds of
  icons. <span class=impl>If multiple icons are provided, the user
  agent must select the most appropriate icon according to the <code title=attr-link-type><a href=#attr-link-type>type</a></code>, <code title=attr-link-media><a href=#attr-link-media>media</a></code>, and <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attributes. If there are
  multiple equally appropriate icons, user agents must use the last
  one declared in <a href=#tree-order>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.</span></p>

  <div class=impl>

  <p class=note>User agents are not required to update icons when
  the list of icons changes, but are encouraged to do so.</p>

  <p>There is no default type for resources given by the <code title=rel-icon><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>

  </div>

  <p>The <dfn id=attr-link-sizes title=attr-link-sizes><code>sizes</code></dfn>
  attribute gives the sizes of icons for visual media. Its value, if
  present, is merely advisory. User agents may use the value to decide
  which icon(s) to use if multiple icons are available.</p>

  <p>If specified, the attribute must have a value that is an
  <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> which
  are <a href=#ascii-case-insensitive>ASCII case-insensitive</a>. Each value must be either
  an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title=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 title="valid non-negative integer">valid non-negative
  integers</a> that do not have a leading U+0030 DIGIT ZERO (0)
  character and that are separated by a single U+0078 LATIN SMALL
  LETTER X or U+0058 LATIN CAPITAL LETTER X character.</p>

  <p>The keywords represent icon sizes.</p>

  <div class=impl>

  <p>To parse and process the attribute's value, the user agent must
  first <a href=#split-a-string-on-spaces title="split a string on spaces">split the attribute's
  value on spaces</a>, and must then parse each resulting keyword
  to determine what it represents.</p>

  </div>

  <p>The <dfn id=attr-link-sizes-any title=attr-link-sizes-any><code>any</code></dfn> keyword
  represents that the resource contains a scalable icon, e.g. as
  provided by an SVG image.</p>

  <div class=impl>

  <p>Other keywords must be further parsed as follows to determine
  what they represent:</p>

  <ul><li><p>If the keyword doesn't contain exactly one U+0078 LATIN
   SMALL LETTER X or U+0058 LATIN CAPITAL LETTER X character, then
   this keyword doesn't represent anything. Abort these steps for that
   keyword.</li>

   <li><p>Let <var title="">width string</var> be the string before
   the "<code title="">x</code>" or "<code title="">X</code>".</li>

   <li><p>Let <var title="">height string</var> be the string after
   the "<code title="">x</code>" or "<code title="">X</code>".</li>

   <li><p>If either <var title="">width string</var> or <var title="">height string</var> start with a U+0030 DIGIT ZERO (0)
   character or contain any characters other than <a href=#ascii-digits>ASCII digits</a>, then this
   keyword doesn't represent anything. Abort these steps for that
   keyword.</li>

   <li><p>Apply the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
   integers</a> to <var title="">width string</var> to obtain <var title="">width</var>.</li>

   <li><p>Apply the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
   integers</a> to <var title="">height string</var> to obtain <var title="">height</var>.</li>

   <li><p>The keyword represents that the resource contains a bitmap
   icon with a width of <var title="">width</var> device pixels and a
   height of <var title="">height</var> device pixels.</li>

  </ul></div>

  <p>The keywords specified on the <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attribute must not represent
  icon sizes that are not actually available in the linked
  resource.</p>

  <div class=impl>

  <p>In the absence of a <code><a href=#the-link-element>link</a></code> with the <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword, for <code><a href=#document>Document</a></code>s
  obtained over HTTP or HTTPS, user agents may instead attempt to
  <a href=#fetch>fetch</a><!--FETCH--> and use an icon with the
  <a href=#absolute-url>absolute URL</a> obtained by resolving the <a href=#url>URL</a>
  "<code title="">/favicon.ico</code>" against <a href="#the-document's-address">the document's
  address</a>, as if the page had declared that icon using the
  <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword.</p>

  </div>

  <div class=example>

   <p>The following snippet shows the top part of an application with
   several icons.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;lsForums &mdash; Inbox&lt;/title&gt;
  &lt;link rel=icon href=favicon.png sizes="16x16" type="image/png"&gt;
  &lt;link rel=icon href=windows.ico sizes="32x32 48x48" type="image/vnd.microsoft.icon"&gt;
  &lt;link rel=icon href=mac.icns sizes="128x128 512x512 8192x8192 32768x32768"&gt;
  &lt;link rel=icon href=iphone.png sizes="57x57" type="image/png"&gt;
  &lt;link rel=icon href=gnome.svg sizes="any" type="image/svg+xml"&gt;
  &lt;link rel=stylesheet href=lsforums.css&gt;
  &lt;script src=lsforums.js&gt;&lt;/script&gt;
  &lt;meta name=application-name content="lsForums"&gt;
 &lt;/head&gt;
 &lt;body&gt;
  ...</pre>

  </div>

  <p>For historical reasons, the <code title=rel-icon><a href=#rel-icon>icon</a></code>
  keyword may be preceded by the keyword "<code title="">shortcut</code>". If the "<code title="">shortcut</code>"
  keyword is present, it must be come immediately before the <code title=rel-icon><a href=#rel-icon>icon</a></code> keyword and the two keywords must be
  separated by only a single U+0020 SPACE character.</p>


  <h5 id=link-type-license><span class=secno>4.12.5.6 </span>Link type "<dfn title=rel-license><code>license</code></dfn>"</h5>

  <p>The <code title=rel-license><a href=#link-type-license>license</a></code> keyword may be used
  with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-license><a href=#link-type-license>license</a></code> keyword indicates
  that the referenced document provides the copyright license terms
  under which the main content of the current document is
  provided.</p>

  <p>This specification does not specify how to distinguish between
  the main content of a document and content that is not deemed to be
  part of that main content. The distinction should be made clear to
  the user.</p>

  <div class=example>

   <p>Consider a photo sharing site. A page on that site might
   describe and show a photograph, and the page might be marked up as
   follows:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Exampl Pictures: Kissat&lt;/title&gt;
  &lt;link rel="stylesheet" href="/style/default"&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;Kissat&lt;/h1&gt;
  &lt;nav&gt;
   &lt;a href="../"&gt;Return to photo index&lt;/a&gt;
  &lt;/nav&gt;
  &lt;figure&gt;
   &lt;img src="/pix/39627052_fd8dcd98b5.jpg"&gt;
   &lt;figcaption&gt;Kissat&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;p&gt;One of them has six toes!&lt;/p&gt;
  &lt;p&gt;&lt;small&gt;&lt;a rel="license" href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT Licensed&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
  &lt;footer&gt;
   &lt;a href="/"&gt;Home&lt;/a&gt; | &lt;a href="../"&gt;Photo index&lt;/a&gt;
   &lt;p&gt;&lt;small&gt;&copy; copyright 2009 Exampl Pictures. All Rights Reserved.&lt;/small&gt;&lt;/p&gt;
  &lt;/footer&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

   <p>In this case the <code title=rel-license><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>

  <div class=impl>

  <p><strong>Synonyms</strong>: For historical reasons, user agents
  must also treat the keyword "<code title="">copyright</code>" like
  the <code title=rel-license><a href=#link-type-license>license</a></code> keyword.</p>

  </div>


  <h5 id=link-type-nofollow><span class=secno>4.12.5.7 </span>Link type "<dfn title=rel-nofollow><code>nofollow</code></dfn>"</h5>

  <p>The <code title=rel-nofollow><a href=#link-type-nofollow>nofollow</a></code> keyword may be
  used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements. This
  keyword does not create a <a href=#hyperlink>hyperlink</a>, but <a href=#hyperlink-annotation title="hyperlink annotation">annotates</a> any other hyperlinks
  created by the element (the implied hyperlink, if no other keywords
  create one).</p>

  <p>The <code title=rel-nofollow><a href=#link-type-nofollow>nofollow</a></code> keyword indicates
  that the link is not endorsed by the original author or publisher of
  the page, or that the link to the referenced document was included
  primarily because of a commercial relationship between people
  affiliated with the two pages.</p>


  <h5 id=link-type-noreferrer><span class=secno>4.12.5.8 </span>Link type "<dfn title=rel-noreferrer><code>noreferrer</code></dfn>"</h5>

  <p>The <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword may be
  used with <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements. This
  keyword does not create a <a href=#hyperlink>hyperlink</a>, but <a href=#hyperlink-annotation title="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>

  <div class=impl>

  <p>If a user agent follows a link defined by an <code><a href=#the-a-element>a</a></code> or
  <code><a href=#the-area-element>area</a></code> element that has the <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword, the user agent
  must not include a <code title=http-referer>Referer</code> (sic)
  HTTP header (<a href=#concept-http-equivalent-headers title=concept-http-equivalent-headers>or
  equivalent</a> for other protocols) in the request.</p>

  <p>This keyword also <a href=#noopener>causes the <code title=dom-opener>opener</code> attribute to remain null</a> if the
  hyperlink creates a new <a href=#browsing-context>browsing context</a>.</p>

  </div>

  <!-- v2: Would be nice to apply this to other elements too,
  e.g. letting <img> or CSS or <video> hide the referrer -->

<!-- used quite a bit; removed for http://www.w3.org/Bugs/Public/show_bug.cgi?id=12224 -->
<!-- now registered in http://microformats.org/wiki/existing-rel-values#formats -->
<!--
  <h5>Link type "<dfn title="rel-pingback"><code>pingback</code></dfn>"</h5>

  <p>The <code title="rel-pingback">pingback</code> keyword may be
  used with <code>link</code> elements. This keyword creates an <span
  title="external resource link">external resource link</span>.</p>

  <p>For the semantics of the <code
  title="rel-pingback">pingback</code> keyword, see the Pingback 1.0
  specification. <a href="#refsPINGBACK">[PINGBACK]</a></p>
-->

  <h5 id=link-type-prefetch><span class=secno>4.12.5.9 </span>Link type "<dfn title=rel-prefetch><code>prefetch</code></dfn>"</h5>

  <p>The <code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword may be
  used with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates an <a href=#external-resource-link title="external resource
  link">external resource link</a>.</p>

  <p>The <code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword indicates
  that preemptively fetching and caching the specified resource is
  likely to be beneficial, as it is highly likely that the user will
  require this resource.</p>

  <p>There is no default type for resources given by the <code title=rel-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword.</p>


  <h5 id=link-type-search><span class=secno>4.12.5.10 </span>Link type "<dfn title=rel-search><code>search</code></dfn>"</h5>

  <p>The <code title=rel-search><a href=#link-type-search>search</a></code> keyword may be used
  with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-search><a href=#link-type-search>search</a></code> keyword indicates that
  the referenced document provides an interface specifically for
  searching the document and its related resources.</p>

  <p class=note>OpenSearch description documents can be used with
  <code><a href=#the-link-element>link</a></code> elements and the <code title=rel-search><a href=#link-type-search>search</a></code> link type to enable user agents to
  autodiscover search interfaces. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>


  <h5 id=link-type-sidebar><span class=secno>4.12.5.11 </span>Link type "<dfn title=rel-sidebar><code>sidebar</code></dfn>"</h5>

  <p>The <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword may be used
  with <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword indicates
  that the referenced document, if retrieved, is intended to be shown
  in a <a href=#secondary-browsing-context>secondary browsing context</a> (if possible), instead
  of in the current <a href=#browsing-context>browsing context</a>.</p>

  <p>A <a href=#hyperlink>hyperlink</a> with the <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword specified is a <dfn id=rel-sidebar-hyperlink title=rel-sidebar-hyperlink>sidebar hyperlink</dfn>.</p>


  <h5 id=link-type-stylesheet><span class=secno>4.12.5.12 </span>Link type "<dfn title=rel-stylesheet><code>stylesheet</code></dfn>"</h5>

  <p>The <code title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword may be
  used with <code><a href=#the-link-element>link</a></code> elements. This keyword creates an <a href=#external-resource-link title="external resource link">external resource link</a> that
  contributes to the <a href=#styling>styling processing model</a>.</p>

  <p>The specified resource is a resource that describes how to
  present the document. Exactly how the resource is to be processed
  depends on the actual type of the resource.</p>

  <p>If the <code title=rel-alternate><a href=#rel-alternate>alternate</a></code> keyword is
  also specified on the <code><a href=#the-link-element>link</a></code> element, then <dfn id=the-link-is-an-alternative-stylesheet>the link
  is an alternative stylesheet</dfn>; in this case, the <code title=attr-title><a href=#attr-title>title</a></code> attribute must be specified on the
  <code><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 title=rel-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword is <code title="">text/css</code>.</p>

  <div class=impl>

  <p>The appropriate time to <a href=#concept-link-obtain title=concept-link-obtain>obtain</a> the resource is when the
  <a href=#external-resource-link title="external resource link">external resource link</a>
  is created or when its element is <a href=#insert-an-element-into-a-document title="insert an element
  into a document">inserted into a document</a>, whichever happens
  last. If the resource is <a href=#the-link-is-an-alternative-stylesheet title="the link is an alternative
  stylesheet">an alternative stylesheet</a> then the user agent may
  defer obtaining the resource until it is part of the <a href=#preferred-style-sheet-set>preferred
  style sheet set</a>. <a href=#refsCSSOM>[CSSOM]</a></p> <!--
  what about DOM access of alt style sheets? -->

  <p><strong>Quirk</strong>: If the document has been set to
  <a href=#quirks-mode>quirks mode</a>, has the <a href=#same-origin>same origin</a> as the
  <a href=#url>URL</a> of the external resource<!-- CVE-2010-0654 -->, and
  the <a href=#content-type title=Content-Type>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 title="">text/css</code>.</p>

  </div>


  <h5 id=link-type-tag><span class=secno>4.12.5.13 </span>Link type "<dfn title=rel-tag><code>tag</code></dfn>"</h5>

  <p>The <code title=rel-tag><a href=#link-type-tag>tag</a></code> keyword may be used with
  <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code> elements. This keyword creates
  a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-tag><a href=#link-type-tag>tag</a></code> keyword indicates that the
  <em>tag</em> that the referenced document represents applies to the
  current document.</p>

  <p class=note>Since it indicates that the tag <em>applies to the
  current document</em>, it would be inappropriate to use this keyword
  in the markup of a <a href=#tag-cloud>tag cloud</a>, which lists
  the popular tags across a set of pages.</p>

  <div class=example>

   <p>This document is about some gems, and so it is <i>tagged</i>
   with "<code title="">http://en.wikipedia.org/wiki/Gemstone</code>"
   to unambiguously categorise it as applying to the "jewel" kind of
   gems, and not to, say, the towns in the US, the Ruby package
   format, or the Swiss locomotive class:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;My Precious&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;header&gt;&lt;h1&gt;My precious&lt;/h1&gt; &lt;p&gt;Summer 2012&lt;/p&gt;&lt;/header&gt;
  &lt;p&gt;Recently I managed to dispose of a red gem that had been
  bothering me. I now have a much nicer blue sapphire.&lt;/p&gt;
  &lt;p&gt;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.&lt;/p&gt;
  &lt;footer&gt;
   Tags: &lt;a rel=tag href="http://en.wikipedia.org/wiki/Gemstone"&gt;Gemstone&lt;/a&gt;
  &lt;/footer&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>

  <div class=example>

   <p>In <em>this</em> document, there are two articles. The "<code title=rel-tag><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><a href=#the-article-element>article</a></code> elements).</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Gem 4/4&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;article&gt;
   &lt;h1&gt;801: Steinbock&lt;/h1&gt;
   &lt;p&gt;The number 801 Gem 4/4 electro-diesel has an ibex and was rebuilt in 2002.&lt;/p&gt;
  &lt;/article&gt;
  &lt;article&gt;
   &lt;h1&gt;802: Murmeltier&lt;/h1&gt;
   &lt;figure&gt;
    &lt;img src="http://upload.wikimedia.org/wikipedia/commons/b/b0/Trains_de_la_Bernina_en_hiver_2.jpg"
         alt="The 802 was red with pantographs and tall vents on the side."&gt;
    &lt;figcaption&gt;The 802 in the 1980s, above Lago Bianco.&lt;/figcaption&gt;
   &lt;/figure&gt;
   &lt;p&gt;The number 802 Gem 4/4 electro-diesel has a marmot and was rebuilt in 2003.&lt;/p&gt;
  &lt;/article&gt;
  &lt;p class="topic"&gt;&lt;a rel=tag href="http://en.wikipedia.org/wiki/Rhaetian_Railway_Gem_4/4"&gt;Gem 4/4&lt;/a&gt;&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>



  <h5 id=sequential-link-types><span class=secno>4.12.5.14 </span>Sequential link types</h5>

  <p>Some documents form part of a sequence of documents.</p>

  <p>A sequence of documents is one where each document can have a
  <em>previous sibling</em> and a <em>next sibling</em>. A document
  with no previous sibling is the start of its sequence, a document
  with no next sibling is the end of its sequence.</p>

  <p>A document may be part of multiple sequences.</p>


  <h6 id=link-type-next><span class=secno>4.12.5.14.1 </span>Link type "<dfn title=rel-next><code>next</code></dfn>"</h6>

  <p>The <code title=rel-next><a href=#link-type-next>next</a></code> keyword may be used with
  <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-next><a href=#link-type-next>next</a></code> keyword indicates that the
  document is part of a sequence, and that the link is leading to the
  document that is the next logical document in the sequence.</p>


  <h6 id=link-type-prev><span class=secno>4.12.5.14.2 </span>Link type "<dfn title=rel-prev><code>prev</code></dfn>"</h6>

  <p>The <code title=rel-prev><a href=#link-type-prev>prev</a></code> keyword may be used with
  <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code>
  elements. This keyword creates a <a href=#hyperlink>hyperlink</a>.</p>

  <p>The <code title=rel-prev><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>

  <div class=impl>

  <p><strong>Synonyms</strong>: For historical reasons, user agents
  must also treat the keyword "<code title="">previous</code>" like
  the <code title=rel-prev><a href=#link-type-prev>prev</a></code> keyword.</p>

  </div>


  <h5 id=other-link-types><span class=secno>4.12.5.15 </span>Other link types</h5>

  <!-- XXX should update this section to more closely match the wiki -->
  <!-- possibly also applying the principles described here:
     http://lists.w3.org/Archives/Public/public-html/2011Mar/0497.html
  -->

  <p><dfn id=concept-rel-extensions title=concept-rel-extensions>Extensions to the predefined
  set of link types</dfn> may be registered in the <a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats wiki existing-rel-values page</a>. <a href=#refsMFREL>[MFREL]</a></p>

  <p>Anyone is free to edit the <span title="">microformats wiki
  existing-rel-values page</span> at any time to add a type. Extension
  types must be specified with the following information:</p>

  <dl><dt>Keyword</dt>

   <dd>

    <p>The actual value being defined. The value should not be
    confusingly similar to any other defined value (e.g. differing
    only in case).</p>

    <p>If the value contains a U+003A COLON character (:), it must
    also be an <a href=#absolute-url>absolute URL</a>.</p>

   </dd>


   <dt>Effect on... <code><a href=#the-link-element>link</a></code></dt>

   <dd>

    <p>One of the following:</p>

    <dl><dt>Not allowed</dt>

     <dd>The keyword must not be specified on <code><a href=#the-link-element>link</a></code>
     elements.</dd>

     <dt>Hyperlink</dt>

     <dd>The keyword may be specified on a <code><a href=#the-link-element>link</a></code> element;
     it creates a <a href=#hyperlink>hyperlink</a>.</dd>

     <dt>External Resource</dt>

     <dd>The keyword may be specified on a <code><a href=#the-link-element>link</a></code> element;
     it creates an <a href=#external-resource-link>external resource link</a>.</dd>

    </dl></dd>


   <dt>Effect on... <code><a href=#the-a-element>a</a></code> and <code><a href=#the-area-element>area</a></code></dt>

   <dd>

    <p>One of the following:</p>

    <dl><dt>Not allowed</dt>

     <dd>The keyword must not be specified on <code><a href=#the-a-element>a</a></code> and
     <code><a href=#the-area-element>area</a></code> elements.</dd>

     <dt>Hyperlink</dt>

     <dd>The keyword may be specified on <code><a href=#the-a-element>a</a></code> and
     <code><a href=#the-area-element>area</a></code> elements; it creates a
     <a href=#hyperlink>hyperlink</a>.</dd>

     <dt>External Resource</dt>

     <dd>The keyword may be specified on <code><a href=#the-a-element>a</a></code> and
     <code><a href=#the-area-element>area</a></code> elements; it creates an <a href=#external-resource-link>external resource
     link</a>.</dd>

     <dt>Hyperlink Annotation</dt>

     <dd>The keyword may be specified on <code><a href=#the-a-element>a</a></code> and
     <code><a href=#the-area-element>area</a></code> elements; it <a href=#hyperlink-annotation title="hyperlink
     annotation">annotates</a> other <a href=#hyperlink title=hyperlink>hyperlinks</a> created by the element.</dd>

    </dl></dd>


   <dt>Brief description</dt>

   <dd><p>A short non-normative description of what the keyword's
   meaning is.</dd>


   <dt>Specification</dt>

   <dd><p>A link to a more detailed description of the keyword's
   semantics and requirements. It could be another page on the Wiki,
   or a link to an external page.</dd>


   <dt>Synonyms</dt>

   <dd><p>A list of other keyword values that have exactly the same
   processing requirements. Authors should not use the values defined
   to be synonyms, they are only intended to allow user agents to
   support legacy content. Anyone may remove synonyms that are not
   used in practice; only names that need to be processed as synonyms
   for compatibility with legacy content are to be registered in this
   way.</dd>


   <dt>Status</dt>

   <dd>

    <p>One of the following:</p>

    <dl><dt>Proposed</dt>

     <dd>The keyword has not received wide peer review and
     approval. Someone has proposed it and is, or soon will be, using
     it.</dd>

     <dt>Ratified</dt>

     <dd>The keyword has received wide peer review and approval. It
     has a specification that unambiguously defines how to handle
     pages that use the keyword, including when they use it in
     incorrect ways.</dd>

     <dt>Discontinued</dt>

     <dd>The keyword has received wide peer review and it has been
     found wanting. Existing pages are using this keyword, but new
     pages should avoid it. The "brief description" and
     "specification" entries will give details of what authors should
     use instead, if anything.</dd>

    </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>

   </dd>

  </dl><div class=impl>

  <p>Conformance checkers must use the information given on the <span title="">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>

  </div>

  <p>Types defined as extensions in the <a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats
  wiki existing-rel-values page</a> with the status "proposed" or
  "ratified" may be used with the <code title="">rel</code> attribute
  on <code><a href=#the-link-element>link</a></code>, <code><a href=#the-a-element>a</a></code>, and <code><a href=#the-area-element>area</a></code> elements
  in accordance to the "Effect on..." field. <a href=#refsMFREL>[MFREL]</a></p>



  <h3 id=common-idioms><span class=secno>4.13 </span>Common idioms without dedicated elements</h3>

  <h4 id=the-main-part-of-the-content><span class=secno>4.13.1 </span>The main part of the content</h4>

  <p>The main content of a page &mdash; not including headers and footers, navigation links,
  sidebars, advertisements, and so forth &mdash; 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><a href=#the-body-element>body</a></code> elements marks up the main content of
  the page, and the bits that aren't main content are excluded through the use of more appropriate
  elements like <code><a href=#the-aside-element>aside</a></code> and <code><a href=#the-nav-element>nav</a></code>.</p>

  <div class=example>

   <p>Here is a short Web page marked up along this minimalistic school of thought. The main content
   is highlighted. Notice how all the <em>other</em> content in the <code><a href=#the-body-element>body</a></code> is marked up
   with elements to indicate that it's not part of the main content, in this case
   <code><a href=#the-header-element>header</a></code>, <code><a href=#the-nav-element>nav</a></code>, and <code><a href=#the-footer-element>footer</a></code>.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt; My Toys &lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;header&gt;
   &lt;h1&gt;My toys&lt;/h1&gt;
  &lt;/header&gt;
  &lt;nav&gt;
   &lt;p&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/p&gt;
   &lt;p&gt;&lt;a href="/contact"&gt;Contact&lt;/a&gt;&lt;/p&gt;
  &lt;/nav&gt;
<strong>  &lt;p&gt;I really like my chained book and my telephone. I'm not such a
  fan of my big ball.&lt;/p&gt;
  &lt;p&gt;Another toy I like is my mirror.&lt;/p&gt;</strong>
  &lt;footer&gt;
   &lt;p&gt;&copy; copyright 2010 by the boy&lt;/p&gt;
  &lt;/footer&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>

  <p>If the main content is an independent unit of content that one could imagine syndicating
  independently, then the <code><a href=#the-article-element>article</a></code> element would be appropriate to mark up the main
  content of the document.</p>

  <div class=example>

   <p>The document in the previous example is here recast as a blog post:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt; The Boy Blog: My Toys &lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;header&gt;
   &lt;h1&gt;The Boy Blog&lt;/h1&gt;
  &lt;/header&gt;
  &lt;nav&gt;
   &lt;p&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/p&gt;
   &lt;p&gt;&lt;a href="/contact"&gt;Contact&lt;/a&gt;&lt;/p&gt;
  &lt;/nav&gt;
<strong>  &lt;article&gt;
   &lt;header&gt;
    &lt;h1&gt;My toys&lt;/h1&gt;
    &lt;p&gt;Published August 4th&lt;/p&gt;
   &lt;/header&gt;
   &lt;p&gt;I really like my chained book and my telephone. I'm not such a
   fan of my big ball.&lt;/p&gt;
   &lt;p&gt;Another toy I like is my mirror.&lt;/p&gt;
  &lt;/article&gt;</strong>
  &lt;footer&gt;
   &lt;p&gt;&copy; copyright 2010 by the boy&lt;/p&gt;
  &lt;/footer&gt;
 &lt;/body&gt;
&lt;/html&gt;</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><a href=#the-section-element>section</a></code> element would be appropriate to mark
  up the main content of the document.</p>

  <div class=example>

   <p>Here is the same document, but as a chapter in an online book:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt; Chapter 2: My Toys &mdash; The Book of the Boy &lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;header&gt;
   &lt;hgroup&gt;
    &lt;h1&gt;The Book of the Boy&lt;/h1&gt;
    &lt;h2&gt;A book about boy stuff&lt;/h2&gt;
   &lt;/hgroup&gt;
  &lt;/header&gt;
  &lt;nav&gt;
   &lt;p&gt;&lt;a href="/"&gt;Front Page&lt;/a&gt;&lt;/p&gt;
   &lt;p&gt;&lt;a href="/toc"&gt;Table of Contents&lt;/a&gt;&lt;/p&gt;
   &lt;p&gt;&lt;a href="/c1"&gt;Chapter 1&lt;/a&gt; &mdash; &lt;a href="/c3"&gt;Chapter 3&lt;/a&gt;&lt;/p&gt;
  &lt;/nav&gt;
<strong>  &lt;section&gt;
   &lt;h1&gt;Chapter 2: My Toys&lt;/h1&gt;
   &lt;p&gt;I really like my chained book and my telephone. I'm not such a
   fan of my big ball.&lt;/p&gt;
   &lt;p&gt;Another toy I like is my mirror.&lt;/p&gt;
  &lt;/section&gt;</strong>
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>

  <p>If neither <code><a href=#the-article-element>article</a></code> nor <code><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><a href=#the-main-element>main</a></code> element can be used.</p>

  <div class=example>

   <p>This is the same as the original example, but using <code><a href=#the-main-element>main</a></code> for the main content
   instead of leaving it implied:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt; My Toys &lt;/title&gt;
  &lt;style&gt;
   body &gt; main { background: navy; color: yellow; }
  &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;header&gt;
   &lt;h1&gt;My toys&lt;/h1&gt;
  &lt;/header&gt;
  &lt;nav&gt;
   &lt;p&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/p&gt;
   &lt;p&gt;&lt;a href="/contact"&gt;Contact&lt;/a&gt;&lt;/p&gt;
  &lt;/nav&gt;
<strong>  &lt;main&gt;
   &lt;p&gt;I really like my chained book and my telephone. I'm not such a
   fan of my big ball.&lt;/p&gt;
   &lt;p&gt;Another toy I like is my mirror.&lt;/p&gt;
  &lt;/main&gt;</strong>
  &lt;footer&gt;
   &lt;p&gt;&copy; copyright 2010 by the boy&lt;/p&gt;
  &lt;/footer&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>


  <h4 id=rel-up><span class=secno>4.13.2 </span>Bread crumb navigation</h4>

  <p>This specification does not provide a machine-readable way of describing bread-crumb navigation
  menus. Authors are encouraged to just use a series of links in a paragraph. The <code><a href=#the-nav-element>nav</a></code>
  element can be used to mark the section containing these paragraphs as being navigation
  blocks.</p>

  <div class=example>

   <p>In the following example, the current page can be reached via two paths. ("<code title="">&amp;gt;</code>" is the "<code title="">&gt;</code>" character.)</p>

   <pre>&lt;nav&gt;
 &lt;p&gt;
  &lt;a href="/"&gt;Main&lt;/a&gt; &amp;gt;
  &lt;a href="/products/"&gt;Products&lt;/a&gt; &amp;gt;
  &lt;a href="/products/dishwashers/"&gt;Dishwashers&lt;/a&gt; &amp;gt;
  &lt;a&gt;Second hand&lt;/a&gt;
 &lt;/p&gt;
 &lt;p&gt;
  &lt;a href="/"&gt;Main&lt;/a&gt; &amp;gt;
  &lt;a href="/second-hand/"&gt;Second hand&lt;/a&gt; &amp;gt;
  &lt;a&gt;Dishwashers&lt;/a&gt;
 &lt;/p&gt;
&lt;/nav&gt;</pre>

  </div>


  <h4 id=tag-clouds><span class=secno>4.13.3 </span>Tag clouds</h4>

  <p id=tag-cloud>This specification does not define any markup specifically for marking up lists
  of keywords that apply to a group of pages (also known as <i>tag clouds</i>). In general, authors
  are encouraged to either mark up such lists using <code><a href=#the-ul-element>ul</a></code> elements with explicit inline
  counts that are then hidden and turned into a presentational effect using a style sheet, or to use
  SVG.</p>

  <div class=example>

   <p>Here, three tags are included in a short tag cloud:</p>

   <pre>&lt;style&gt;
@media screen, print, handheld, tv {
  /* should be ignored by non-visual browsers */
  .tag-cloud &gt; li &gt; span { display: none; }
  .tag-cloud &gt; 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; }
}
&lt;/style&gt;
...
&lt;ul class="tag-cloud"&gt;
 &lt;li class="tag-cloud-4"&gt;&lt;a title="28 instances" href="/t/apple"&gt;apple&lt;/a&gt; &lt;span&gt;(popular)&lt;/span&gt;
 &lt;li class="tag-cloud-2"&gt;&lt;a title="6 instances"  href="/t/kiwi"&gt;kiwi&lt;/a&gt; &lt;span&gt;(rare)&lt;/span&gt;
 &lt;li class="tag-cloud-5"&gt;&lt;a title="41 instances" href="/t/pear"&gt;pear&lt;/a&gt; &lt;span&gt;(very popular)&lt;/span&gt;
&lt;/ul&gt;</pre>

   <p>The actual frequency of each tag is given using the <code title=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><a href=#the-ul-element>ul</a></code> element is used (rather than <code><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 title=rel-tag><a href=#link-type-tag>tag</a></code> <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>-keyword is
   <em>not</em> used on these <code><a href=#the-a-element>a</a></code> elements because they do not represent tags that apply
   to the page itself; they are just part of an index listing the tags themselves.</p>

  </div>


  <h4 id=conversations><span class=secno>4.13.4 </span>Conversations</h4>

  <!-- http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/022576.html -->

  <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><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><a href=#the-span-element>span</a></code> or <code><a href=#the-b-element>b</a></code>. Paragraphs with their text
  wrapped in the <code><a href=#the-i-element>i</a></code> element can be used for marking up
  stage directions.</p>

  <div class=example>

   <p>This example demonstrates this using an extract from Abbot and
   Costello's famous sketch, <cite>Who's on first</cite>:</p>

<pre>&lt;p&gt; Costello: Look, you gotta first baseman?
&lt;p&gt; Abbott: Certainly.
&lt;p&gt; Costello: Who's playing first?
&lt;p&gt; Abbott: That's right.
&lt;p&gt; Costello becomes exasperated.
&lt;p&gt; Costello: When you pay off the first baseman every month, who gets the money?
&lt;p&gt; Abbott: Every dollar of it.</pre>

  </div>

  <div class=example>

   <p>The following extract shows how an IM conversation log could be
   marked up, using the <code><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><a href=#the-time-element>time</a></code> element does not support, so
   the <code><a href=#the-data-element>data</a></code> element is used instead (namely, Unix <code title="">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><a href=#the-time-element>time</a></code> element, that element could have been used
   instead of <code><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>&lt;p&gt; &lt;data value="1319898155"&gt;14:22&lt;/data&gt; &lt;b&gt;egof&lt;/b&gt; I'm not that nerdy, I've only seen 30% of the star trek episodes
&lt;p&gt; &lt;data value="1319898192"&gt;14:23&lt;/data&gt; &lt;b&gt;kaj&lt;/b&gt; if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
&lt;p&gt; &lt;data value="1319898200"&gt;14:23&lt;/data&gt; &lt;b&gt;egof&lt;/b&gt; it's unarguably
&lt;p&gt; &lt;data value="1319898228"&gt;14:23&lt;/data&gt; &lt;i&gt;* kaj blinks&lt;/i&gt;
&lt;p&gt; &lt;data value="1319898260"&gt;14:24&lt;/data&gt; &lt;b&gt;kaj&lt;/b&gt; you are not helping your case</pre>
   <!-- with thanks to http://bash.org/?854262 -->

  </div>

  <div class=example>

   <p>HTML does not have a good way to mark up graphs, so descriptions
   of interactive conversations from games are more difficult to mark
   up. This example shows one possible convention using
   <code><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>&lt;p&gt; Next, you meet a fisherman. You can say one of several greetings:
&lt;dl&gt;
 &lt;dt&gt; "Hello there!"
 &lt;dd&gt;
  &lt;p&gt; He responds with "Hello, how may I help you?"; you can respond with:
  &lt;dl&gt;
   &lt;dt&gt; "I would like to buy a fish."
   &lt;dd&gt; &lt;p&gt; He sells you a fish and the conversation finishes.
   &lt;dt&gt; "Can I borrow your boat?"
   &lt;dd&gt;
    &lt;p&gt; He is surprised and asks "What are you offering in return?".
    &lt;dl&gt;
     &lt;dt&gt; "Five gold." (if you have enough)
     &lt;dt&gt; "Ten gold." (if you have enough)
     &lt;dt&gt; "Fifteen gold." (if you have enough)
     &lt;dd&gt; &lt;p&gt; He lends you his boat. The conversation ends.
     &lt;dt&gt; "A fish." (if you have one)
     &lt;dt&gt; "A newspaper." (if you have one)
     &lt;dt&gt; "A pebble." (if you have one)
     &lt;dd&gt; &lt;p&gt; "No thanks", he replies. Your conversation options        
     at this point are the same as they were after asking to borrow
     his boat, minus any options you've suggested before.
    &lt;/dl&gt;
   &lt;/dd&gt;
  &lt;/dl&gt;
 &lt;/dd&gt;
 &lt;dt&gt; "Vote for me in the next election!"
 &lt;dd&gt; &lt;p&gt; He turns away. The conversation finishes.
 &lt;dt&gt; "Sir, are you aware that your fish are running away?"
 &lt;dd&gt;
  &lt;p&gt; He looks at you skeptically and says "Fish cannot run, sir".
  &lt;dl&gt;
   &lt;dt&gt; "You got me!"
   &lt;dd&gt; &lt;p&gt; The fisherman sighs and the conversation ends.
   &lt;dt&gt; "Only kidding."
   &lt;dd&gt; &lt;p&gt; "Good one!" he retorts. Your conversation options at this
   point are the same as those following "Hello there!" above.
   &lt;dt&gt; "Oh, then what are they doing?"
   &lt;dd&gt; &lt;p&gt; He looks at his fish, giving you an opportunity to steal
   his boat, which you do. The conversation ends.
  &lt;/dl&gt;
 &lt;/dd&gt;
&lt;/dl&gt;</pre>

  </div>

  <div class=example>

   <p>In some games, conversations are simpler: each character merely has a fixed set of lines that
   they say. In this example, a game FAQ/walkthrough lists some of the known possible responses for
   each character:</p>

   <pre>&lt;section&gt;
 &lt;h1&gt;Dialogue&lt;/h1&gt;
 &lt;p&gt;&lt;small&gt;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.&lt;/small&gt;
 &lt;h2&gt;The Shopkeeper&lt;/h2&gt;
 &lt;ul&gt;
  &lt;li&gt;How may I help you?
  &lt;li&gt;Fresh apples!
  &lt;li&gt;A loaf of bread for madam?
 &lt;/ul&gt;
 &lt;h2&gt;The pilot&lt;/h2&gt;
 &lt;p&gt;Before the accident:
 &lt;ul&gt;
  &lt;/li&gt;I'm about to fly out, sorry!
  &lt;/li&gt;Sorry, I'm just waiting for flight clearance and then I'll be off!
 &lt;/ul&gt;
 &lt;p&gt;After the accident:
 &lt;ol&gt;
  &lt;li&gt;I'm about to fly out, sorry!
  &lt;li&gt;Ok, I'm not leaving right now, my plane is being cleaned.
  &lt;li&gt;Ok, it's not being cleaned, it needs a minor repair first.
  &lt;li&gt;Ok, ok, stop bothering me! Truth is, I had a crash.
 &lt;/ol&gt;
 &lt;h2&gt;Clan Leader&lt;/h2&gt;
 &lt;p&gt;During the first clan meeting:
 &lt;ul&gt;
  &lt;li&gt;Hey, have you seen my daughter? I bet she's up to something nefarious again...
  &lt;li&gt;Nice weather we're having today, eh?
  &lt;li&gt;The name is Bailey, Jeff Bailey. How can I help you today?
  &lt;li&gt;A glass of water? Fresh from the well!
 &lt;/ul&gt;
 &lt;p&gt;After the earthquake:
 &lt;ol&gt;
  &lt;li&gt;Everyone is safe in the shelter, we just have to put out the fire!
  &lt;li&gt;I'll go and tell the fire brigade, you keep hosing it down!
 &lt;/ol&gt;
&lt;/section&gt;</pre>

  </div>


  <h4 id=footnotes><span class=secno>4.13.5 </span>Footnotes</h4>

  <p>HTML does not have a dedicated mechanism for marking up
  footnotes. Here are the suggested alternatives.</p>

  <hr><p>For short inline annotations, the <code title=attr-title><a href=#attr-title>title</a></code> attribute could <!-- SHOULD, modulo
  title-warning --> be used.</p>

  <div class=example>

   <p>In this example, two parts of a dialogue are annotated with
   footnote-like content using the <code title=attr-title><a href=#attr-title>title</a></code> attribute.</p>

   <pre>&lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Hello! I wish to register a complaint. Hello. Miss?
&lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: <strong>&lt;span title="Colloquial pronunciation of 'What do you'"</strong>
&gt;Watcha&lt;/span&gt; mean, miss?
&lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Uh, I'm sorry, I have a cold. I wish to make a complaint.
&lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: Sorry, &lt;span <strong>title="This is, of course, a lie."</strong>&gt;we're
closing for lunch&lt;/span&gt;.</pre>

  </div>

  <!-- search for title-warning if modifying this paragraph -->
  <p class=note>Unfortunately, relying on the <code title=attr-title><a href=#attr-title>title</a></code> attribute is currently discouraged
  as many user agents do not expose the attribute in an accessible
  manner as required by this specification (e.g. requiring a pointing
  device such as a mouse to cause a tooltip to appear, which excludes
  keyboard-only users and touch-only users, such as anyone with a
  modern phone or tablet).</p>

  <p class=note>If the <code title=attr-title><a href=#attr-title>title</a></code>
  attribute is used, CSS can used to draw the reader's attention to
  the elements with the attribute.</p>

  <div class=example>

   <p>For example, the following CSS places a dashed line below
   elements that have a <code title=attr-title><a href=#attr-title>title</a></code>
   attribute.</p>

   <pre>[title] { border-bottom: thin dashed; }</pre>

  </div>

  <hr><p>For longer annotations, the <code><a href=#the-a-element>a</a></code> element should be
  used, pointing to an element later in the document. The convention
  is that the contents of the link be a number in square brackets.</p>

  <div class=example>

   <p>In this example, a footnote in the dialogue links to a paragraph
   below the dialogue. The paragraph then reciprocally links back to the
   dialogue, allowing the user to return to the location of the
   footnote.</p>

   <pre>&lt;p&gt; Announcer: Number 16: The &lt;i&gt;hand&lt;/i&gt;.
&lt;p&gt; Interviewer: Good evening. I have with me in the studio tonight
Mr Norman St John Polevaulter, who for the past few years has been
contradicting people. Mr Polevaulter, why &lt;em&gt;do&lt;/em&gt; you
contradict people?
&lt;p&gt; Norman: I don't. &lt;sup&gt;&lt;a href="#fn1" id="r1"&gt;[1]&lt;/a&gt;&lt;/sup&gt;
&lt;p&gt; Interviewer: You told me you did!
<em>...</em>
&lt;section&gt;
 &lt;p id="fn1"&gt;&lt;a href="#r1"&gt;[1]&lt;/a&gt; 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.&lt;/p&gt;
&lt;/section&gt;</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><a href=#the-aside-element>aside</a></code> element should be used.</p>

  <div class=example>

   <p>In this example, a sidebar is given after a dialogue, giving it
   some context.</p>

   <pre>&lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
&lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: I'm sorry?
&lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
&lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: No no no, this's'a tobacconist's.
&lt;aside&gt;
 &lt;p&gt;In 1970, the British Empire lay in ruins, and foreign
 nationalists frequented the streets &mdash; many of them Hungarians
 (not the streets &mdash; the foreign nationals). Sadly, Alexander
 Yalt has been publishing incompetently-written phrase books.
&lt;/aside&gt;</pre>

  </div>

  <hr><p>For figures or tables, footnotes can be included in the relevant
  <code><a href=#the-figcaption-element>figcaption</a></code> or <code><a href=#the-caption-element>caption</a></code> element, or in
  surrounding prose.</p>

  <div class=example>

   <p>In this example, a <!-- round --> table has cells with footnotes
   that are given in prose. A <code><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>&lt;figure&gt;
 &lt;figcaption&gt;Table 1. Alternative activities for knights.&lt;/figcaption&gt;
 &lt;table&gt;
  &lt;tr&gt;
   &lt;th&gt; Activity
   &lt;th&gt; Location
   &lt;th&gt; Cost
  &lt;tr&gt;
   &lt;td&gt; Dance
   &lt;td&gt; Wherever possible
   &lt;td&gt; &pound;0&lt;sup&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;
  &lt;tr&gt;
   &lt;td&gt; Routines, chorus scenes&lt;sup&gt;&lt;a href="#fn2"&gt;2&lt;/a&gt;&lt;/sup&gt;
   &lt;td&gt; Undisclosed
   &lt;td&gt; Undisclosed
  &lt;tr&gt;
   &lt;td&gt; Dining&lt;sup&gt;&lt;a href="#fn3"&gt;3&lt;/a&gt;&lt;/sup&gt;
   &lt;td&gt; Camelot
   &lt;td&gt; Cost of ham, jam, and spam&lt;sup&gt;&lt;a href="#fn4"&gt;4&lt;/a&gt;&lt;/sup&gt;
 &lt;/table&gt;
 &lt;p id="fn1"&gt;1. Assumed.&lt;/p&gt;
 &lt;p id="fn2"&gt;2. Footwork impeccable.&lt;/p&gt;
 &lt;p id="fn3"&gt;3. Quality described as "well".&lt;/p&gt;
 &lt;p id="fn4"&gt;4. A lot.&lt;/p&gt;
&lt;/figure&gt;</pre>

  </div>


  <h3 id=disabled-elements><span class=secno>4.14 </span>Disabled elements</h3>

  <p>An element is said to be <dfn id=concept-element-disabled title=concept-element-disabled>actually disabled</dfn> if it
  falls into one of the following categories:</p>

  <ul><li><code><a href=#the-button-element>button</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

   <li><code><a href=#the-input-element>input</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

   <li><code><a href=#the-select-element>select</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

   <li><code><a href=#the-textarea-element>textarea</a></code> elements that are <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

   <li><code><a href=#the-optgroup-element>optgroup</a></code> elements that have a <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute</li>

   <li><code><a href=#the-option-element>option</a></code> elements that are <a href=#concept-option-disabled title=concept-option-disabled>disabled</a></li>

   <li><code><a href=#the-menuitem-element>menuitem</a></code> elements that have a <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute</li>

   <li><code><a href=#the-fieldset-element>fieldset</a></code> elements that have a <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> attribute</li>

  </ul><p class=note>This definition is used to determine what elements can be <a href=#specially-focusable title="tabindex
  focus flag">focused</a> and which elements match the <code title=selector-disabled><a href=#selector-disabled>:disabled</a></code> pseudo-class.</p>


  <div class=impl>

<!--ADD-TOPIC:CSS-->

  <h3 id=selectors><span class=secno>4.15 </span>Matching HTML elements using selectors</h3>

  <h4 id=case-sensitivity><span class=secno>4.15.1 </span>Case-sensitivity</h4>

  <p>The Selectors specification leaves the case-sensitivity of IDs, classes, element names,
  attribute names, and attribute values to be defined by the host language. <a href=#refsSELECTORS>[SELECTORS]</a></p>

  <p>The <a href=#concept-id title=concept-id>unique identifier</a> of <a href=#html-elements>HTML elements</a> in
  documents that are in <a href=#quirks-mode>quirks mode</a> must be treated as <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> for the purposes of selector matching.</p>

  <p>Classes from the <code title=attr-class><a href=#classes>class</a></code> attribute of <a href=#html-elements>HTML elements</a>
  in documents that are in <a href=#quirks-mode>quirks mode</a> must be treated as <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> for the purposes of selector matching.</p>

  <p>Attribute and element <em>names</em> of <a href=#html-elements>HTML elements</a> in <a href=#html-documents>HTML
  documents</a> must be treated as <a href=#ascii-case-insensitive>ASCII case-insensitive</a> for the purposes of
  selector matching.</p>

  <p>Everything else (attribute values on <a href=#html-elements>HTML elements</a>, IDs and classes in
  <a href=#no-quirks-mode>no-quirks mode</a> and <a href=#limited-quirks-mode>limited-quirks mode</a>, and element names, attribute
  names, and attribute values in <a href=#xml-documents>XML documents</a>) must be treated as
  <a href=#case-sensitive>case-sensitive</a> for the purposes of selector matching.</p>


  <h4 id=pseudo-classes><span class=secno>4.15.2 </span>Pseudo-classes</h4>

  <p>There are a number of dynamic selectors that can be used with HTML. This section defines when
  these selectors match HTML elements. <a href=#refsSELECTORS>[SELECTORS]</a> <a href=#refsCSSUI>[CSSUI]</a></p>

  <dl><dt><dfn id=selector-link title=selector-link><code>:link</code></dfn></dt>
   <dt><dfn id=selector-visited title=selector-visited><code>:visited</code></dfn></dt>

   <dd>

    <p>All <code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
    attribute, all <code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, and all <code><a href=#the-link-element>link</a></code> elements that have
    an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute, must match one of <code title=selector-link><a href=#selector-link>:link</a></code> and <code title=selector-visited><a href=#selector-visited>:visited</a></code>.</p>

    <p>Other specifications might apply more specific rules regarding how these elements are to
    match these pseudo-classes, to mitigate some privacy concerns that apply with straightforward
    implementations of this requirement.</p>

   </dd>


   <dt><dfn id=selector-active title=selector-active><code>:active</code></dfn></dt>

   <dd>

    <p>The <code title=selector-active><a href=#selector-active>:active</a></code> pseudo-class is defined to match an element
    <q cite=http://dev.w3.org/csswg/selectors3/#the-user-action-pseudo-classes-hover-act>while an
    element is <i>being activated</i> by the user</q>. For the purposes of defining the <code title=selector-active><a href=#selector-active>:active</a></code> pseudo-class only, an HTML user agent must consider an
    element as <i>being activated</i> if it is:</p>

    <ul><li>

      <p>An element falling into one of the following categories between the time the user begins to
      indicate an intent to trigger the element's <a href=#activation-behavior>activation behavior</a> and either the
      time the user stops indicating an intent to trigger the element's <a href=#activation-behavior>activation
      behavior</a>, or the time the element's <a href=#activation-behavior>activation behavior</a> has finished
      running, which ever comes first:</p>

      <ul><li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
       attribute</li>

       <li><code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
       attribute</li>

       <li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code>
       attribute</li>

       <li><code><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

       <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is
       in the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a>, <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a>, <a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset
       Button</a>, or <a href="#button-state-(type=button)" title=attr-input-type-button>Button</a> state</li>

       <li><code><a href=#the-menuitem-element>menuitem</a></code> elements that do not have a <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute</li>

       <li>elements that have their <a href=#specially-focusable>tabindex focus flag</a> set</li>

      </ul><p class=example>For example, if the user is using a keyboard to push a <code><a href=#the-button-element>button</a></code>
      element by pressing the space bar, the element would match this pseudo-class in between the
      time that the element received the <code title=event-keydown>keydown</code> event and the
      time the element received the <code title=event-keyup>keyup</code> event.</p>

     </li>

     <li>

      <p>An element that the user indicates using a pointing device while that pointing device is in
      the "down" state (e.g. for a mouse, between the time the mouse button is pressed and the time
      it is depressed).</p>

     </li>

     <li>

      <p>An element that has a descendant that is currently matching the <code title=selector-active><a href=#selector-active>:active</a></code> pseudo-class.</p>

     </li>

    </ul></dd>

<!--CLEANUP-->

   <dt><dfn id=selector-hover title=selector-hover><code>:hover</code></dfn></dt>

   <dd>

    <p>The <code title=selector-hover><a href=#selector-hover>:hover</a></code> pseudo-class is
    defined to match an element <q cite=http://dev.w3.org/csswg/selectors3/#the-user-action-pseudo-classes-hover-act>while
    the user <i>designates</i> an element with a pointing device</q>.
    For the purposes of defining the <code title=selector-hover><a href=#selector-hover>:hover</a></code> pseudo-class only, an HTML
    user agent must consider an element as being one that the user
    <i>designates</i> if it is:</p>

    <ul><li>

      <p>An element that the user indicates using a pointing device.</p>

     </li>

     <li>

      <p>An element that has a descendant that the user indicates
      using a pointing device.</p>

     </li>

     <li>

      <p>An element that is the <a href=#labeled-control>labeled control</a> of a
      <code><a href=#the-label-element>label</a></code> element that is currently matching <a href=#selector-hover title=selector-hover>:hover</a>.</p>

     </li>

    </ul><!--
Demos:
 http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1315
 http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1316
 http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1317
--><div class=example>

     <p>Consider in particular a fragment such as:</p>

     <pre>&lt;p&gt; &lt;label for=c&gt; &lt;input id=a&gt; &lt;/label&gt; &lt;span id=b&gt; &lt;input id=c&gt; &lt;/span&gt; &lt;/p&gt;</pre>

     <p>If the user designates the element with ID "<code title="">a</code>" with their pointing device, then the
     <code><a href=#the-p-element>p</a></code> element (and all its ancestors not shown in the
     snippet above), the <code><a href=#the-label-element>label</a></code> element, the element with
     ID "<code title="">a</code>", and the element with ID "<code title="">c</code>" will match the <a href=#selector-hover title=selector-hover>:hover</a> pseudo-class. The element
     with ID "<code title="">a</code>" matches it from condition 1,
     the <code><a href=#the-label-element>label</a></code> and <code><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 title="">c</code>" matches it
     through condition 3 (its <code><a href=#the-label-element>label</a></code> element matches <a href=#selector-hover title=selector-hover>:hover</a>). However, the element with
     ID "<code title="">b</code>" does <em>not</em> match <a href=#selector-hover title=selector-hover>:hover</a>: its descendant is not
     designated, even though it matches <a href=#selector-hover title=selector-hover>:hover</a>.</p>

    </div>

   </dd>


   <dt><dfn id=selector-enabled title=selector-enabled><code>:enabled</code></dfn></dt>

   <dd>

    <p>The <code title=selector-enabled><a href=#selector-enabled>:enabled</a></code> pseudo-class
    must match any element falling into one of the following
    categories:</p>

    <ul><li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>

     <li><code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>

     <li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute</li>

     <li><code><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

     <li><code><a href=#the-input-element>input</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

     <li><code><a href=#the-select-element>select</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

     <li><code><a href=#the-textarea-element>textarea</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

     <li><code><a href=#the-optgroup-element>optgroup</a></code> elements that do not have a <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute</li>

     <li><code><a href=#the-option-element>option</a></code> elements that are not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a></li>

     <li><code><a href=#the-menuitem-element>menuitem</a></code> elements that do not have a <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute</li>

     <li><code><a href=#the-fieldset-element>fieldset</a></code> elements that do not have a <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> attribute</li>

    </ul></dd>


   <dt><dfn id=selector-disabled title=selector-disabled><code>:disabled</code></dfn></dt>

   <dd>

    <p>The <code title=selector-disabled><a href=#selector-disabled>:disabled</a></code> pseudo-class must match any element that
    is <a href=#concept-element-disabled title=concept-element-disabled>actually disabled</a>.</p>

   </dd>


   <dt><dfn id=selector-checked title=selector-checked><code>:checked</code></dfn></dt>

   <dd>

    <p>The <code title=selector-checked><a href=#selector-checked>:checked</a></code> pseudo-class
    must match any element falling into one of the following
    categories:</p>

    <ul><li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state and whose
     <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is
     true</li>

     <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state and whose
     <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is
     true</li>

     <li><code><a href=#the-option-element>option</a></code> elements whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is
     true</li>

     <li><code><a href=#the-menuitem-element>menuitem</a></code> elements whose <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is in the <a href=#attr-menuitem-type-state-checkbox title=attr-menuitem-type-state-checkbox>Checkbox</a> state
     and that have a <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>
     attribute</li>

     <li><code><a href=#the-menuitem-element>menuitem</a></code> elements whose <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is in the <a href=#attr-menuitem-type-state-radio title=attr-menuitem-type-state-radio>Radio</a> state and that
     have a <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>
     attribute</li>

    </ul></dd>


   <dt><dfn id=selector-indeterminate title=selector-indeterminate><code>:indeterminate</code></dfn></dt>

   <dd>

    <p>The <code title=selector-indeterminate><a href=#selector-indeterminate>:indeterminate</a></code>
    pseudo-class must match any element falling into one of the
    following categories:</p>

    <ul><li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state and whose
     <code title=dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL
     attribute is set to true</li>

     <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
     the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state and whose <a href=#radio-button-group>radio button
     group</a> contains no <code><a href=#the-input-element>input</a></code> elements whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> state is true.</li>

     <li><code><a href=#the-progress-element>progress</a></code> elements with no <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> content attribute</li>

    </ul></dd>


   <dt><dfn id=selector-default title=selector-default><code>:default</code></dfn></dt>

   <dd>

    <p>The <code title=selector-default><a href=#selector-default>:default</a></code> pseudo-class
    must match any element falling into one of the following
    categories:</p>

    <ul><li><code><a href=#the-button-element>button</a></code> elements that are their form's
     <a href=#default-button>default button</a></li>

     <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a> or <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, and that
     are their form's <a href=#default-button>default button</a></li>

     <li><code><a href=#the-input-element>input</a></code> elements to which the <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> attribute applies and
     that have a <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>
     attribute</li>

     <li><code><a href=#the-option-element>option</a></code> elements that have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute</li>
<!--
     <li><code>menuitem</code> elements that have a <code
     title="attr-menuitem-default">default</code> attribute</li>
-->
    </ul></dd>


   <dt><dfn id=selector-valid title=selector-valid><code>:valid</code></dfn></dt>

   <dd>

    <p>The <code title=selector-valid><a href=#selector-valid>:valid</a></code> pseudo-class
    must match any element falling into one of the following
    categories:</p>

    <ul><li>elements that are <a href=#candidate-for-constraint-validation title="candidate for constraint
     validation">candidates for constraint validation</a> and that
     <a href=#concept-fv-valid title=concept-fv-valid>satisfy their
     constraints</a></li>

     <li><code><a href=#the-form-element>form</a></code> elements that are not the <a href=#form-owner>form
     owner</a> of any elements that themselves are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for
     constraint validation</a> but do not <a href=#concept-fv-valid title=concept-fv-valid>satisfy their constraints</a></li>

     <li><code><a href=#the-fieldset-element>fieldset</a></code> elements that have no descendant elements that themselves
     are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for constraint validation</a> but do not <a href=#concept-fv-valid title=concept-fv-valid>satisfy their constraints</a></li>

    </ul></dd>


   <dt><dfn id=selector-invalid title=selector-invalid><code>:invalid</code></dfn></dt>

   <dd>

    <p>The <code title=selector-invalid><a href=#selector-invalid>:invalid</a></code> pseudo-class
    must match any element falling into one of the following
    categories:</p>

    <ul><li>elements that are <a href=#candidate-for-constraint-validation title="candidate for constraint
     validation">candidates for constraint validation</a> but that
     do not <a href=#concept-fv-valid title=concept-fv-valid>satisfy their
     constraints</a></li>

     <li><code><a href=#the-form-element>form</a></code> elements that are the <a href=#form-owner>form
     owner</a> of one or more elements that themselves are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for
     constraint validation</a> but do not <a href=#concept-fv-valid title=concept-fv-valid>satisfy their constraints</a></li>

     <li><code><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 title="candidate for constraint validation">candidates for constraint validation</a> but do not <a href=#concept-fv-valid title=concept-fv-valid>satisfy their constraints</a></li>

    </ul></dd>


   <dt><dfn id=selector-in-range title=selector-in-range><code>:in-range</code></dfn></dt>

   <dd>

    <p>The <code title=selector-in-range><a href=#selector-in-range>:in-range</a></code>
    pseudo-class must match all elements that are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for
    constraint validation</a>, <a href=#have-range-limitations>have range limitations</a>,
    and that are neither <a href=#suffering-from-an-underflow>suffering from an underflow</a> nor
    <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p>

   </dd>


   <dt><dfn id=selector-out-of-range title=selector-out-of-range><code>:out-of-range</code></dfn></dt>

   <dd>

    <p>The <code title=selector-out-of-range><a href=#selector-out-of-range>:out-of-range</a></code>
    pseudo-class must match all elements that are <a href=#candidate-for-constraint-validation title="candidate for constraint validation">candidates for
    constraint validation</a>, <a href=#have-range-limitations>have range limitations</a>,
    and that are either <a href=#suffering-from-an-underflow>suffering from an underflow</a> or
    <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p>

   </dd>


   <dt><dfn id=selector-required title=selector-required><code>:required</code></dfn></dt>

   <dd>

    <p>The <code title=selector-required><a href=#selector-required>:required</a></code>
    pseudo-class must match any element falling into one of the
    following categories:</p>

    <ul><li><code><a href=#the-input-element>input</a></code> elements that are <i title=concept-input-required><a href=#concept-input-required>required</a></i></li>

     <li><code><a href=#the-select-element>select</a></code> elements that have a <code title=attr-select-required><a href=#attr-select-required>required</a></code>
     attribute</li>

     <li><code><a href=#the-textarea-element>textarea</a></code> elements that have a <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>
     attribute</li>

    </ul></dd>


   <dt><dfn id=selector-optional title=selector-optional><code>:optional</code></dfn></dt>

   <dd>

    <p>The <code title=selector-optional><a href=#selector-optional>:optional</a></code>
    pseudo-class must match any element falling into one of the
    following categories:</p>

    <ul><li><code><a href=#the-input-element>input</a></code> elements to which the <code title=attr-input-required><a href=#attr-input-required>required</a></code> attribute applies
     that are not <i title=concept-input-required><a href=#concept-input-required>required</a></i></li>

     <li><code><a href=#the-select-element>select</a></code> elements that do not have a <code title=attr-select-required><a href=#attr-select-required>required</a></code> attribute</li>

     <li><code><a href=#the-textarea-element>textarea</a></code> elements that do not have a <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>
     attribute</li>

    </ul></dd>


   <dt><dfn id=selector-read-only title=selector-read-only><code>:read-only</code></dfn></dt>
   <dt><dfn id=selector-read-write title=selector-read-write><code>:read-write</code></dfn></dt>

   <dd>

    <p>The <code title=selector-read-write><a href=#selector-read-write>:read-write</a></code> pseudo-class must match any element
    falling into one of the following categories, which for the purposes of Selectors are thus
    considered <i>user-alterable</i>: <a href=#refsSELECTORS>[SELECTORS]</a></p>

    <ul><li><code><a href=#the-input-element>input</a></code> elements to which the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute applies,
     and that are <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i> (i.e. that
     do not have the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>
     attribute specified and that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>)</li>

     <li><code><a href=#the-textarea-element>textarea</a></code> elements that do not have a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute, and
     that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

     <li>elements that are <a href=#editing-host title="editing host">editing
     hosts</a> or <a href=#editable>editable</a> and are neither
     <code><a href=#the-input-element>input</a></code> elements nor <code><a href=#the-textarea-element>textarea</a></code>
     elements</li>

    </ul><p>The <code title=selector-read-only><a href=#selector-read-only>:read-only</a></code>
    pseudo-class must match all other <a href=#html-elements>HTML elements</a>.</p>

   </dd>


   <dt><dfn id=selector-ltr title=selector-ltr><code>:dir(ltr)</code></dfn></dt>

   <dd>

    <p>The <code title=selector-ltr><a href=#selector-ltr>:dir(ltr)</a></code> pseudo-class must
    match all elements whose <a href=#the-directionality title="the
    directionality">directionality</a> is '<a href=#concept-ltr title=concept-ltr>ltr</a>'.</p>

   </dd>

   <dt><dfn id=selector-rtl title=selector-rtl><code>:dir(rtl)</code></dfn></dt>

   <dd>

    <p>The <code title=selector-rtl><a href=#selector-rtl>:dir(rtl)</a></code> pseudo-class must
    match all elements whose <a href=#the-directionality title="the
    directionality">directionality</a> is '<a href=#concept-rtl title=concept-rtl>rtl</a>'.</p>

   </dd>

  </dl><p class=note>Another section of this specification defines the
  <i><a href=#target-element>target element</a></i> used with the <code title=selector-target>:target</code> pseudo-class.</p>

  <p class=note>This specification does not define when an element
  matches the <code title=selector-focus>:focus</code> or <code title=selector-lang()>:lang()</code> dynamic pseudo-classes, as
  those are all defined in sufficient detail in a language-agnostic
  fashion in the Selectors specification. <a href=#refsSELECTORS>[SELECTORS]</a></p>

<!--REMOVE-TOPIC:CSS-->

  </div>


<!--TOPIC:Microdata-->

  <h2 id=microdata><span class=secno>5 </span><dfn>Microdata</dfn></h2>

<!-- USE CASES

     Getting data out of poorly written Web pages
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019595.html

     Allowing authors to keep track of where content originates
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019620.html

     Helping people seaching for content filtered by license
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019668.html

     Allowing authors to annotate their documents to explain things for readers
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019672.html

     Annotating structured data that HTML has no semantics for
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019681.html

     Exposing known data types in a reusable way
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019833.html

     Providing enhanced search results
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019834.html

     Dragging or copying data between sites
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019835.html

     Writing authoring tools and validators for custom microdata vocabularies
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019839.html

     Removing the need for separate feeds
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019884.html

     Use cases for which I haven't been able to find solutions
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-May/019886.html     

-->

<!-- v2

  * <itemref itemprop="foo" src="url#id"> to import the item with id="id" from url into the current
    microdata block as the value of property foo?

  * splitting the 'content' part of a property into multiple sub-bits, as in:

     <span itemprop="tel" item-content-in-bits>
       Telephone:
       <span content-bit>+44</span> (0) <span content-bit>1223 123 123</span>
     </span>

    maybe vocabs that need this can use a sub vocabulary specifically for this:

     <span itemprop="tel" itemscope itemtype="http://bits.example/">
       Telephone:
       <span itemprop=bit>+44</span> (0) <span itemprop=bit>1223 123 123</span>
     </span>

-->

  <h3 id=introduction-4><span class=secno>5.1 </span>Introduction</h3>

  <h4 id=overview><span class=secno>5.1.1 </span>Overview</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Sometimes, it is desirable to annotate content with specific machine-readable labels, e.g. to
  allow generic scripts to provide services that are customised to the page, or to enable content
  from a variety of cooperating authors to be processed by a single script in a consistent
  manner.</p>

  <p>For this purpose, authors can use the microdata features described in this section. Microdata
  allows nested groups of name-value pairs to be added to documents, in parallel with the existing
  content.</p>


  <h4 id=the-basic-syntax><span class=secno>5.1.2 </span>The basic syntax</h4>

  <p><i>This section is non-normative.</i></p>

  <p>At a high level, microdata consists of a group of name-value pairs. The groups are called <a href=#concept-item title=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 title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is used.</p>

  <p>To add a property to an item, the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is used
  on one of the <a href=#concept-item title=concept-item>item's</a> descendants.</p>

  <div class=example>

   <p>Here there are two items, each of which has the property "name":</p>

   <pre>&lt;div itemscope&gt;
 &lt;p&gt;My name is &lt;span itemprop="name"&gt;Elizabeth&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;

&lt;div itemscope&gt;
 &lt;p&gt;My name is &lt;span itemprop="name"&gt;Daniel&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;</pre>

  </div>

  <p>Markup without microdata attributes has no effect on microdata.</p>

  <div class=example>

   <p>These two examples are exactly equivalent, at a microdata level, as the previous two examples
   respectively:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p&gt;My &lt;em&gt;name&lt;/em&gt; is &lt;span itemprop="name"&gt;E&lt;strong&gt;liz&lt;/strong&gt;abeth&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;

&lt;section&gt;
 &lt;div itemscope&gt;
  &lt;aside&gt;
   &lt;p&gt;My name is &lt;span itemprop="name"&gt;&lt;a href="/?user=daniel"&gt;Daniel&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;
  &lt;/aside&gt;
 &lt;/div&gt;
&lt;/section&gt;</pre>

  </div>

  <p>Properties generally have values that are strings.</p>

  <div class=example>

   <p>Here the item has three properties:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p&gt;My name is &lt;span itemprop="name"&gt;Neil&lt;/span&gt;.&lt;/p&gt;
 &lt;p&gt;My band is called &lt;span itemprop="band"&gt;Four Parts Water&lt;/span&gt;.&lt;/p&gt;
 &lt;p&gt;I am &lt;span itemprop="nationality"&gt;British&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;</pre>

  </div>

  <p>When a string value is a <a href=#url>URL</a>, it is expressed using the <code><a href=#the-a-element>a</a></code> element and
  its <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, the <code><a href=#the-img-element>img</a></code> element and its
  <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute, or other elements that link to or embed external
  resources.</p>

  <div class=example>

   <p>In this example, the item has one property, "image", whose value is a URL:</p>

   <pre>&lt;div itemscope&gt;
 &lt;img itemprop="image" src="google-logo.png" alt="Google"&gt;
&lt;/div&gt;</pre>

  </div>

  <p>When a string value is in some machine-readable format unsuitable
  for human consumption, it is expressed using the <code title=attr-data-value><a href=#attr-data-value>value</a></code> attribute of the
  <code><a href=#the-data-element>data</a></code> element, with the human-readable version given in
  the element's contents.</p>

  <div class=example>

   <p>Here, there is an item with a property whose value is a product ID. The ID is not
   human-friendly, so the product's name is used the human-visible text instead of the ID.</p>

   <pre>&lt;h1 itemscope&gt;
 &lt;data itemprop="product-id" value="9678AOU879"&gt;The Instigator 2000&lt;/data&gt;
&lt;/h1&gt;</pre>

  </div>

  <p>For numeric data, the <code><a href=#the-meter-element>meter</a></code> element and its <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute can be used instead.</p>

  <div class=example>

   <p>Here a rating is given using a <code><a href=#the-meter-element>meter</a></code> element.</p>

   <pre>&lt;div itemscope itemtype="http://schema.org/Product"&gt;
 &lt;span itemprop="name"&gt;Panasonic White 60L Refrigerator&lt;/span&gt;
 &lt;img src="panasonic-fridge-60l-white.jpg" alt=""&gt;
  &lt;div itemprop="aggregateRating"
       itemscope itemtype="http://schema.org/AggregateRating"&gt;
   &lt;meter itemprop="ratingValue" min=0 value=3.5 max=5&gt;Rated 3.5/5&lt;/meter&gt;
   (based on &lt;span itemprop="reviewCount"&gt;11&lt;/span&gt; customer reviews)
  &lt;/div&gt;
&lt;/div&gt;</pre>

  </div>

  <p>Similarly, for date- and time-related data, the <code><a href=#the-time-element>time</a></code> element and its <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute can be used instead.</p>

  <div class=example>

   <p>In this example, the item has one property, "birthday", whose value is a date:</p>

   <pre>&lt;div itemscope&gt;
 I was born on &lt;time itemprop="birthday" datetime="2009-05-10"&gt;May 10th 2009&lt;/time&gt;.
&lt;/div&gt;</pre>

  </div>

  <p>Properties can also themselves be groups of name-value pairs, by putting the <code title=attr-itemscope><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>top-level microdata items</a>.</p>

  <div class=example>

   <p>In this example, the outer item represents a person, and the inner one represents a band:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p&gt;Name: &lt;span itemprop="name"&gt;Amanda&lt;/span&gt;&lt;/p&gt;
 &lt;p&gt;Band: &lt;span itemprop="band" itemscope&gt; &lt;span itemprop="name"&gt;Jazz Band&lt;/span&gt; (&lt;span itemprop="size"&gt;12&lt;/span&gt; players)&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</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 title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute can be associated with the <a href=#concept-item title=concept-item>item</a> using the <code title=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 title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute.</p>

  <div class=example>

   <p>This example is the same as the previous one, but all the properties are separated from their
   <a href=#concept-item title=concept-item>items</a>:</p>

   <pre>&lt;div itemscope id="amanda" itemref="a b"&gt;&lt;/div&gt;
&lt;p id="a"&gt;Name: &lt;span itemprop="name"&gt;Amanda&lt;/span&gt;&lt;/p&gt;
&lt;div id="b" itemprop="band" itemscope itemref="c"&gt;&lt;/div&gt;
&lt;div id="c"&gt;
 &lt;p&gt;Band: &lt;span itemprop="name"&gt;Jazz Band&lt;/span&gt;&lt;/p&gt;
 &lt;p&gt;Size: &lt;span itemprop="size"&gt;12&lt;/span&gt; players&lt;/p&gt;
&lt;/div&gt;</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 title=concept-item>item</a> can have multiple properties with the same name and
  different values.</p>

  <div class=example>

   <p>This example describes an ice cream, with two flavors:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p&gt;Flavors in my favorite ice cream:&lt;/p&gt;
 &lt;ul&gt;
  &lt;li itemprop="flavor"&gt;Lemon sorbet&lt;/li&gt;
  &lt;li itemprop="flavor"&gt;Apricot sorbet&lt;/li&gt;
 &lt;/ul&gt;
&lt;/div&gt;</pre>

   <p>This thus results in an item with two properties, both "flavor", having the values "Lemon
   sorbet" and "Apricot sorbet".</p>

  </div>

  <p>An element introducing a property can also introduce multiple properties at once, to avoid
  duplication when some of the properties have the same value.</p>

  <div class=example>

   <p>Here we see an item with two properties, "favorite-color" and "favorite-fruit", both set to
   the value "orange":</p>

   <pre>&lt;div itemscope&gt;
 &lt;span itemprop="favorite-color favorite-fruit"&gt;orange&lt;/span&gt;
&lt;/div&gt;</pre>

  </div>

  <p>It's important to note that there is no relationship between the microdata and the content of
  the document where the microdata is marked up.</p>

  <div class=example>

   <p>There is no semantic difference, for instance, between the following two examples:</p>

   <pre>&lt;figure&gt;
 &lt;img src="castle.jpeg"&gt;
 &lt;figcaption&gt;&lt;span itemscope&gt;&lt;span itemprop="name"&gt;The Castle&lt;/span&gt;&lt;/span&gt; (1986)&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

   <pre>&lt;span itemscope&gt;&lt;meta itemprop="name" content="The Castle"&gt;&lt;/span&gt;
&lt;figure&gt;
 &lt;img src="castle.jpeg"&gt;
 &lt;figcaption&gt;The Castle (1986)&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

   <p>Both have a figure with a caption, and both, completely unrelated to the figure, have an item
   with a name-value pair with the name "name" and the value "The Castle". The only difference is
   that if the user drags the caption out of the document, in the former case, the item will be
   included in the drag-and-drop data. In neither case is the image in any way associated with the
   item.</p>

  </div>


  <h4 id=typed-items><span class=secno>5.1.3 </span>Typed items</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The examples in the previous section show how information could be marked up on a page that
  doesn't expect its microdata to be re-used. Microdata is most useful, though, when it is used in
  contexts where other authors and readers are able to cooperate to make new uses of the markup.</p>

  <p>For this purpose, it is necessary to give each <a href=#concept-item title=concept-item>item</a> a type,
  such as "http://example.com/person", or "http://example.org/cat", or "http://band.example.net/".
  Types are identified as <a href=#url title=URL>URLs</a>.</p>

  <p>The type for an <a href=#concept-item title=concept-item>item</a> is given as the value of an <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute on the same element as the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute.</p>

  <div class=example>

   <p>Here, the item's type is "http://example.org/animals#cat":</p>

<pre>&lt;section itemscope itemtype="http://example.org/animals#cat"&gt;
 &lt;h1 itemprop="name"&gt;Hedral&lt;/h1&gt;
 &lt;p itemprop="desc"&gt;Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.&lt;/p&gt;
 &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months"&gt;
&lt;/section&gt;</pre>

   <p>In this example the "http://example.org/animals#cat" item has three properties, a "name"
   ("Hedral"), a "desc" ("Hedral is..."), and an "img" ("hedral.jpeg").</p>

  </div>

  <p>The type gives the context for the properties, thus selecting a vocabulary: a property named
  "class" given for an item with the type "http://census.example/person" might refer to the economic
  class of an individual, while a property named "class" given for an item with the type
  "http://example.com/school/teacher" might refer to the classroom a teacher has been assigned.
  Several types can share a vocabulary. For example, the types "<code title="">http://example.org/people/teacher</code>" and "<code title="">http://example.org/people/engineer</code>" could be defined to use the same vocabulary
  (though maybe some properties would not be especially useful in both cases, e.g. maybe the "<code title="">http://example.org/people/engineer</code>" type might not typically be used with the
  "<code title="">classroom</code>" property). Multiple types defined to use the same vocabulary can
  be given for a single item by listing the URLs as a space-separated list in the attribute' value.
  An item cannot be given two types if they do not use the same vocabulary, however.</p>


  <h4 id=global-identifiers-for-items><span class=secno>5.1.4 </span>Global identifiers for items</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Sometimes, an <a href=#concept-item title=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 title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute) can
  be designed such that <a href=#concept-item title=concept-item>items</a> get associated with their global
  identifier in an unambiguous way by expressing the global identifiers as <a href=#url title=URL>URLs</a> given in an <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute.</p>

  <p>The exact meaning of the <a href=#url title=URL>URLs</a> given in <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attributes depends on the vocabulary used.</p>

  <div class=example>

   <p>Here, an item is talking about a particular book:</p>

<pre>&lt;dl itemscope
    itemtype="http://vocab.example.net/book"
    <strong>itemid="urn:isbn:0-330-34032-8"</strong>&gt;
 &lt;dt&gt;Title
 &lt;dd itemprop="title"&gt;The Reality Dysfunction
 &lt;dt&gt;Author
 &lt;dd itemprop="author"&gt;Peter F. Hamilton
 &lt;dt&gt;Publication date
 &lt;dd&gt;&lt;time itemprop="pubdate" datetime="1996-01-26"&gt;26 January 1996&lt;/time&gt;
&lt;/dl&gt;</pre>

   <p>The "<code title="">http://vocab.example.net/book</code>" vocabulary in this example would
   define that the <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute takes a <code title="">urn:</code> <a href=#url>URL</a> pointing to the ISBN of the book.</p>

  </div>

  <!-- (commented out since itemtype="" defines the meaning of the
        identifier for now)
  <p>Although it is common practice, authors are encouraged not to use the same URL to identify
  multiple topics; in particular, an HTTP URL usually identifies a specific resource (such as an
  image or document), and authors are encouraged to not use them to identify people, non-Web
  resources like companies, movies, and products, or other abstract concepts. Using an HTTP URL as a
  global identifier for something other than the resource actually designated by the URL leads to a
  situation where it is ambiguous whether the identifier, and thus the set of properties specified
  in the microdata, references the page or something else.</p>
  -->



  <h4 id=selecting-names-when-defining-vocabularies><span class=secno>5.1.5 </span>Selecting names when defining vocabularies</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Using microdata means using a vocabulary. For some purposes, an ad-hoc vocabulary is adequate.
  For others, a vocabulary will need to be designed. Where possible, authors are encouraged to
  re-use existing vocabularies, as this makes content re-use easier.</p>

  <p>When designing new vocabularies, identifiers can be created either using <a href=#url title=URL>URLs</a>, or, for properties, as plain words (with no dots or colons). For URLs,
  conflicts with other vocabularies can be avoided by only using identifiers that correspond to
  pages that the author has control over.</p>

  <div class=example>

   <p>For instance, if Jon and Adam both write content at <code title="">example.com</code>, at <code title="">http://example.com/~jon/...</code> and <code title="">http://example.com/~adam/...</code> respectively, then
   they could select identifiers of the form
   "http://example.com/~jon/name" and "http://example.com/~adam/name"
   respectively.</p>

  </div>

  <p>Properties whose names are just plain words can only be used within the context of the types
  for which they are intended; properties named using URLs can be reused in items of any type. If an
  item has no type, and is not part of another item, then if its properties have names that are just
  plain words, they are not intended to be globally unique, and are instead only intended for
  limited use. Generally speaking, authors are encouraged to use either properties with globally
  unique names (URLs) or ensure that their items are typed.</p>

  <div class=example>

   <p>Here, an item is an "http://example.org/animals#cat", and most of the properties have names
   that are words defined in the context of that type. There are also a few additional properties
   whose names come from other vocabularies.</p>

<pre>&lt;section itemscope itemtype="http://example.org/animals#cat"&gt;
 &lt;h1 itemprop="name http://example.com/fn"&gt;Hedral&lt;/h1&gt;
 &lt;p itemprop="desc"&gt;Hedral is a male american domestic
 shorthair, with a fluffy &lt;span
 itemprop="http://example.com/color"&gt;black&lt;/span&gt; fur with &lt;span
 itemprop="http://example.com/color"&gt;white&lt;/span&gt; paws and belly.&lt;/p&gt;
 &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months"&gt;
&lt;/section&gt;</pre>

   <p>This example has one item with the type "http://example.org/animals#cat" and the following
   properties:</p>

   <table><thead><tr><td>Property
      <td>Value
    <tbody><tr><td>name
      <td>Hedral
     <tr><td>http://example.com/fn
      <td>Hedral
     <tr><td>desc
      <td>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.
     <tr><td>http://example.com/color
      <td>black
     <tr><td>http://example.com/color
      <td>white
     <tr><td>img
      <td>.../hedral.jpeg
   </table></div>



  <h4 id=using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the microdata DOM API</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The microdata becomes even more useful when scripts can use it to expose information to the
  user, for example offering it in a form that can be used by other applications.</p>

  <p>The <code title=dom-document-getItems><a href=#dom-document-getitems>document.getItems(<var title="">typeNames</var>)</a></code>
  method provides access to the <a href=#top-level-microdata-items>top-level microdata items</a>. It returns a
  <code><a href=#nodelist>NodeList</a></code> containing the items with the specified types, or all types if no argument
  is specified.</p>

  <p>Each <a href=#concept-item title=concept-item>item</a> is represented in the DOM by the element on which
  the relevant <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is found. These elements have
  their <code title=dom-itemScope><a href=#dom-itemscope>element.itemScope</a></code> IDL attribute set to true.</p>

  <p>The type(s) of <a href=#concept-item title=concept-item>items</a> can be obtained using the <code title=dom-itemType><a href=#dom-itemtype>element.itemType</a></code> IDL attribute on the element with the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute.</p>

  <div class=example>

   <p>This sample shows how the <code title=dom-document-getItems><a href=#dom-document-getitems>getItems()</a></code> method can be
   used to obtain a list of all the top-level microdata items of a particular type given in the
   document:</p>

   <pre>var cats = document.getItems("http://example.com/feline");</pre>

  </div>

  <p>Once an element representing an <a href=#concept-item title=concept-item>item</a> has been obtained, its
  properties can be extracted using the <code title=dom-properties><a href=#dom-properties>properties</a></code> IDL
  attribute. This attribute returns an <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code>, which can be
  enumerated to go through each element that adds one or more properties to the item. It can also be
  indexed by name, which will return an object with a list of the elements that add properties with
  that name.</p>

  <p>Each element that adds a property also has an <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL
  attribute that returns its value.</p>

  <div class=example>

   <p>This sample gets the first item of type "http://example.net/user" and then pops up an alert
   using the "name" property from that item.</p>

   <pre>var user = document.getItems('http://example.net/user')[0];
alert('Hello ' + user.properties['name'][0].itemValue + '!');</pre>

  </div>

  <p>The <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object, when indexed by name in this way, actually
  returns a <code><a href=#propertynodelist>PropertyNodeList</a></code> object with all the matching properties. The
  <code><a href=#propertynodelist>PropertyNodeList</a></code> object can be used to obtain all the values at once using
  <em>its</em> <code title=dom-PropertyNodeList-getValues><a href=#dom-propertynodelist-getvalues>getValues</a></code> method, which returns
  an array of all the values.</p>

  <div class=example>

   <p>In an earlier example, a "http://example.org/animals#cat" item had two
   "http://example.com/color" values. This script looks up the first such item and then lists all
   its values.</p>

   <pre>var cat = document.getItems('http://example.org/animals#cat')[0];
var colors = cat.properties['http://example.com/color'].getValues();
var result;
if (colors.length == 0) {
  result = 'Color unknown.';
} else if (colors.length == 1) {
  result = 'Color: ' + colors[0];
} else {
  result = 'Colors:';
  for (var i = 0; i &lt; colors.length; i += 1)
    result += ' ' + colors[i];
}</pre>

  </div>

  <p>It's also possible to get a list of all the <a href=#property-names>property names</a> using the object's
  <code title=dom-HTMLPropertiesCollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code> IDL attribute.</p>

  <div class=example>

   <p>This example creates a big list with a nested list for each item on the page, each with all of
   the property names used in that item.</p>

   <pre>var outer = document.createElement('ul');
var items = document.getItems();
for (var item = 0; item &lt; items.length; item += 1) {
  var itemLi = document.createElement('li');
  var inner = document.createElement('ul');
  for (var name = 0; name &lt; items[item].properties.names.length; name += 1) {
    var propLi = document.createElement('li');
    propLi.appendChild(document.createTextNode(items[item].properties.names[name]));
    inner.appendChild(propLi);
  }
  itemLi.appendChild(inner);
  outer.appendChild(itemLi);
}
document.body.appendChild(outer);</pre>

   <p>If faced with the following from an earlier example:</p>

   <pre>&lt;section itemscope itemtype="http://example.org/animals#cat"&gt;
 &lt;h1 itemprop="name http://example.com/fn"&gt;Hedral&lt;/h1&gt;
 &lt;p itemprop="desc"&gt;Hedral is a male american domestic
 shorthair, with a fluffy &lt;span
 itemprop="http://example.com/color"&gt;black&lt;/span&gt; fur with &lt;span
 itemprop="http://example.com/color"&gt;white&lt;/span&gt; paws and belly.&lt;/p&gt;
 &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months"&gt;
&lt;/section&gt;</pre>

   <p>...it would result in the following output:</p>

   <ul><li>
     <ul><li>name</li>
      <li>http://example.com/fn</li>
      <li>desc</li>
      <li>http://example.com/color</li>
      <li>img</li>
     </ul></li>
   </ul><p>(The duplicate occurrence of "http://example.com/color" is not included in the list.)</p>

  </div>


  <h3 id=encoding-microdata><span class=secno>5.2 </span>Encoding microdata</h3>


  <h4 id=the-microdata-model><span class=secno>5.2.1 </span>The microdata model</h4>

  <p>The microdata model consists of groups of name-value pairs known as <a href=#concept-item title=concept-item>items</a>.</p>

  <p>Each group is known as an <a href=#concept-item title=concept-item>item</a>. Each <a href=#concept-item title=concept-item>item</a> can have <a href=#item-types>item types</a>, a <a href=#global-identifier>global
  identifier</a> (if the vocabulary specified by the <a href=#item-types>item types</a> <a href=#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 title="the properties of an item">property</a>, and each <a href=#the-properties-of-an-item title="the
  properties of an item">property</a> has one or more <a href=#concept-property-value title=concept-property-value>values</a>. Each <a href=#concept-property-value title=concept-property-value>value</a> is either a string or itself a group of name-value
  pairs (an <a href=#concept-item title=concept-item>item</a>). The names are unordered relative to each other,
  but if a particular name has multiple values, they do have a relative order.</p>



  <h4 id=items><span class=secno>5.2.2 </span>Items</h4>

  <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have an <dfn id=attr-itemscope title=attr-itemscope><code>itemscope</code></dfn> attribute specified. The <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is a <a href=#boolean-attribute>boolean attribute</a>.</p>

  <p>An element with the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute specified creates a
  new <dfn id=concept-item title=concept-item>item</dfn>, a group of name-value pairs.</p>

  <hr><p>Elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute may have an <dfn id=attr-itemtype title=attr-itemtype><code>itemtype</code></dfn> attribute specified, to give the <a href=#item-types>item
  types</a> of the <a href=#concept-item title=concept-item>item</a>.</p>

  <p>The <code title=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>unordered set of unique space-separated tokens</a> that are
  <a href=#case-sensitive>case-sensitive</a>, each of which is a <a href=#valid-url>valid URL</a> that is an <a href=#absolute-url>absolute
  URL</a>, and all of which are defined to use the same vocabulary. The attribute's value must
  have at least one token.</p>

  <p>The <dfn id=item-types>item types</dfn> of an <a href=#concept-item title=concept-item>item</a> are the tokens obtained
  by <a href=#split-a-string-on-spaces title="split a string on spaces">splitting the element's <code title=attr-itemtype>itemtype</code> attribute's value on spaces</a>. If the <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute is missing or parsing it in this way finds no
  tokens, the <a href=#concept-item title=concept-item>item</a> is said to have no <a href=#item-types>item types</a>.</p>

  <p>The <a href=#item-types>item types</a> must all be types defined in <a href=#other-applicable-specifications title="other applicable
  specifications">applicable specifications</a> and must all be defined to use the same
  vocabulary.</p>

  <div class=impl>

   <p>Except if otherwise specified by that specification, the <a href=#url title=URL>URLs</a> given
   as the <a href=#item-types>item types</a> should not be automatically dereferenced.</p>

   <p class=note>A specification could define that its <a href=#item-types title="item types">item type</a>
   can be derefenced to provide the user with help information, for example. In fact, vocabulary
   authors are encouraged to provide useful information at the given <a href=#url>URL</a>.</p>

   <p><a href=#item-types>Item types</a> are opaque identifiers, and user agents must not dereference unknown
   <a href=#item-types>item types</a>, or otherwise deconstruct them, in order to determine how to process
   <a href=#concept-item title=concept-item>items</a> that use them.</p>

  </div>

  <p>The <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute must not be specified on elements
  that do not have an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>

  <hr><p>An <a href=#concept-item title=concept-item>item</a> is said to be a <dfn id=typed-item>typed item</dfn> when either it
  has an <a href=#item-types title="item types">item type</a>, or it is the <a href=#concept-property-value title=concept-property-value>value</a> of a <a href=#the-properties-of-an-item title="the properties of an
  item">property</a> of a <a href=#typed-item>typed item</a>. The <dfn id=relevant-types>relevant types</dfn> for a
  <a href=#typed-item>typed item</a> is the <a href=#concept-item title=concept-item>item</a>'s <a href=#item-types>item types</a>,
  if it has any, or else is the <a href=#relevant-types>relevant types</a> of the <a href=#concept-item title=concept-item>item</a> for which it is a <a href=#the-properties-of-an-item title="the properties of an
  item">property</a>'s <a href=#concept-property-value title=concept-property-value>value</a>.</p>

  <hr><p>Elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute and an <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute that references a vocabulary that is defined to
  <dfn id=support-global-identifiers-for-items>support global identifiers for items</dfn> may also have an <dfn id=attr-itemid title=attr-itemid><code>itemid</code></dfn> attribute specified, to give a global identifier for
  the <a href=#concept-item title=concept-item>item</a>, so that it can be related to other <a href=#concept-item title=concept-item>items</a> on pages elsewhere on the Web.</p>

  <p>The <code title=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>valid URL potentially surrounded by spaces</a>.</p>

  <p>The <dfn id=global-identifier>global identifier</dfn> of an <a href=#concept-item title=concept-item>item</a> is the value of
  its element's <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute, if it has one, <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element on which the attribute is specified.
  If the <code title=attr-itemid><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>global identifier</a>.</p>

  <p>The <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> attribute must not be specified on elements that do
  not have both an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute and an <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute specified, and must not be specified on elements
  with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute whose <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute specifies a vocabulary that does not <a href=#support-global-identifiers-for-items>support
  global identifiers for items</a>, as defined by that vocabulary's specification.</p>

  <p>The exact meaning of a <a href=#global-identifier>global identifier</a> is determined by the vocabulary's
  specification. It is up to such specifications to define whether multiple items with the same
  global identifier (whether on the same page or on different pages) are allowed to exist, and what
  the processing rules for that vocabulary are with respect to handling the case of multiple items
  with the same ID.</p>

  <hr><p>Elements with an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute may have an <dfn id=attr-itemref title=attr-itemref><code>itemref</code></dfn> attribute specified, to give a list of additional
  elements to crawl to find the name-value pairs of the <a href=#concept-item title=concept-item>item</a>.</p>

  <p>The <code title=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>unordered set of unique space-separated tokens</a> that are
  <a href=#case-sensitive>case-sensitive</a>, consisting of <a href=#concept-id title=concept-ID>IDs</a> of elements in the
  same <a href=#home-subtree>home subtree</a>.</p>

  <p>The <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute must not be specified on elements that
  do not have an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>

  <p class=note>The <code title=attr-itemref><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 title=concept-item>item</a>, while keeping the properties in the cells.</p>

  <div class=example>

   <p>This example shows a simple vocabulary used to describe the products of a model railway
   manufacturer. The vocabulary has just five property names:</p>

   <dl><dt>product-code</dt>
    <dd>An integer that names the product in the manufacturer's catalog.</dd>
    <dt>name</dt>
    <dd>A brief description of the product.</dd>
    <dt>scale</dt>
    <dd>One of "HO", "1", or "Z" (potentially with leading or trailing
    whitespace), indicating the scale of the product.</dd>
    <dt>digital</dt>
    <dd>If present, one of "Digital", "Delta", or "Systems"
    (potentially with leading or trailing whitespace) indicating that
    the product has a digital decoder of the given type.</dd>
    <dt>track-type</dt>
    <dd>For track-specific products, one of "K", "M", "C" (potentially
    with leading or trailing whitespace) indicating the type of track
    for which the product is intended.</dd>
   </dl><p>This vocabulary has four defined <a href=#item-types>item types</a>:</p>

   <dl><dt>http://md.example.com/loco</dt>
    <dd>Rolling stock with an engine</dd>
    <dt>http://md.example.com/passengers</dt>
    <dd>Passenger rolling stock</dd>
    <dt>http://md.example.com/track</dt>
    <dd>Track pieces</dd>
    <dt>http://md.example.com/lighting</dt>
    <dd>Equipment with lighting</dd>
   </dl><p>Each <a href=#concept-item title=concept-item>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>&lt;dl itemscope itemtype="http://md.example.com/loco 
                        http://md.example.com/lighting"&gt;
 &lt;dt&gt;Name:
 &lt;dd itemprop="name"&gt;Tank Locomotive (DB 80)
 &lt;dt&gt;Product code:
 &lt;dd itemprop="product-code"&gt;33041
 &lt;dt&gt;Scale:
 &lt;dd itemprop="scale"&gt;HO
 &lt;dt&gt;Digital:
 &lt;dd itemprop="digital"&gt;Delta
&lt;/dl&gt;</pre>

   <p>A turnout lantern retrofit kit might be marked up as:</p>

   <pre>&lt;dl itemscope itemtype="http://md.example.com/track
                       http://md.example.com/lighting"&gt;    
 &lt;dt&gt;Name:
 &lt;dd itemprop="name"&gt;Turnout Lantern Kit
 &lt;dt&gt;Product code:
 &lt;dd itemprop="product-code"&gt;74470
 &lt;dt&gt;Purpose:
 &lt;dd&gt;For retrofitting 2 &lt;span itemprop="track-type"&gt;C&lt;/span&gt; Track 
 turnouts. &lt;meta itemprop="scale" content="HO"&gt;
&lt;/dl&gt;</pre>

   <p>A passenger car with no lighting might be marked up as:</p>

   <pre>&lt;dl itemscope itemtype="http://md.example.com/passengers"&gt;
 &lt;dt&gt;Name:
 &lt;dd itemprop="name"&gt;Express Train Passenger Car (DB Am 203)
 &lt;dt&gt;Product code:
 &lt;dd itemprop="product-code"&gt;8710
 &lt;dt&gt;Scale:
 &lt;dd itemprop="scale"&gt;Z
&lt;/dl&gt;</pre>

   <p>Great care is necessary when creating new vocabularies. Often, a hierarchical approach to
   types can be taken that results in a vocabulary where each item only ever has a single type,
   which is generally much simpler to manage.</p>

  </div>


  <h4 id=names:-the-itemprop-attribute><span class=secno>5.2.3 </span>Names: the <dfn title=attr-itemprop><code>itemprop</code></dfn> attribute</h4>

  <p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute specified, if doing so <a href=#the-properties-of-an-item title="the properties
  of an item">adds one or more properties</a> to one or more <a href=#concept-item title=concept-item>items</a> (as defined below).</p>

  <p>The <code title=attr-itemprop><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>unordered set of unique space-separated tokens</a> that are
  <a href=#case-sensitive>case-sensitive</a>, representing the names of the name-value pairs that it adds. The
  attribute's value must have at least one token.</p>

  <p>Each token must be either:</p>

  <ul><li>If the item is a <a href=#typed-item>typed item</a>: a <dfn id=defined-property-name>defined property name</dfn> allowed in this
   situation according to the specification that defines the <a href=#relevant-types>relevant types</a> for the
   item, or</li>

   <li>A <a href=#valid-url>valid URL</a> that is an <a href=#absolute-url>absolute URL</a> defined as an item property
   name allowed in this situation by a vocabulary specification, or</li>

   <li>A <a href=#valid-url>valid URL</a> that is an <a href=#absolute-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), or</li>

   <li>If the item is not a <a href=#typed-item>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).</li>

  </ul><p>Specifications that introduce <a href=#defined-property-name title="defined property name">defined property names</a>
  must ensure all such property names contain no U+002E FULL STOP characters (.), no U+003A COLON
  characters (:), and no <a href=#space-character title="space character">space characters</a>.</p>

  <p>When an element with an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute <a href=#the-properties-of-an-item title="the
  properties of an item">adds a property</a> to multiple <a href=#concept-item title=concept-item>items</a>,
  the requirement above regarding the tokens applies for each <a href=#concept-item title=concept-item>item</a>
  individually.</p>

  <!--

   e.g.:

     <div itemscope itemtype="http://example.com/a"> <ref refid="x"> </div>
     <div itemscope itemtype="http://example.com/b"> <ref refid="x"> </div>
     <meta id="x" itemprop="z" content="">

     "z" had better be valid for both http://example.com/a and http://example.com/b

  -->

  <p>The <dfn id=property-names>property names</dfn> of an element are the tokens that the element's <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is found to contain when its value is <a href=#split-a-string-on-spaces title="split a string on spaces">split on spaces</a>, with the order preserved but with
  duplicates removed (leaving only the first occurrence of each name).</p>

  <p>Within an <a href=#concept-item title=concept-item>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>the properties of an item</a>.</p>

  <div class=example>

   <p>In the following example, the "a" property has the values "1" and "2", <em>in that order</em>,
   but whether the "a" property comes before the "b" property or not is not important:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
&lt;/div&gt;</pre>

   <p>Thus, the following is equivalent:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
&lt;/div&gt;</pre>

   <p>As is the following:</p>

   <pre>&lt;div itemscope&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
&lt;/div&gt;</pre>

   <p>And the following:</p>

   <pre>&lt;div id="x"&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
&lt;/div&gt;
&lt;div itemscope itemref="x"&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
&lt;/div&gt;
</pre>

  </div>



  <h4 id=values><span class=secno>5.2.4 </span>Values</h4>

  <p>The <dfn id=concept-property-value title=concept-property-value>property value</dfn> of a name-value pair added by an
  element with an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is as given for the first
  matching case in the following list:</p>

  <dl class=switch><dt>If the element also has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute</dt>

   <dd>

    <p>The value is the <a href=#concept-item title=concept-item>item</a> created by the element.</p>

   </dd>


   <dt>If the element is a <code><a href=#the-meta-element>meta</a></code> element</dt>

   <dd>

    <p>The value is the value of the element's <code title=attr-content>content</code> attribute,
    if any, or the empty string if there is no such attribute.</p>

   </dd>


   <dt>If the element is an <code><a href=#the-audio-element>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
   <code><a href=#the-img-element>img</a></code>, <code><a href=#the-source-element>source</a></code>, <code><a href=#the-track-element>track</a></code>, or <code><a href=#the-video-element>video</a></code> element</dt>

   <dd>

    <p>The value is the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a
    url">resolving</a> the value of the element's <code title="">src</code> attribute relative to
    the element at the time the attribute is set, or the empty string if there is no such attribute
    or if <a href=#resolve-a-url title="resolve a url">resolving</a> it results in an error.</p>

   </dd>


   <dt>If the element is an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, or <code><a href=#the-link-element>link</a></code> element</dt>

   <dd>

    <p>The value is the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a
    url">resolving</a> the value of the element's <code title="">href</code> attribute relative
    to the element at the time the attribute is set, or the empty string if there is no such
    attribute or if <a href=#resolve-a-url title="resolve a url">resolving</a> it results in an error.</p>

   </dd>


   <dt>If the element is an <code><a href=#the-object-element>object</a></code> element</dt>

   <dd>

    <p>The value is the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a
    url">resolving</a> the value of the element's <code title="">data</code> attribute relative
    to the element at the time the attribute is set, or the empty string if there is no such
    attribute or if <a href=#resolve-a-url title="resolve a url">resolving</a> it results in an error.</p>

   </dd>


   <dt>If the element is a <code><a href=#the-data-element>data</a></code> element</dt>

   <dd>

    <p>The value is the value of the element's <code title=attr-data-value><a href=#attr-data-value>value</a></code> attribute,
    if it has one, or the empty string otherwise.</p>

   </dd>


   <dt>If the element is a <code><a href=#the-meter-element>meter</a></code> element</dt>

   <dd>

    <p>The value is the value of the element's <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute,
    if it has one, or the empty string otherwise.</p>

   </dd>


   <dt>If the element is a <code><a href=#the-time-element>time</a></code> element</dt>

   <dd>

    <p>The value is the element's <a href=#datetime-value>datetime value</a>.</p>

   </dd>


   <dt>Otherwise</dt>

   <dd>

    <p>The value is the element's <code><a href=#textcontent>textContent</a></code>.</p>

   </dd>

  </dl><p>The <dfn id=url-property-elements>URL property elements</dfn> are the <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>,
  <code><a href=#the-audio-element>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-link-element>link</a></code>,
  <code><a href=#the-object-element>object</a></code>, <code><a href=#the-source-element>source</a></code>, <code><a href=#the-track-element>track</a></code>, and <code><a href=#the-video-element>video</a></code> elements.</p>

  <p>If a property's <a href=#concept-property-value title=concept-property-value>value</a>, as defined by the property's
  definition, is an <a href=#absolute-url>absolute URL</a>, the property must be specified using a <a href=#url-property-elements title="URL property elements">URL property element</a>.</p>

  <p class=note>These requirements do not apply just because a property value happens to match the
  syntax for a URL. They only apply if the property is explicitly defined as taking such a
  value.</p>

  <p class=example>For example, a book about the first moon landing <!-- 1969-07-20 --> 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><a href=#the-a-element>a</a></code> element, even though it looks like a
  <a href=#url>URL</a>. On the other hand, if there was a (rather narrowly scoped!) vocabulary for
  "books whose titles look like URLs" which had a "title" property defined to take a URL, then the
  property <em>would</em> expect the title to be given in an <code><a href=#the-a-element>a</a></code> element (or one of the
  other <a href=#url-property-elements>URL property elements</a>), because of the requirement above.</p>


  <div class=impl>

  <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating names with items</h4>

  <p>To find <dfn id=the-properties-of-an-item>the properties of an item</dfn> defined by the element <var title="">root</var>,
  the user agent must run the following steps. These steps are also used to flag <a href=#microdata-error title="microdata error">microdata errors</a>.</p>

  <ol><li><p>Let <var title="">results</var>, <var title="">memory</var>, and <var title="">pending</var> be empty lists of elements.</li>

   <li><p>Add the element <var title="">root</var> to <var title="">memory</var>.</li>

   <li><p>Add the child elements of <var title="">root</var>, if any, to <var title="">pending</var>.</li>

   <li><p>If <var title="">root</var> has an <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute,
   <a href=#split-a-string-on-spaces title="split a string on spaces">split the value of that <code title=attr-itemref>itemref</code> attribute on spaces</a>. For each resulting token <var title="">ID</var>, if there is an element in the <a href=#home-subtree>home subtree</a> of <var title="">root</var> with the <a href=#concept-id title=concept-ID>ID</a> <var title="">ID</var>, then add
   the first such element to <var title="">pending</var>.</li>

   <li><p><i>Loop</i>: If <var title="">pending</var> is empty, jump to the step labeled <i>end of
   loop</i>.</li>

   <li><p>Remove an element from <var title="">pending</var> and let <var title="">current</var> be
   that element.</li>

   <li><p>If <var title="">current</var> is already in <var title="">memory</var>, there is a
   <a href=#microdata-error>microdata error</a>; return to the step labeled <i>loop</i>.</li>

   <li><p>Add <var title="">current</var> to <var title="">memory</var>.</li>

   <li><p>If <var title="">current</var> does not have an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute, then: add all the child elements of <var title="">current</var> to <var title="">pending</var>.</li>

   <li><p>If <var title="">current</var> has an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code>
   attribute specified and has one or more <a href=#property-names>property names</a>, then add <var title="">current</var> to <var title="">results</var>.</li>

   <li><p>Return to the step labeled <i>loop</i>.</li>

   <li><p><i>End of loop</i>: Sort <var title="">results</var> in <a href=#tree-order>tree order</a>.</li>

   <li><p>Return <var title="">results</var>.</li>

  </ol><p>A document must not contain any <a href=#concept-item title=concept-item>items</a> for which the algorithm
  to find <a href=#the-properties-of-an-item>the properties of an item</a> finds any <dfn id=microdata-error title="microdata error">microdata
  errors</dfn>.</p>

  <p>An <a href=#concept-item title=concept-item>item</a> is a <dfn id=top-level-microdata-items title="top-level microdata items">top-level
  microdata item</dfn> if its element does not have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code>
  attribute.</p>

<!--(this is currently redundant with "requirement itemprop" below)
  <p>An <span title="concept-item">item</span> is a <dfn title="used microdata items">used microdata
  item</dfn> if it is a <span title="top-level microdata items">top-level microdata item</span>, or
  if it has an <code title="attr-itemprop">itemprop</code> attribute and would be <span title="the
  properties of an item">found to be the property</span> of an <span
  title="concept-item">item</span> that is itself a <span title="used microdata items">used
  microdata item</span>.</p>

  <p>All <span title="concept-item">items</span> in a document must be <span>used microdata
  items</span>.</p>
-->

  <p>All <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attributes in a <code><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 title=concept-item>item</a> in the <code><a href=#document>Document</a></code> as a node in the graph and each
  <a href=#the-properties-of-an-item title="the properties of an item">property</a> of an item whose <a href=#concept-property-value title=concept-property-value>value</a> is another item as an edge in the graph connecting
  those two items.</p>

  <!-- "requirement itemprop" (see above) -->
  <p>A document must not contain any elements that have an <code title=attr-itemprop><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 title=concept-item>items</a> in that document were their <a href=#the-properties-of-an-item title="the
  properties of an item">properties</a> all to be determined.</p>

  <div class=example>

   <p>In this example, a single license statement is applied to two works, using <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> from the items representing the works:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Photo gallery&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;My photos&lt;/h1&gt;
  &lt;figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses"&gt;
   &lt;img itemprop="work" src="images/house.jpeg" alt="A white house, boarded up, sits in a forest."&gt;
   &lt;figcaption itemprop="title"&gt;The house I found.&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses"&gt;
   &lt;img itemprop="work" src="images/mailbox.jpeg" alt="Outside the house is a mailbox. It has a leaflet inside."&gt;
   &lt;figcaption itemprop="title"&gt;The mailbox.&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;footer&gt;
   &lt;p id="licenses"&gt;All images licensed under the &lt;a itemprop="license"
   href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT
   license&lt;/a&gt;.&lt;/p&gt;
  &lt;/footer&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

   <p>The above results in two items with the type "<code title="">http://n.whatwg.org/work</code>",
   one with:</p>

   <dl class=brief><dt>work
    <dd><code title="">images/house.jpeg</code>
    <dt>title
    <dd>The house I found.
    <dt>license
    <dd><code title="">http://www.opensource.org/licenses/mit-license.php</code>
   </dl><p>...and one with:</p>

   <dl class=brief><dt>work
    <dd><code title="">images/mailbox.jpeg</code>
    <dt>title
    <dd>The mailbox.
    <dt>license
    <dd><code title="">http://www.opensource.org/licenses/mit-license.php</code>
   </dl></div>

  </div> <!-- see comment above -->


  <h4 id=microdata-and-other-namespaces><span class=secno>5.2.6 </span>Microdata and other namespaces</h4>

  <p>Currently, the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>, <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code>, and other microdata attributes are only defined for
  <a href=#html-elements>HTML elements</a>. This means that attributes with the literal names "<code title="">itemscope</code>", "<code title="">itemprop</code>", etc, do not cause microdata
  processing to occur on elements in other namespaces, such as SVG.</p>

  <div class=example>

   <p>Thus, in the following example there is only one item, not
   two.</p>

   <pre class=bad>&lt;p itemscope&gt;&lt;/p&gt; &lt;!-- this is an item (with no properties and no type) --&gt;
&lt;svg itemscope&gt;&lt;/svg&gt; &lt;!-- this is not, it's just an <code><a href=#svg>svg</a></code> element with an invalid unknown attribute --&gt;</pre>

  </div>


  <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-getItems><a href=#dom-document-getitems>getItems</a></code>( [ <var title="">types</var> ] )</dt>

   <dd>

    <p>Returns a <code><a href=#nodelist>NodeList</a></code> of the elements in the <code><a href=#document>Document</a></code> that create
    <a href=#concept-item title=concept-item>items</a>, that are not part of other <a href=#concept-item title=concept-item>items</a>, and that are of the types given in the argument, if any are
    listed.</p>

    <p>The <var title="">types</var> argument is interpreted as a space-separated list of types.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-properties><a href=#dom-properties>properties</a></code></dt>

   <dd>

    <p>If the element has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute, returns an
    <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object with all the element's properties. Otherwise, an
    empty <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> object.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the element's <a href=#concept-property-value title=concept-property-value>value</a>.</p>

    <p>Can be set, to change the element's <a href=#concept-property-value title=concept-property-value>value</a>.
    Setting the <a href=#concept-property-value title=concept-property-value>value</a> when the element has no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute or when the element's value is an <a href=#concept-item title=concept-item>item</a> throws an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-getitems title=dom-document-getItems><code>document.getItems(<var title="">typeNames</var>)</code></dfn> method takes a string that contains an
  <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are <a href=#case-sensitive>case-sensitive</a>,
  representing types. When called, the method must return a <a href=#live>live</a> <code><a href=#nodelist>NodeList</a></code>
  object containing all the elements in the document, in <a href=#tree-order>tree order</a>, that are each
  <a href=#top-level-microdata-items>top-level microdata items</a> whose <a href=#item-types title="item types">types</a> include all the
  types specified in the method's argument, having obtained the types by <a href=#split-a-string-on-spaces title="split a string
  on spaces">splitting the string on spaces</a>. If there are no tokens specified in the
  argument, then the method must return a <code><a href=#nodelist>NodeList</a></code>
  containing all the <a href=#top-level-microdata-items>top-level microdata items</a> in the document. When the method is
  invoked on a <code><a href=#document>Document</a></code> object again with the same argument, the user agent may return
  the same object as the object returned by the earlier call. In other cases, a new
  <code><a href=#nodelist>NodeList</a></code> object must be returned.</p>

  <p>The <dfn id=dom-itemscope title=dom-itemScope><code>itemScope</code></dfn> IDL attribute on <a href=#html-elements>HTML
  elements</a> must <a href=#reflect>reflect</a> the <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code>
  content attribute. The <dfn id=dom-itemtype title=dom-itemType><code>itemType</code></dfn> IDL attribute on
  <a href=#html-elements>HTML elements</a> must <a href=#reflect>reflect</a> the <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> content attribute. The <dfn id=dom-itemid title=dom-itemId><code>itemId</code></dfn> IDL attribute on <a href=#html-elements>HTML elements</a> must
  <a href=#reflect>reflect</a> the <code title=attr-itemid><a href=#attr-itemid>itemid</a></code> content attribute. The <dfn id=dom-itemprop title=dom-itemProp><code>itemProp</code></dfn> IDL attribute on <a href=#html-elements>HTML elements</a> must
  <a href=#reflect>reflect</a> the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> content attribute. The <dfn id=dom-itemref title=dom-itemRef><code>itemRef</code></dfn> IDL attribute on <a href=#html-elements>HTML elements</a> must
  <a href=#reflect>reflect</a> the <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> content attribute.</p>

  <p>The <dfn id=dom-properties title=dom-properties><code>properties</code></dfn> IDL attribute on <a href=#html-elements>HTML
  elements</a> must return an <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> rooted at the element's
  <a href=#root-element>root element</a> (which element this is might change during the collection's lifetime, as
  the element moves between different subtrees), whose filter matches only elements that are <a href=#the-properties-of-an-item title="the properties of an item">the properties of the item</a> created by the element on
  which the attribute was invoked, while that element is an <a href=#concept-item title=concept-item>item</a>,
  and matches nothing the rest of the time.</p>

  <p>The <dfn id=dom-itemvalue title=dom-itemValue><code>itemValue</code></dfn> IDL attribute's behavior depends on
  the element, as follows:</p>

  <dl><dt>If the element has no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute</dt>

   <dd><p>The attribute must return null on getting and must throw an
   <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception on setting.</p>


   <dt>If the element has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute</dt>

   <dd><p>The attribute must return the element itself on getting and must throw an
   <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception on setting.</p>


   <dt>If the element is a <code><a href=#the-meta-element>meta</a></code> element</dt>

   <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the
   element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> content attribute.</dd>


   <dt>If the element is an <code><a href=#the-audio-element>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
   <code><a href=#the-img-element>img</a></code>, <code><a href=#the-source-element>source</a></code>, <code><a href=#the-track-element>track</a></code>, or <code><a href=#the-video-element>video</a></code> element</dt>

   <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the
   element's <code title="">src</code> content attribute.</dd>


   <dt>If the element is an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, or <code><a href=#the-link-element>link</a></code> element</dt>

   <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the
   element's <code title="">href</code> content attribute.</dd>


   <dt>If the element is an <code><a href=#the-object-element>object</a></code> element</dt>

   <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the
   element's <code title="">data</code> content attribute.</dd>


   <dt>If the element is a <code><a href=#the-data-element>data</a></code> element</dt>

   <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the
   element's <code title=attr-data-value><a href=#attr-data-value>value</a></code> content attribute.</dd>


   <dt>If the element is a <code><a href=#the-meter-element>meter</a></code> element</dt>

   <dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the
   element's <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> content attribute.</dd>


   <dt>If the element is a <code><a href=#the-time-element>time</a></code> element</dt>

   <dd><p>On getting, if the element has a <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content
   attribute, the IDL attribute must return that content attribute's value; otherwise, it must
   return the element's <code><a href=#textcontent>textContent</a></code>. On setting, the IDL attribute must act as it would
   if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content attribute.</dd>


   <dt>Otherwise</dt>

   <dd><p>The attribute must act the same as the element's <code><a href=#textcontent>textContent</a></code>
   attribute.</dd>

  </dl><p>When the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute is <a href=#reflect title=reflect>reflecting</a> a content attribute or acting like the element's
  <code><a href=#textcontent>textContent</a></code> attribute, the user agent must, on setting, convert the new value to the
  IDL <code title="">DOMString</code> value before using it according to the mappings described
  above.</p>

  </div>

  <div class=example>

   <p>In this example, a script checks to see if a particular element <var title="">element</var> is
   declaring a particular property, and if it is, it increments a counter:</p>

   <pre>if (element.itemProp.contains('color'))
  count += 1;</pre>

  </div>

  <div class=example>

   <p>This script iterates over each of the values of an element's <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute, calling a function for each referenced
   element:</p>

   <pre>for (var index = 0; index &lt; element.itemRef.length; index += 1)
  process(document.getElementById(element.itemRef[index]));</pre>

  </div>


  <h3 id=mdvocabs><span class=secno>5.4 </span>Sample microdata vocabularies</h3>

  <p>The vocabularies in this section are primarily intended to demonstrate how a vocabulary is
  specified, though they are also usable in their own right.</p>


  <h4 id=vcard><span class=secno>5.4.1 </span>vCard</h4>

  <p>An item with the <a href=#item-types title="item types">item type</a> <dfn id=md-vcard title=md-vcard><code>http://microformats.org/profile/hcard</code></dfn> represents a person's or
  organization's contact information.</p>

  <p>This vocabulary does not <a href=#support-global-identifiers-for-items>support global identifiers for items</a>.</p>

  <p>The following are the type's <a href=#defined-property-name title="defined property name">defined property names</a>.
  They are based on the vocabulary defined in the vCard 4.0 specification and its extensions, where
  more information on how to interpret the values can be found. <a href=#refsRFC6350>[RFC6350]</a></p>

  <dl><dt><dfn id=md-vcard-kind title=md-vcard-kind><code>kind</code></dfn></dt>

   <dd>

    <p>Describes what kind of contact the item represents.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
    is equal to one of the <a href=#kind-strings>kind strings</a>.</p>

    <p>A single property with the name <code title=md-vcard-kind><a href=#md-vcard-kind>kind</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <!-- XML not included since there's no good way to do it here -->
   <!-- Note: vCard->microdata->vCard doesn't count as "propagating
        vCards" according to Tantek, so we're not non-conforming when
        we drop it, despite vCard's requirement -->


   <dt><dfn id=md-vcard-fn title=md-vcard-fn><code>fn</code></dfn></dt>

   <dd>

    <p>Gives the formatted text corresponding to the name of the
    person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Exactly one property with the name <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> must be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-n title=md-vcard-n><code>n</code></dfn></dt>

   <dd>

    <p>Gives the structured name of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#concept-item title=concept-item>item</a> with zero or more of
    each of the <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code>, <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code>, <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code>, <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>, and
    <code title=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 title=md-vcard-n><a href=#md-vcard-n>n</a></code> must be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-n-family-name title=md-vcard-n-family-name><code>family-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>

   <dd>

    <p>Gives the family name of the person, or the full name of the
    organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> may be present
    within the <a href=#concept-item title=concept-item>item</a> that forms the
    <a href=#concept-property-value title=concept-property-value>value</a> of the <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-n-given-name title=md-vcard-n-given-name><code>given-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>

   <dd>

    <p>Gives the given-name of the person.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> may be present
    within the <a href=#concept-item title=concept-item>item</a> that forms the
    <a href=#concept-property-value title=concept-property-value>value</a> of the <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-n-additional-name title=md-vcard-n-additional-name><code>additional-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>

   <dd>

    <p>Gives the any additional names of the person.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code> may be
    present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of the
    <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-n-honorific-prefix title=md-vcard-n-honorific-prefix><code>honorific-prefix</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>

   <dd>

    <p>Gives the honorific prefix of the person.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code> may be
    present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of the
    <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-n-honorific-suffix title=md-vcard-n-honorific-suffix><code>honorific-suffix</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>

   <dd>

    <p>Gives the honorific suffix of the person.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code> may be
    present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of the
    <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-nickname title=md-vcard-nickname><code>nickname</code></dfn></dt>

   <dd>

    <p>Gives the nickname of the person or organization.</p>

    <!-- copied from vCard -->
    <p class=note>The nickname is the descriptive name given instead
    of or in addition to the one belonging to a person, place, or
    thing. It can also be used to specify a familiar form of a proper
    name specified by the <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> or <code title=md-vcard-n><a href=#md-vcard-n>n</a></code> properties.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-nickname><a href=#md-vcard-nickname>nickname</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-photo title=md-vcard-photo><code>photo</code></dfn></dt>

   <dd>

    <p>Gives a photograph of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-photo><a href=#md-vcard-photo>photo</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-bday title=md-vcard-bday><code>bday</code></dfn></dt>

   <dd>

    <p>Gives the birth date of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be a
    <a href=#valid-date-string>valid date string</a>.</p>

    <p>A single property with the name <code title=md-vcard-bday><a href=#md-vcard-bday>bday</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-anniversary title=md-vcard-anniversary><code>anniversary</code></dfn></dt>

   <dd>

    <p>Gives the birth date of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be a
    <a href=#valid-date-string>valid date string</a>.</p>

    <p>A single property with the name <code title=md-vcard-anniversary><a href=#md-vcard-anniversary>anniversary</a></code> may be present
    within each <a href=#concept-item title=concept-item>item</a> with the type
    <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-sex title=md-vcard-sex><code>sex</code></dfn></dt>

   <dd>

    <p>Gives the biological sex of the person.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be one of
    <code title="">F</code>, meaning "female",
    <code title="">M</code>, meaning "male",
    <code title="">N</code>, meaning "none or not applicable", 
    <code title="">O</code>, meaning "other", or
    <code title="">U</code>, meaning "unknown".</p>

    <p>A single property with the name <code title=md-vcard-sex><a href=#md-vcard-sex>sex</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-gender-identity title=md-vcard-gender-identity><code>gender-identity</code></dfn></dt>

   <dd>

    <p>Gives the gender identity of the person.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vcard-gender-identity><a href=#md-vcard-gender-identity>gender-identity</a></code> may be
    present within each <a href=#concept-item title=concept-item>item</a> with
    the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-adr title=md-vcard-adr><code>adr</code></dfn></dt>

   <dd>

    <p>Gives the delivery address of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#concept-item title=concept-item>item</a> with zero or more <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code>, <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code>, <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code>, and
    <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code>
    properties, and optionally a <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> property, optionally
    a <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> property,
    optionally a <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> property, and
    optionally a <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code>
    property.</p>

    <p>If no <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> properties
    are present within an <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
    <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>,
    then the <a href=#address-type-strings title="address type strings">address type
    string</a> <code title=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 title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-type title=md-vcard-adr-type><code>type</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <dd>

    <p>Gives the type of delivery address.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
    is equal to one of the <a href=#address-type-strings>address type strings</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> may be present within the
    <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> property per distinct
    value.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-post-office-box title=md-vcard-adr-post-office-box><code>post-office-box</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <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 title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code> may be
    present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
    <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

    <p class=note>The vCard specification urges authors not to use
    this field.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-extended-address title=md-vcard-adr-extended-address><code>extended-address</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <dd>

    <p>Gives an additional component of the delivery address of the
    person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code> may
    be present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
    <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

    <p class=note>The vCard specification urges authors not to use
    this field.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-street-address title=md-vcard-adr-street-address><code>street-address</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <dd>

    <p>Gives the street address component of the delivery address of
    the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code> may be
    present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
    <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-locality title=md-vcard-adr-locality><code>locality</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <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 title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> may be present
    within the <a href=#concept-item title=concept-item>item</a> that forms the
    <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-region title=md-vcard-adr-region><code>region</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <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 title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> may be present within
    the <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-postal-code title=md-vcard-adr-postal-code><code>postal-code</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <dd>

    <p>Gives the postal code component of the delivery address of the
    person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> may be present
    within the <a href=#concept-item title=concept-item>item</a> that forms the
    <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-adr-country-name title=md-vcard-adr-country-name><code>country-name</code></dfn> (inside <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code>)</dt>

   <dd>

    <p>Gives the country name component of the delivery address of the
    person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code> may be
    present within the <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of an
    <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-tel title=md-vcard-tel><code>tel</code></dfn></dt>

   <dd>

    <p>Gives the telephone number of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>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 title=concept-item>item</a> with zero or more <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> properties and exactly one
    <code title=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 title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> properties
    are present within an <a href=#concept-item title=concept-item>item</a> that
    forms the <a href=#concept-property-value title=concept-property-value>value</a> of a
    <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or if the <a href=#concept-property-value title=concept-property-value>value</a> of such a <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property is text, then the <a href=#telephone-type-strings title="telephone type strings">telephone type string</a> <code title=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 title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-tel-type title=md-vcard-tel-type><code>type</code></dfn> (inside <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code>)</dt>

   <dd>

    <p>Gives the type of telephone number.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
    is equal to one of the <a href=#telephone-type-strings>telephone type strings</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> may be present within the
    <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of a <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property <a href=#concept-item title=concept-item>item</a> there must only be one <code title=md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> property per distinct
    value.</p>

   </dd>

   <dt><dfn id=md-vcard-tel-value title=md-vcard-tel-value><code>value</code></dfn> (inside <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code>)</dt>

   <dd>

    <p>Gives the actual telephone number of the person or
    organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>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 title=md-vcard-tel-value><a href=#md-vcard-tel-value>value</a></code> must be present within the
    <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of a <code title=md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-email title=md-vcard-email><code>email</code></dfn></dt>

   <dd>

    <p>Gives the e-mail address of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-email><a href=#md-vcard-email>email</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-impp title=md-vcard-impp><code>impp</code></dfn></dt>

   <dd>

    <p>Gives a <a href=#url>URL</a> for instant messaging and presence
    protocol communications with the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-impp><a href=#md-vcard-impp>impp</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-lang title=md-vcard-lang><code>lang</code></dfn></dt>

   <dd>

    <p>Gives a language understood by the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>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 title=md-vcard-lang><a href=#md-vcard-lang>lang</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-tz title=md-vcard-tz><code>tz</code></dfn></dt>

   <dd>

    <p>Gives the time zone of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>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>

     <li>A <a href=#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>

     <li>A U+003A COLON character (:).</li>

     <li>A <a href=#valid-non-negative-integer>valid non-negative integer</a> that is exactly two
     digits long and that represents a number in the range
     00..59.</li>

    </ol><p>Any number of properties with the name <code title=md-vcard-tz><a href=#md-vcard-tz>tz</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-geo title=md-vcard-geo><code>geo</code></dfn></dt>

   <dd>

    <p>Gives the geographical position of the person or
    organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>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>

     <li>One or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>Optionally*, a U+002E FULL STOP character (.) followed by one
     or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>A U+003B SEMICOLON character (;).</li>

     <li>Optionally, either a U+002B PLUS SIGN character (+) or a
     U+002D HYPHEN-MINUS character (-).</li>

     <li>One or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>Optionally*, a U+002E FULL STOP character (.) followed by one
     or more <a href=#ascii-digits>ASCII digits</a>.</li>

    </ol><p>The optional components marked with an asterisk (*) should be
    included, and should have six digits each.</p>

    <!-- copied from vCard -->
    <p class=note>The value specifies latitude and longitude, in
    that order (i.e., "LAT LON" ordering), in decimal degrees. The
    longitude represents the location east and west of the prime
    meridian as a positive or negative real number, respectively.  The
    latitude represents the location north and south of the equator as
    a positive or negative real number, respectively.</p>

    <p>Any number of properties with the name <code title=md-vcard-geo><a href=#md-vcard-geo>geo</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-title title=md-vcard-title><code>title</code></dfn></dt>

   <dd>

    <p>Gives the job title, functional position or function of the
    person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-title><a href=#md-vcard-title>title</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-role title=md-vcard-role><code>role</code></dfn></dt>

   <dd>

    <p>Gives the role, occupation, or business category of the person
    or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-role><a href=#md-vcard-role>role</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-logo title=md-vcard-logo><code>logo</code></dfn></dt>

   <dd>

    <p>Gives the logo of the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-logo><a href=#md-vcard-logo>logo</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-agent title=md-vcard-agent><code>agent</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    either an <a href=#concept-item title=concept-item>item</a> with the type
    <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or an <a href=#absolute-url>absolute
    URL</a>, or text.</p>

    <p>Any number of properties with the name <code title=md-vcard-agent><a href=#md-vcard-agent>agent</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-org title=md-vcard-org><code>org</code></dfn></dt>

   <dd>

    <p>Gives the name and units of the organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    either text or an <a href=#concept-item title=concept-item>item</a> with one
    <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
    property and zero or more <code title=md-vcard-n-organization-unit>organization-unit</code>
    properties.</p>

    <p>Any number of properties with the name <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-org-organization-name title=md-vcard-org-organization-name><code>organization-name</code></dfn> (inside <code title=md-vcard-org><a href=#md-vcard-org>org</a></code>)</dt>

   <dd>

    <p>Gives the name of the organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Exactly one property with the name <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
    must be present within the <a href=#concept-item title=concept-item>item</a>
    that forms the <a href=#concept-property-value title=concept-property-value>value</a>
    of an <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-org-organization-unit title=md-vcard-org-organization-unit><code>organization-unit</code></dfn> (inside <code title=md-vcard-org><a href=#md-vcard-org>org</a></code>)</dt>

   <dd>

    <p>Gives the name of the organization unit.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code>
    may be present within the <a href=#concept-item title=concept-item>item</a>
    that forms the <a href=#concept-property-value title=concept-property-value>value</a>
    of the <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-member title=md-vcard-member><code>member</code></dfn></dt>

   <dd>

    <p>Gives a <a href=#url>URL</a> that represents a member of the
    group.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-member><a href=#md-vcard-member>member</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code> if
    the <a href=#concept-item title=concept-item>item</a> also has a property
    with the name <code title=md-vcard-kind><a href=#md-vcard-kind>kind</a></code> whose value
    is "<code title=md-vcard-kind-group><a href=#md-vcard-kind-group>group</a></code>".</p>

   </dd>


   <dt><dfn id=md-vcard-related title=md-vcard-related><code>related</code></dfn></dt>

   <dd>

    <p>Gives a relationship to another entity.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must an
    <a href=#concept-item title=concept-item>item</a> with one <code title=md-vcard-org-related-url><a href=#md-vcard-org-related-url>url</a></code> property and one <code title=md-vcard-org-related-rel><a href=#md-vcard-org-related-rel>rel</a></code> properties.</p>

    <p>Any number of properties with the name <code title=md-vcard-related><a href=#md-vcard-related>orrelated</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-org-related-url title=md-vcard-org-related-url><code>url</code></dfn> (inside <code title=md-vcard-related><a href=#md-vcard-related>related</a></code>)</dt>

   <dd>

    <p>Gives the <a href=#url>URL</a> for the related entity.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Exactly one property with the name <code title=md-vcard-org-url>url</code> must be present within the
    <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-related><a href=#md-vcard-related>related</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>

   <dt><dfn id=md-vcard-org-related-rel title=md-vcard-org-related-rel><code>rel</code></dfn> (inside <code title=md-vcard-related><a href=#md-vcard-related>related</a></code>)</dt>

   <dd>

    <p>Gives the relationship between the entity and the related
    entity.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that, when compared in a <a href=#case-sensitive>case-sensitive</a> manner,
    is equal to one of the <a href=#relationship-strings>relationship strings</a>.</p>

    <p>Exactly one property with the name <code title=md-vcard-org-rel>rel</code> must be present within the
    <a href=#concept-item title=concept-item>item</a> that forms the <a href=#concept-property-value title=concept-property-value>value</a> of an <code title=md-vcard-related><a href=#md-vcard-related>related</a></code> property of an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-categories title=md-vcard-categories><code>categories</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-categories><a href=#md-vcard-categories>categories</a></code> may be present
    within each <a href=#concept-item title=concept-item>item</a> with the type
    <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-note title=md-vcard-note><code>note</code></dfn></dt>

   <dd>

    <p>Gives supplemental information or a comment about the person or
    organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vcard-note><a href=#md-vcard-note>note</a></code> may be present
    within each <a href=#concept-item title=concept-item>item</a> with the type
    <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <!-- PRODID not included -->


   <dt><dfn id=md-vcard-rev title=md-vcard-rev><code>rev</code></dfn></dt>

   <dd>

    <p>Gives the revision date and time of the contact
    information.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>

    <!-- copied from vCard -->
    <p class=note>The value distinguishes the current revision of
    the information for other renditions of the information.</p>

    <p>Any number of properties with the name <code title=md-vcard-rev><a href=#md-vcard-rev>rev</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-sound title=md-vcard-sound><code>sound</code></dfn></dt>

   <dd>

    <p>Gives a sound file relating to the person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-sound><a href=#md-vcard-sound>sound</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <dt><dfn id=md-vcard-uid title=md-vcard-uid><code>uid</code></dfn></dt>

   <dd>

    <p>Gives a globally unique identifier corresponding to the
    person or organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vcard-uid><a href=#md-vcard-uid>uid</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <!-- CLIENTPIDMAP not included since the global parameters are not included -->


   <dt><dfn id=md-vcard-url title=md-vcard-url><code>url</code></dfn></dt>

   <dd>

    <p>Gives a <a href=#url>URL</a> relating to the person or
    organization.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vcard-url><a href=#md-vcard-url>url</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>

   </dd>


   <!-- VERSION not included - always 4.0 -->

   <!-- KEY not included - no way to include binary data at this time -->

   <!-- FBURL, CALADRURI, CALURI not included - unclear how calendars would be exposed on the web -->

  </dl><p>The <dfn id=kind-strings>kind strings</dfn> are:</p>

  <dl><dt><dfn id=md-vcard-kind-individual title=md-vcard-kind-individual><code>individual</code></dfn></dt>
   <dd>
    <p>Indicates a single entity (e.g. a person).</p>
   </dd>

   <dt><dfn id=md-vcard-kind-group title=md-vcard-kind-group><code>group</code></dfn></dt>
   <dd>
    <p>Indicates multiple entities (e.g. a mailing list).</p>
   </dd>

   <dt><dfn id=md-vcard-kind-org title=md-vcard-kind-org><code>org</code></dfn></dt>
   <dd>
    <p>Indicates a single entity that is not a person (e.g. a company).</p>
   </dd>

   <dt><dfn id=md-vcard-kind-location title=md-vcard-kind-location><code>location</code></dfn></dt>
   <dd>
    <p>Indicates a geographical place (e.g. an office building).</p>
   </dd>

   <!-- update this when http://www.iana.org/assignments/vcard-elements/vcard-elements.xml#property-values is updated -->

  </dl><p>The <dfn id=address-type-strings>address type strings</dfn> are:</p>

  <dl><dt><dfn id=md-vcard-type-adr-home title=md-vcard-type-adr-home><code>home</code></dfn></dt>
   <dd>
    <p>Indicates a delivery address for a residence.</p>
   </dd>

   <dt><dfn id=md-vcard-type-adr-work title=md-vcard-type-adr-work><code>work</code></dfn></dt>
   <dd>
    <p>Indicates a delivery address for a place of work.</p>
   </dd>

  </dl><p>The <dfn id=telephone-type-strings>telephone type strings</dfn> are:</p>

  <dl><dt><dfn id=md-vcard-type-tel-home title=md-vcard-type-tel-home><code>home</code></dfn></dt>
   <dd>
    <p>Indicates a residential number.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-work title=md-vcard-type-tel-work><code>work</code></dfn></dt>
   <dd>
    <p>Indicates a telephone number for a place of work.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-text title=md-vcard-type-tel-text><code>text</code></dfn></dt>
   <dd>
    <p>Indicates that the telephone number supports text messages (SMS).</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-voice title=md-vcard-type-tel-voice><code>voice</code></dfn></dt>
   <dd>
    <p>Indicates a voice telephone number.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-fax title=md-vcard-type-tel-fax><code>fax</code></dfn></dt>
   <dd>
    <p>Indicates a facsimile telephone number.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-cell title=md-vcard-type-tel-cell><code>cell</code></dfn></dt>
   <dd>
    <p>Indicates a cellular telephone number.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-video title=md-vcard-type-tel-video><code>video</code></dfn></dt>
   <dd>
    <p>Indicates a video conferencing telephone number.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-pager title=md-vcard-type-tel-pager><code>pager</code></dfn></dt>
   <dd>
    <p>Indicates a paging device telephone number.</p>
   </dd>

   <dt><dfn id=md-vcard-type-tel-textphone title=md-vcard-type-tel-textphone><code>textphone</code></dfn></dt>
   <dd>
    <p>Indicates a telecommunication device for people with hearing or speech difficulties.</p>
   </dd>

  </dl><p>The <dfn id=relationship-strings>relationship strings</dfn> are:</p>

  <dl><dt><dfn id=md-vcard-rel-emergency title=md-vcard-rel-emergency><code>emergency</code></dfn></dt>
   <dd>
    <p>An emergency contact.</p>
   </dd>

   <dt><dfn id=md-vcard-rel-agent title=md-vcard-rel-agent><code>agent</code></dfn></dt>
   <dd>
    <p>Another entity that acts on behalf of this entity.</p>
   </dd>

   <dt><dfn id=md-vcard-rel-contact title=md-vcard-rel-contact>contact</dfn></dt>
   <dt><dfn id=md-vcard-rel-acquaintance title=md-vcard-rel-acquaintance>acquaintance</dfn></dt>
   <dt><dfn id=md-vcard-rel-friend title=md-vcard-rel-friend>friend</dfn></dt>
   <dt><dfn id=md-vcard-rel-met title=md-vcard-rel-met>met</dfn></dt>
   <dt><dfn id=md-vcard-rel-co-worker title=md-vcard-rel-co-worker>worker</dfn></dt>
   <dt><dfn id=md-vcard-rel-colleague title=md-vcard-rel-colleague>colleague</dfn></dt>
   <dt><dfn id=md-vcard-rel-co-resident title=md-vcard-rel-co-resident>resident</dfn></dt>
   <dt><dfn id=md-vcard-rel-neighbor title=md-vcard-rel-neighbor>neighbor</dfn></dt>
   <dt><dfn id=md-vcard-rel-child title=md-vcard-rel-child>child</dfn></dt>
   <dt><dfn id=md-vcard-rel-parent title=md-vcard-rel-parent>parent</dfn></dt>
   <dt><dfn id=md-vcard-rel-sibling title=md-vcard-rel-sibling>sibling</dfn></dt>
   <dt><dfn id=md-vcard-rel-spouse title=md-vcard-rel-spouse>spouse</dfn></dt>
   <dt><dfn id=md-vcard-rel-kin title=md-vcard-rel-kin>kin</dfn></dt>
   <dt><dfn id=md-vcard-rel-muse title=md-vcard-rel-muse>muse</dfn></dt>
   <dt><dfn id=md-vcard-rel-crush title=md-vcard-rel-crush>crush</dfn></dt>
   <dt><dfn id=md-vcard-rel-date title=md-vcard-rel-date>date</dfn></dt>
   <dt><dfn id=md-vcard-rel-sweetheart title=md-vcard-rel-sweetheart>sweetheart</dfn></dt>
   <dt><dfn id=md-vcard-rel-me title=md-vcard-rel-me>me</dfn></dt>
   <dd>
    <p>Has the meaning defined in XFN. <a href=#refsXFN>[XFN]</a></p>
   </dd>

   <!-- update this when http://www.iana.org/assignments/vcard-elements/vcard-elements.xml#parameter-values is updated -->
  </dl><h5 id=conversion-to-vcard><span class=secno>5.4.1.1 </span>Conversion to vCard</h5>

  <p>Given a list of nodes <var title="">nodes</var> in a <code><a href=#document>Document</a></code>, a user agent must
  run the following algorithm to <dfn id=extracting-a-vcard title="extracting a vCard">extract any vCard data represented
  by those nodes</dfn> (only the first vCard is returned):</p>

  <ol><!--CLEANUP--><li><p>If none of the nodes in <var title="">nodes</var> are <a href=#concept-item title=concept-item>items</a> with the <a href=#item-types title="item
   types">item type</a> <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, then
   there is no vCard. Abort the algorithm, returning nothing.</li>

   <li><p>Let <var title="">node</var> be the first node in <var title="">nodes</var> that is an <a href=#concept-item title=concept-item>item</a> with the <a href=#item-types title="item
   types">item type</a> <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</li>

   <li><p>Let <var title="">output</var> be an empty string.</li>

   <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VCARD</code>"
   to <var title="">output</var>.</li>

   <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">PROFILE</code>" and the value "<code title="">VCARD</code>" to <var title="">output</var>.</li>

   <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">VERSION</code>" and the value "<code title="">4.0</code>"
   to <var title="">output</var>.</li>

   <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">SOURCE</code>" and the result of <a href=#escaping-the-vcard-text-string>escaping the vCard
   text string</a> that is <a href="#the-document's-address">the document's address</a> as
   the value to <var title="">output</var>.</li>

   <li><p>If <a href=#the-title-element-0>the <code>title</code> element</a> is not null,
   <a href=#add-a-vcard-line>add a vCard line</a> with the type "<code title="">NAME</code>" and with the result of <a href=#escaping-the-vcard-text-string>escaping the
   vCard text string</a> obtained from the <code><a href=#textcontent>textContent</a></code>
   of <a href=#the-title-element-0>the <code>title</code> element</a> as the value to <var title="">output</var>.</li>

   <li><p>Let <var title="">sex</var> be the empty string.</li>

   <li><p>Let <var title="">gender-identity</var> be the empty
   string.</li>

   <li>

    <p>For each element <var title="">element</var> that is <a href=#the-properties-of-an-item title="the properties of an item">a property of the item</a>
    <var title="">node</var>: for each name <var title="">name</var>
    in <var title="">element</var>'s <a href=#property-names>property names</a>, run
    the following substeps:</p>

    <ol><li><p>Let <var title="">parameters</var> be an empty set of
     name-value pairs.</li>

     <li>

      <p>Run the appropriate set of substeps from the following
      list. The steps will set a variable <var title="">value</var>,
      which is used in the next step.</p>

      <dl><dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
       and <var title="">name</var> is <code title=md-vcard-n><a href=#md-vcard-n>n</a></code></dt>

       <dd>

        <ol><li><p>Let <var title="">value</var> be the empty
         string.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> in
         <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> in <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code> in
         <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>
         in <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code>
         in <var title="">subitem</var>.</p>

        </ol></dd>

       <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
       and <var title="">name</var> is <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code></dt>

       <dd>

        <ol><li><p>Let <var title="">value</var> be the empty
         string.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code>
         in <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code>
         in <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code> in
         <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> in <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> in <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> in
         <var title="">subitem</var>.</p>

         <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code>
         in <var title="">subitem</var>.</p>

         <li><p>If there is a property named <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> in <var title="">subitem</var>, and the first such property has a
         <a href=#concept-property-value title=concept-property-value>value</a> that is not
         an <a href=#concept-item title=concept-item>item</a> and whose value
         consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
         then add a parameter named "<code title="">TYPE</code>" whose
         value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
         to <var title="">parameters</var>.</li>

        </ol></dd>

       <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
       and <var title="">name</var> is <code title=md-vcard-org><a href=#md-vcard-org>org</a></code></dt>

       <dd>

        <ol><li><p>Let <var title="">value</var> be the empty
         string.</li>

         <li><p>Append to <var title="">value</var> the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
         in <var title="">subitem</var>.</p>

         <li>

          <p>For each property named <code title=md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code>
          in <var title="">subitem</var>, run the following steps:</p>

          <ol><li><p>If the <a href=#concept-property-value title=concept-property-value>value</a> of the property
           is an <a href=#concept-item title=concept-item>item</a>, then skip
           this property.</li>

           <li><p>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>

           <li><p>Append the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
           string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the property
           to <var title="">value</var>.</li>

          </ol></li>

        </ol></dd>

       <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
       with the <a href=#item-types title="item types">item type</a> <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
       and <var title="">name</var> is <code title=md-vcard-related><a href=#md-vcard-related>related</a></code></dt>

       <dd>

        <ol><li><p>Let <var title="">value</var> be the empty
         string.</li>

         <li><p>If there is a property named <code title=md-vcard-related-url>url</code> in <var title="">subitem</var>, and its element is a <a href=#url-property-elements title="URL
         property elements">URL property element</a>, then append
         the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a>
         given by the <a href=#concept-property-value title=concept-property-value>value</a> of the first such
         property to <var title="">value</var>, and add a parameter
         with the name "<code title="">VALUE</code>" and the value
         "<code title="">URI</code>" to <var title="">parameters</var>.</li>

         <li><p>If there is a property named <code title=md-vcard-related-rel>rel</code> in <var title="">subitem</var>, and the first such property has a
         <a href=#concept-property-value title=concept-property-value>value</a> that is not
         an <a href=#concept-item title=concept-item>item</a> and whose value
         consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
         then add a parameter named "<code title="">RELATION</code>"
         whose value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
         to <var title="">parameters</var>.</li>

        </ol></dd>

       <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> and <var title="">name</var>
       is none of the above</dt>

       <!-- tel, adr -->

       <dd>

        <ol><li><p>Let <var title="">value</var> be the result of
         <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
         <code title="">value</code> in <var title="">subitem</var>.</p>

         <li><p>If there is a property named <code title="">type</code> in <var title="">subitem</var>, and the
         first such property has a <a href=#concept-property-value title=concept-property-value>value</a> that is not an
         <a href=#concept-item title=concept-item>item</a> and whose value
         consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
         then add a parameter named "<code title="">TYPE</code>" whose
         value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
         to <var title="">parameters</var>.</li>

        </ol></dd>


       <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is not an <a href=#concept-item title=concept-item>item</a> and its <var title="">name</var> is <code title=md-vcard-sex><a href=#md-vcard-sex>sex</a></code></dt>

       <dd>

        <p>If this is the first such property to be found, set <var title="">sex</var> to the property's <a href=#concept-property-value title=concept-property-value>value</a>.</p>

       </dd>


       <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is not an <a href=#concept-item title=concept-item>item</a> and its <var title="">name</var> is <code title=md-vcard-gender-identity><a href=#md-vcard-gender-identity>gender-identity</a></code></dt>

       <dd>

        <p>If this is the first such property to be found, set <var title="">gender-identity</var> to the property's <a href=#concept-property-value title=concept-property-value>value</a>.</p>

       </dd>


       <dt>Otherwise (the property's <a href=#concept-property-value title=concept-property-value>value</a> is not an <a href=#concept-item title=concept-item>item</a>)</dt>

       <dd>

        <ol><li><p>Let <var title="">value</var> be the property's <a href=#concept-property-value title=concept-property-value>value</a>.</li>

         <li><p>If <var title="">element</var> is one of the <a href=#url-property-elements>URL
         property elements</a>, add a parameter with the name "<code title="">VALUE</code>" and the value "<code title="">URI</code>" to <var title="">parameters</var>.</li>

         <li><p>Otherwise, if <var title="">name</var> is <code title=md-vcard-bday><a href=#md-vcard-bday>bday</a></code> or <code title=md-vcard-anniversary><a href=#md-vcard-anniversary>anniversary</a></code> and the <var title="">value</var> is a <a href=#valid-date-string>valid date string</a>, add
         a parameter with the name "<code title="">VALUE</code>" and
         the value "<code title="">DATE</code>" to <var title="">parameters</var>.</li>

         <li><p>Otherwise, if <var title="">name</var> is <code title=md-vcard-rev><a href=#md-vcard-rev>rev</a></code> and the <var title="">value</var> is a <a href=#valid-global-date-and-time-string>valid global date and time
         string</a>, add a parameter with the name "<code title="">VALUE</code>" and the value "<code title="">DATE-TIME</code>" to <var title="">parameters</var>.</li>

         <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in
         <var title="">value</var> with another U+005C REVERSE SOLIDUS
         character (\).</li>

         <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
         (\).</li>

         <li><p>Unless <var title="">name</var> is <code title=md-vcard-geo><a href=#md-vcard-geo>geo</a></code>, prefix every U+003B SEMICOLON
         character (;) in <var title="">value</var> with a U+005C
         REVERSE SOLIDUS character (\).</li>

         <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
         character pair (CRLF) in <var title="">value</var> with a
         U+005C REVERSE SOLIDUS character (\) followed by a U+006E
         LATIN SMALL LETTER N character (n).</li>

         <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
         U+000A LINE FEED (LF) character in <var title="">value</var>
         with a U+005C REVERSE SOLIDUS character (\) followed by a
         U+006E LATIN SMALL LETTER N character (n).</li>

        </ol></dd>

      </dl></li>

     <li>

      <p><a href=#add-a-vcard-line>Add a vCard line</a> with the type <var title="">name</var>, the parameters <var title="">parameters</var>, and the value <var title="">value</var> to <var title="">output</var>.</p>

     </li>

    </ol></li>

   <li><p>If either <var title="">sex</var> or <var title="">gender-identity</var> has a value that is not the empty
   string, <a href=#add-a-vcard-line>add a vCard line</a> with the type "<code title="">GENDER</code>" and the value consisting of the
   concatenation of <var title="">sex</var>, a U+003B SEMICOLON
   character (;), and <var title="">gender-identity</var> to <var title="">output</var>.</li>

   <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">END</code>" and the value "<code title="">VCARD</code>"
   to <var title="">output</var>.</li>

  </ol><p>When the above algorithm says that the user agent is to <dfn id=add-a-vcard-line>add a vCard line</dfn> consisting
  of a type <var title="">type</var>, optionally some parameters, and a value <var title="">value</var> to a string <var title="">output</var>, it must run the following steps:</p>

  <ol><li><p>Let <var title="">line</var> be an empty string.

   <li><p>Append <var title="">type</var>, <a href=#converted-to-ascii-uppercase>converted to
   ASCII uppercase</a>, to <var title="">line</var>.</li>

   <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 title="">line</var>.</li>

     <li><p>Append the parameter's name to <var title="">line</var>.</li>

     <li><p>Append a U+003D EQUALS SIGN character (=) to <var title="">line</var>.</li>

     <li><p>Append the parameter's value to <var title="">line</var>.</li>

    </ol></li>

   <li><p>Append a U+003A COLON character (:) to <var title="">line</var>.</li>

   <li><p>Append <var title="">value</var> to <var title="">line</var>.</li>

   <li><p>Let <var title="">maximum length</var> be 75.</li>

   <li>

    <p>If and while <var title="">line</var> is longer than <var title="">maximum length</var> Unicode code points long, run the
    following substeps:</p>

    <ol><li><p>Append the first <var title="">maximum length</var>
     Unicode code points of <var title="">line</var> to <var title="">output</var>.</li>

     <li><p>Remove the first <var title="">maximum length</var>
     Unicode code points from <var title="">line</var>.</li>

     <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>

     <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>

     <li><p>Append a U+0020 SPACE character to <var title="">output</var>.</li>

     <li><p>Let <var title="">maximum length</var> be 74.</li>

    </ol></li>

   <li><p>Append (what remains of) <var title="">line</var> to <var title="">output</var>.</li>

   <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>

   <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>

  </ol><p>When the steps above require the user agent to obtain the result of <dfn id=collecting-vcard-subproperties>collecting vCard
  subproperties</dfn> named <var title="">subname</var> in <var title="">subitem</var>, the user
  agent must run the following steps:</p>

  <ol><li><p>Let <var title="">value</var> be the empty string.</li>

   <li>

    <p>For each property named <var title="">subname</var> in the item
    <var title="">subitem</var>, run the following substeps:</p>

    <ol><li><p>If the <a href=#concept-property-value title=concept-property-value>value</a>
     of the property is itself an <a href=#concept-item title=concept-item>item</a>, then skip this
     property.</li>

     <li><p>If this is not the first property named <var title="">subname</var> in <var title="">subitem</var> (ignoring
     any that were skipped by the previous step), then append a U+002C
     COMMA character (,) to <var title="">value</var>.</li>

     <li><p>Append the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
     string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the property to
     <var title="">value</var>.</li>

    </ol></li>

   <li><p>Return <var title="">value</var>.</li>

  </ol><p>When the steps above require the user agent to obtain the result of <dfn id=collecting-the-first-vcard-subproperty>collecting the first
  vCard subproperty</dfn> named <var title="">subname</var> in <var title="">subitem</var>, the user
  agent must run the following steps:</p>

  <ol><li><p>If there are no properties named <var title="">subname</var>
   in <var title="">subitem</var>, then abort these substeps,
   returning the empty string.</li>

   <li><p>If the <a href=#concept-property-value title=concept-property-value>value</a> of
   the first property named <var title="">subname</var> in <var title="">subitem</var> is an <a href=#concept-item title=concept-item>item</a>, then abort these substeps,
   returning the empty string.</li>

   <li><p>Return the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
   string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the first property
   named <var title="">subname</var> in <var title="">subitem</var>.</li>

  </ol><p>When the above algorithms say the user agent is to <dfn id=escaping-the-vcard-text-string title="escaping the vCard text
  string">escape the vCard text string</dfn> <var title="">value</var>, the user agent must use the
  following steps:</p>

  <ol><li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var title="">value</var> with another U+005C REVERSE SOLIDUS character
   (\).</li>

   <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
   (\).</li>

   <li><p>Prefix every U+003B SEMICOLON character (;) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
   (\).</li>

   <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
   character pair (CRLF) in <var title="">value</var> with a U+005C
   REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
   LETTER N character (n).</li>

   <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
   U+000A LINE FEED (LF) character in <var title="">value</var> with a
   U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
   SMALL LETTER N character (n).</li>

   <li><p>Return the mutated <var title="">value</var>.</li>

  </ol><p class=note>This algorithm can generate invalid vCard output, if the input does not conform to
  the rules described for the <code title=md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
  <a href=#item-types title="item types">item type</a> and <a href=#defined-property-name title="defined property name">defined property
  names</a>.</p> <!-- of course since vcard doesn't define error handling, this is somewhat
  problematic. -->



  <h5 id=examples-1><span class=secno>5.4.1.2 </span>Examples</h5>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

   <p>Here is a long example vCard for a fictional character called "Jack Bauer":</p>

   <pre>&lt;section id="jack" itemscope itemtype="http://microformats.org/profile/hcard"&gt;
 &lt;h1 itemprop="fn"&gt;
  &lt;span itemprop="n" itemscope&gt;
   &lt;span itemprop="given-name"&gt;Jack&lt;/span&gt;
   &lt;span itemprop="family-name"&gt;Bauer&lt;/span&gt;
  &lt;/span&gt;
 &lt;/h1&gt;
 &lt;img itemprop="photo" alt="" src="jack-bauer.jpg"&gt;
 &lt;p itemprop="org" itemscope&gt;
  &lt;span itemprop="organization-name"&gt;Counter-Terrorist Unit&lt;/span&gt;
  (&lt;span itemprop="organization-unit"&gt;Los Angeles Division&lt;/span&gt;)
 &lt;/p&gt;
 &lt;p&gt;
  &lt;span itemprop="adr" itemscope&gt;
   &lt;span itemprop="street-address"&gt;10201 W. Pico Blvd.&lt;/span&gt;&lt;br&gt;
   &lt;span itemprop="locality"&gt;Los Angeles&lt;/span&gt;,
   &lt;span itemprop="region"&gt;CA&lt;/span&gt;
   &lt;span itemprop="postal-code"&gt;90064&lt;/span&gt;&lt;br&gt;
   &lt;span itemprop="country-name"&gt;United States&lt;/span&gt;&lt;br&gt;
  &lt;/span&gt;
  &lt;span itemprop="geo"&gt;34.052339;-118.410623&lt;/span&gt;
 &lt;/p&gt;
 &lt;h2&gt;Assorted Contact Methods&lt;/h2&gt;
 &lt;ul&gt;
  &lt;li itemprop="tel" itemscope&gt;
   &lt;span itemprop="value"&gt;+1 (310) 597 3781&lt;/span&gt; &lt;span itemprop="type"&gt;work&lt;/span&gt;
   &lt;meta itemprop="type" content="voice"&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a itemprop="url" href="http://en.wikipedia.org/wiki/Jack_Bauer"&gt;I'm on Wikipedia&lt;/a&gt;
  so you can leave a message on my user talk page.&lt;/li&gt;
  &lt;li&gt;&lt;a itemprop="url" href="http://www.jackbauerfacts.com/"&gt;Jack Bauer Facts&lt;/a&gt;&lt;/li&gt;
  &lt;li itemprop="email"&gt;&lt;a href="mailto:j.bauer@la.ctu.gov.invalid"&gt;j.bauer@la.ctu.gov.invalid&lt;/a&gt;&lt;/li&gt;
  &lt;li itemprop="tel" itemscope&gt;
   &lt;span itemprop="value"&gt;+1 (310) 555 3781&lt;/span&gt; &lt;span&gt;
   &lt;meta itemprop="type" content="cell"&gt;mobile phone&lt;/span&gt;
  &lt;/li&gt;
 &lt;/ul&gt;
 &lt;ins datetime="2008-07-20 21:00:00+01:00"&gt;
  &lt;meta itemprop="rev" content="2008-07-20 21:00:00+01:00"&gt;
  &lt;p itemprop="tel" itemscope&gt;&lt;strong&gt;Update!&lt;/strong&gt;
  My new &lt;span itemprop="type"&gt;home&lt;/span&gt; phone number is
  &lt;span itemprop="value"&gt;01632 960 123&lt;/span&gt;.&lt;/p&gt;
 &lt;/ins&gt;
&lt;/section&gt;</pre>

   <p>The odd line wrapping is needed because newlines are meaningful in microdata: newlines would
   be preserved in a conversion to, for example, the vCard format.</p>

  </div>

  <div class=example>

   <p>This example shows a site's contact details (using the <code><a href=#the-address-element>address</a></code> element)
   containing an address with two street components:</p>

   <pre>&lt;address itemscope itemtype="http://microformats.org/profile/hcard"&gt;
 &lt;strong itemprop="fn"&gt;&lt;span itemprop="n" itemscope&gt;&lt;span itemprop="given-name"&gt;Alfred&lt;/span&gt;
 &lt;span itemprop="family-name"&gt;Person&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt; &lt;br&gt;
 &lt;span itemprop="adr" itemscope&gt;
  &lt;span itemprop="street-address"&gt;1600 Amphitheatre Parkway&lt;/span&gt; &lt;br&gt;
  &lt;span itemprop="street-address"&gt;Building 43, Second Floor&lt;/span&gt; &lt;br&gt;
  &lt;span itemprop="locality"&gt;Mountain View&lt;/span&gt;,
   &lt;span itemprop="region"&gt;CA&lt;/span&gt; &lt;span itemprop="postal-code"&gt;94043&lt;/span&gt;
 &lt;/span&gt;
&lt;/address&gt;</pre>

  </div>

  <div class=example>

   <p>The vCard vocabulary can be used to just mark up people's names:</p>

   <pre>&lt;span itemscope itemtype="http://microformats.org/profile/hcard"
&gt;&lt;span itemprop=fn&gt;&lt;span itemprop="n" itemscope&gt;&lt;span itemprop="given-name"
&gt;George&lt;/span&gt; &lt;span itemprop="family-name"&gt;Washington&lt;/span&gt;&lt;/span
&gt;&lt;/span&gt;&lt;/span&gt;</pre>

   <p>This creates a single item with a two name-value pairs, one with the name "fn" and the value
   "George Washington", and the other with the name "n" and a second item as its value, the second
   item having the two name-value pairs "given-name" and "family-name" with the values "George" and
   "Washington" respectively. This is defined to map to the following vCard:</p>

   <pre>BEGIN:VCARD
PROFILE:VCARD
VERSION:4.0
SOURCE:<var title="">document's address</var>
FN:George Washington
N:Washington;George;;;
END:VCARD</pre>

  </div>


  <h4 id=vevent><span class=secno>5.4.2 </span>vEvent</h4>

  <p>An item with the <a href=#item-types title="item types">item type</a> <dfn id=md-vevent title=md-vevent><code>http://microformats.org/profile/hcalendar#vevent</code></dfn> represents
  an event.</p>

  <p>This vocabulary does not <a href=#support-global-identifiers-for-items>support global identifiers for items</a>.</p>

  <p>The following are the type's <a href=#defined-property-name title="defined property name">defined property names</a>.
  They are based on the vocabulary defined in the iCalendar specification, where more information on
  how to interpret the values can be found. <a href=#refsRFC2445>[RFC2445]</a></p>

  <p class=note>Only the parts of the iCalendar vocabulary relating to events are used here; this
  vocabulary cannot express a complete iCalendar instance.</p>

  <dl><dt><dfn id=md-vevent-attach title=md-vevent-attach><code>attach</code></dfn></dt>

   <dd>

    <p>Gives the address of an associated document for the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-vevent-attach><a href=#md-vevent-attach>attach</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-categories title=md-vevent-categories><code>categories</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vevent-categories><a href=#md-vevent-categories>categories</a></code> may be present
    within each <a href=#concept-item title=concept-item>item</a> with the type
    <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-class title=md-vevent-class><code>class</code></dfn></dt>

   <dd>

    <p>Gives the access classification of the information regarding
    the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text with one of the following values:</p>

    <ul class=brief><li><code title="">public</code></li>
     <li><code title="">private</code></li>
     <li><code title="">confidential</code></li>
    </ul><p class=warning>This is merely advisory and cannot be
    considered a confidentiality measure.</p>

    <p>A single property with the name <code title=md-vevent-class><a href=#md-vevent-class>class</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-comment title=md-vevent-comment><code>comment</code></dfn></dt>

   <dd>

    <p>Gives a comment regarding the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>Any number of properties with the name <code title=md-vevent-comment><a href=#md-vevent-comment>comment</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-description title=md-vevent-description><code>description</code></dfn></dt>

   <dd>

    <p>Gives a detailed description of the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vevent-description><a href=#md-vevent-description>description</a></code> may be present
    within each <a href=#concept-item title=concept-item>item</a> with the type
    <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-geo title=md-vevent-geo><code>geo</code></dfn></dt>

   <dd>

    <p>Gives the geographical position of the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>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>

     <li>One or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>Optionally*, a U+002E FULL STOP character (.) followed by one
     or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>A U+003B SEMICOLON character (;).</li>

     <li>Optionally, either a U+002B PLUS SIGN character (+) or a
     U+002D HYPHEN-MINUS character (-).</li>

     <li>One or more <a href=#ascii-digits>ASCII digits</a>.</li>

     <li>Optionally*, a U+002E FULL STOP character (.) followed by one
     or more <a href=#ascii-digits>ASCII digits</a>.</li>

    </ol><p>The optional components marked with an asterisk (*) should be
    included, and should have six digits each.</p> <!-- iCalendar
    actually limits the range to -91.0 < lat < 91.0; -181.0 < long <
    181.0, which seems weird. It also gives special meanings to
    +90/-90 lat, and +180 long. -->

    <!-- copied from vcard (not icalendar!) -->
    <p class=note>The value specifies latitude and longitude, in
    that order (i.e., "LAT LON" ordering), in decimal degrees. The
    longitude represents the location east and west of the prime
    meridian as a positive or negative real number, respectively.  The
    latitude represents the location north and south of the equator as
    a positive or negative real number, respectively.</p>

    <p>A single property with the name <code title=md-vevent-geo><a href=#md-vevent-geo>geo</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-location title=md-vevent-location><code>location</code></dfn></dt>

   <dd>

    <p>Gives the location of the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p> <!-- v2: support vcard here -->

    <p>A single property with the name <code title=md-vevent-location><a href=#md-vevent-location>location</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <!-- PRIORITY not included - always 0 - doesn't make sense for single events -->


   <dt><dfn id=md-vevent-resources title=md-vevent-resources><code>resources</code></dfn></dt>

   <dd>

    <p>Gives a resource that will be needed for the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p> <!-- v2: support vcard here -->

    <p>Any number of properties with the name <code title=md-vevent-resources><a href=#md-vevent-resources>resources</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-status title=md-vevent-status><code>status</code></dfn></dt>

   <dd>

    <p>Gives the confirmation status of the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text with one of the following values:</p>

    <ul class=brief><li><code title="">tentative</code></li>
     <li><code title="">confirmed</code></li>
     <li><code title="">cancelled</code></li> <!-- two Ls as per iCalendar spec -->
    </ul><p>A single property with the name <code title=md-vevent-status><a href=#md-vevent-status>status</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-summary title=md-vevent-summary><code>summary</code></dfn></dt>

   <dd>

    <p>Gives a short summary of the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>User agents should replace U+000A LINE FEED (LF) characters in
    the <a href=#concept-property-value title=concept-property-value>value</a> by U+0020
    SPACE characters when using the value.</p>

    <p>A single property with the name <code title=md-vevent-summary><a href=#md-vevent-summary>summary</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-dtend title=md-vevent-dtend><code>dtend</code></dfn></dt>

   <dd>

    <p>Gives the date and time by which the event ends.</p>

    <p>If the property with the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> is present within an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
    that has a property with the name <code title=md-vevent-dtstart><a href=#md-vevent-dtstart>dtstart</a></code> whose value is a
    <a href=#valid-date-string>valid date string</a>, then the <a href=#concept-property-value title=concept-property-value>value</a> of the property with
    the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> must be text
    that is a <a href=#valid-date-string>valid date string</a> also. Otherwise, the
    <a href=#concept-property-value title=concept-property-value>value</a> of the property
    must be text that is a <a href=#valid-global-date-and-time-string>valid global date and time
    string</a>.</p>

    <p>In either case, the <a href=#concept-property-value title=concept-property-value>value</a> be later in time than
    the value of the <code title=md-event-dtstart>dtstart</code>
    property of the same <a href=#concept-item title=concept-item>item</a>.</p>

    <p class=note>The time given by the <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> property is not
    inclusive. For day-long events, therefore, the <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> property's <a href=#concept-property-value title=concept-property-value>value</a> will be the day
    <em>after</em> the end of the event.</p>

    <p>A single property with the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>,
    so long as that <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
    does not have a property with the name <code title=md-vevent-duration><a href=#md-vevent-duration>duration</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-dtstart title=md-vevent-dtstart><code>dtstart</code></dfn></dt>

   <dd>

    <p>Gives the date and time at which the event starts.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that is either a <a href=#valid-date-string>valid date string</a> or a
    <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>

    <p>Exactly one property with the name <code title=md-vevent-dtstart><a href=#md-vevent-dtstart>dtstart</a></code> must be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-duration title=md-vevent-duration><code>duration</code></dfn></dt>

   <dd>

    <p>Gives the duration of the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that is a <a href=#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 title=md-vevent-duration><a href=#md-vevent-duration>duration</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>,
    so long as that <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>
    does not have a property with the name <code title=md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-transp title=md-vevent-transp><code>transp</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    text with one of the following values:</p>

    <ul class=brief><li><code title="">opaque</code></li>
     <li><code title="">transparent</code></li>
    </ul><p>A single property with the name <code title=md-vevent-transp><a href=#md-vevent-transp>transp</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <!-- ATTENDEE not included; iCalendar says MUST NOT be included in
   published events -->


   <dt><dfn id=md-vevent-contact title=md-vevent-contact><code>contact</code></dfn></dt>

   <dd>

    <p>Gives the contact information for the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p> <!-- v2: support vcard here -->

    <p>Any number of properties with the name <code title=md-vevent-contact><a href=#md-vevent-contact>contact</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <!-- ORGANIZER not included, as it is calendar-system-specific
   (gives a CAL-ADDRESS value); use CONTACT instead -->


   <!-- RECURRENCE-ID not included... unclear how to make it usefully
   work here -->


   <!-- RELATED-TO not included, as it only makes sense for complete
   calendars -->


   <dt><dfn id=md-vevent-url title=md-vevent-url><code>url</code></dfn></dt>

   <dd>

    <p>Gives a <a href=#url>URL</a> for the event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>A single property with the name <code title=md-vevent-url><a href=#md-vevent-url>url</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>

                                   
   <dt><dfn id=md-vevent-uid title=md-vevent-uid><code>uid</code></dfn></dt>

   <dd>

    <p>Gives a globally unique identifier corresponding to the
    event.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text.</p>

    <p>A single property with the name <code title=md-vevent-uid><a href=#md-vevent-uid>uid</a></code> may be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-exdate title=md-vevent-exdate><code>exdate</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    text that is either a <a href=#valid-date-string>valid date string</a> or a
    <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>

    <p>Any number of properties with the name <code title=md-vevent-exdate><a href=#md-vevent-exdate>exdate</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-exrule title=md-vevent-exrule><code>exrule</code></dfn></dt>

   <dd>

    <p>Gives a rule for finding dates and times at which the event
    does not occur despite the recurrence rules.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that matches the RECUR value type defined in the iCalendar
    specification. <a href=#refsRFC2445>[RFC2445]</a></p>

    <p>Any number of properties with the name <code title=md-vevent-exrule><a href=#md-vevent-exrule>exrule</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-rdate title=md-vevent-rdate><code>rdate</code></dfn></dt>

   <dd>

    <p>Gives a date and time at which the event recurs.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that is one of the following:

    <ul><li>A <a href=#valid-date-string>valid date string</a>.</li>

     <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</li>

     <li>A <a href=#valid-global-date-and-time-string>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>valid
     global date and time string</a> representing a later time.</li>

     <li>A <a href=#valid-global-date-and-time-string>valid global date and time string</a> followed by
     a U+002F SOLIDUS character (/) followed by a <a href=#valid-vevent-duration-string>valid vevent
     duration string</a>.</li>

    </ul><p>Any number of properties with the name <code title=md-vevent-rdate><a href=#md-vevent-rdate>rdate</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-rrule title=md-vevent-rrule><code>rrule</code></dfn></dt>

   <dd>

    <p>Gives a rule for finding dates and times at which the event
    occurs.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that matches the RECUR value type defined in the iCalendar
    specification. <a href=#refsRFC2445>[RFC2445]</a></p>

    <p>Any number of properties with the name <code title=md-vevent-rrule><a href=#md-vevent-rrule>rrule</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-created title=md-vevent-created><code>created</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    text that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>

    <p>A single property with the name <code title=md-vevent-created><a href=#md-vevent-created>created</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <!-- DTSTAMP not included, it gets added when serialising -->


   <dt><dfn id=md-vevent-last-modified title=md-vevent-last-modified><code>last-modified</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    text that is a <a href=#valid-global-date-and-time-string>valid global date and time string</a>.</p>

    <p>A single property with the name <code title=md-vevent-last-modified><a href=#md-vevent-last-modified>last-modified</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <dt><dfn id=md-vevent-sequence title=md-vevent-sequence><code>sequence</code></dfn></dt>

   <dd>

    <p>Gives a revision number for the event information.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    text that is a <a href=#valid-non-negative-integer>valid non-negative integer</a>.</p>

    <p>A single property with the name <code title=md-vevent-sequence><a href=#md-vevent-sequence>sequence</a></code> may be present within
    each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>

   </dd>


   <!-- REQUEST-STATUS not included, calendaring system interop
   feature -->


  </dl><p>A string is a <dfn id=valid-vevent-duration-string>valid vevent duration string</dfn> if it
  matches the following pattern:</p>

  <ol><li>A U+0050 LATIN CAPITAL LETTER P character (P).</li>

   <li>One of the following:

    <ul><li> A <a href=#valid-non-negative-integer>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>

     <li> At least one, and possible both in this order, of the
     following:

      <ol><li> A <a href=#valid-non-negative-integer>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>

       <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>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>

         <li> A <a href=#valid-non-negative-integer>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>

         <li> A <a href=#valid-non-negative-integer>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. </li>

        </ol></ol></li>

    </ul></li>

  </ol><h5 id=conversion-to-icalendar><span class=secno>5.4.2.1 </span>Conversion to iCalendar</h5>

  <p>Given a list of nodes <var title="">nodes</var> in a <code><a href=#document>Document</a></code>, a user agent must
  run the following algorithm to <dfn id=extracting-vevent-data title="extracting vEvent data">extract any vEvent data
  represented by those nodes</dfn>:</p>

  <ol><li><p>If none of the nodes in <var title="">nodes</var> are <a href=#concept-item title=concept-item>items</a> with the type <code title=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>

   <li><p>Let <var title="">output</var> be an empty string.</li>

   <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VCALENDAR</code>" to <var title="">output</var>.</li>

   <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">PRODID</code>" and the value equal to a
   user-agent-specific string representing the user agent to <var title="">output</var>.</li>

   <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">VERSION</code>" and the value "<code title="">2.0</code>"
   to <var title="">output</var>.</li>

   <li>

    <p>For each node <var title="">node</var> in <var title="">nodes</var> that is an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><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>Add an iCalendar line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VEVENT</code>" to <var title="">output</var>.</li>

     <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">DTSTAMP</code>" and a value consisting of an iCalendar
     DATE-TIME string representing the current date and time, with the
     annotation "<code title="">VALUE=DATE-TIME</code>", to <var title="">output</var>.  <a href=#refsRFC2445>[RFC2445]</a></li>

     <li>

      <p>For each element <var title="">element</var> that is <a href=#the-properties-of-an-item title="the properties of an item">a property of the item</a>
      <var title="">node</var>: for each name <var title="">name</var>
      in <var title="">element</var>'s <a href=#property-names>property names</a>,
      run the appropriate set of substeps from the following list:</p>

      <dl><dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a></dt>

       <dd>

        <p>Skip the property.</p>

       </dd>


       <dt>If the property is <code title=md-event-dtend>dtend</code></dt>
       <dt>If the property is <code title=md-event-dtstart>dtstart</code></dt>
       <dt>If the property is <code title=md-event-exdate>exdate</code></dt>
       <dt>If the property is <code title=md-event-rdate>rdate</code></dt>
       <dt>If the property is <code title=md-event-created>created</code></dt>
       <dt>If the property is <code title=md-event-last-modified>last-modified</code></dt>

       <dd>

        <p>Let <var title="">value</var> be the result of stripping
        all U+002D HYPHEN-MINUS (-) and U+003A COLON (:) characters
        from the property's <a href=#concept-property-value title=concept-property-value>value</a>.</p>

        <p>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is a <a href=#valid-date-string>valid
        date string</a> then <a href=#add-an-icalendar-line>add an iCalendar line</a>
        with the type <var title="">name</var> and the value <var title="">value</var> to <var title="">output</var>, with the
        annotation "<code title="">VALUE=DATE</code>".</p>

        <p>Otherwise, if the property's <a href=#concept-property-value title=concept-property-value>value</a> is a <a href=#valid-global-date-and-time-string>valid
        global date and time string</a> then <a href=#add-an-icalendar-line>add an iCalendar
        line</a> with the type <var title="">name</var> and the
        value <var title="">value</var> to <var title="">output</var>,
        with the annotation "<code title="">VALUE=DATE-TIME</code>".</p>

        <p>Otherwise skip the property.</p>

       </dd>


       <dt>Otherwise</dt>

       <dd>

        <p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type <var title="">name</var> and the property's <a href=#concept-property-value title=concept-property-value>value</a> to <var title="">output</var>.</p>

       </dd>

      </dl></li>

     <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">END</code>" and the value "<code title="">VEVENT</code>"
     to <var title="">output</var>.</li>

    </ol></li>

   <li><p><a href=#add-an-icalendar-line>Add an iCalendar line</a> with the type "<code title="">END</code>" and the value "<code title="">VCALENDAR</code>" to <var title="">output</var>.</li>

  </ol><p>When the above algorithm says that the user agent is to <dfn id=add-an-icalendar-line>add an iCalendar line</dfn>
  consisting of a type <var title="">type</var>, a value <var title="">value</var>, and optionally
  an annotation, to a string <var title="">output</var>, it must run the following steps:</p>

  <ol><li><p>Let <var title="">line</var> be an empty string.</li>

   <li><p>Append <var title="">type</var>, <a href=#converted-to-ascii-uppercase>converted to
   ASCII uppercase</a>, to <var title="">line</var>.</li>

   <li>

    <p>If there is an annotation:</p>

    <ol><li><p>Append a U+003B SEMICOLON character (;) to <var title="">line</var>.</li>

     <li><p>Append the annotation to <var title="">line</var>.</li>

    </ol></li>

   <li><p>Append a U+003A COLON character (:) to <var title="">line</var>.</li>

   <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in
   <var title="">value</var> with another U+005C REVERSE SOLIDUS
   character (\).</li>

   <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
   (\).</li>

   <li><p>Prefix every U+003B SEMICOLON character (;) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
   (\).</li>

   <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
   character pair (CRLF) in <var title="">value</var> with a U+005C
   REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
   LETTER N character (n).</li>

   <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
   U+000A LINE FEED (LF) character in <var title="">value</var> with a
   U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
   SMALL LETTER N character (n).</li>

   <li><p>Append <var title="">value</var> to <var title="">line</var>.</li>

   <li><p>Let <var title="">maximum length</var> be 75.</li>

   <li>

    <p>If and while <var title="">line</var> is longer than <var title="">maximum length</var> Unicode code points long, run the
    following substeps:</p>

    <ol><li><p>Append the first <var title="">maximum length</var>
     Unicode code points of <var title="">line</var> to <var title="">output</var>.</li>

     <li><p>Remove the first <var title="">maximum length</var>
     Unicode code points from <var title="">line</var>.</li>

     <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>

     <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>

     <li><p>Append a U+0020 SPACE character to <var title="">output</var>.</li>

     <li><p>Let <var title="">maximum length</var> be 74.</li>

    </ol></li>

   <li><p>Append (what remains of) <var title="">line</var> to <var title="">output</var>.</li>

   <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>

   <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>

  </ol><p class=note>This algorithm can generate invalid iCalendar output, if the input does not
  conform to the rules described for the <code title=md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code> <a href=#item-types title="item
  types">item type</a> and <a href=#defined-property-name title="defined property name">defined property names</a>.</p>
  <!-- of course since iCalendar doesn't define error handling, this is somewhat problematic. -->



  <h5 id=examples-2><span class=secno>5.4.2.2 </span>Examples</h5>

  <p><i>This section is non-normative.</i></p>

<!-- get more from http://tools.ietf.org/html/rfc2445 -->

  <div class=example>

   <p>Here is an example of a page that uses the vEvent vocabulary to mark up an event:</p>

   <pre>&lt;body itemscope itemtype="http://microformats.org/profile/hcalendar#vevent"&gt;
 ...
 &lt;h1 itemprop="summary"&gt;Bluesday Tuesday: Money Road&lt;/h1&gt;
 ...
 &lt;time itemprop="dtstart" datetime="2009-05-05T19:00:00Z"&gt;May 5th @ 7pm&lt;/time&gt;
 (until &lt;time itemprop="dtend" datetime="2009-05-05T21:00:00Z"&gt;9pm&lt;/time&gt;)
 ...
 &lt;a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
    rel="bookmark" itemprop="url"&gt;Link to this page&lt;/a&gt;
 ...
 &lt;p&gt;Location: &lt;span itemprop="location"&gt;The RoadHouse&lt;/span&gt;&lt;/p&gt;
 ...
 &lt;p&gt;&lt;input type=button value="Add to Calendar"
           onclick="location = getCalendar(this)"&gt;&lt;/p&gt;
 ...
 &lt;meta itemprop="description" content="via livebrum.co.uk"&gt;
&lt;/body&gt;</pre>

   <p>The "<code title="">getCalendar()</code>" method could look like
   this:</p>

   <pre>function getCalendar(node) {
  // This function assumes the content is valid.
  // It is not a compliant implementation of the algorithm for <a href=#extracting-vevent-data>extracting vEvent data</a>.
  while (node &amp;&amp; (!node.itemScope || !node.itemType.contains('http://microformats.org/profile/hcalendar#vevent')))
    node = node.parentNode;
  if (!node) {
    alert('No event data found.');
    return;
  }
  var stamp = new Date();
  var stampString = '' + stamp.getUTCFullYear() + (stamp.getUTCMonth() + 1) + stamp.getUTCDate() + 'T' +
                         stamp.getUTCHours() + stamp.getUTCMinutes() + stamp.getUTCSeconds() + 'Z';
  var calendar = 'BEGIN:VCALENDAR\r\nPRODID:HTML\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nDTSTAMP:' + stampString + '\r\n';
  for (var propIndex = 0; propIndex &lt; node.properties.length; propIndex += 1) {
    var prop = node.properties[propIndex];
    var value = prop.itemValue;
    var parameters = '';
    if (prop.localName == 'time') {
      value = value.replace(/[:-]/g, '');
      if (value.match(/T/))
        parameters = ';VALUE=DATE';
      else
        parameters = ';VALUE=DATE-TIME';
    } else {
      value = value.replace(/\\/g, '\\n');
      value = value.replace(/;/g, '\\;');
      value = value.replace(/,/g, '\\,');
      value = value.replace(/\n/g, '\\n');
    }
    for (var nameIndex = 0; nameIndex &lt; prop.itemProp.length; nameIndex += 1) {
      var name = prop.itemProp[nameIndex];
      if (!name.match(/:/) &amp;&amp; !name.match(/\./))
        calendar += name.toUpperCase() + parameters + ':' + value + '\r\n';
    }
  }
  calendar += 'END:VEVENT\r\nEND:VCALENDAR\r\n';
  return 'data:text/calendar;component=vevent,' + encodeURI(calendar);
}</pre>

   <p>The same page could offer some markup, such as the following,
   for copy-and-pasting into blogs:</p>

   <pre>&lt;div itemscope itemtype="http://microformats.org/profile/hcalendar#vevent"&gt;
 &lt;p&gt;I'm going to
 &lt;strong itemprop="summary"&gt;Bluesday Tuesday: Money Road&lt;/strong&gt;,
 &lt;time itemprop="dtstart" datetime="2009-05-05T19:00:00Z"&gt;May 5th at 7pm&lt;/time&gt;
 to &lt;time itemprop="dtend" datetime="2009-05-05T21:00:00Z"&gt;9pm&lt;/time&gt;,
 at &lt;span itemprop="location"&gt;The RoadHouse&lt;/span&gt;!&lt;/p&gt;
 &lt;p&gt;&lt;a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
       itemprop="url"&gt;See this event on livebrum.co.uk&lt;/a&gt;.&lt;/p&gt;
 &lt;meta itemprop="description" content="via livebrum.co.uk"&gt;
&lt;/div&gt;</pre>

  </div>


  <h4 id=licensing-works><span class=secno>5.4.3 </span>Licensing works</h4>

  <p>An item with the <a href=#item-types title="item types">item type</a> <dfn id=md-work title=md-work><code>http://n.whatwg.org/work</code></dfn> represents a work (e.g. an article, an
  image, a video, a song, etc). This type is primarily intended to allow authors to include
  licensing information for works.</p>

  <p>The following are the type's <a href=#defined-property-name title="defined property name">defined property
  names</a>.</p>

  <dl><dt><dfn id=md-work-work title=md-work-work><code>work</code></dfn></dt>

   <dd>

    <p>Identifies the work being described.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Exactly one property with the name <code title=md-work-work><a href=#md-work-work>work</a></code> must be present within each <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>

   </dd>


   <dt><dfn id=md-work-title title=md-work-title><code>title</code></dfn></dt>

   <dd>

    <p>Gives the name of the work.</p>

    <p>A single property with the name <code title=md-work-title><a href=#md-work-title>title</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>

   </dd>


   <dt><dfn id=md-work-author title=md-work-author><code>author</code></dfn></dt>

   <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 title=concept-property-value>value</a> must be
    either an <a href=#concept-item title=concept-item>item</a> with the type
    <code title=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 title=md-work-author><a href=#md-work-author>author</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>

   </dd>


   <dt><dfn id=md-work-license title=md-work-license><code>license</code></dfn></dt>

   <dd>

    <p>Identifies one of the licenses under which the work is
    available.</p>

    <p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
    an <a href=#absolute-url>absolute URL</a>.</p>

    <p>Any number of properties with the name <code title=md-work-license><a href=#md-work-license>license</a></code> may be present within each
    <a href=#concept-item title=concept-item>item</a> with the type <code title=md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>

   </dd>

  </dl><h5 id=examples-3><span class=secno>5.4.3.1 </span>Examples</h5>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

   <p>This example shows an embedded image entitled <cite>My Pond</cite>, licensed under the
   Creative Commons Attribution-Share Alike 3.0 United States License and the MIT license
   simultaneously.</p>

   <pre>&lt;figure <strong>itemscope itemtype="http://n.whatwg.org/work"</strong>&gt;
 &lt;img <strong>itemprop="work"</strong> src="mypond.jpeg"&gt;
 &lt;figcaption&gt;
  &lt;p&gt;&lt;cite <strong>itemprop="title"</strong>&gt;My Pond&lt;/cite&gt;&lt;/p&gt;
  &lt;p&gt;&lt;small&gt;Licensed under the &lt;a <strong>itemprop="license"</strong>
  href="http://creativecommons.org/licenses/by-sa/3.0/us/"&gt;Creative
  Commons Attribution-Share Alike 3.0 United States License&lt;/a&gt;
  and the &lt;a <strong>itemprop="license"</strong>
  href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT
  license&lt;/a&gt;.&lt;/small&gt;
 &lt;/figcaption&gt;
&lt;/figure&gt;</pre>

  </div>


  <div class=impl>

  <h3 id=converting-html-to-other-formats><span class=secno>5.5 </span>Converting HTML to other formats</h3>

  <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>

  <p>Given a list of nodes <var title="">nodes</var> in a <code><a href=#document>Document</a></code>, a user agent must
  run the following algorithm to <dfn id=extracting-json title="extracting JSON">extract the microdata from those nodes
  into a JSON form</dfn>:</p>

  <ol><li><p>Let <var title="">result</var> be an empty object.</li>

   <li><p>Let <var title="">items</var> be an empty array.</li>

   <li><p>For each <var title="">node</var> in <var title="">nodes</var>, check if the element is a
   <a href=#top-level-microdata-items title="top-level microdata items">top-level microdata item</a>, and if it is then
   <a href=#get-the-object>get the object</a> for that element and add it to <var title="">items</var>.</li>

   <li><p>Add an entry to <var title="">result</var> called "<code title="">items</code>" whose
   value is the array <var title="">items</var>.</li>

   <li><p>Return the result of serializing <var title="">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 title="">e</code>" used, when appropriate, in the
   representation of any numbers. <a href=#refsJSON>[JSON]</a></li>

  </ol><p class=note>This algorithm returns an object with a single property that is an array, instead
  of just returning an array, so that it is possible to extend the algorithm in the future if
  necessary.</p>

  <p>When the user agent is to <dfn id=get-the-object>get the object</dfn> for an item <var title="">item</var>,
  optionally with a list of elements <var title="">memory</var>, it must run the following
  substeps:</p>

  <ol><li><p>Let <var title="">result</var> be an empty object.</li>

   <li><p>If no <var title="">memory</var> was passed to the algorithm, let <var title="">memory</var> be an empty list.</li>

   <li><p>Add <var title="">item</var> to <var title="">memory</var>.</li>

   <li><p>If the <var title="">item</var> has any <a href=#item-types>item types</a>, add an entry to <var title="">result</var> called "<code title="">type</code>" whose value is an array listing the
   <a href=#item-types>item types</a> of <var title="">item</var>, in the order they were specified on the
   <code title=attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute.</p>

   <li><p>If the <var title="">item</var> has a <a href=#global-identifier>global identifier</a>, add an entry to <var title="">result</var> called "<code title="">id</code>" whose value is the <a href=#global-identifier>global
   identifier</a> of <var title="">item</var>.</li>

   <li><p>Let <var title="">properties</var> be an empty object.</li>

   <li>

    <p>For each element <var title="">element</var> that has one or more <a href=#property-names>property names</a>
    and is one of <a href=#the-properties-of-an-item title="the properties of an item">the properties of the item</a> <var title="">item</var>, in the order those elements are given by the algorithm that returns
    <a href=#the-properties-of-an-item>the properties of an item</a>, run the following substeps:</p>

    <ol><li><p>Let <var title="">value</var> be the <a href=#concept-property-value title=concept-property-value>property
     value</a> of <var title="">element</var>.</li>

     <li><p>If <var title="">value</var> is an <a href=#concept-item title=concept-item>item</a>, then: If <var title="">value</var> is in <var title="">memory</var>, then let <var title="">value</var> be
     the string "<code title="">ERROR</code>". Otherwise, <a href=#get-the-object>get the object</a> for <var title="">value</var>, passing a copy of <var title="">memory</var>, and then replace <var title="">value</var> with the object returned from those steps.</li>

     <li>

      <p>For each name <var title="">name</var> in <var title="">element</var>'s <a href=#property-names>property
      names</a>, run the following substeps:</p>

      <ol><li><p>If there is no entry named <var title="">name</var> in <var title="">properties</var>,
       then add an entry named <var title="">name</var> to <var title="">properties</var> whose
       value is an empty array.</li>

       <li><p>Append <var title="">value</var> to the entry named <var title="">name</var> in <var title="">properties</var>.</li>

      </ol></li>

    </ol></li>

   <li><p>Add an entry to <var title="">result</var> called "<code title="">properties</code>" whose
   value is the object <var title="">properties</var>.</li>

   <li><p>Return <var title="">result</var>.</li>

  </ol></div>




<!--TOPIC:HTML-->

  <h2 id=browsers><span class=secno>6 </span>Loading Web pages</h2>

  <div class=impl>

  <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>

  </div>



  <h3 id=windows><span class=secno>6.1 </span>Browsing contexts</h3>

  <p>A <dfn id=browsing-context>browsing context</dfn> is an environment in which <code><a href=#document>Document</a></code> objects are
  presented to the user.</p>

  <p class=note>A tab or window in a Web browser typically contains a <a href=#browsing-context>browsing
  context</a>, as does an <code><a href=#the-iframe-element>iframe</a></code><span class=impl> or <code><a href=#frame>frame</a></code>s in a
  <code><a href=#frameset>frameset</a></code></span>.</p>

  <p>Each <a href=#browsing-context>browsing context</a> has a corresponding <code><a href=#windowproxy>WindowProxy</a></code> object.</p>

  <p>A <a href=#browsing-context>browsing context</a> has a <a href=#session-history>session history</a>, which lists the
  <code><a href=#document>Document</a></code> objects that that <a href=#browsing-context>browsing context</a> has presented, is
  presenting, or will present. At any time, one <code><a href=#document>Document</a></code> in each <a href=#browsing-context>browsing
  context</a> is designated the <dfn id=active-document>active document</dfn>. A <code><a href=#document>Document</a></code>'s
  <a href=#browsing-context>browsing context</a> is that <a href=#browsing-context>browsing context</a> whose <a href=#session-history>session
  history</a> contains the <code><a href=#document>Document</a></code>, if any. (A <code><a href=#document>Document</a></code> created using
  an API such as <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> has no
  <a href=#browsing-context>browsing context</a>.)</p>

  <p>Each <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a> is
  <dfn id=concept-document-window title=concept-document-window>associated</dfn> with a <code><a href=#window>Window</a></code> object. A <a href=#browsing-context>browsing
  context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object forwards everything to the <a href=#browsing-context>browsing
  context</a>'s <a href=#active-document>active document</a>'s <code><a href=#window>Window</a></code> object.</p>

  <p class=note>In general, there is a 1-to-1 mapping from the <code><a href=#window>Window</a></code> object to the
  <code><a href=#document>Document</a></code> object. There are two exceptions. First, a <code><a href=#window>Window</a></code> can be reused
  for the presentation of a second <code><a href=#document>Document</a></code> in the same <a href=#browsing-context>browsing context</a>,
  such that the mapping is then 1-to-2. This occurs when a <a href=#browsing-context>browsing context</a> is <a href=#navigate title=navigate>navigated</a> from the initial <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code>
  to another, with <a href=#replacement-enabled>replacement enabled</a>. Second, a <code><a href=#document>Document</a></code> can end up
  being reused for several <code><a href=#window>Window</a></code> objects when the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method is used, such that the mapping is then
  many-to-1.</p>

  <p class=note>A <code><a href=#document>Document</a></code> does not necessarily have a <a href=#browsing-context>browsing context</a>
  associated with it. In particular, data mining tools are likely to never instantiate browsing
  contexts.</p>

  <hr><p>A <a href=#browsing-context>browsing context</a> can have a <dfn id=creator-browsing-context>creator browsing context</dfn>, the
  <a href=#browsing-context>browsing context</a> that was responsible for its creation. If a <a href=#browsing-context>browsing
  context</a> has a <a href=#parent-browsing-context>parent browsing context</a>, then that is its <a href=#creator-browsing-context>creator browsing
  context</a>. Otherwise, if the <a href=#browsing-context>browsing context</a> has an <a href=#opener-browsing-context>opener browsing
  context</a>, then <em>that</em> is its <a href=#creator-browsing-context>creator browsing context</a>. Otherwise, the
  <a href=#browsing-context>browsing context</a> has no <a href=#creator-browsing-context>creator browsing context</a>.</p>

  <p>If a <a href=#browsing-context>browsing context</a> <var title="">A</var> has a <a href=#creator-browsing-context>creator browsing
  context</a>, then the <code><a href=#document>Document</a></code> that was the <a href=#active-document>active document</a> of that
  <a href=#creator-browsing-context>creator browsing context</a> at the time <var title="">A</var> was created is the
  <dfn id=creator-document>creator <code>Document</code></dfn>.</p>

  <div class=impl>

  <p>When a <a href=#browsing-context>browsing context</a> is first created, it must be created with a single
  <code><a href=#document>Document</a></code> in its session history, whose <a href="#the-document's-address" title="the document's
  address">address</a> is <code><a href=#about:blank>about:blank</a></code>, which is marked as being an <a href=#html-documents title="HTML
  documents">HTML document</a>, whose <a href="#document's-character-encoding" title="document's character encoding">character
  encoding</a> is UTF-8, and which is both <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> and
  <a href=#completely-loaded>completely loaded</a> immediately. The <code><a href=#document>Document</a></code> must have a single child
  <code><a href=#the-html-element>html</a></code> node, which itself has a single child <code><a href=#the-body-element>body</a></code> node. As soon as this
  <code><a href=#document>Document</a></code> is created, the user agent must <a href=#implement-the-sandboxing>implement the sandboxing</a> for
  it. If the <a href=#browsing-context>browsing context</a> has a <a href=#creator-document>creator <code>Document</code></a>, then
  the <a href=#browsing-context>browsing context</a>'s <code><a href=#document>Document</a></code>'s <a href="#the-document's-referrer" title="the document's
  referrer">referrer</a> must be set to <a href="#the-document's-address" title="the document's address">the address</a>
  of that <a href=#creator-document>creator <code>Document</code></a> at the time of the <a href=#browsing-context>browsing
  context</a>'s creation.</p>

  <p class=note>If the <a href=#browsing-context>browsing context</a> is created specifically to be immediately
  navigated, then that initial navigation will have <a href=#replacement-enabled>replacement enabled</a>.</p>

  <p id=about-blank-origin>The <a href=#origin>origin</a> and <a href=#effective-script-origin>effective script origin</a> of the
  <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> are set when the <code><a href=#document>Document</a></code> is created.
  If the new <a href=#browsing-context>browsing context</a> has a <a href=#creator-browsing-context>creator browsing context</a>, then the
  <a href=#origin>origin</a> of the <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the <a href=#creator-document>creator
  <code>Document</code></a> and the <a href=#effective-script-origin>effective script origin</a> of the
  <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#effective-script-origin>effective script origin</a> of the
  <a href=#creator-document>creator <code>Document</code></a>. Otherwise, the <a href=#origin>origin</a> of the
  <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> is a globally unique identifier assigned when the
  new <a href=#browsing-context>browsing context</a> is created and the <a href=#effective-script-origin>effective script origin</a> of the
  <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to its <a href=#origin>origin</a>.</p>

  </div>


  <h4 id=nested-browsing-contexts><span class=secno>6.1.1 </span>Nested browsing contexts</h4>

  <p>Certain elements (for example, <code><a href=#the-iframe-element>iframe</a></code> elements) can instantiate further <a href=#browsing-context title="browsing context">browsing contexts</a>. These are called <dfn id=nested-browsing-context title="nested browsing
  context">nested browsing contexts</dfn>. If a browsing context <var title="">P</var> has a
  <code><a href=#document>Document</a></code> <var title="">D</var> with an element <var title="">E</var> that nests
  another browsing context <var title="">C</var> inside it, then <var title="">C</var> is said to be
  <dfn id=browsing-context-nested-through title="browsing context nested through">nested through</dfn> <var title="">D</var>, and <var title="">E</var> is said to be the <dfn id=browsing-context-container>browsing context container</dfn> of <var title="">C</var>.
  If the <a href=#browsing-context-container>browsing context container</a> element <var title="">E</var> is <a href=#in-a-document title="in a
  Document">in</a> the <code><a href=#document>Document</a></code> <var title="">D</var>, then <var title="">P</var> is
  said to be the <dfn id=parent-browsing-context>parent browsing context</dfn> of <var title="">C</var> and <var title="">C</var> is said to be a <dfn id=child-browsing-context>child browsing context</dfn> of <var title="">P</var>.
  Otherwise, the <a href=#nested-browsing-context>nested browsing context</a> <var title="">C</var> has no <a href=#parent-browsing-context>parent
  browsing context</a>.</p>

  <p>A browsing context <var title="">A</var> is said to be an <dfn id=ancestor-browsing-context title="ancestor browsing
  context">ancestor</dfn> of a browsing context <var title="">B</var> if there exists a browsing
  context <var title="">A'</var> that is a <a href=#child-browsing-context>child browsing context</a> of <var title="">A</var> and that is itself an <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor</a> of
  <var title="">B</var>, or if there is a browsing context <var title="">P</var> that is a
  <a href=#child-browsing-context>child browsing context</a> of <var title="">A</var> and that is the <a href=#parent-browsing-context>parent browsing
  context</a> of <var title="">B</var>.</p>

  <p>A browsing context that is not a <a href=#nested-browsing-context>nested browsing context</a> has no <a href=#parent-browsing-context>parent
  browsing context</a>, and is the <dfn id=top-level-browsing-context>top-level browsing context</dfn> of all the browsing
  contexts for which it is an <a href=#ancestor-browsing-context>ancestor browsing context</a>.</p>

  <p>The transitive closure of <a href=#parent-browsing-context title="parent browsing context">parent browsing contexts</a>
  for a <a href=#nested-browsing-context>nested browsing context</a> gives the list of <a href=#ancestor-browsing-context title="ancestor browsing
  context">ancestor browsing contexts</a>.</p>

  <p>The <dfn id=list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts</dfn> of a <code><a href=#document>Document</a></code> <var title="">d</var> is the (ordered) list returned by the following algorithm:</p>

  <ol><li><p>Let <var title="">list</var> be an empty list.</li>

   <li>

    <p>For each <a href=#child-browsing-context>child browsing context</a> of <var title="">d</var> that is <a href=#browsing-context-nested-through title="browsing context nested through">nested through</a> an element that is <a href=#in-a-document title="in
    a document">in the <code>Document</code></a> <var title="">d</var>, in the <a href=#tree-order>tree
    order</a> of the elements nesting those <a href=#browsing-context title="browsing context">browsing
    contexts</a>, run these substeps:</p>

    <ol><li><p>Append that <a href=#child-browsing-context>child browsing context</a> to the list <var title="">list</var>.</p>

     <li><p>Append the <a href=#list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts</a> of the <a href=#active-document>active
     document</a> of that <a href=#child-browsing-context>child browsing context</a> to the list <var title="">list</var>.</li>

    </ol></li>

   <li><p>Return the constructed <var title="">list</var>.</li>

  </ol><p>A <code><a href=#document>Document</a></code> is said to be <dfn id=fully-active>fully active</dfn> when it is the <a href=#active-document>active
  document</a> of its <a href=#browsing-context>browsing context</a>, and either its browsing context is a
  <a href=#top-level-browsing-context>top-level browsing context</a>, or it has a <a href=#parent-browsing-context>parent browsing context</a> and the
  <code><a href=#document>Document</a></code> <a href=#browsing-context-nested-through title="browsing context nested through">through which</a> it is
  <a href=#nested-browsing-context title="nested browsing context">nested</a> is itself <a href=#fully-active>fully active</a>.</p>

  <p>Because they are nested through an element, <a href=#child-browsing-context title="child browsing context">child browsing
  contexts</a> are always tied to a specific <code><a href=#document>Document</a></code> in their <a href=#parent-browsing-context>parent browsing
  context</a>. User agents must not allow the user to interact with <a href=#child-browsing-context title="child browsing
  context">child browsing contexts</a> of elements that are in <code><a href=#document>Document</a></code>s that are
  not themselves <a href=#fully-active>fully active</a>.</p>

  <p>A <a href=#nested-browsing-context>nested browsing context</a> can have a <a href=#seamless-browsing-context-flag>seamless browsing context flag</a>
  set, if it is embedded through an <code><a href=#the-iframe-element>iframe</a></code> element with a <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attribute.</p>

  <p>A <a href=#nested-browsing-context>nested browsing context</a> can be put into a <dfn id=delaying-load-events-mode>delaying <code title=event-load>load</code> events mode</dfn>. This is used when it is <a href=#navigate title=navigate>navigated</a>, to <a href=#delay-the-load-event>delay the load event</a> of the <a href=#browsing-context-container>browsing
  context container</a> <code><a href=#the-iframe-element>iframe</a></code> element before the new <code><a href=#document>Document</a></code> is
  created.</p>

<!--(There's no current way for this to happen, since removing an iframe from a document discards its browsing context)
  <p class="note">A <span>nested browsing context</span> can in some cases be taken out of its
  <span>parent browsing context</span> (e.g. if an <code>iframe</code> element is removed from its
  <code>Document</code>). In such a situation, the <span>nested browsing context</span> has no
  <span>parent browsing context</span>, but it still has the same <span>browsing context
  container</span> and is still <span title="browsing context nested through">nested through</span>
  that element's <code>Document</code>. Such a <span>nested browsing context</span> is <em>not</em>
  a <span>top-level browsing context</span>, and cannot contain <code>Document</code>s that are
  <span>fully active</span>. Furthermore, if a <span>browsing context container</span> (such as an
  <code>iframe</code>) is moved to another <code>Document</code>, then the <span>parent browsing
  context</span> of its <span>nested browsing context</span> will change.</p>
-->

  <p>The <dfn id=document-family>document family</dfn> of a <a href=#browsing-context>browsing context</a> consists of the union of all
  the <code><a href=#document>Document</a></code> objects in that <a href=#browsing-context>browsing context</a>'s <a href=#session-history>session
  history</a> and the <a href=#document-family title="document family">document families</a> of all those
  <code><a href=#document>Document</a></code> objects. The <a href=#document-family>document family</a> of a <code><a href=#document>Document</a></code> object
  consists of the union of all the <a href=#document-family title="document family">document families</a> of the
  <a href=#browsing-context title="browsing context">browsing contexts</a> that are <a href=#browsing-context-nested-through title="browsing context
  nested through">nested through</a> the <code><a href=#document>Document</a></code> object.</p>


  <h5 id=navigating-nested-browsing-contexts-in-the-dom><span class=secno>6.1.1.1 </span>Navigating nested browsing contexts in the DOM</h5>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-top><a href=#dom-top>top</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> for the <a href=#top-level-browsing-context>top-level browsing context</a>.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-parent><a href=#dom-parent>parent</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> for the <a href=#parent-browsing-context>parent browsing context</a>.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-frameElement><a href=#dom-frameelement>frameElement</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#element>Element</a></code> for the <a href=#browsing-context-container>browsing context container</a>.</p>

    <p>Returns null if there isn't one.</p>

    <p>Throws a <code><a href=#securityerror>SecurityError</a></code> exception in cross-origin situations.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-top title=dom-top><code>top</code></dfn> IDL attribute on the <code><a href=#window>Window</a></code> object
  of a <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a> <var title="">b</var> must return
  the <code><a href=#windowproxy>WindowProxy</a></code> object of its <a href=#top-level-browsing-context>top-level browsing context</a> (which would be
  its own <code><a href=#windowproxy>WindowProxy</a></code> object if it was a <a href=#top-level-browsing-context>top-level browsing context</a>
  itself), if it has one, or its own <code><a href=#windowproxy>WindowProxy</a></code> object otherwise (e.g. if it was a
  detached <a href=#nested-browsing-context>nested browsing context</a>).</p>

  <p>The <dfn id=dom-parent title=dom-parent><code>parent</code></dfn> IDL attribute on the <code><a href=#window>Window</a></code>
  object of a <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a> <var title="">b</var> must
  return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#parent-browsing-context>parent browsing context</a>, if there
  is one (i.e. if <var title="">b</var> is a <a href=#child-browsing-context>child browsing context</a>), or the
  <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context>browsing context</a> <var title="">b</var> itself,
  otherwise (i.e. if it is a <a href=#top-level-browsing-context>top-level browsing context</a> or a detached <a href=#nested-browsing-context>nested
  browsing context</a>).</p>

  <p>The <dfn id=dom-frameelement title=dom-frameElement><code>frameElement</code></dfn> IDL attribute on the
  <code><a href=#window>Window</a></code> object of a <code><a href=#document>Document</a></code> <var title="">d</var>, on getting, must run
  the following algorithm:</p>

  <ol><li><p>If <var title="">d</var> is not a <code><a href=#document>Document</a></code> in a <a href=#nested-browsing-context>nested browsing
   context</a>, return null and abort these steps.</li>

   <li><p>If the <a href=#browsing-context-container>browsing context container</a>'s <code><a href=#document>Document</a></code> does not have the
   <a href=#same-origin title="same origin">same</a> <a href=#effective-script-origin>effective script origin</a> as the <a href=#entry-script>entry
   script</a>, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>

   <li><p>Return the <a href=#browsing-context-container>browsing context container</a> for <var title="">b</var>.</li>

  </ol></div>



  <h4 id=auxiliary-browsing-contexts><span class=secno>6.1.2 </span>Auxiliary browsing contexts</h4>

  <p>It is possible to create new browsing contexts that are related to a <a href=#top-level-browsing-context>top-level browsing
  context</a> without being nested through an element. Such browsing contexts are called <dfn id=auxiliary-browsing-context title="auxiliary browsing context">auxiliary browsing contexts</dfn>. Auxiliary browsing contexts
  are always <a href=#top-level-browsing-context title="top-level browsing context">top-level browsing contexts</a>.</p>

  <p>An <a href=#auxiliary-browsing-context>auxiliary browsing context</a> has an <dfn id=opener-browsing-context>opener browsing context</dfn>, which is
  the <a href=#browsing-context>browsing context</a> from which the <a href=#auxiliary-browsing-context>auxiliary browsing context</a> was
  created.</p>


  <h5 id=navigating-auxiliary-browsing-contexts-in-the-dom><span class=secno>6.1.2.1 </span>Navigating auxiliary browsing contexts in the DOM</h5>

  <p>The <dfn id=dom-opener title=dom-opener><code>opener</code></dfn> IDL attribute on the <code><a href=#window>Window</a></code>
  object, on getting, must return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context>browsing
  context</a> from which the current <a href=#browsing-context>browsing context</a> was created (its <a href=#opener-browsing-context>opener
  browsing context</a>), if there is one, if it is still available, and if the current
  <a href=#browsing-context>browsing context</a> has not <i><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>browsing context</a> must <dfn id=disowned-its-opener title="disowned its opener">disown its opener</dfn>; if the new value is anything else then the
  user agent must ignore the new value.</p>



  <h4 id=secondary-browsing-contexts><span class=secno>6.1.3 </span>Secondary browsing contexts</h4>

  <p>User agents may support <dfn id=secondary-browsing-context title="secondary browsing context">secondary browsing
  contexts</dfn>, which are <a href=#browsing-context title="browsing context">browsing contexts</a> that form part
  of the user agent's interface, apart from the main content area.</p>

  <p class=note>The <code title=rel-sidebar><a href=#link-type-sidebar>sidebar</a></code> link type uses <a href=#secondary-browsing-context title="secondary
  browsing context">secondary browsing contexts</a>.</p>


<!--ADD-TOPIC:Security-->
  <div class=impl>

  <h4 id=security-nav><span class=secno>6.1.4 </span>Security</h4>

  <p id=security-1>A <a href=#browsing-context>browsing context</a> <var title="">A</var> is <dfn id=familiar-with>familiar with</dfn> a second <a href=#browsing-context>browsing context</a> <var title="">B</var> if one of the
  following conditions is true:</p>

  <ul><li>Either the <a href=#origin>origin</a> of the <a href=#active-document>active document</a> of <var title="">A</var>
   is the <a href=#same-origin title="same origin">same</a> as the <a href=#origin>origin</a> of the <a href=#active-document>active
   document</a> of <var title="">B</var>, or</li>

   <li>The browsing context <var title="">A</var> is a <a href=#nested-browsing-context>nested browsing context</a> with a
   <a href=#top-level-browsing-context>top-level browsing context</a>, and its <a href=#top-level-browsing-context>top-level browsing context</a> is <var title="">B</var>, or</li>

   <li>The browsing context <var title="">B</var> is an <a href=#auxiliary-browsing-context>auxiliary browsing context</a> and
   <var title="">A</var> is <a href=#familiar-with>familiar with</a> <var title="">B</var>'s <a href=#opener-browsing-context>opener
   browsing context</a>, or</li>

   <li>The browsing context <var title="">B</var> is not a <a href=#top-level-browsing-context>top-level browsing context</a>,
   but there exists an <a href=#ancestor-browsing-context>ancestor browsing context</a> of <var title="">B</var> whose
   <a href=#active-document>active document</a> has the <a href=#same-origin title="same origin">same</a> <a href=#origin>origin</a> as
   the <a href=#active-document>active document</a> of <var title="">A</var> (possibly in fact being <var title="">A</var> itself).</li>

  </ul><hr><p>A <a href=#browsing-context>browsing context</a> <var title="">A</var> is <dfn id=allowed-to-navigate>allowed to navigate</dfn> a
  second <a href=#browsing-context>browsing context</a> <var title="">B</var> if the following algorithm terminates
  positively:</p>

  <ol><li><p>If <var title="">A</var> is not the same <a href=#browsing-context>browsing context</a> as <var title="">B</var>, and <var title="">A</var> is not one of the <a href=#ancestor-browsing-context title="ancestor browsing
   context">ancestor browsing contexts</a> of <var title="">B</var>, and <var title="">B</var>
   is not a <a href=#top-level-browsing-context>top-level browsing context</a>, and <var title="">A</var>'s <a href=#active-document>active
   document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation
   browsing context flag</a> set, then abort these steps negatively.</li>

   <li><p>Otherwise, if <var title="">B</var> is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is
   one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of <var title="">A</var>, and <var title="">A</var>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
   flag set</a> has its <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> set,
   then abort these steps negatively.</li>

   <li><p>Otherwise, if <var title="">B</var> is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is
   not one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of <var title="">A</var>, and <var title="">A</var>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
   flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set, and <var title="">A</var> is not the <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a> of <var title="">B</var>, then abort these steps negatively.</li> <!-- we do not check the
   /sandboxed auxiliary navigation browsing context flag/ here, that's only for actually opening
   the new top-level browsing context. -->

   <li><p>Otherwise, terminate positively!</li>

  </ol><hr><p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its <code><a href=#document>Document</a></code>'s
  <a href=#browsing-context>browsing context</a> is a <a href=#top-level-browsing-context>top-level browsing context</a> or if all of its
  <code><a href=#document>Document</a></code>'s <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a>
  all have <a href=#active-document title="active document">active documents</a> whose <a href=#origin>origin</a> are the
  <a href=#same-origin>same origin</a> as the element's <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>. If an
  element has a <a href=#browsing-context-scope-origin>browsing context scope origin</a>, then its value is the
  <a href=#origin>origin</a> of the element's <code><a href=#document>Document</a></code>.</p>

  </div>
<!--REMOVE-TOPIC:Security-->


  <div class=impl>

  <h4 id=groupings-of-browsing-contexts><span class=secno>6.1.5 </span>Groupings of browsing contexts</h4>

  <p>Each <a href=#browsing-context>browsing context</a> is defined as having a list of one or more <dfn id=directly-reachable-browsing-contexts>directly
  reachable browsing contexts</dfn>. These are:</p>

  <ul><li>The <a href=#browsing-context>browsing context</a> itself.</li>

   <li>All the <a href=#browsing-context>browsing context</a>'s <a href=#child-browsing-context title="child browsing context">child browsing
   contexts</a>.</li>

   <li>The <a href=#browsing-context>browsing context</a>'s <a href=#parent-browsing-context>parent browsing context</a>.</li>

   <li>All the <a href=#browsing-context title="browsing context">browsing contexts</a> that have the <a href=#browsing-context>browsing
   context</a> as their <a href=#opener-browsing-context>opener browsing context</a>.</li>

   <li>The <a href=#browsing-context>browsing context</a>'s <a href=#opener-browsing-context>opener browsing context</a>.</li>

  </ul><p>The transitive closure of all the <a href=#browsing-context title="browsing context">browsing contexts</a> that
  are <a href=#directly-reachable-browsing-contexts>directly reachable browsing contexts</a> forms a <dfn id=unit-of-related-browsing-contexts>unit of related browsing
  contexts</dfn>.</p>

  <p>Each <a href=#unit-of-related-browsing-contexts>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>active document</a> with an
  <a href=#effective-script-origin>effective script origin</a> that, through appropriate manipulation of the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute, could be made to be the same as
  other members of the group, but could not be made the same as members of any other group. Each
  such group is a <dfn id=unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</dfn>.</p>

  <p class=note>There is also at most one <a href=#event-loop>event loop</a> per <a href=#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 title="unit of related
  similar-origin browsing contexts">units of related similar-origin browsing contexts</a> can
  have a shared <a href=#event-loop>event loop</a>).</p>

  </div>



  <h4 id=browsing-context-names><span class=secno>6.1.6 </span>Browsing context names</h4>

  <p>Browsing contexts can have a <dfn id=browsing-context-name>browsing context name</dfn>. By default, a browsing context
  has no name (its name is not set).</p>

  <p>A <dfn id=valid-browsing-context-name>valid browsing context name</dfn> is any string with at least one character that does
  not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for
  special keywords.)</p>

  <p>A <dfn id=valid-browsing-context-name-or-keyword>valid browsing context name or keyword</dfn> is any string that is either a <a href=#valid-browsing-context-name>valid
  browsing context name</a> or that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for one of:
  <code title="">_blank</code>, <code title="">_self</code>, <code title="">_parent</code>, or <code title="">_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>browsing context</a> that the link or script is in, "parent" means the <a href=#parent-browsing-context>parent
  browsing context</a> of the one the link or script is in, "master" means the nearest
  <a href=#ancestor-browsing-context>ancestor browsing context</a> of the one the link or script is in that is not itself in a
  <a href=#attr-iframe-seamless title=attr-iframe-seamless>seamless iframe</a>, "top" means the <a href=#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>top-level
  browsing context</a> or <a href=#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 title=attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>" keyword is also specified on the
  <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute (or if the user overrode the
  sandboxing), and the same as "none" otherwise.</p>

  <table><thead><tr><th rowspan=2>Keyword
     <th rowspan=2>Ordinary effect
     <th colspan=5>Effect in an <code><a href=#the-iframe-element>iframe</a></code> with...
    <tr><!-- nothing --><th><code title="">seamless=""</code>
     <th><code title="">sandbox=""</code>
     <th><code title="">sandbox="" seamless=""</code>
     <th><code title="">sandbox="allow-top-navigation"</code>
     <th><code title="">sandbox="allow-top-navigation" seamless=""</code>

   <tbody><tr><td>none specified, for links and form submissions <!-- same as empty string -->
     <td>current
     <td>master
     <td>current
     <td>master
     <td>current
     <td>master

    <tr><td>empty string
     <td>current
     <td>master
     <td>current
     <td>master
     <td>current
     <td>master

    <tr><td><code title="">_blank</code>
     <td>new
     <td>new
     <td>maybe new
     <td>maybe new
     <td>maybe new
     <td>maybe new

    <tr><td><code title="">_self</code>
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current

    <tr><td><code title="">_parent</code> if there isn't a parent
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current

    <tr><td><code title="">_parent</code> if parent is also top
     <td>parent/top
     <td>parent/top
     <td>none
     <td>none
     <td>parent/top
     <td>parent/top

    <tr><td><code title="">_parent</code> if there is one and it's not top
     <td>parent
     <td>parent
     <td>none
     <td>none
     <td>none
     <td>none

    <tr><td><code title="">_top</code> if top is current
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current

    <tr><td><code title="">_top</code> if top is not current
     <td>top
     <td>top
     <td>none
     <td>none
     <td>top
     <td>top

    <tr><td>name that doesn't exist
     <td>new
     <td>new
     <td>maybe new
     <td>maybe new
     <td>maybe new
     <td>maybe new

    <tr><td>name that exists and is a descendant
     <td>specified descendant
     <td>specified descendant
     <td>specified descendant
     <td>specified descendant
     <td>specified descendant
     <td>specified descendant

    <tr><td>name that exists and is current
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current
     <td>current

    <tr><td>name that exists and is an ancestor that is top
     <td>specified ancestor
     <td>specified ancestor
     <td>none
     <td>none
     <td>specified ancestor/top
     <td>specified ancestor/top

    <tr><td>name that exists and is an ancestor that is not top
     <td>specified ancestor
     <td>specified ancestor
     <td>none
     <td>none
     <td>none
     <td>none

    <tr><td>other name that exists with common top
     <td>specified
     <td>specified
     <td>none
     <td>none
     <td>none
     <td>none

    <tr><td>name that exists with different top, if <a href=#familiar-with title="familiar with">friends</a> and <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a>
     <td>specified
     <td>specified
     <td>specified
     <td>specified
     <td>specified
     <td>specified

    <tr><td>name that exists with different top, if <a href=#familiar-with title="familiar with">friends</a> but not <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a>
     <td>specified
     <td>specified
     <td>none
     <td>none
     <td>none
     <td>none

    <tr><td>name that exists with different top, not <a href=#familiar-with title="familiar with">friends</a>
     <td>new
     <td>new
     <td>maybe new
     <td>maybe new
     <td>maybe new
     <td>maybe new

  </table><p class=tablenote><small>Most of the restrictions on sandboxed browsing contexts are applied by
  other algorithms, e.g. the <a href=#navigate title=navigate>navigation</a> algorithm, not <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules
  for choosing a browsing context given a browsing context name</a> given below.</small></p>

  <div class=impl>

  <hr><p>An algorithm is <dfn id=allowed-to-show-a-popup>allowed to show a popup</dfn> if any of the following conditions is
  true:</p>

  <ul><li><p>The <a href=#concept-task title=concept-task>task</a> in which the algorithm is running is currently
   processing an <a href=#activation-behavior>activation behavior</a> whose <code title=event-click><a href=#event-click>click</a></code> event
   was <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>.</li>

   <li>

    <p>The <a href=#concept-task title=concept-task>task</a> in which the algorithm is running is currently
    running the event listener for a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event whose
    type is in the following list:</p>

    <ul class=brief><li><code title=event-change>change</code></li>
     <li><code title=event-click><a href=#event-click>click</a></code></li>
     <li><code title=event-dblclick>dblclick</code></li>
     <li><code title=event-mouseup>mouseup</code></li>
     <li><code title=event-reset>reset</code></li>
     <li><code title=event-submit>submit</code></li>
    </ul></li>

   <li>

    <p>The <a href=#concept-task title=concept-task>task</a> in which the algorithm is running was <a href=#queue-a-task title="queue a task">queued</a> by an algorithm that was <a href=#allowed-to-show-a-popup>allowed to show a popup</a>,
    and the chain of such algorithms started within a user-agent defined timeframe.</p>

    <p class=example>For example, if a user clicked a button, it might be acceptable for a popup
    to result from that after 4 seconds, but it would likely not be acceptable for a popup to result
    from that after 4 hours.</p>

   </li>

  </ul><hr><p><dfn id=the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>The rules for choosing a browsing context given a browsing context name</dfn> are as
  follows. The rules assume that they are being applied in the context of a <a href=#browsing-context>browsing
  context</a>, as part of the execution of a <a href=#concept-task title=concept-task>task</a>.</p>

  <ol><li>

    <p>If the given browsing context name is the empty string or <code title="">_self</code>, then
    the chosen browsing context must be the current one.</p>

    <p>If the given browsing context name is <code title="">_self</code>, then this is an
    <a href=#explicit-self-navigation-override>explicit self-navigation override</a>, which overrides the behavior of the
    <a href=#seamless-browsing-context-flag>seamless browsing context flag</a> set by the <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attribute on <code><a href=#the-iframe-element>iframe</a></code> elements.</p>

   </li>

   <li><p>If the given browsing context name is <code title="">_parent</code>, then the chosen
   browsing context must be the <a href=#parent-browsing-context><em>parent</em> browsing context</a> of the current one,
   unless there isn't one, in which case the chosen browsing context must be the current browsing
   context.</li>

   <li><p>If the given browsing context name is <code title="">_top</code>, then the chosen browsing
   context must be the <a href=#top-level-browsing-context>top-level browsing context</a> of the current one, if there is one,
   or else the current browsing context.</li>

   <li>

    <p>If the given browsing context name is not <code title="">_blank</code> and there exists a
    browsing context whose <a href=#browsing-context-name title="browsing context name">name</a> is the same as the given
    browsing context name, and the current browsing context is <a href=#familiar-with>familiar with</a> that
    browsing context, and the user agent determines that the two browsing contexts are related
    enough that it is ok if they reach each other, then that browsing context must be the chosen
    one. If there are multiple matching browsing contexts, the user agent should select one in some
    arbitrary consistent manner, such as the most recently opened, most recently focused, or more
    closely related.</p>

    <p>If the browsing context is chosen by this step to be the current browsing context, then this
    is also an <a href=#explicit-self-navigation-override>explicit self-navigation override</a>.</p>

   </li>

   <li>

    <p>Otherwise, a new browsing context is being requested, and what happens depends on the user
    agent's configuration and abilities &mdash; it is determined by the rules given for the first
    applicable option from the following list:</p>

    <dl class=switch><dt id=popup-blocker>If the algorithm is not <a href=#allowed-to-show-a-popup>allowed to show a popup</a> and the
     user agent has been configured to not show popups (i.e. the user agent has a "popup blocker"
     enabled)</dt>

     <dd>

      <p>There is no chosen browsing context. The user agent may inform the user that a popup has
      been blocked.</p>

     </dd>

     <dt id=sandboxWindowOpen>If the current browsing context's <a href=#active-document>active document</a>'s
     <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing
     context flag</a> set.</dt>

     <dd>

      <p>Typically, there is no chosen browsing context.</p>

      <p>The user agent may offer to create a new <a href=#top-level-browsing-context>top-level browsing context</a> or reuse
      an existing <a href=#top-level-browsing-context>top-level browsing context</a>. If the user picks one of those options,
      then the designated browsing context must be the chosen one (the browsing context's name isn't
      set to the given browsing context name). The default behaviour (if the user agent doesn't
      offer the option to the user, or if the user declines to allow a browsing context to be used)
      must be that there must not be a chosen browsing context.</p>

      <p class=warning>If this case occurs, it means that an author has explicitly sandboxed the
      document that is trying to open a link.</p>

     </dd>


     <dt id=noopener>If the user agent has been configured such that in this instance it will
     create a new browsing context, and the browsing context is being requested as part of <a href=#following-hyperlinks title="following hyperlinks">following a hyperlink</a> whose <a href=#linkTypes>link
     types</a> include the <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword</dt>

     <dd><p>A new <a href=#top-level-browsing-context>top-level browsing context</a> must be created. If the given browsing
     context name is not <code title="">_blank</code>, then the new top-level browsing context's
     name must be the given browsing context name (otherwise, it has no name). The chosen browsing
     context must be this new browsing context. The creation of such a <a href=#browsing-context>browsing context</a>
     is <dfn id=a-new-start-for-session-storage>a new start for session storage</dfn>.</p>

     <p class=note>If it is immediately <a href=#navigate title=navigate>navigated</a>, then the
     navigation will be done with <a href=#replacement-enabled>replacement enabled</a>.</dd>


     <dt>If the user agent has been configured such that in this instance it will create a new
     browsing context, and the <code title=rel-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword doesn't
     apply</dt>

     <dd><p>A new <a href=#auxiliary-browsing-context>auxiliary browsing context</a> must be created, with the <a href=#opener-browsing-context>opener
     browsing context</a> being the current one. If the given browsing context name is not <code title="">_blank</code>, then the new auxiliary browsing context's name must be the given
     browsing context name (otherwise, it has no name). The chosen browsing context must be this new
     browsing context.</p>

     <p class=note>If it is immediately <a href=#navigate title=navigate>navigated</a>, then the
     navigation will be done with <a href=#replacement-enabled>replacement enabled</a>.</dd>


     <dt>If the user agent has been configured such that in this instance it will reuse the current
     browsing context</dt>

     <dd><p>The chosen browsing context is the current browsing context.</dd>


     <dt>If the user agent has been configured such that in this instance it will not find a
     browsing context</dt>

     <dd><p>There must not be a chosen browsing context.</dd>

    </dl><p>User agent implementors are encouraged to provide a way for users to configure the user agent
    to always reuse the current browsing context.</p>

    <p>If the current browsing context's <a href=#active-document>active document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag
    set</a> has the <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set and the chosen
    browsing context picked above, if any, is a new browsing context (whether top-level or
    auxiliary), then all the flags that are set in the current browsing context's <a href=#active-document>active
    document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> when the new browsing context is
    created must be set in the new browsing context's <a href=#popup-sandboxing-flag-set>popup sandboxing flag set</a>, and
    the current browsing context must be set as the new browsing context's <a href=#one-permitted-sandboxed-navigator>one permitted
    sandboxed navigator</a>.</p>

   </li>

  </ol></div>



<!--TOPIC:DOM APIs-->
  <h3 id=the-window-object><span class=secno>6.2 </span>The <code><a href=#window>Window</a></code> object</h3>

  <pre class=idl>[Global]
/*sealed*/ interface <dfn id=window>Window</dfn> : <a href=#eventtarget>EventTarget</a> {
  // the current browsing context
  [Unforgeable] readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-window title=dom-window>window</a>;
  [Replaceable] readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-self title=dom-self>self</a>;
  [Unforgeable] readonly attribute <a href=#document>Document</a> <a href=#dom-document-0 title=dom-document>document</a>;
           attribute DOMString <a href=#dom-name title=dom-name>name</a>; <!-- not [Replaceable] per WebKit and IE8 -->
  [PutForwards=<a href=#dom-url-href title=dom-url-href>href</a>, Unforgeable] readonly attribute <a href=#location>Location</a> <a href=#dom-location title=dom-location>location</a>;
  readonly attribute <a href=#history-0>History</a> <a href=#dom-history title=dom-history>history</a>;
  [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-locationbar title=dom-window-locationbar>locationbar</a>;
  [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-menubar title=dom-window-menubar>menubar</a>;
  [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-personalbar title=dom-window-personalbar>personalbar</a>;
  [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-scrollbars title=dom-window-scrollbars>scrollbars</a>;
  [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-statusbar title=dom-window-statusbar>statusbar</a>;
  [Replaceable] readonly attribute <a href=#barprop>BarProp</a> <a href=#dom-window-toolbar title=dom-window-toolbar>toolbar</a>;<!--
  [Replaceable] readonly attribute <span>BarProp</span> <span title="dom-window-directories">directories</span>; // legacy (Gecko-only) -->
           attribute DOMString <a href=#dom-window-status title=dom-window-status>status</a>;
  void <a href=#dom-window-close title=dom-window-close>close</a>();
  readonly attribute boolean <a href=#dom-window-closed title=dom-window-closed>closed</a>;
  void <a href=#dom-window-stop title=dom-window-stop>stop</a>();
  void <a href=#dom-window-focus title=dom-window-focus>focus</a>();
  void <a href=#dom-window-blur title=dom-window-blur>blur</a>();

  // other browsing contexts
  [Replaceable] readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-frames title=dom-frames>frames</a>;
  [Replaceable] readonly attribute unsigned long <a href=#dom-length title=dom-length>length</a>;
  [Unforgeable] readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-top title=dom-top>top</a>;
           attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-opener title=dom-opener>opener</a>;
  readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-parent title=dom-parent>parent</a>;
  readonly attribute <a href=#element>Element</a>? <a href=#dom-frameelement title=dom-frameElement>frameElement</a>;
  <a href=#windowproxy>WindowProxy</a> <a href=#dom-open title=dom-open>open</a>(optional DOMString url = "about:blank", optional DOMString target = "_blank", optional DOMString features = "", optional boolean replace = false);
  <a href=#dom-window-item title=dom-window-item>getter</a> <a href=#windowproxy>WindowProxy</a> (unsigned long index);
  <a href=#dom-window-nameditem title=dom-window-namedItem>getter</a> object (DOMString name);

  // the user agent
  readonly attribute <a href=#navigator>Navigator</a> <a href=#dom-navigator title=dom-navigator>navigator</a>; <!-- IE also has window.clientInformation === window.navigator -->
  readonly attribute <a href=#external>External</a> <a href=#dom-external title=dom-external>external</a>;
  readonly attribute <a href=#applicationcache>ApplicationCache</a> <a href=#dom-applicationcache title=dom-applicationCache>applicationCache</a>;

  // user prompts
  void <a href=#dom-alert title=dom-alert>alert</a>(optional DOMString message = "");
  boolean <a href=#dom-confirm title=dom-confirm>confirm</a>(optional DOMString message = "");
  DOMString? <a href=#dom-prompt title=dom-prompt>prompt</a>(optional DOMString message = "", optional DOMString default = "");
  void <a href=#dom-print title=dom-print>print</a>();
  any <a href=#dom-showmodaldialog title=dom-showModalDialog>showModalDialog</a>(DOMString url, optional any argument<!--, optional DOMString features-->);

  void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(any message, DOMString targetOrigin, optional sequence&lt;<a href=#transferable>Transferable</a>&gt; transfer);

  // <a href="#Window-partial">also has obsolete members</a>
};
<a href=#window>Window</a> implements <a href=#globaleventhandlers>GlobalEventHandlers</a>;
<a href=#window>Window</a> implements <a href=#windoweventhandlers>WindowEventHandlers</a>;</pre>

<!-- for more features to add here, look here:
 http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp
 http://www.mozilla.org/docs/dom/domref/dom_window_ref.html
 http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindow.idl - scrollBy, etc
 http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindowInternal.idl - DOM level 0
-->

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-window><a href=#dom-window>window</a></code></dt>
   <dt><var title="">window</var> . <code title=dom-frames><a href=#dom-frames>frames</a></code></dt>
   <dt><var title="">window</var> . <code title=dom-self><a href=#dom-self>self</a></code></dt>

   <dd>

    <p>These attributes all return <var title="">window</var>.</p>

   </dd>


   <dt><var title="">window</var> . <code title=dom-document><a href=#dom-document-0>document</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#document>Document</a></code> associated with <var title="">window</var>.</p>

   </dd>


   <dt><var title="">document</var> . <code title=dom-document-defaultView><a href=#dom-document-defaultview>defaultView</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#window>Window</a></code> object of the <a href=#active-document>active document</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <code><a href=#window>Window</a></code> interface must only be <a href=#exposed-to-javascript>exposed to JavaScript</a> if the
  <a href=#javascript-global-environment>JavaScript global environment</a> is a <a href=#document-environment>document environment</a>.</p>

  <p>The <dfn id=dom-window title=dom-window><code>window</code></dfn>, <dfn id=dom-frames title=dom-frames><code>frames</code></dfn>, and <dfn id=dom-self title=dom-self><code>self</code></dfn>
  IDL attributes must all return the <code><a href=#window>Window</a></code> object's <a href=#browsing-context>browsing context</a>'s
  <code><a href=#windowproxy>WindowProxy</a></code> object.</p>

  <p>The <dfn id=dom-document-0 title=dom-document><code>document</code></dfn> IDL attribute must return
  <a href=#concept-document-window title=concept-document-window>the <code>Window</code> object's newest <code>Document</code> object</a>.</p>

  <p>The <dfn id=dom-document-defaultview title=dom-document-defaultView><code>defaultView</code></dfn> IDL attribute of the
  <code><a href=#document>Document</a></code> interface must return the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing
  context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object, if there is one, or null otherwise.</p>

  <hr><p>For historical reasons, <code><a href=#window>Window</a></code> objects must also have a writable, configurable,
  non-enumerable property named <dfn id=htmldocument><code>HTMLDocument</code></dfn> whose value is the
  <code><a href=#document>Document</a></code> interface object.</p>

  </div>


<!--ADD-TOPIC:Security-->
  <div class=impl>

  <h4 id=security-window><span class=secno>6.2.1 </span>Security</h4>

  <p id=security-2>User agents must throw a <code><a href=#securityerror>SecurityError</a></code> exception whenever any
  properties of a <code><a href=#window>Window</a></code> object are accessed when the <a href=#incumbent-script>incumbent script</a> has
  an <a href=#effective-script-origin>effective script origin</a> that is not the <a href=#same-origin title="same origin">same</a> as
  <a href=#concept-document-window title=concept-document-window>the <code>Window</code> object's
  <code>Document</code></a>'s <a href=#effective-script-origin>effective script origin</a>, with the following
  exceptions:</p>

  <ul><li>The <code title=dom-location><a href=#dom-location>location</a></code> attribute

   <li>The <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method

   <li>The <code title=dom-window><a href=#dom-window>window</a></code> attribute

   <li>The <code title=dom-frames><a href=#dom-frames>frames</a></code> attribute

   <li>The <code title=dom-self><a href=#dom-self>self</a></code> attribute

   <li>The <code title=dom-top><a href=#dom-top>top</a></code> attribute

   <li>The <code title=dom-parent><a href=#dom-parent>parent</a></code> attribute

   <li>The <code title=dom-opener><a href=#dom-opener>opener</a></code> attribute

   <li>The <code title=dom-window-closed><a href=#dom-window-closed>closed</a></code> attribute

   <li>The <code title=dom-window-close><a href=#dom-window-close>close()</a></code> method

   <li>The <code title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> method

   <li>The <code title=dom-window-focus><a href=#dom-window-focus>focus()</a></code> method

   <li>The <a href=#dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</a>

  </ul><p>When the <a href=#incumbent-script>incumbent script</a>'s <a href=#effective-script-origin>effective script origin</a> is different than
  a <a href=#concept-document-window title=concept-document-window><code>Window</code> object's
  <code>Document</code></a>'s <a href=#effective-script-origin>effective script origin</a>, the user agent must act as if
  any changes to that <code><a href=#window>Window</a></code> object's properties, getters, setters, etc, were not
  present, and as if all the properties of that <code><a href=#window>Window</a></code> object had their [[Enumerable]]
  attribute set to false.</p>

  <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin>effective
  script origin</a> that is not the same as the <code><a href=#window>Window</a></code> object's
  <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a> must be provided with a separate set
  of objects. These objects must have the prototype chain appropriate for the script for which the
  objects are created (not those that would be appropriate for scripts whose <a href="#script's-global-object">script's global
  object</a> is the <code><a href=#window>Window</a></code> object in question).</p>

  <div class=example>

   <p>For instance, if two frames containing <code><a href=#document>Document</a></code>s from different <a href=#origin title=origin>origins</a> access the same <code><a href=#window>Window</a></code> object's <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, they will get distinct objects that
   are not equal.</p>

  </div>

  </div>
<!--REMOVE-TOPIC:Security-->



  <h4 id=apis-for-creating-and-navigating-browsing-contexts-by-name><span class=secno>6.2.2 </span>APIs for creating and navigating browsing contexts by name</h4>

  <dl class=domintro><dt><var title="">window</var> = <var title="">window</var> . <code title=dom-open><a href=#dom-open>open</a></code>( [ <var title="">url</var> [, <var title="">target</var> [, <var title="">features</var> [, <var title="">replace</var> ] ] ] ] )</dt>

   <dd>

    <p>Opens a window to show <var title="">url</var> (defaults to <code><a href=#about:blank>about:blank</a></code>), and
    returns it. The <var title="">target</var> argument gives the name of the new window. If a
    window exists with that name already, it is reused. The <var title="">replace</var> attribute,
    if true, means that whatever page is currently open in that window will be removed from the
    window's session history. The <var title="">features</var> argument is ignored.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-name><a href=#dom-name>name</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the name of the window.</p>

    <p>Can be set, to change the name.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-window-close><a href=#dom-window-close>close</a></code>()</dt>

   <dd>

    <p>Closes the window.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-window-closed><a href=#dom-window-closed>closed</a></code></dt>

   <dd>

    <p>Returns true if the window has been closed, false otherwise.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-window-stop><a href=#dom-window-stop>stop</a></code>()</dt>

   <dd>

    <p>Cancels the document load.</p>

   </dd>

  </dl><div class=impl>

  <!-- This whole section should be rewritten to use algorithmic style -->

  <p>The <dfn id=dom-open title=dom-open><code>open()</code></dfn> method on <code><a href=#window>Window</a></code> objects
  provides a mechanism for <a href=#navigate title=navigate>navigating</a> an existing <a href=#browsing-context>browsing
  context</a> or opening and navigating an <a href=#auxiliary-browsing-context>auxiliary browsing context</a>.</p>

  <p>The method has four arguments, though they are all optional.</p>

  <p>The first argument, <var title="">url</var>, must be a <a href=#valid-non-empty-url>valid non-empty URL</a> for a
  page to load in the browsing context. If the first argument is the empty string, then the <var title="">url</var> argument must be interpreted as "<code><a href=#about:blank>about:blank</a></code>". Otherwise, the
  argument must be <a href=#resolve-a-url title="resolve a url">resolved</a> to an <a href=#absolute-url>absolute URL</a> (or
  an error), relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
  URL</a>, when the method is invoked.</p>

  <p>The second argument, <var title="">target</var>, specifies the <a href=#browsing-context-name title="browsing context
  name">name</a> of the browsing context that is to be navigated. It must be a <a href=#valid-browsing-context-name-or-keyword>valid
  browsing context name or keyword</a>.</p>

  <p>The third argument, <var title="">features</var>, has no defined effect and is mentioned for
  historical reasons only. User agents may interpret this argument as instructions to set the size
  and position of the browsing context, but are encouraged to instead ignore the argument
  entirely.</p>

  <p>The fourth argument, <var title="">replace</var>, specifies whether or not the new page will
  <a href=#replacement-enabled title="replacement enabled">replace</a> the page currently loaded in the browsing
  context, when <var title="">target</var> identifies an existing browsing context (as opposed to
  leaving the current page in the browsing context's <a href=#session-history>session history</a>).</p>

  <p>When the method is invoked, the user agent must first select a <a href=#browsing-context>browsing context</a> to
  navigate by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a browsing context
  name</a> using the <var title="">target</var> argument as the name and the <a href=#browsing-context>browsing
  context</a> of the script as the context in which the algorithm is executed, unless the user
  has indicated a preference, in which case the browsing context to navigate may instead be the one
  indicated by the user.</p>

  <p class=example>For example, suppose there is a user agent that supports control-clicking a
  link to open it in a new tab. If a user clicks in that user agent on an element whose <code title=handler-onclick><a href=#handler-onclick>onclick</a></code> handler uses the <code title=dom-open><a href=#dom-open>window.open()</a></code> API to open a page in an iframe, but, while doing so, holds
  the control key down, the user agent could override the selection of the target browsing context
  to instead target a new tab.</p>

  <p>If applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a browsing context
  name</a> using the <var title="">target</var> argument would result in there not being a chosen
  browsing context, then throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort these
  steps.</p>

  <p>Otherwise, if <var title="">url</var> is not "<code><a href=#about:blank>about:blank</a></code>", the user agent must
  <a href=#navigate>navigate</a><!--DONAV window.open()--> the selected <a href=#browsing-context>browsing context</a> to the
  <a href=#absolute-url>absolute URL</a> obtained from <a href=#resolve-a-url title="resolve a url">resolving</a> <var title="">url</var> earlier. If the <var title="">replace</var> is true or if the <a href=#browsing-context>browsing
  context</a> was just created as part of <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
  browsing context name</a>, then <a href=#replacement-enabled title="replacement enabled">replacement must be
  enabled</a>. The navigation must be done with the <a href="#script's-browsing-context" title="script's browsing
  context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <a href=#source-browsing-context>source browsing
  context</a>. If the <a href=#resolve-a-url>resolve a URL</a> algorithm failed, then the user agent may either
  instead <a href=#navigate>navigate</a> to an inline error page, using the same replacement behavior and
  source browsing context behavior as described earlier in this paragraph; or treat the <var title="">url</var> as "<code><a href=#about:blank>about:blank</a></code>", acting as described in the next paragraph.</p>

  <p>If <var title="">url</var> <em>is</em> "<code><a href=#about:blank>about:blank</a></code>", and the <a href=#browsing-context>browsing
  context</a> was just created as part of <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
  browsing context name</a>, then the user agent must instead <a href=#queue-a-task>queue a task</a> to
  <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the selected
  <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object, but with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the selected <a href=#browsing-context>browsing context</a>'s <a href=#concept-document-window title=concept-document-window><code>Window</code> object's <code>Document</code></a> object
  (and the <code title=dom-event-currentTarget>currentTarget</code> set to the <code><a href=#window>Window</a></code>
  object).</p>

  <p>The method must return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context>browsing context</a>
  that was navigated, or null if no browsing context was navigated.</p>

  <hr><p>The <dfn id=dom-name title=dom-name><code>name</code></dfn> attribute of the <code><a href=#window>Window</a></code> object
  must, on getting, return the current <a href=#browsing-context-name title="browsing context name">name</a> of the
  <a href=#browsing-context>browsing context</a>, and, on setting, set the <a href=#browsing-context-name title="browsing context
  name">name</a> of the <a href=#browsing-context>browsing context</a> to the new value.</p>

  <p class=note>The name <a href=#resetBCName>gets reset</a> when the browsing context is
  navigated to another domain.</p>

  <hr><!--CLEANUP--><p>The <dfn id=dom-window-close title=dom-window-close><code>close()</code></dfn> method on <code><a href=#window>Window</a></code>
  objects should, if all the following conditions are met, <a href=#close-a-browsing-context title="close a browsing context">close</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>:

  <ul class=brief><li>The corresponding <a href=#browsing-context>browsing context</a> <var title="">A</var> is
   <a href=#script-closable>script-closable</a>.</li>

   <li>The <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
   script</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</li>

   <li id=sandboxClose>The <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
   script</a> is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</li>

  </ul><p>A <a href=#browsing-context>browsing context</a> is <dfn id=script-closable>script-closable</dfn> if it is an <a href=#auxiliary-browsing-context>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=#browsing-context>browsing context</a> whose <a href=#session-history>session history</a> contains only one
  <code><a href=#document>Document</a></code>.</p>

  <p>The <dfn id=dom-window-closed title=dom-window-closed><code>closed</code></dfn> attribute on <code><a href=#window>Window</a></code>
  objects must return true if the <code><a href=#window>Window</a></code> object's <a href=#browsing-context>browsing context</a> has
  been <a href=#a-browsing-context-is-discarded title="a browsing context is discarded">discarded</a>, and false otherwise.</p>

  <p>The <dfn id=dom-window-stop title=dom-window-stop><code>stop()</code></dfn> method on <code><a href=#window>Window</a></code>
  objects should, if there is an existing attempt to <a href=#navigate>navigate</a> the <a href=#browsing-context>browsing
  context</a> and that attempt is not currently running the <a href=#unload-a-document>unload a document</a>
  algorithm, cancel that <a href=#navigate title=navigate>navigation</a>; then, it must <a href=#abort-a-document title="abort
  a document">abort</a> the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a> of
  the <code><a href=#window>Window</a></code> object on which it was invoked.</p>

  </div>


  <h4 id=accessing-other-browsing-contexts><span class=secno>6.2.3 </span>Accessing other browsing contexts</h4>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-length><a href=#dom-length>length</a></code></dt>

   <dd>

    <p>Returns the number of <a href=#child-browsing-context title="child browsing context">child browsing
    contexts</a>.</p>

   </dd>

   <dt><var title="">window</var>[<var title="">index</var>]</dt>

   <dd>

    <p>Returns the indicated <a href=#child-browsing-context>child browsing context</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-length title=dom-length><code>length</code></dfn> IDL attribute on the <code><a href=#window>Window</a></code>
  interface must return the number of <a href=#child-browsing-context title="child browsing context">child browsing
  contexts</a> that are <a href=#browsing-context-nested-through title="browsing context nested through">nested through</a>
  elements that are <a href=#in-a-document title="in a document">in the <code>Document</code></a> that is the
  <a href=#active-document>active document</a> of that <code><a href=#window>Window</a></code> object, if that <code><a href=#window>Window</a></code>'s
  <a href=#browsing-context>browsing context</a> shares the same <a href=#event-loop>event loop</a> as the <a href="#script's-browsing-context">script's
  browsing context</a> of the <a href=#entry-script>entry script</a> accessing the IDL attribute; otherwise,
  it must return zero.</p>

  <!-- in other words, frames are only accessible to same-thread processes -->

  <p>The <a href=#supported-property-indices>supported property indices</a> on the <code><a href=#window>Window</a></code> object at any instant
  are the numbers in the range 0 .. <span title=""><var title="">n</var>-1</span>, where <var title="">n</var> is the number returned by the <code title=dom-length><a href=#dom-length>length</a></code> IDL
  attribute. If <var title="">n</var> is zero then there are no <a href=#supported-property-indices>supported property
  indices</a>.</p>

  <p>To <dfn id=dom-window-item title=dom-window-item>determine the value of an indexed property</dfn> <var title="">index</var> of a <code><a href=#window>Window</a></code> object, the user agent must return the
  <code><a href=#windowproxy>WindowProxy</a></code> object of the <var title="">index</var>th <a href=#child-browsing-context>child browsing
  context</a> of the <code><a href=#document>Document</a></code> that is nested through an element that is <a href=#in-a-document title="in a document">in the <code>Document</code></a>, sorted in the <a href=#tree-order>tree order</a>
  of the elements nesting those <a href=#browsing-context title="browsing context">browsing contexts</a>.</p>

  <p>These properties are the <dfn id=dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</dfn>.</p>

  </div>



  <h4 id=named-access-on-the-window-object><span class=secno>6.2.4 </span>Named access on the <code><a href=#window>Window</a></code> object</h4>

  <dl class=domintro><dt><var title="">window</var>[<var title="">name</var>]</dt>

   <dd>

    <p>Returns the indicated element or collection of elements.</p>

   </dd>

  </dl><div class=impl>

  <p>The <code><a href=#window>Window</a></code> interface <a href=#support-named-properties title="support named properties">supports named
  properties</a>. The <a href=#supported-property-names>supported property names</a> at any moment consist of the
  following, in <a href=#tree-order>tree order</a>, ignoring later duplicates:</p>

  <ul><li>the <a href=#browsing-context-name>browsing context name</a> of any <a href=#child-browsing-context>child browsing context</a> of the
   <a href=#active-document>active document</a> whose name is not the empty string,</li>

   <li>the value of the <code title="">name</code> content attribute for all <code><a href=#the-a-element>a</a></code>,
   <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>,
   <code><a href=#frameset>frameset</a></code>, <code><a href=#the-img-element>img</a></code>, and <code><a href=#the-object-element>object</a></code> elements in the <a href=#active-document>active
   document</a> that have a non-empty <code title="">name</code> content attribute, and</li>

   <li>the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute of any <a href=#html-elements title="HTML
   elements">HTML element</a> in the <a href=#active-document>active document</a> with a non-empty <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute.</li>

  </ul><p>To <a href=#determine-the-value-of-a-named-property>determine the value of a named property</a> <var title="">name</var> when <dfn id=dom-window-nameditem title=dom-window-namedItem>the <code>Window</code> object is indexed for property
  retrieval</dfn>, the user agent must return the value obtained using the following steps:</p>

  <ol><!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1716 --><li>

    <p>Let <var title="">objects</var> be the list of <a href=#dom-window-nameditem-filter title=dom-window-namedItem-filter>named objects</a> with the name <var title="">name</var>
    in the <a href=#active-document>active document</a>.

    <p class=note>There will be at least one such object, by definition.<!-- (If there wasn't,
    then this algorithm wouldn't have been invoked by Web IDL.) --></p>

   </li>

   <li>

    <p>If <var title="">objects</var> contains a <a href=#nested-browsing-context>nested browsing context</a>, then return
    the <code><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#nested-browsing-context>nested browsing context</a> corresponding to
    the first <a href=#browsing-context-container>browsing context container</a> in <a href=#tree-order>tree order</a> whose
    <a href=#browsing-context>browsing context</a> is in <var title="">objects</var>, and abort these steps.</p>

   </li>

   <li>

    <p>Otherwise, if <var title="">objects</var> has only one element, return that element and
    abort these steps.</p>

   </li>

   <li>

    <p>Otherwise return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code><a href=#document>Document</a></code> node,
    whose filter matches only <a href=#dom-window-nameditem-filter title=dom-window-namedItem-filter>named objects</a> with
    the name <var title="">name</var>. (By definition, these will all be elements.)</p> <!-- the
    same one each time is returned, because of the rule under collections -->

   </li>

  </ol><p><dfn id=dom-window-nameditem-filter title=dom-window-nameditem-filter>Named objects</dfn> with the name <var title="">name</var>, for the purposes of the above algorithm, are those that are either:</p>

  <ul><li><a href=#child-browsing-context title="child browsing context">child browsing contexts</a> of the <a href=#active-document>active
   document</a> whose name is <var title="">name</var>,</li>

   <li><code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>,
   <code><a href=#the-form-element>form</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> elements that
   have a <code title=attr-name>name</code> content attribute whose value is <var title="">name</var>, or</li>

   <li><a href=#html-elements>HTML elements</a> that have an <code title=attr-id><a href=#the-id-attribute>id</a></code> content attribute
   whose value is <var title="">name</var>.</li>

  </ul></div>


  <div class=impl>

  <h4 id=garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>Garbage collection and browsing contexts</h4>

  <p>A <a href=#browsing-context>browsing context</a> has a strong reference to each of its <code><a href=#document>Document</a></code>s
  and its <code><a href=#windowproxy>WindowProxy</a></code> object, and the user agent itself has a strong reference to its
  <a href=#top-level-browsing-context title="top-level browsing context">top-level browsing contexts</a>.</p>

  <p>A <code><a href=#document>Document</a></code> has a strong reference to its <code><a href=#window>Window</a></code> object.</p>

  <p class=note>A <code><a href=#window>Window</a></code> object <a href=#implied-strong-reference title="implied strong reference">has a strong
  reference</a> to its <code><a href=#document>Document</a></code> object through its <code title=dom-document><a href=#dom-document-0>document</a></code> attribute. Thus, references from other scripts to either of
  those objects will keep both alive. Similarly, both <code><a href=#document>Document</a></code> and <code><a href=#window>Window</a></code>
  objects have <a href=#implied-strong-reference title="implied strong reference">implied strong references</a> to the
  <code><a href=#windowproxy>WindowProxy</a></code> object.</p>

  <p>Each <a href=#concept-script title=concept-script>script</a> has a strong reference to its <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> and its <a href="#script's-document" title="script's
  document">document</a>.</p>

  <!-- discard a document -->
  <p>When a <a href=#browsing-context>browsing context</a> is to <dfn id=discard-a-document>discard a <code>Document</code></dfn>, the user
  agent must run the following steps:</p>

  <ol><li><p>Set the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.</li>

   <li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for the <code><a href=#document>Document</a></code> that
   are defined by this specification and <a href=#other-applicable-specifications>other applicable specifications</a>.</li>

   <li><p><a href=#abort-a-document title="abort a document">Abort the <code>Document</code></a>.</li>

   <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> associated with the
   <code><a href=#document>Document</a></code> in any <a href=#task-source>task source</a>, without running those tasks.</li>

   <li><p><a href=#a-browsing-context-is-discarded title="a browsing context is discarded">Discard</a> all the <a href=#child-browsing-context title="child
   browsing context">child browsing contexts</a> of the <code><a href=#document>Document</a></code>.</li>

   <li><p>Lose the strong reference from the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>
   to the <code><a href=#document>Document</a></code>.</li>

  </ol><p class=note>Whenever a <code><a href=#document>Document</a></code> object is <a href=#discard-a-document title="discard a
  Document">discarded</a>, it is also removed from the list of <a href="#the-worker's-documents">the worker's
  <code>Document</code>s</a> of each worker whose list contains that <code><a href=#document>Document</a></code>.</p>

  <p>When <dfn id=a-browsing-context-is-discarded>a <em><span>browsing context</span></em> is discarded</dfn>, the strong reference
  from the user agent itself to the <a href=#browsing-context>browsing context</a> must be severed, and all the
  <code><a href=#document>Document</a></code> objects for all the entries in the <a href=#browsing-context>browsing context</a>'s session
  history must be <a href=#discard-a-document title="discard a document">discarded</a> as well.</p>

  <p>User agents may <a href=#a-browsing-context-is-discarded title="a browsing context is discarded">discard</a> <a href=#top-level-browsing-context title="top-level browsing context">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 title="top-level browsing context">top-level browsing contexts</a>). Other <a href=#browsing-context title="browsing context">browsing contexts</a> must be discarded once their
  <code><a href=#windowproxy>WindowProxy</a></code> object is eligible for garbage collection.</p>

  </div>


  <h4 id=closing-browsing-contexts><span class=secno>6.2.6 </span>Closing browsing contexts</h4>

  <p>When the user agent is required to <dfn id=close-a-browsing-context>close a browsing context</dfn>, it must run the
  following steps:</p>

  <ol><li><p>Let <var title="">specified browsing context</var> be the <a href=#browsing-context>browsing context</a>
   being closed.</li>

   <li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to unload</a> the <a href=#active-document>active
   document</a> of the <var title="">specified browsing context</var>. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused
   to allow the document to be unloaded</a>, then abort these steps.</li>

   <li><p><a href=#unload-a-document title="unload a document">Unload</a> the <a href=#active-document>active document</a> of the <var title="">specified browsing context</var> with the <var title="">recycle</var> parameter set to
   false.</li>

   <li><p>Remove the <var title="">specified browsing context</var> from the user interface (e.g.
   close or hide its tab in a tabbed browser).</li>

   <li><p><a href=#a-browsing-context-is-discarded title="a browsing context is discarded">Discard</a> the <var title="">specified
   browsing context</var>.</li>

  </ol><p>User agents should offer users the ability to arbitrarily <a href=#close-a-browsing-context title="close a browsing
  context">close</a> any <a href=#top-level-browsing-context>top-level browsing context</a>.</p>



  <h4 id=browser-interface-elements><span class=secno>6.2.7 </span>Browser interface elements</h4>

  <p>To allow Web pages to integrate with Web browsers, certain Web
  browser interface elements are exposed in a limited way to scripts
  in Web pages.</p>

  <p>Each interface element is represented by a <code><a href=#barprop>BarProp</a></code>
  object:</p>

  <pre class=idl>interface <dfn id=barprop>BarProp</dfn> {
           attribute boolean <a href=#dom-barprop-visible title=dom-BarProp-visible>visible</a>;
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-locationbar><a href=#dom-window-locationbar>locationbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
   <dd>
    <p>Returns true if the location bar is visible; otherwise, returns false.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-window-menubar><a href=#dom-window-menubar>menubar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
   <dd>
    <p>Returns true if the menu bar is visible; otherwise, returns false.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-window-personalbar><a href=#dom-window-personalbar>personalbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
   <!--<dt><var title="">window</var> . <code title="dom-window-directories">directories</code> . <code title="dom-BarProp-visible">visible</code></dt>-->
   <dd>
    <p>Returns true if the personal bar is visible; otherwise, returns false.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-window-scrollbars><a href=#dom-window-scrollbars>scrollbars</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
   <dd>
    <p>Returns true if the scroll bars are visible; otherwise, returns false.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-window-statusbar><a href=#dom-window-statusbar>statusbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
   <dd>
    <p>Returns true if the status bar is visible; otherwise, returns false.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-window-toolbar><a href=#dom-window-toolbar>toolbar</a></code> . <code title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code></dt>
   <dd>
    <p>Returns true if the toolbar is visible; otherwise, returns false.</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-barprop-visible title=dom-BarProp-visible>visible</dfn> attribute, on getting, must return either
  true or a value determined by the user agent to most accurately represent the visibility state of
  the user interface element that the object represents, as described below. On setting, the new
  value must be discarded.</p>

  <p>The following <code><a href=#barprop>BarProp</a></code> objects exist for each <code><a href=#document>Document</a></code> object in a
  <a href=#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 title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code> attribute must return true).</p>

  <dl><dt><dfn id=the-location-bar-barprop-object>The location bar <code>BarProp</code> object</dfn></dt>

   <dd>Represents the user interface element that contains a control that displays the
   <a href=#url>URL</a> of the <a href=#active-document>active document</a>, or some similar interface concept.</dd>

   <dt><dfn id=the-menu-bar-barprop-object>The menu bar <code>BarProp</code> object</dfn></dt>

   <dd>Represents the user interface element that contains a list of commands in menu form, or some
   similar interface concept.</dd>

   <dt><dfn id=the-personal-bar-barprop-object>The personal bar <code>BarProp</code> object</dfn></dt>

   <dd>Represents the user interface element that contains links to the user's favorite pages, or
   some similar interface concept.</dd>

   <dt><dfn id=the-scrollbar-barprop-object>The scrollbar <code>BarProp</code> object</dfn></dt>

   <dd>Represents the user interface element that contains a scrolling
   mechanism, or some similar interface concept.</dd>

   <dt><dfn id=the-status-bar-barprop-object>The status bar <code>BarProp</code> object</dfn></dt>

   <dd>Represents a user interface element found immediately below or after the document, as
   appropriate for the user's media. 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 title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code> attribute may return false).</dd>

   <dt><dfn id=the-toolbar-barprop-object>The toolbar <code>BarProp</code> object</dfn></dt>

   <dd>Represents the user interface element found immediately above or before the document, as
   appropriate for the user's media. 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 title=dom-BarProp-visible><a href=#dom-barprop-visible>visible</a></code> attribute may return false).</dd>

  </dl><p>The <dfn id=dom-window-locationbar title=dom-window-locationbar><code>locationbar</code></dfn> attribute must return
  <a href=#the-location-bar-barprop-object>the location bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn id=dom-window-menubar title=dom-window-menubar><code>menubar</code></dfn> attribute must return <a href=#the-menu-bar-barprop-object>the
  menu bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn id=dom-window-personalbar title=dom-window-personalbar><code>personalbar</code></dfn> attribute must return
  <a href=#the-personal-bar-barprop-object>the personal bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn id=dom-window-scrollbars title=dom-window-scrollbars><code>scrollbars</code></dfn> attribute must return
  <a href=#the-scrollbar-barprop-object>the scrollbar <code>BarProp</code> object</a>.</p>

  <p>The <dfn id=dom-window-statusbar title=dom-window-statusbar><code>statusbar</code></dfn> attribute must return
  <a href=#the-status-bar-barprop-object>the status bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn id=dom-window-toolbar title=dom-window-toolbar><code>toolbar</code></dfn> attribute must return <a href=#the-toolbar-barprop-object>the
  toolbar <code>BarProp</code> object</a>.</p>

<!--
  <p>For legacy reasons, the <dfn title="dom-window-directories"><code>directories</code></dfn>
  attribute must also return <span>the personal bar <code>BarProp</code> object</span>.</p>
-->

  <hr><p>For historical reasons, the <dfn id=dom-window-status title=dom-window-status><code>status</code></dfn> attribute
  on the <code><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><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>

  </div>


  <div class=impl>

  <h4 id=the-windowproxy-object><span class=secno>6.2.8 </span>The <code><a href=#windowproxy>WindowProxy</a></code> object</h4>


  <p>As mentioned earlier, each <a href=#browsing-context>browsing context</a> has a
  <dfn id=windowproxy><code>WindowProxy</code></dfn> object. This object is unusual in that all operations that
  would be performed on it must be performed on the <code><a href=#window>Window</a></code> object of the <a href=#browsing-context>browsing
  context</a>'s <a href=#active-document>active document</a> instead. It is thus indistinguishable from that
  <code><a href=#window>Window</a></code> object in every way until the <a href=#browsing-context>browsing context</a> is navigated.</p>

  <p>There is no <code><a href=#windowproxy>WindowProxy</a></code> interface object.</p>

  <p class=note>The <code><a href=#windowproxy>WindowProxy</a></code> object allows scripts to act as if each
  <a href=#browsing-context>browsing context</a> had a single <code><a href=#window>Window</a></code> object, while still keeping
  separate <code><a href=#window>Window</a></code> objects for each <code><a href=#document>Document</a></code>.</p>

  <div class=example>

   <p>In the following example, the variable <var title="">x</var> is set to the
   <code><a href=#windowproxy>WindowProxy</a></code> object returned by the <code title=dom-window><a href=#dom-window>window</a></code> accessor
   on the global object. All of the expressions following the assignment return true, because in
   every respect, the <code><a href=#windowproxy>WindowProxy</a></code> object acts like the underlying <code><a href=#window>Window</a></code>
   object.</p>

   <pre>var x = window;
x instanceof Window; // true
x === this; // true</pre>

  </div>

  </div>
<!--TOPIC:HTML-->



<!--TOPIC:Security-->
  <h3 id=origin-0><span class=secno>6.3 </span>Origin</h3>
  <!-- Hallowed are the Ori -->

  <p>Origins are the fundamental currency of the Web's security model. Two actors in the Web
  platform that share an origin are assumed to trust each other and to have the same authority.
  Actors with differing origins are considered potentially hostile versus each other, and are
  isolated from each other to varying degrees.</p>

  <p class=example>For example, if Example Bank's Web site, hosted at <code title="">bank.example.com</code>, tries to examine the DOM of Example Charity's Web site, hosted
  at <code title="">charity.example.org</code>, a <code><a href=#securityerror>SecurityError</a></code> exception will be
  raised.</p>

  <hr><p>The <dfn id=origin>origin</dfn> of a resource and the <dfn id=effective-script-origin>effective script origin</dfn> of a resource
  are both either opaque identifiers or tuples consisting of a scheme component, a host component, a
  port component, and optionally extra data.</p>

  <p class=note>The extra data could include the certificate of the
  site when using encrypted connections, to ensure that if the site's
  secure certificate changes, the origin is considered to change as
  well.</p>

  <div class=impl>

  <p>An <a href=#origin>origin</a> or <a href=#effective-script-origin>effective script origin</a> can be defined as an <dfn id=concept-origin-alias title=concept-origin-alias>alias</dfn> to another <a href=#origin>origin</a> or <a href=#effective-script-origin>effective script
  origin</a>. The value of the <a href=#origin>origin</a> or <a href=#effective-script-origin>effective script origin</a> is
  then the value of the <a href=#origin>origin</a> or <a href=#effective-script-origin>effective script origin</a> to which it is
  an alias.</p>

  <p>These characteristics are defined as follows:</p>

  <dl><dt>For URLs</dt>

   <dd>

    <p>The <a href=#origin>origin</a> and <a href=#effective-script-origin>effective script origin</a> of the <a href=#url>URL</a> are
    the origin defined in <cite>The Web Origin Concept</cite>. <a href=#refsORIGIN>[ORIGIN]</a></p>

   </dd>


   <dt>For <code><a href=#document>Document</a></code> objects</dt>

   <dd>

    <dl class=switch><dt id=sandboxOrigin>If a <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has
     its <a href=#sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</a> set</dt>

     <dd>

      <p>The <a href=#origin>origin</a> is a globally unique identifier assigned when the
      <code><a href=#document>Document</a></code> is created.</p>

      <p>The <a href=#effective-script-origin>effective script origin</a> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the
      <code><a href=#document>Document</a></code>.</p>

     </dd>


     <dt>If a <code><a href=#document>Document</a></code> was generated from a <a href=#javascript-protocol title="javascript protocol"><code>javascript:</code>
     URL</a></dt>

     <dd>

      <p>The <a href=#origin>origin</a> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the
      <a href=#origin>origin</a> of the script of that <a href=#javascript-protocol title="javascript
      protocol"><code>javascript:</code> URL</a>.</p>

      <p>The <a href=#effective-script-origin>effective script origin</a> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the
      <code><a href=#document>Document</a></code>.</p>

     </dd>


     <dt>If a <code><a href=#document>Document</a></code> was served over the network and has an address that uses a URL
     scheme with a server-based naming authority</dt>

     <dd>

      <p>The <a href=#origin>origin</a> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the
      <a href=#origin>origin</a> of <a href="#the-document's-address">the <code>Document</code>'s address</a>.</p>

      <p>The <a href=#effective-script-origin>effective script origin</a> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the
      <code><a href=#document>Document</a></code>.</p>

     </dd>


     <dt>If a <code><a href=#document>Document</a></code> was generated from a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a> found in another <code><a href=#document>Document</a></code> or in a script</dt>

     <dd>

      <p>The <a href=#origin>origin</a> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the
      <a href=#origin>origin</a> of the <a href=#incumbent-script>incumbent script</a> when the <a href=#navigate>navigate</a>
      algorithm was invoked, or, if no <a href=#concept-script title=concept-script>script</a> was involved, of
      the <code><a href=#document>Document</a></code> of the element that initiated the <a href=#navigate title=navigate>navigation</a> to that <a href=#url>URL</a>.</p>

      <p>The <a href=#effective-script-origin>effective script origin</a> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#effective-script-origin>effective script origin</a> of that
      same <a href=#concept-script title=concept-script>script</a> or <code><a href=#document>Document</a></code>.</p>

     </dd>


     <dt>If a <code><a href=#document>Document</a></code> has the <a href="#the-document's-address" title="the document's address">address</a>
     "<code><a href=#about:blank>about:blank</a></code>"</dt>

     <dd>

      <p>The <a href=#origin>origin</a> and <a href=#effective-script-origin>effective script origin</a> of the
      <code><a href=#document>Document</a></code> are <a href=#about-blank-origin>those it was assigned when its
      browsing context was created</a>.</p>

     </dd>


     <dt>If a <code><a href=#document>Document</a></code> is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a></dt>

     <dd>

      <p>The <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the
      <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-container>browsing context
      container</a>'s <code><a href=#document>Document</a></code>.</p>

      <p>The <a href=#effective-script-origin>effective script origin</a> is initially an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#effective-script-origin>effective script origin</a> of the
      <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-container>browsing context
      container</a>'s <code><a href=#document>Document</a></code>.</p>

     </dd>


     <dt>If a <code><a href=#document>Document</a></code> was obtained in some other manner (e.g. a <a href=#data-protocol title="data
     protocol"><code title="">data:</code> URL</a> typed in by the user or that was returned as
     the location of an HTTP redirect (<a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
     equivalent</a> in other protocols), a <code><a href=#document>Document</a></code> created using the <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> API, etc)</dt>

     <dd>

      <p>The default behavior as defined in the DOM standard applies. <a href=#refsDOM>[DOM]</a>.</p>

      <p class=note>The <a href=#origin>origin</a> is a globally unique identifier assigned when the
      <code><a href=#document>Document</a></code> is created, and the <a href=#effective-script-origin>effective script origin</a> is initially an
      <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the
      <code><a href=#document>Document</a></code>.</p>

     </dd>

    </dl><p class=note>The <a href=#effective-script-origin>effective script origin</a> of a <code><a href=#document>Document</a></code> can be
    manipulated using the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> IDL
    attribute.</p>

   </dd>


   <dt>For images</dt>

   <dd>

    <dl class=switch><dt>If an image is the image of an <code><a href=#the-img-element>img</a></code> element and its image data is
     <a href=#cors-cross-origin>CORS-cross-origin</a></dt>

     <dd>The <a href=#origin>origin</a> is a globally unique identifier assigned when the image is
     created.</dd>


     <dt>If an image is the image of an <code><a href=#the-img-element>img</a></code> element and its image data is
     <a href=#cors-same-origin>CORS-same-origin</a></dt>

     <dd>The <a href=#origin>origin</a> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the
     <a href=#origin>origin</a> of the <code><a href=#the-img-element>img</a></code> element's <code><a href=#document>Document</a></code>.</dd>

     <!-- all image loads go through the "potentially CORS-enabled fetch" algorithm so they're all
     either CORS-cross-origin or CORS-same-origin if they succeed at all -->

    </dl><p>Images do not have an <a href=#effective-script-origin>effective script origin</a>.</p>

   </dd>


   <dt>For <code><a href=#the-audio-element>audio</a></code> and <code><a href=#the-video-element>video</a></code> elements</dt>

   <dd>

    <dl class=switch><dt>If the <a href=#media-data>media data</a> is <a href=#cors-cross-origin>CORS-cross-origin</a></dt>

     <dd>The <a href=#origin>origin</a> is a globally unique identifier assigned when the <a href=#media-data>media
     data</a> is <a href=#fetch title=fetch>fetched</a>.</dd>


     <dt>If the <a href=#media-data>media data</a> is <a href=#cors-same-origin>CORS-same-origin</a></dt>

     <dd>The <a href=#origin>origin</a> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the
     <a href=#origin>origin</a> of the <a href=#media-element>media element</a>'s <code><a href=#document>Document</a></code>.</dd>

    </dl><p><a href=#media-element title="media element">Media elements</a> do not have an <a href=#effective-script-origin>effective script
    origin</a>.</p>

   </dd>


   <dt>For fonts</dt>

   <dd>
<!--CLEANUP-->

    <p>The <a href=#origin>origin</a> of a downloadable Web font is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the
    <a href=#origin>origin</a> of the <a href=#absolute-url>absolute URL</a> used to
    obtain the font (after any redirects). <a href=#refsCSSFONTS>[CSSFONTS]</a> <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p> <!-- this means you can
    get data from a remote site if you can make it redirect to your
    own site in some fashion controlled by the data you want to read
    -->

    <p>The <a href=#origin>origin</a> of a locally installed system font is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the
    <code><a href=#document>Document</a></code> in which that font is being used.</p>

    <p>Fonts do not have an <a href=#effective-script-origin>effective script origin</a>.</p>

   </dd>


   <dt>For scripts</dt>

   <dd>

    <p>The <a href=#origin>origin</a> and <a href=#effective-script-origin>effective script origin</a> of a script are determined
    from another resource, called the <i>owner</i>:</p>

    <dl class=switch><dt>If a script is in a <code><a href=#the-script-element>script</a></code> element</dt>

     <dd>The owner is the <code><a href=#document>Document</a></code> to which the <code><a href=#the-script-element>script</a></code> element
     belongs.</dd>


     <dt>If a script is in an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
     attribute</a></dt>

     <dd>The owner is the <code><a href=#document>Document</a></code> to which the attribute node belongs.</dd>


     <dt>If a script is a function or other code reference created by another script</dt>

     <dd>The owner is the <a href=#incumbent-script>incumbent script</a> when the function or other code reference
     was created.</dd>


     <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
     URL</a> that was returned as the location of an HTTP redirect (<a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a> in other protocols)</dt>

     <dd>The owner is the <a href=#url>URL</a> that redirected to the <a href=#javascript-protocol title="javascript
     protocol"><code title="">javascript:</code> URL</a>.</dd>


     <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
     URL</a> in an attribute</dt>

     <dd>The owner is the <code><a href=#document>Document</a></code> of the element on which the attribute is found.</dd>


     <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
     URL</a> in a style sheet</dt>

     <dd>The owner is the <a href=#url>URL</a> of the style sheet.</dd>


     <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
     URL</a> to which a <a href=#browsing-context>browsing context</a> is being <a href=#navigate title=navigate>navigated</a>, the URL having been provided by the user (e.g. by using a
     <i>bookmarklet</i>)</dt>

     <dd>The owner is the <code><a href=#document>Document</a></code> of the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active
     document</a>.</dd>


     <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
     URL</a> to which a <a href=#browsing-context>browsing context</a> is being <a href=#navigate title=navigate>navigated</a>, the URL having been declared in markup</dt>

     <dd>The owner is the <code><a href=#document>Document</a></code> of the element (e.g. an <code><a href=#the-a-element>a</a></code> or
     <code><a href=#the-area-element>area</a></code> element) that declared the URL.</dd>


     <dt>If a script is a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code>
     URL</a> to which a <a href=#browsing-context>browsing context</a> is being <a href=#navigate title=navigate>navigated</a>, the URL having been provided by script</dt>

     <dd>The owner is the <a href=#incumbent-script>incumbent script</a> when the <a href=#navigate>navigate</a> algorithm was
     invoked.</dd>

    </dl><p>The <a href=#origin>origin</a> of the script is then an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#origin>origin</a> of the owner, and the
    <a href=#effective-script-origin>effective script origin</a> of the script is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a> to the <a href=#effective-script-origin>effective script origin</a> of the
    owner.</p>

   </dd>

  </dl><p>Other specifications can override the above definitions by themselves specifying the origin of
  a particular <a href=#url>URL</a>, <code><a href=#document>Document</a></code>, image, <a href=#media-element>media element</a>, font, or
  <a href=#concept-script title=concept-script>script</a>.</p>

  <!-- e.g.:

    <p>The <span>origin</span> of a <code>Document</code> object returned by the
    <code>XMLHttpRequest</code> API is an <span title="concept-origin-alias">alias</span> to the
    <span>XMLHttpRequest origin</span> of the <code>XMLHttpRequest</code> object.</p>

  -->

  <hr><p>The <dfn id=unicode-serialization-of-an-origin>Unicode serialization of an origin</dfn> is the string obtained by applying the
  following algorithm to the given <a href=#origin>origin</a>:</p>

  <ol><li><p>If the <a href=#origin>origin</a> in question is not a scheme/host/port tuple, then return the
   literal string "<code title="">null</code>" and abort these steps.</li>

   <li><p>Otherwise, let <var title="">result</var> be the scheme part of the <a href=#origin>origin</a>
   tuple.</li>

   <li><p>Append the string "<code title="">://</code>" to <var title="">result</var>.</li>

   <li><p>Apply the IDNA ToUnicode algorithm to each component of the host part of the
   <a href=#origin>origin</a> tuple, and append the results &mdash; each component, in the same order,
   separated by U+002E FULL STOP characters (.) &mdash; to <var title="">result</var>. <a href=#refsRFC3490>[RFC3490]</a></li>

   <li><p>If the port part of the <a href=#origin>origin</a> tuple gives a port that is different from the
   default port for the protocol given by the scheme part of the <a href=#origin>origin</a> tuple, then
   append a U+003A COLON character (:) and the given port, in base ten, to <var title="">result</var>.</li>

   <li><p>Return <var title="">result</var>.</li>

  </ol><p>The <dfn id=ascii-serialization-of-an-origin>ASCII serialization of an origin</dfn> is the string obtained by applying the
  following algorithm to the given <a href=#origin>origin</a>:</p>

  <ol><li><p>If the <a href=#origin>origin</a> in question is not a scheme/host/port tuple, then return the
   literal string "<code title="">null</code>" and abort these steps.</li>

   <li><p>Otherwise, let <var title="">result</var> be the scheme part of the <a href=#origin>origin</a>
   tuple.</li>

   <li><p>Append the string "<code title="">://</code>" to <var title="">result</var>.</li>

   <li>

    <p>Apply the IDNA ToASCII algorithm to the host part of the <a href=#origin>origin</a> tuple, with both
    the AllowUnassigned and UseSTD3ASCIIRules flags set, and append the results to <var title="">result</var>.</p>

    <p>If ToASCII fails to convert one of the components of the string, e.g. because it is too long
    or because it contains invalid characters, then return the empty string and abort these steps.
    <a href=#refsRFC3490>[RFC3490]</a></p>

   </li>

   <li><p>If the port part of the <a href=#origin>origin</a> tuple gives a port that is different from the
   default port for the protocol given by the scheme part of the <a href=#origin>origin</a> tuple, then
   append a U+003A COLON character (:) and the given port, in base ten, to <var title="">result</var>.</li>

   <li><p>Return <var title="">result</var>.</li>

  </ol><p>Two <a href=#origin title=origin>origins</a> are said to be the <dfn id=same-origin>same origin</dfn> if the
  following algorithm returns true:</p>

  <ol><li><p>Let <var title="">A</var> be the first <a href=#origin>origin</a> being compared, and <var title="">B</var> be the second <a href=#origin>origin</a> being compared.</li>

   <li><p>If <var title="">A</var> and <var title="">B</var> are both opaque identifiers, and their
   value is equal, then return true.</li>

   <li><p>Otherwise, if either <var title="">A</var> or <var title="">B</var> or both are opaque
   identifiers, return false.</li>

   <li><p>If <var title="">A</var> and <var title="">B</var> have scheme components that are not
   identical, return false.</li>

   <li><p>If <var title="">A</var> and <var title="">B</var> have host components that are not
   identical, return false.</li>

   <li><p>If <var title="">A</var> and <var title="">B</var> have port components that are not
   identical, return false.</li>

   <li><p>If either <var title="">A</var> or <var title="">B</var> have additional data, but that
   data is not identical for both, return false.</li>

   <li><p>Return true.</li>

  </ol></div>


  <h4 id=relaxing-the-same-origin-restriction><span class=secno>6.3.1 </span>Relaxing the same-origin restriction</h4>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-domain><a href=#dom-document-domain>domain</a></code> [ = <var title="">domain</var> ]</dt>

   <dd>

    <p>Returns the current domain used for security checks.</p>

    <p>Can be set to a value that removes subdomains, to change the <a href=#effective-script-origin>effective script
    origin</a> to allow pages on other subdomains of the same domain (if they do the same thing)
    to access each other.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-domain title=dom-document-domain><code>domain</code></dfn> attribute on
  <code><a href=#document>Document</a></code> objects must be initialized to <a href="#the-document's-domain">the document's domain</a>, if it has
  one, and the empty string otherwise. If <a href="#the-document's-domain">the document's domain</a> starts with a U+005B
  LEFT SQUARE BRACKET character ([) and ends with a U+005D RIGHT SQUARE BRACKET character (]), it is
  an IPv6 address; these square brackets must be omitted when initializing the attribute's
  value.</p>

  <p>On getting, the attribute must return its current value, unless the <code><a href=#document>Document</a></code> has
  no <a href=#browsing-context>browsing context</a>, in which case it must return the empty string.</p>

  <p>On setting, the user agent must run the following algorithm:</p>

  <ol><li>

    <p>If the <code><a href=#document>Document</a></code> has no <a href=#browsing-context>browsing context</a>, throw a
    <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>

   </li>

   <li>
<!--CLEANUP-->

    <p>If the new value is an IPv4 or IPv6 address, let <var title="">new value</var> be the new value.
    Otherwise, apply the IDNA ToASCII algorithm to the new value, with both the AllowUnassigned and
    UseSTD3ASCIIRules flags set, and let <var title="">new value</var> be the result of the ToASCII
    algorithm.</p>

    <p>If ToASCII fails to convert one of the components of the string, e.g. because it is too long
    or because it contains invalid characters, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and
    abort these steps. <a href=#refsRFC3490>[RFC3490]</a></p>

   </li>

   <li>

    <p>If <var title="">new value</var> is not exactly equal to the current value of the <code title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute, then run these substeps:</p>

    <ol><li>

      <p>If the current value is an IPv4 or IPv6 address, throw a <code><a href=#securityerror>SecurityError</a></code>
      exception and abort these steps.</p>

     </li>

     <li>

      <p>If <var title="">new value</var>, prefixed by a U+002E FULL STOP (.), does not exactly
      match the end of the current value, throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort
      these steps.</p>

      <p class=note>If the <var title="">new value</var> is an IPv4 or IPv6 address, it cannot
      match the <var title="">new value</var> in this way and thus an exception will be thrown
      here.</p>

      <!-- this is the step that prevents us from ever setting document.domain if the >effective
      script origin< isn't a scheme/host/port tuple -->

     </li>

     <li>

      <p>If <var title="">new value</var> matches a suffix in the Public Suffix List, or, if <var title="">new value</var>, prefixed by a U+002E FULL STOP (.), matches the end of a suffix in
      the Public Suffix List, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these
      steps. <a href=#refsPSL>[PSL]</a></p>

      <p>Suffixes must be compared after applying the IDNA ToASCII algorithm to them, with both the
      AllowUnassigned and UseSTD3ASCIIRules flags set, in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
      manner. <a href=#refsRFC3490>[RFC3490]</a></p>

     </li>

    </ol></li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <li>

    <p>Set the attribute's value to <var title="">new value</var>.</p>

   </li>

   <li>

    <p>If the <a href=#effective-script-origin>effective script origin</a> of the <code><a href=#document>Document</a></code> is an <a href=#concept-origin-alias title=concept-origin-alias>alias</a>, set it to the value of the <a href=#effective-script-origin>effective script
    origin</a> (essentially de-aliasing the <a href=#effective-script-origin>effective script origin</a>).</p>

   </li>

   <li>

    <p>If <var title="">new value</var> is not the empty string, then run these substeps:</p>

    <ol><li>

      <p>Set the host part of the <a href=#effective-script-origin>effective script origin</a> tuple of the
      <code><a href=#document>Document</a></code> to <var title="">new value</var>.</p>

     </li>

     <li>

      <p>Set the port part of the <a href=#effective-script-origin>effective script origin</a> tuple of the
      <code><a href=#document>Document</a></code> to "manual override" (a value that, for the purposes of <a href=#same-origin title="same origin">comparing origins</a>, is identical to "manual override" but not
      identical to any other value).</p>

     </li>

    </ol></li>

  </ol><p>The <dfn id="the-document's-domain" title="the document's domain">domain</dfn> of a <code><a href=#document>Document</a></code> is the host part
  of the document's <a href=#origin>origin</a>, if the value of that <a href=#origin>origin</a> is a
  scheme/host/port tuple. If it isn't, then the document does not have a domain.</p>

  </div>

  <p class=note>The <code title=dom-document-domain><a href=#dom-document-domain>domain</a></code> attribute is used to enable
  pages on different hosts of a domain to access each others' DOMs.</p>

  <p class=warning>Do not use the <code title=dom-document-domain><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 title=dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute has been
  used.</p>



<!--TOPIC:HTML-->

  <h3 id=sandboxing><span class=secno>6.4 </span>Sandboxing</h3>

  <p>A <dfn id=sandboxing-flag-set>sandboxing flag set</dfn> is a set of zero or more of the following flags, which are
  used to restrict the abilities that potentially untrusted resources have:</p>

  <dl><dt>The <dfn id=sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</dfn></dt>

   <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 title="auxiliary browsing context">auxiliary browsing contexts</a> (which are protected
    by the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> defined next), and the
    <a href=#top-level-browsing-context>top-level browsing context</a> (which is protected by the <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level
    navigation browsing context flag</a> defined below).</p>

    <p>If the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>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 title="top-level browsing
    context">top-level browsing contexts</a>) to be opened. These <a href=#browsing-context title="browsing
    context">browsing contexts</a> always have <dfn id=one-permitted-sandboxed-navigator>one permitted sandboxed navigator</dfn>, set
    when the browsing context is created, which allows the <a href=#browsing-context>browsing context</a> that
    created them to actually navigate them. (Otherwise, the <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing
    context flag</a> would prevent them from being navigated even if they were opened.)</p>

   </dd>


   <dt>The <dfn id=sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</dfn></dt>

   <dd>

    <p>This flag <a href=#sandboxWindowOpen>prevents content from creating new auxiliary browsing
    contexts</a>, e.g. using the <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, the
    <code title=dom-open><a href=#dom-open>window.open()</a></code> method, or the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>

   </dd>


   <dt>The <dfn id=sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</dfn></dt>

   <dd>

    <p>This flag <a href=#sandboxLinks>prevents content from navigating their <span>top-level
    browsing context</span></a> and <a href=#sandboxClose>prevents content from closing their
    <span>top-level browsing context</span></a>.</p>

    <p>When the <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> is <em>not</em>
    set, content can navigate its <a href=#top-level-browsing-context>top-level browsing context</a>, but other <a href=#browsing-context title="browsing context">browsing contexts</a> are still protected by the <a href=#sandboxed-navigation-browsing-context-flag>sandboxed
    navigation browsing context flag</a> and possibly the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation
    browsing context flag</a>.</p>

   </dd>


   <dt>The <dfn id=sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</dfn></dt>

   <dd>

    <p>This flag prevents content from instantiating <a href=#plugin title=plugin>plugins</a>, whether
    using <a href=#sandboxPluginEmbed>the <code>embed</code> element</a>, <a href=#sandboxPluginObject>the <code>object</code> element</a>, <a href=#sandboxPluginApplet>the <code>applet</code> element</a>, or through <a href=#sandboxPluginNavigate>navigation</a> of a <a href=#nested-browsing-context>nested browsing context</a>, unless
    those <a href=#plugin title=plugin>plugins</a> can be <a href=#concept-plugin-secure title=concept-plugin-secure>secured</a>.</p>

   </dd>


   <dt>The <dfn id=sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</dfn></dt>

   <dd>

    <p>This flag prevents content from using the <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>
    attribute on descendant <code><a href=#the-iframe-element>iframe</a></code> elements.</p>

    <p class=note>This prevents a page inserted using the <code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> keyword from using a
    CSS-selector-based method of probing the DOM of other pages on the same site (in particular,
    pages that contain user-sensitive information).</p>

    <!-- http://lists.w3.org/Archives/Public/public-web-security/2009Dec/thread.html#msg51 -->

   </dd>


   <dt>The <dfn id=sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</dfn></dt>

   <dd>

    <p>This flag <a href=#sandboxOrigin>forces content into a unique origin</a>, thus preventing
    it from accessing other content from the same <a href=#origin>origin</a>.</p>

    <p>This flag also <a href=#sandboxCookies>prevents script from reading from or writing to the
    <code title=dom-document-cookie>document.cookie</code> IDL attribute</a>, and blocks access to
    <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code>.
    </p>

   </dd>


   <dt>The <dfn id=sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</dfn></dt>

   <dd>

    <p>This flag <a href=#sandboxSubmitBlocked>blocks form submission</a>.</p>

   </dd>


   <dt>The <dfn id=sandboxed-pointer-lock-browsing-context-flag>sandboxed pointer lock browsing context flag</dfn></dt>

   <dd>

    <p>This flag disables the Pointer Lock API. <a href=#refsPOINTERLOCK>[POINTERLOCK]</a></p>

   </dd>


   <dt>The <dfn id=sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</dfn></dt>

   <dd>

    <p>This flag <a href=#sandboxScriptBlocked>blocks script execution</a>.</p>

   </dd>


   <dt>The <dfn id=sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context
   flag</dfn></dt>

   <dd>

    <p>This flag blocks features that trigger automatically, such as <a href=#attr-media-autoplay title=attr-media-autoplay>automatically playing a video</a> or <a href=#attr-fe-autofocus title=attr-fe-autofocus>automatically focusing a form control</a>.</p>

   </dd>


   <dt>The <dfn id=sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context flag</dfn></dt>

   <dd>

    <p>This flag prevents content from using the <code title=dom-element-requestFullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code> method.</p>

   </dd>

  </dl><p>When the user agent is to <dfn id=parse-a-sandboxing-directive>parse a sandboxing directive</dfn>, given a string <var title="">input</var>, a <a href=#sandboxing-flag-set>sandboxing flag set</a> <var title="">output</var>, and
  optionally an <var title="">allow fullscreen flag</var>, it must run the following steps:</p>

  <ol><li><p><a href=#split-a-string-on-spaces title="split a string on spaces">Split <var title="">input</var> on spaces</a>, to obtain <var title="">tokens</var>.</li>

   <li><p>Let <var title="">output</var> be empty.</li>

   <li>

    <p>Add the following flags to <var title="">output</var>:</p>

    <ul><li><p>The <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a>.</li>

     <li><p>The <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a>, unless <var title="">tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-popups title=attr-iframe-sandbox-allow-popups><code>allow-popups</code></dfn> keyword.</li>

     <li><p>The <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a>, unless <var title="">tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-top-navigation title=attr-iframe-sandbox-allow-top-navigation><code>allow-top-navigation</code></dfn>
     keyword.</li>

     <li><p>The <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a>.</li>

     <li><p>The <a href=#sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</a>.</li>

     <li>

      <p>The <a href=#sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</a>, unless the <var title="">tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-same-origin title=attr-iframe-sandbox-allow-same-origin><code>allow-same-origin</code></dfn>
      keyword.</p>

      <div class=note>

       <p>The <code title=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>

     <li><p>The <a href=#sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a>, unless <var title="">tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-forms title=attr-iframe-sandbox-allow-forms><code>allow-forms</code></dfn> keyword.</li>

     <li><p>The <a href=#sandboxed-pointer-lock-browsing-context-flag>sandboxed pointer lock browsing context flag</a>, unless <var title="">tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-pointer-lock title=attr-iframe-sandbox-allow-pointer-lock><code>allow-pointer-lock</code></dfn>
     keyword.</li>

     <li><p>The <a href=#sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</a>, unless <var title="">tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-scripts title=attr-iframe-sandbox-allow-scripts><code>allow-scripts</code></dfn> keyword.</li>

     <li>

      <p>The <a href=#sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a>, unless <var title="">tokens</var> contains the <code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> keyword (defined above).</p>

      <p class=note>This flag is relaxed by the same keyword as scripts, because when scripts are
      enabled these features are trivially possible anyway, and it would be unfortunate to force
      authors to use script to do them when sandboxed rather than allowing them to use the
      declarative features.</p>

     </li>

     <li><p>The <a href=#sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context flag</a>, unless the <var title="">allow fullscreen flag</var> was passed to the <a href=#parse-a-sandboxing-directive>parse a sandboxing
     directive</a> flag.</li>

    </ul></li>

  </ol><hr><p>Every <a href=#top-level-browsing-context>top-level browsing context</a> has a <dfn id=popup-sandboxing-flag-set>popup
  sandboxing flag set</dfn>, which is a <a href=#sandboxing-flag-set>sandboxing flag
  set</a>. When a <a href=#browsing-context>browsing context</a> is created, its
  <a href=#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>the rules for choosing a browsing context given a
  browsing context name</a>.</p>

  <p>Every <a href=#nested-browsing-context>nested browsing context</a> has an
  <dfn id=iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag set</dfn>, which is a
  <a href=#sandboxing-flag-set>sandboxing flag set</a>. Which flags in a <a href=#nested-browsing-context>nested
  browsing context</a>'s <a href=#iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag
  set</a> are set at any particular time is determined by the
  <code><a href=#the-iframe-element>iframe</a></code> element's <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>

  <p>Every <code><a href=#document>Document</a></code> has an <dfn id=active-sandboxing-flag-set>active sandboxing flag
  set</dfn>, which is a <a href=#sandboxing-flag-set>sandboxing flag set</a>. When the
  <code><a href=#document>Document</a></code> is created, its <a href=#active-sandboxing-flag-set>active sandboxing flag
  set</a> must be empty. It is populated by the <a href=#navigate title=navigate>navigation algorithm</a>.</p>

  <p>Every resource that is obtained by the <a href=#navigate title=navigate>navigation algorithm</a> has a <dfn id=forced-sandboxing-flag-set>forced
  sandboxing flag set</dfn>, which is a <a href=#sandboxing-flag-set>sandboxing flag
  set</a>. A resource by default has no flags set in its
  <a href=#forced-sandboxing-flag-set>forced sandboxing flag set</a>, but other
  specifications can define that certain flags are set.</p>

  <p class=note>In particular, the <a href=#forced-sandboxing-flag-set>forced sandboxing flag
  set</a> is used by the Content Security Policy specification.
  <a href=#refsCSP>[CSP]</a></p>

  <hr><p>When a user agent is to <dfn id=implement-the-sandboxing>implement the sandboxing</dfn> for a <code><a href=#document>Document</a></code>, it
  must populate <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> with the union of
  the flags that are present in the following <a href=#sandboxing-flag-set title="sandboxing flag set">sandboxing flag
  sets</a> at the time the <code><a href=#document>Document</a></code> object is created:</p>

  <ul><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is a <a href=#top-level-browsing-context>top-level browsing
   context</a>, then: the flags set on the <a href=#browsing-context>browsing context</a>'s <a href=#popup-sandboxing-flag-set>popup sandboxing
   flag set</a>.</li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is a <a href=#nested-browsing-context>nested browsing
   context</a>, then: the flags set on the <a href=#browsing-context>browsing context</a>'s
   <a href=#iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag set</a>.</li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is a <a href=#nested-browsing-context>nested browsing
   context</a>, then: the flags set on the <a href=#browsing-context>browsing context</a>'s <a href=#parent-browsing-context>parent browsing
   context</a>'s <a href=#active-document>active document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a>.</li>

   <li><p>The flags set on the <code><a href=#document>Document</a></code>'s resource's <a href=#forced-sandboxing-flag-set>forced sandboxing flag
   set</a>, if it has one.</li>

  </ul><h3 id=history><span class=secno>6.5 </span>Session history and navigation</h3>

  <h4 id=the-session-history-of-browsing-contexts><span class=secno>6.5.1 </span>The session history of browsing contexts</h4>

  <p>The sequence of <code><a href=#document>Document</a></code>s in a <a href=#browsing-context>browsing
  context</a> is its <dfn id=session-history>session history</dfn>.</p>

  <p><code><a href=#history-0>History</a></code> objects provide a representation of the
  pages in the session history of <a href=#browsing-context title="browsing
  context">browsing contexts</a>. Each <a href=#browsing-context>browsing
  context</a>, including <a href=#nested-browsing-context title="nested browsing
  context">nested browsing contexts</a>, has a distinct session
  history.</p>

  <p>Each <code><a href=#document>Document</a></code> object in a <a href=#browsing-context>browsing
  context</a>'s <a href=#session-history>session history</a> is associated with a
  unique instance of the <code><a href=#history-0>History</a></code> object, although they
  all must model the same underlying <a href=#session-history>session history</a>.</p>

  <div class=impl>

  <p>The <dfn id=dom-history title=dom-history><code>history</code></dfn> attribute
  of the <code><a href=#window>Window</a></code> interface must return the object
  implementing the <code><a href=#history-0>History</a></code> interface for that
  <a href=#concept-document-window title=concept-document-window><code>Window</code> object's newest <code>Document</code></a>.</p>

  </div>

  <p><code><a href=#history-0>History</a></code> objects represent their <a href=#browsing-context>browsing
  context</a>'s session history as a flat list of <a href=#session-history-entry title="session history entry">session history entries</a>. Each
  <dfn id=session-history-entry>session history entry</dfn> consists of a <a href=#url>URL</a> and
  optionally a <a href=#state-object>state object</a><span class=impl>, and may
  in addition have a title, a <code><a href=#document>Document</a></code> object, form data,
  a scroll position, and other information associated with
  it</span>.</p>

  <div class=impl>

  <p class=note>This does not imply that the user interface need be
  linear. See the <a href=#history-notes>notes below</a>.</p>

  </div>

  <p class=note>Titles associated with <a href=#session-history-entry title="session history
  entry">session history entries</a> need not have any relation
  with the current <code><a href=#the-title-element>title</a></code> of the
  <code><a href=#document>Document</a></code>. The title of a <a href=#session-history-entry>session history
  entry</a> is intended to explain the state of the document at
  that point, so that the user can navigate the document's
  history.</p>

  <p>URLs without associated <a href=#state-object title="state object">state
  objects</a> are added to the session history as the user (or
  script) navigates from page to page.</p>

  <p>A <dfn id=state-object>state object</dfn> is an object representing a user
  interface state.</p>

  <p>Pages can <a href=#dom-history-pushstate title=dom-history-pushState>add</a> <a href=#state-object title="state object">state
  objects</a> to the session history. These are then <a href=#event-popstate title=event-popstate>returned to the
  script</a> when the user (or script) goes back in the history, thus enabling authors to use the
  "navigation" metaphor even in one-page applications.</p>

  <div class=note>

   <p><a href=#state-object title="state object">State objects</a> are intended to
   be used for two main purposes: first, storing a preparsed
   description of the state in the <a href=#url>URL</a> so that in the
   simple case an author doesn't have to do the parsing (though one
   would still need the parsing for handling <a href=#url title=URL>URLs</a> passed around by users, so it's only a minor
   optimization), and second, so that the author can store state that
   one wouldn't store in the URL because it only applies to the current
   <code><a href=#document>Document</a></code> instance and it would have to be reconstructed
   if a new <code><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><a href=#the-div-element>div</a></code> was made
   to animate, so that if the user goes back, it can be made to animate
   to the same location. Or alternatively, it could be used to keep a
   pointer into a cache of data that would be fetched from the server
   based on the information in the <a href=#url>URL</a>, so that when going
   back and forward, the information doesn't have to be fetched
   again.</p>

  </div>

  <hr><p>At any point, one of the entries in the session history is the
  <dfn id=current-entry>current entry</dfn>. This is the entry representing the
  <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>.
  Which entry is the <a href=#current-entry>current entry</a> is changed by the
  algorithms defined in this specification, e.g. during <a href=#traverse-the-history title="traverse the history">session history traversal</a>.</p>

  <p class=note>The <a href=#current-entry>current entry</a> is usually an entry
  for the <a href="#the-document's-address" title="the document's address">address</a> of the
  <code><a href=#document>Document</a></code>. However, it can also be one of the entries
  for <a href=#state-object title="state object">state objects</a> added to the
  history by that document.</p>

  <p><dfn id=an-entry-with-persisted-user-state>An entry with persisted user state</dfn> is one that also
  has user-agent defined state. This specification does not specify
  what kind of state can be stored.</p>
  
  <p class=example>For example, some user agents might want to
  persist the scroll position, or the values of form controls.</p>

  <p class=note>User agents that persist the value of form controls
  are encouraged to also persist their directionality (the value of
  the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute). This
  prevents values from being displayed incorrectly after a history
  traversal when the user had originally entered the values with an
  explicit, non-default directionality.</p>

  <p>Entries that consist of <a href=#state-object title="state object">state
  objects</a> share the same <code><a href=#document>Document</a></code> as the entry for
  the page that was active when they were added.</p>

  <p>Contiguous entries that differ just by fragment identifier also
  share the same <code><a href=#document>Document</a></code>.</p>

  <p class=note>All entries that share the same
  <code><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><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a> can
  also have a <dfn id=latest-entry>latest entry</dfn>. This is the entry or that
  <code><a href=#document>Document</a></code> that was most the recently traversed to. When
  a <code><a href=#document>Document</a></code> is created, it initially has no <a href=#latest-entry>latest
  entry</a>.</p>

  <div class=impl>

  <p>User agents may <a href=#discard-a-document title="discard a Document">discard</a>
  the <code><a href=#document>Document</a></code> objects of entries other than the
  <a href=#current-entry>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><a href=#document>Document</a></code> objects and when they should
  cache them.</p>

  <p>Entries that have had their <code><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><a href=#document>Document</a></code> object with it
  must share the new object as well.</p>

  </div>


<!--TOPIC:DOM APIs-->
  <h4 id=the-history-interface><span class=secno>6.5.2 </span>The <code><a href=#history-0>History</a></code> interface</h4>

  <pre class=idl>interface <dfn id=history-0>History</dfn> {
  readonly attribute long <a href=#dom-history-length title=dom-history-length>length</a>;
  readonly attribute any <a href=#dom-history-state title=dom-history-state>state</a>;
  void <a href=#dom-history-go title=dom-history-go>go</a>(optional long delta);
  void <a href=#dom-history-back title=dom-history-back>back</a>();
  void <a href=#dom-history-forward title=dom-history-forward>forward</a>();
  void <a href=#dom-history-pushstate title=dom-history-pushState>pushState</a>(any data, DOMString title, optional DOMString? url = null);
  void <a href=#dom-history-replacestate title=dom-history-replaceState>replaceState</a>(any data, DOMString title, optional DOMString? url = null);
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-length><a href=#dom-history-length>length</a></code></dt>

   <dd>

    <p>Returns the number of entries in the <a href=#joint-session-history>joint session history</a>.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-state><a href=#dom-history-state>state</a></code></dt>

   <dd>

    <p>Returns the current <a href=#state-object>state object</a>.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-go><a href=#dom-history-go>go</a></code>( [ <var title="">delta</var> ] )</dt>

   <dd>

    <p>Goes back or forward the specified number of steps in the <a href=#joint-session-history>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>

   </dd>

   <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-back><a href=#dom-history-back>back</a></code>()</dt>

   <dd>

    <p>Goes back one step in the <a href=#joint-session-history>joint session history</a>.</p>

    <p>If there is no previous page, does nothing.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-forward><a href=#dom-history-forward>forward</a></code>()</dt>

   <dd>

    <p>Goes forward one step in the <a href=#joint-session-history>joint session history</a>.</p>

    <p>If there is no next page, does nothing.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState</a></code>(<var title="">data</var>, <var title="">title</var> [, <var title="">url</var> ] )</dt>

   <dd>

    <p>Pushes the given data onto the session history, with the given title, and, if provided and not null, the given URL.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState</a></code>(<var title="">data</var>, <var title="">title</var> [, <var title="">url</var> ] )</dt>

   <dd>

    <p>Updates the current entry in the session history to have the given data, title, and, if provided and not null, URL.</p>

   </dd>

  </dl><!--TOPIC:HTML--><p>The <dfn id=joint-session-history>joint session history</dfn> of a <code><a href=#history-0>History</a></code> object is the union of all the
  <a href=#session-history title="session history">session histories</a> of all <a href=#browsing-context title="browsing
  context">browsing contexts</a> of all the <a href=#fully-active>fully active</a> <code><a href=#document>Document</a></code>
  objects that share the <code><a href=#history-0>History</a></code> object's <a href=#top-level-browsing-context>top-level browsing context</a>, with
  all the entries that are <a href=#current-entry title="current entry">current entries</a> in their respective
  <a href=#session-history title="session history">session histories</a> removed except for the <a href=#current-entry-of-the-joint-session-history>current entry
  of the joint session history</a>.</p>

  <p>The <dfn id=current-entry-of-the-joint-session-history>current entry of the joint session history</dfn> is the entry that most recently
  became a <a href=#current-entry>current entry</a> in its <a href=#session-history>session history</a>.</p>

  <p>Entries in the <a href=#joint-session-history>joint session history</a> are ordered chronologically by the time they
  were added to their respective <a href=#session-history title="session history">session histories</a>. (Since all
  these <a href=#browsing-context title="browsing context">browsing contexts</a> by definition share an <a href=#event-loop>event
  loop</a>, there is always a well-defined sequential order in which their <a href=#session-history title="session
  history">session histories</a> had their entries added.) 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>

<!--TOPIC:DOM APIs-->

  <div class=impl>

  <p>The <dfn id=dom-history-length title=dom-history-length><code>length</code></dfn> attribute of the
  <code><a href=#history-0>History</a></code> interface must return the number of entries in the <a href=#joint-session-history>joint session
  history</a>.</p>

  <p>The actual entries are not accessible from script.</p>

  <p>The <dfn id=dom-history-state title=dom-history-state><code>state</code></dfn> attribute of the
  <code><a href=#history-0>History</a></code> interface must return the last value it was set to by the user agent.
  Initially, its value must be null.</p>

  <p>When the <dfn id=dom-history-go title=dom-history-go><code>go(<var title="">delta</var>)</code></dfn> method is
  invoked, if the argument to the method was omitted or has the value zero, the user agent must act
  as if the <code title=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>traverse the history by a delta</a> whose value is the
  value of the method's argument.</p>

  <p>When the <dfn id=dom-history-back title=dom-history-back><code>back()</code></dfn> method is invoked, the user
  agent must <a href=#traverse-the-history-by-a-delta>traverse the history by a delta</a> &minus;1.</p>

  <p>When the <dfn id=dom-history-forward title=dom-history-forward><code>forward()</code></dfn>method is invoked, the
  user agent must <a href=#traverse-the-history-by-a-delta>traverse the history by a delta</a> +1.</p>

<!--TOPIC:HTML-->

  <p>To <dfn id=traverse-the-history-by-a-delta>traverse the history by a delta</dfn> <var title="">delta</var>, the user agent must
  <a href=#queue-a-task>queue a task</a> to run the following steps. The <a href=#task-source>task source</a> for the queued
  task is the <a href=#history-traversal-task-source>history traversal task source</a>.</p>

  <ol><li><p>Let <var title="">delta</var> be the argument to the method.</li>

   <li><p>If the index of the <a href=#current-entry-of-the-joint-session-history>current entry of the joint session history</a> plus <var title="">delta</var> is less than zero or greater than or equal to the number of items in the
   <a href=#joint-session-history>joint session history</a>, then abort these steps.</p>

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#unload-a-document>unload a document</a> algorithm is currently
   running, abort these steps.</li>

   <li><p>If there is an ongoing attempt to navigate the <a href=#browsing-context>browsing context</a> that has not
   yet <a href=#concept-navigate-mature title=concept-navigate-mature>matured</a> (i.e. it has not passed the point of
   making its <code><a href=#document>Document</a></code> the <a href=#active-document>active document</a>), then cancel that attempt to
   navigate the <a href=#browsing-context>browsing context</a>.</li>

   <li><p>Let <var title="">specified entry</var> be the entry in the <a href=#joint-session-history>joint session
   history</a> whose index is the sum of <var title="">delta</var> and the index of the
   <a href=#current-entry-of-the-joint-session-history>current entry of the joint session history</a>.</li>

   <li><p>Let <var title="">specified browsing context</var> be the <a href=#browsing-context>browsing context</a> of
   the <var title="">specified entry</var>.</li>

   <li>

    <p>If the <var title="">specified browsing context</var>'s <a href=#active-document>active document</a> is not
    the same <code><a href=#document>Document</a></code> as the <code><a href=#document>Document</a></code> of the <var title="">specified
    entry</var>, then run these substeps:</p>

    <ol><li><p><a href=#fully-exit-fullscreen>Fully exit fullscreen</a>.</li>

     <li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to unload</a> the <a href=#active-document>active
     document</a> of the <var title="">specified browsing context</var>. If the user
     <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then abort these steps.</li>

     <li><p><a href=#unload-a-document title="unload a document">Unload</a> the <a href=#active-document>active document</a> of the
     <var title="">specified browsing context</var> with the <var title="">recycle</var> parameter
     set to false.</li>

    </ol></li>

   <li><p><a href=#traverse-the-history>Traverse the history</a> of the <var title="">specified browsing context</var> to
   the <var title="">specified entry</var>.</p>

  </ol><p>When the user navigates through a <a href=#browsing-context>browsing context</a>, e.g. using a browser's back
  and forward buttons, the user agent must <a href=#traverse-the-history-by-a-delta>traverse the history by a delta</a> equivalent
  to the action specified by the user.</p>

  <hr><!--TOPIC:DOM APIs--><p>The <dfn id=dom-history-pushstate title=dom-history-pushState><code>pushState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method adds a state object entry to
  the history.</p>

  <p>The <dfn id=dom-history-replacestate title=dom-history-replaceState><code>replaceState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method updates the state object,
  title, and optionally the <a href=#url>URL</a> of the <a href=#current-entry>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 title="">cloned data</var> be a <a href=#structured-clone>structured clone</a> of the specified
   <var title="">data</var>. If this throws an exception, then rethrow that exception and abort
   these steps.</li>

   <li>

    <p>If the third argument is not null, run these substeps:</p>

    <ol><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the third argument, relative to the
     <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</li>

     <li>If that fails, throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>

     <li>Compare the resulting <a href=#parsed-url>parsed URL</a> to the result of applying the <a href=#url-parser>URL
     parser</a> algorithm to <a href="#the-document's-address">the document's address</a>. If any component of these two
     <a href=#url title=URL>URLs</a> differ other than the <a href=#concept-url-path title=concept-url-path>path</a>,
     <a href=#concept-url-query title=concept-url-query>query</a>, and <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> components, then throw a
     <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>

     <li>If the <a href=#origin>origin</a> of the resulting <a href=#absolute-url>absolute URL</a> is not the same as
     the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
     document">document</a>, and either the <a href=#concept-url-path title=concept-url-path>path</a> or <a href=#concept-url-query title=concept-url-query>query</a> components of the two <a href=#parsed-url title="parsed URL">parsed
     URLs</a> compared in the previous step differ, throw a <code><a href=#securityerror>SecurityError</a></code> exception
     and abort these steps. (This prevents sandboxed content from spoofing other pages on the same
     origin.)</li>

     <li><p>Let <var title="">new URL</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>

    </ol><p>For the purposes of the comparisons in the above substeps, the <a href=#concept-url-path title=concept-url-path>path</a> and <a href=#concept-url-query title=concept-url-query>query</a> components
    can only be the same if the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of both
    <a href=#parsed-url title="parsed URL">parsed URLs</a> are <a href=#concept-url-scheme-relative title=concept-url-scheme-relative>relative schemes</a>.</p>

   </li>

   <li>

    <p>If the third argument is null, then let <var title="">new URL</var> be the <a href=#url>URL</a>
    of the <a href=#current-entry>current entry</a>.</p>

   <li>

    <p>If the method invoked was the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code>
    method:</p>

    <ol><li>

      <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s <a href=#session-history>session history</a>
      after the <a href=#current-entry>current entry</a>. If the <a href=#current-entry>current entry</a> is the last entry in
      the session history, then no entries are removed.</p>

      <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
      agent's user interface.</p>

     </li>

     <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued by the <a href=#history-traversal-task-source>history traversal
     task source</a> that are associated with any <code><a href=#document>Document</a></code> objects in the
     <a href=#top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family>document family</a>.</li>

     <li><p>If appropriate, update the <a href=#current-entry>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>an entry with persisted user
     state</a>.</li>

     <li><p>Add a <a href=#state-object>state object</a> entry to the session history, after the <a href=#current-entry>current
     entry</a>, with <var title="">cloned data</var> as the <a href=#state-object>state object</a>, the given
     <var title="">title</var> as the title, and <var title="">new URL</var> as the <a href=#url>URL</a>
     of the entry.</li>

     <li><p>Update the <a href=#current-entry>current entry</a> to be this newly added entry.</li>

    </ol><p>Otherwise, if the method invoked was the <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState()</a></code> method:</p>

    <ol><li><p>Update the <a href=#current-entry>current entry</a> in the session history so that <var title="">cloned data</var> is the entry's new state object, the given <var title="">title</var>
     is the new title, and <var title="">new URL</var> is the entry's new <a href=#url>URL</a>.</li>

    </ol></li>

   <li><p>If the <a href=#current-entry>current entry</a> in the session history represents a non-GET request
   (e.g. it was the result of a POST submission) then update it to instead represent a GET request
   (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>).</li>

   <li>

    <p>Set <a href="#the-document's-address">the document's address</a> to <var title="">new URL</var>.</p>

    <p class=note>Since this is neither a <a href=#navigate title=navigate>navigation</a> of the
    <a href=#browsing-context>browsing context</a> nor a <a href=#traverse-the-history title="traverse the history">history traversal</a>,
    it does not cause a <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> event to be fired.</p>

   </li>

   <li>

    <p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a <a href=#structured-clone>structured clone</a>
    of <var title="">cloned data</var>.</p> <!-- it's a clone of /cloned data/, not /data/, so that
    there's no risk of running scripts again -->

   </li>

   <li>

    <p>Let the <a href=#latest-entry>latest entry</a> of the <code><a href=#document>Document</a></code> of the <a href=#current-entry>current
    entry</a> be the <a href=#current-entry>current entry</a>.</p>

   </li>

  </ol><p class=note>The <var title="">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><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>

  <div class=example>

   <p>Consider a game where the user can navigate along a line, such that the user is always at some
   coordinate, and such that the user can bookmark the page corresponding to a particular
   coordinate, to return to it later.</p>

   <p>A static page implementing the x=5 position in such a game could look like the following:</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;!-- this is http://example.com/line?x=5 --&gt;
&lt;title&gt;Line Game - 5&lt;/title&gt;
&lt;p&gt;You are at coordinate 5 on the line.&lt;/p&gt;
&lt;p&gt;
 &lt;a href="?x=6"&gt;Advance to 6&lt;/a&gt; or
 &lt;a href="?x=4"&gt;retreat to 4&lt;/a&gt;?
&lt;/p&gt;</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>&lt;!DOCTYPE HTML&gt;
&lt;!-- this starts off as http://example.com/line?x=5 --&gt;
&lt;title&gt;Line Game - 5&lt;/title&gt;
&lt;p&gt;You are at coordinate &lt;span id="coord"&gt;5&lt;/span&gt; on the line.&lt;/p&gt;
&lt;p&gt;
 &lt;a href="?x=6" onclick="go(1); return false;"&gt;Advance to 6&lt;/a&gt; or
 &lt;a href="?x=4" onclick="go(-1); return false;"&gt;retreat to 4&lt;/a&gt;?
&lt;/p&gt;
&lt;script&gt;
 var currentPage = 5; // prefilled by server
 function go(d) {
   setupPage(currentPage + d);
   history.pushState(currentPage, document.title, '?x=' + currentPage);
 }
 onpopstate = function(event) {
   setupPage(event.state);
 }
 function setupPage(page) {
   currentPage = page;
   document.title = 'Line Game - ' + currentPage;
   document.getElementById('coord').textContent = currentPage;
   document.links[0].href = '?x=' + (currentPage+1);
   document.links[0].textContent = 'Advance to ' + (currentPage+1);
   document.links[1].href = '?x=' + (currentPage-1);
   document.links[1].textContent = 'retreat to ' + (currentPage-1);
 }
&lt;/script&gt;</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&iuml;ve script-based approach, bookmarking and navigating the session history still work.</p>

   <p>In the example above, the <var title="">data</var> argument to the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> method is the same information as would be sent
   to the server, but in a more convenient form, so that the script doesn't have to parse the URL
   each time the user navigates.</p>

  </div>

  <div class=example>

   <p>Applications might not use the same title for a <a href=#session-history-entry>session history entry</a> as the
   value of the document's <code><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><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>&lt;!DOCTYPE HTML&gt;
&lt;TITLE&gt;Line&lt;/TITLE&gt;
&lt;SCRIPT&gt;
 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;
 }
&lt;/SCRIPT&gt;
&lt;BODY ONPOPSTATE="set(event.state)"&gt;
&lt;FORM NAME=F&gt;
State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BUTTON ONCLICK="inc()"&gt;
&lt;/FORM&gt;</pre>

  </div>



  <h4 id=the-location-interface><span class=secno>6.5.3 </span>The <code><a href=#location>Location</a></code> interface</h4>

  <p>Each <code><a href=#document>Document</a></code> object in a <a href=#browsing-context>browsing context</a>'s session history is
  associated with a unique instance of a <code><a href=#location>Location</a></code> object.</p>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-location><a href=#dom-document-location>location</a></code> [ = <var title="">value</var> ]</dt>
   <dt><var title="">window</var> . <code title=dom-location><a href=#dom-location>location</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns a <code><a href=#location>Location</a></code> object with the current page's location.</p>

    <p>Can be set, to navigate to another page.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-location title=dom-document-location><code>location</code></dfn> attribute of the
  <code><a href=#document>Document</a></code> interface must return the <code><a href=#location>Location</a></code> object for that
  <code><a href=#document>Document</a></code> object, if it is in a <a href=#browsing-context>browsing context</a>, and null otherwise.</p>

  <p>The <dfn id=dom-location title=dom-location><code>location</code></dfn> attribute of the <code><a href=#window>Window</a></code>
  interface must return the <code><a href=#location>Location</a></code> object for that <code><a href=#window>Window</a></code> object's
  <code><a href=#document>Document</a></code>.</p>

  </div>

  <p><code><a href=#location>Location</a></code> objects provide a representation of <a href="#the-document's-address" title="the document's
  address">the address</a> of the <a href=#active-document>active document</a> of their <code><a href=#document>Document</a></code>'s
  <a href=#browsing-context>browsing context</a>, and allow the <a href=#current-entry>current entry</a> of the <a href=#browsing-context>browsing
  context</a>'s session history to be changed, by adding or replacing entries in the <code title=dom-history><a href=#dom-history>history</a></code> object.</p>

  <pre class=idl>[Unforgeable] interface <dfn id=location>Location</dfn> {
  void <a href=#dom-location-assign title=dom-location-assign>assign</a>(DOMString url);
  void <a href=#dom-location-replace title=dom-location-replace>replace</a>(DOMString url);
  void <a href=#dom-location-reload title=dom-location-reload>reload</a>();
};
<a href=#location>Location</a> implements <a href=#urlutils>URLUtils</a>;</pre>

  <dl class=domintro><dt><var title="">location</var> . <code title=dom-location-assign><a href=#dom-location-assign>assign</a></code>(<var title="">url</var>)</dt>

   <dd>

    <p>Navigates to the given page.</p>

   </dd>

   <dt><var title="">location</var> . <code title=dom-location-replace><a href=#dom-location-replace>replace</a></code>(<var title="">url</var>)</dt>

   <dd>

    <p>Removes the current page from the session history and navigates to the given page.</p>

   </dd>

   <dt><var title="">location</var> . <code title=dom-location-reload><a href=#dom-location-reload>reload</a></code>()</dt>

   <dd>

    <p>Reloads the current page.</p>

   </dd>

  </dl><div class=impl>

  <p>The <i>relevant <code><a href=#document>Document</a></code></i> is the <code><a href=#location>Location</a></code> object's associated
  <code><a href=#document>Document</a></code> object's <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>.</p>

  <p>When the <dfn id=dom-location-assign title=dom-location-assign><code>assign(<var title="">url</var>)</code></dfn>
  method is invoked, the UA must <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative
  to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, and if that is
  successful, must <a href=#navigate>navigate</a><!--DONAV location.href/assign--> the <a href=#browsing-context>browsing
  context</a> to the specified <var title="">url</var>. If the <a href=#browsing-context>browsing context</a>'s
  <a href=#session-history>session history</a> contains only one <code><a href=#document>Document</a></code>, and that was the
  <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> created when the <a href=#browsing-context>browsing context</a> was
  created, then the navigation must be done with <a href=#replacement-enabled>replacement enabled</a>.</p> <!-- READ ME
  WHEN EDITING THIS: IE and Firefox only seem to treat it that way if the DOM is still a virgin DOM;
  Safari doesn't check that. Thus this might need changing if testing shows the IE/Firefox behaviour
  is required here. -->

  <p>When the <dfn id=dom-location-replace title=dom-location-replace><code>replace(<var title="">url</var>)</code></dfn>
  method is invoked, the UA must <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative
  to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, and if that is
  successful, <a href=#navigate>navigate</a><!--DONAV location.href/replace--> the <a href=#browsing-context>browsing
  context</a> to the specified <var title="">url</var> with <a href=#replacement-enabled>replacement enabled</a>.</p>

  <p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done with the <a href="#script's-browsing-context" title="script's
  browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <a href=#source-browsing-context>source
  browsing context</a>.</p>

  <p>If the <a href=#resolve-a-url title="resolve a url">resolving</a> step of the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods is not successful, then the user agent must
  instead throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception.</p>

  <p>When the <dfn id=dom-location-reload title=dom-location-reload><code>reload()</code></dfn> method is invoked, the
  user agent must run the appropriate steps from the following list:</p>

  <dl class=switch><dt>If the currently executing <a href=#concept-task title=concept-task>task</a> is the dispatch of a <code title=event-resize>resize</code> event in response to the user resizing the <a href=#browsing-context>browsing
   context</a></dt>

   <dd><p>Repaint the <a href=#browsing-context>browsing context</a> and abort these steps.</dd> <!-- this
   theoretically would have no effect but in practice can be useful to work around rendering bugs.
   -->

   <dt>If the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> is <a href=#an-iframe-srcdoc-document>an
   <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a></dt>

   <dd><p><a href=#process-the-iframe-attributes title="process the iframe attributes">Reprocess the <code>iframe</code>
   attributes</a> of the <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-container>browsing context
   container</a>.</dd>

   <dt>If the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> has its <a href=#reload-override-flag>reload
   override flag</a> set</dt>

   <dd><p>Perform <a href=#an-overridden-reload>an overridden reload</a>.</dd>

   <dt>Otherwise</dt>

   <dd><p><a href=#navigate>Navigate</a><!--DONAV location.reload()--> the
   <a href=#browsing-context>browsing context</a> to <a href="#the-document's-address">the document's
   address</a> with <a href=#replacement-enabled>replacement enabled</a>. The
   <a href=#source-browsing-context>source browsing context</a> must be the <a href=#browsing-context>browsing
   context</a> being navigated.</dd> <!-- it appears that
   document.reload() always uses GET and does not, e.g., re-POST. -->

   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/141 -->

  </dl><p>When a user requests that the <a href=#active-document>active document</a> of a <a href=#browsing-context>browsing context</a>
  be reloaded through a user interface element, the user agent should <a href=#navigate>navigate</a><!--DONAV
  user reload--> the <a href=#browsing-context>browsing context</a> to the same resource as that
  <code><a href=#document>Document</a></code>, with <a href=#replacement-enabled>replacement enabled</a>. In the case of non-idempotent
  methods (e.g. HTTP POST), the user agent should prompt the user to confirm the operation first,
  since otherwise transactions (e.g. purchases or database modifications) could be repeated. User
  agents may allow the user to explicitly override any caches when reloading. If <a href=#browsing-context>browsing
  context</a>'s <a href=#active-document>active document</a>'s <a href=#reload-override-flag>reload override flag</a> is set, then the
  user agent may instead perform <a href=#an-overridden-reload>an overridden reload</a> rather than the navigation
  described in this paragraph.</p>

  <hr></div>

  <!-- concept-uu -->

  <p>The <code><a href=#location>Location</a></code> interface also supports the <code><a href=#urlutils>URLUtils</a></code> interface. <a href=#refsURL>[URL]</a></p>

  <div class=impl>

  <p>When the object is created, and whenever the <a href="#the-document's-address" title="the document's address">the
  address</a> of the <i>relevant <code><a href=#document>Document</a></code></i> changes, the user agent must invoke
  the element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-set-the-input title=concept-uu-set-the-input>set the
  input</a> algorithm with <a href="#the-document's-address" title="the document's address">the address</a> of the
  <i>relevant <code><a href=#document>Document</a></code></i> as the given value.</p>

  <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base title=concept-uu-get-the-base>get the
  base</a> algorithm must return the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base
  URL">base URL</a>, if there is one, or null otherwise.</p>

  <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding title=concept-uu-query-encoding>query
  encoding</a> is the <a href="#document's-character-encoding">document's character encoding</a>.</p>

<!--CLEANUP-->
  <p>When the element's <code><a href=#urlutils>URLUtils</a></code> interface invokes its <a href=#concept-uu-update title=concept-uu-update>update steps</a> with the string <var title="">value</var>, the user
  agent must run the following steps:</p>

  <ol><li>

    <p>If any of the following conditions are met, let <var title="">mode</var> be <i>normal
    navigation</i>; otherwise, let it be <i>replace navigation</i>:</p>

    <ul class=brief><li>The <code><a href=#location>Location</a></code> object's <i>relevant <code><a href=#document>Document</a></code></i> has
     <a href=#completely-loaded>completely loaded</a>, or</li>

     <li>In the <a href=#concept-task title=concept-task>task</a> in which the algorithm is running, an
     <a href=#activation-behavior>activation behavior</a> is currently being processed whose <code title=event-click><a href=#event-click>click</a></code> event was <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>,
     or</li>

     <li>In the <a href=#concept-task title=concept-task>task</a> in which the algorithm is running, the event
     listener for a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code title=event-click><a href=#event-click>click</a></code> event is being handled.</li>

    </ul></li>

   <li><p>If <var title="">mode</var> is <i>normal navigation</i>, then act as if the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> method had been called with <var title="">value</var> as its
   argument. Otherwise, act as if the <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method had
   been called with <var title="">value</var> as its argument.</li>
   <!--DONAV location.href, defined in terms of the paragraphs far above-->

  </ol></div>



<!--ADD-TOPIC:Security-->
  <div class=impl>

  <h5 id=security-location><span class=secno>6.5.3.1 </span>Security</h5>

  <p id=security-3>User agents must throw a <code><a href=#securityerror>SecurityError</a></code> exception whenever any
  properties of a <code><a href=#location>Location</a></code> object are accessed when the <a href=#entry-script>entry script</a> has an
  <a href=#effective-script-origin>effective script origin</a> that is not the <a href=#same-origin title="same origin">same</a> as the
  <code><a href=#location>Location</a></code> object's associated <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>'s
  <a href=#active-document>active document</a>'s <a href=#effective-script-origin>effective script origin</a>, with the following
  exceptions:</p>

  <ul><li>The <code title=dom-url-href><a href=#dom-url-href>href</a></code> setter, if the <a href=#entry-script>entry script</a>'s
   <a href="#script's-browsing-context">script's browsing context</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing
   context</a> with which the <code><a href=#location>Location</a></code> object is associated

   <li>The <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method, if the <a href=#entry-script>entry
   script</a>'s <a href="#script's-browsing-context">script's browsing context</a> is <a href=#familiar-with>familiar with</a> the
   <a href=#browsing-context>browsing context</a> with which the <code><a href=#location>Location</a></code> object is associated

   <li>Any properties not defined in the IDL for the <code><a href=#location>Location</a></code> object or indirectly via
   one of those properties (e.g. <code title="">toString()</code>, which is defined via the <code title="">stringifier</code> keyword), if the <a href=#entry-script>entry script</a>'s <a href=#effective-script-origin>effective script
   origin</a> is the <a href=#same-origin>same origin</a> as the <code><a href=#location>Location</a></code> object's associated
   <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a>

  </ul><p>When the <a href=#entry-script>entry script</a>'s <a href=#effective-script-origin>effective script origin</a> is different than a
  <code><a href=#location>Location</a></code> object's associated <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script
  origin</a>, the user agent must act as if any changes to that <code><a href=#location>Location</a></code> object's
  properties, getters, setters, etc, were not present, and as if all the properties of that
  <code><a href=#location>Location</a></code> object had their [[Enumerable]] attribute set to false.</p>

  <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin>effective
  script origin</a> that is not the <a href=#same-origin>same origin</a> as the <code><a href=#location>Location</a></code> object's
  <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a> must be provided with a separate set
  of objects. These objects must have the prototype chain appropriate for the script for which the
  objects are created (not those that would be appropriate for scripts whose <a href="#script's-global-object">script's global
  object</a> is the <code><a href=#location>Location</a></code> object's <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>
  object).</p>

  </div>
<!--REMOVE-TOPIC:Security-->


  <div class=impl>

  <h4 id=history-notes><span class=secno>6.5.4 </span>Implementation notes for session history</h4>
  <!-- don't change the ID without updating multiple internal links -->

  <p><i>This section is non-normative.</i></p>

  <p>The <code><a href=#history-0>History</a></code> interface is not meant to place
  restrictions on how implementations represent the session history to
  the user.</p>

  <p>For example, session history could be implemented in a tree-like
  manner, with each page having multiple "forward" pages. This
  specification doesn't define how the linear list of pages in the
  <code title=dom-history><a href=#dom-history>history</a></code> object are derived from the
  actual session history as seen from the user's perspective.</p>

  <p>Similarly, a page containing two <code><a href=#the-iframe-element>iframe</a></code>s has a <code title=dom-history><a href=#dom-history>history</a></code> object distinct from the
  <code><a href=#the-iframe-element>iframe</a></code>s' <code title=dom-history><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>

<!--ADD-TOPIC:Security-->
  <p><strong>Security</strong>: It is suggested that to avoid letting
  a page "hijack" the history navigation facilities of a UA by abusing
  <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code>, the UA
  provide the user with a way to jump back to the previous page
  (rather than just going back to the previous state). For example,
  the back button could have a drop down showing just the pages in the
  session history, and not showing any of the states. Similarly, an
  aural browser could have two "back" commands, one that goes back to
  the previous state, and one that jumps straight back to the previous
  page.</p>

  <p>In addition, a user agent could ignore calls to <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> that are invoked on
  a timer, or from event listeners that are not triggered in response
  to a clear user action, or that are invoked in rapid succession.</p>
<!--REMOVE-TOPIC:Security-->

  </div>


<!--TOPIC:HTML-->
  <h3 id=browsing-the-web><span class=secno>6.6 </span>Browsing the Web</h3>

  <div class=impl>

  <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating across documents</h4>

  <p>Certain actions cause the <a href=#browsing-context>browsing context</a> to <i><a href=#navigate>navigate</a></i> to a new resource.
  Navigation always involves <dfn id=source-browsing-context>source browsing context</dfn>, which is the browsing context which
  was responsible for starting the navigation.</p>

  <p class=example>For example, <a href=#following-hyperlinks title="following hyperlinks">following a hyperlink</a>,
  <a href=#concept-form-submit title=concept-form-submit>form submission</a>, and the <code title=dom-open><a href=#dom-open>window.open()</a></code> and <code title=dom-location-assign><a href=#dom-location-assign>location.assign()</a></code> methods can all cause a browsing context to
  navigate.</p>

  <p>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>

  <!-- NAVIGATE <dfn>navigate</dfn> -->
  <!-- For places that _call_ this, as opposed to just referring to
  it, search for "DONAV" -->
  <p>When a browsing context is <dfn id=navigate title=navigate>navigated</dfn> to a new resource, the user
  agent must run the following steps:</p>

  <ol><li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <li id=sandboxLinks>

    <p>If the <a href=#source-browsing-context>source browsing context</a> is not <a href=#allowed-to-navigate>allowed to navigate</a> the
    <a href=#browsing-context>browsing context</a> being navigated, then abort these steps.</p>

    <p>If these steps are aborted here, the user agent may instead offer to open the new resource in a
    new <a href=#top-level-browsing-context>top-level browsing context</a> or in the <a href=#top-level-browsing-context>top-level browsing context</a> of
    the <a href=#source-browsing-context>source browsing context</a>, at the user's option, in which case the user agent
    must <a href=#navigate>navigate</a><!--DONAV sandbox manual load--> that designated <a href=#top-level-browsing-context>top-level
    browsing context</a> to the new resource as if the user had requested it independently.</p>

    <p class=note>Doing so, however, can be dangerous, as it means that the user is overriding the
    author's explicit request to sandbox the content.</p>

   </li>

   <li id=seamlessLinks><p>If the <a href=#source-browsing-context>source browsing context</a> is the same as the
   <a href=#browsing-context>browsing context</a> being navigated, and this browsing context has its <a href=#seamless-browsing-context-flag>seamless
   browsing context flag</a> set, and the <a href=#browsing-context>browsing context</a> being navigated was not
   chosen using an <dfn id=explicit-self-navigation-override>explicit self-navigation override</dfn>, then find the nearest
   <a href=#ancestor-browsing-context>ancestor browsing context</a> that does not have its <a href=#seamless-browsing-context-flag>seamless browsing context
   flag</a> set, and continue these steps as if <em>that</em> <a href=#browsing-context>browsing context</a> was
   the one that was going to be <a href=#navigate title=navigate>navigated</a> instead.</li>

   <li><p>If there is a preexisting attempt to navigate the <a href=#browsing-context>browsing context</a>, and the
   <a href=#source-browsing-context>source browsing context</a> is the same as the <a href=#browsing-context>browsing context</a> being
   navigated, and that attempt is currently running the <a href=#unload-a-document>unload a document</a> algorithm,
   and the <a href=#origin>origin</a> of the <a href=#url>URL</a> of the resource being loaded in that
   navigation is not the <a href=#same-origin>same origin</a> as the <a href=#origin>origin</a> of the <a href=#url>URL</a>
   of the resource being loaded in <em>this</em> navigation, then abort these steps without
   affecting the preexisting attempt to navigate the <a href=#browsing-context>browsing context</a>.</li> <!--
   http://www.hixie.ch/tests/adhoc/html/navigation/unload/ -->

   <li><p>If a <a href=#concept-task title=concept-task>task</a> queued by the <a href=#traverse-the-history-by-a-delta>traverse the history by a
   delta</a> algorithm is running the <a href=#unload-a-document>unload a document</a> algorithm for the
   <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a> being navigated, then abort
   these steps without affecting the <a href=#unload-a-document>unload a document</a> algorithm or the aforementioned
   history traversal task.</li> <!-- this stops pages from hijacking the back/forward button -->

   <li><p>If the <a href=#prompt-to-unload-a-document>prompt to unload a document</a> algorithm is being run for the
   <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a> being navigated, then abort
   these steps without affecting the <a href=#prompt-to-unload-a-document>prompt to unload a document</a> algorithm.</li>
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1946 to 1955 -->

   <li><p>Let <var title="">gone async</var> be false.</li>

   <li id=navigate-fragid-step><p><i>Fragment identifiers</i>: Apply the <a href=#url-parser>URL parser</a>
   algorithm to the <a href=#absolute-url>absolute URL</a> of the new resource and the <a href="#the-document's-address" title="the
   document's address">address</a> of the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
   context</a> being navigated. If all the components of the resulting <a href=#parsed-url title="parsed
   URL">parsed URLs</a>, ignoring any <a href=#concept-url-fragment title=concept-url-fragment>fragment</a>
   components, are identical, and the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, and the <a href=#parsed-url>parsed URL</a> of the
   new resource has a <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> component that is not null
   (even if it is empty), then <a href=#scroll-to-fragid title=navigate-fragid>navigate to that fragment
   identifier</a> and abort these steps.</li>

   <li><p>If <var title="">gone async</var> is false, cancel any preexisting but not yet <a href=#concept-navigate-mature title=concept-navigate-mature>mature</a> attempt to navigate the <a href=#browsing-context>browsing
   context</a>, including canceling any instances of the <a href=#fetch>fetch</a> algorithm started by
   those attempts. If one of those attempts has already <a href=#create-a-document-object title="create a document
   object">created a new <code>Document</code> object</a>, <a href=#abort-a-document title="abort a
   document">abort</a> that <code><a href=#document>Document</a></code> also. (Navigation attempts that have <a href=#concept-navigate-mature title=concept-navigate-mature>matured</a> already have session history entries, and are
   therefore handled during the <a href=#update-the-session-history-with-the-new-page>update the session history with the new page</a> algorithm,
   later.)</li>

   <li><p>If the new resource is to be handled using a mechanism that does not affect the browsing
   context, e.g. ignoring the navigation request altogether because the specified scheme is not one
   of the supported protocols, then abort these steps and proceed with that mechanism
   instead.</li>

   <li>

    <p>If <var title="">gone async</var> is false, <a href=#prompt-to-unload-a-document title="prompt to unload a document">prompt
    to unload</a> the <code><a href=#document>Document</a></code> object. If the user <a href=#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 title=navigate>navigation</a> algorithm gets canceled
    while this step is running, the <a href=#prompt-to-unload-a-document>prompt to unload a document</a> algorithm must
    nonetheless be run to completion.</p>

   </li>

   <li><p>If <var title="">gone async</var> is false, <a href=#abort-a-document title="abort a
   document">abort</a> the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
   context</a>.</li>

   <li>

    <p>If the new resource is to be handled by displaying some sort of inline content, e.g. an error
    message because the specified scheme is not one of the supported protocols, or an inline prompt
    to allow the user to select <a href=#dom-navigator-registerprotocolhandler title=dom-navigator-registerProtocolHandler>a registered
    handler</a> for the given scheme, then <a href=#read-ua-inline title=navigate-ua-inline>display the inline
    content</a> and abort these steps.</p>

    <p class=note>In the case of a registered handler being used, the algorithm will be reinvoked
    with a new URL to handle the request.</p>

   </li>

   <li>

    <p>If the resource has already been obtained (e.g. because it is being used to populate an
    <code><a href=#the-object-element>object</a></code> element's new <a href=#child-browsing-context>child browsing context</a>), then skip this step.</p>

    <p>Otherwise:</p>

    <p>If the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, and there are <a href=#relevant-application-cache title="relevant
    application cache">relevant application caches</a> that are identified by a URL with the
    <a href=#same-origin>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 title=concept-appcache-foreign>foreign</a>, and whose
    <a href=#concept-appcache-mode title=concept-appcache-mode>mode</a> is <a href=#concept-appcache-mode-fast title=concept-appcache-mode-fast>fast</a>, and the user agent is not in a mode where it
    will avoid using <a href=#application-cache title="application cache">application caches</a> then
    <a href=#fetch>fetch</a> the resource from the <a href=#concept-appcache-selection title=concept-appcache-selection>most
    appropriate application cache</a> of those that match.</p>

    <p class=example>For example, imagine an HTML page with an associated application cache
    displaying an image and a form, where the image is also used by several other application
    caches. If the user right-clicks on the image and chooses "View Image", then the user agent
    could decide to show the image from any of those caches, but it is likely that the most useful
    cache for the user would be the one that was used for the aforementioned HTML page. On the other
    hand, if the user submits the form, and the form does a POST submission, then the user agent
    will not use an application cache at all; the submission will be made to the network.</p>

    <p>Otherwise, <a href=#fetch>fetch</a><!--FETCH--> the new resource, with the <i>manual redirect
    flag</i> set.</p>

    <p>If the resource is being fetched using a method other than one <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>equivalent to</a> HTTP's GET<!-- or HEAD (but that can't
    happen) -->, or, if the <a href=#navigate title=navigate>navigation algorithm</a> was invoked as a
    result of the <a href=#concept-form-submit title=concept-form-submit>form submission algorithm</a>, then the <a href=#fetch title=fetch>fetching algorithm</a> must be invoked from the <a href=#origin>origin</a> of the
    <a href=#active-document>active document</a> of the <a href=#source-browsing-context>source browsing context</a>, if any.</p> <!--
    potentially http-origin privacy sensitive -->

    <p>If the <a href=#browsing-context>browsing context</a> being navigated is a <a href=#child-browsing-context>child browsing context</a>
    for an <code><a href=#the-iframe-element>iframe</a></code> or <code><a href=#the-object-element>object</a></code> element, then the <a href=#fetch title=fetch>fetching
    algorithm</a> must be invoked from the <code><a href=#the-iframe-element>iframe</a></code> or <code><a href=#the-object-element>object</a></code> element's
    <a href=#browsing-context-scope-origin>browsing context scope origin</a>, if it has one.</p> <!-- potentially http-origin
    privacy sensitive -->

    <p>If the <a href=#browsing-context>browsing context</a> is a <a href=#nested-browsing-context>nested browsing context</a>, then in the
    time between the <a href=#fetch>fetch</a> algorithm being started by this step, and either the
    creation of a <code><a href=#document>Document</a></code> object or the canceling of the <a href=#fetch>fetch</a> or <a href=#navigate title=navigate>navigation</a> algorithms, the <a href=#browsing-context>browsing context</a> must be put in
    the <a href=#delaying-load-events-mode>delaying <code title=event-load>load</code> events mode</a>.</p> <!-- this is
    what makes <iframe> elements delay the load event of their parent browsing context when their
    child browsing context is in between this step and the step that starts the parser. -->

   </li>

   <li>

    <!-- *********************************** ASYNC BOUNDARY *********************************** -->

    <p>If <var title="">gone async</var> is false, return to whatever algorithm invoked the
    navigation steps and continue running these steps asynchronously.</p>

   </li>

   <li><p>Let <var title="">gone async</var> be true.</li>

   <li>

    <p>If fetching the resource results in a redirect, and either the <a href=#url>URL</a> of the target
    of the redirect has the <a href=#same-origin>same origin</a> as the original resource, or the resource is
    being obtained using the POST method or a safe method (in HTTP terms), return to <a href=#navigate-fragid-step>the step labeled <i>fragment identifiers</i></a> with the new resource,
    except that if the <a href=#url>URL</a> of the target of the redirect does not have a fragment
    identifier and the <a href=#url>URL</a> of the resource that led to the redirect does, then the
    fragment identifier of the resource that led to the redirect must be propagated to the
    <a href=#url>URL</a> of the target of the redirect.</p>

    <p class=example>So for instance, if the original URL was "<code title="">http://example.com/#!sample</code>" and "<code title="">http://example.com/</code>" is
    found to redirect to "<code title="">https://example.com/</code>", the URL of the new resource
    will be "<code title="">https://example.com/#!sample</code>".</p>

    <p>Otherwise, if fetching the resource results in a redirect but the <a href=#url>URL</a> of the
    target of the redirect does not have the <a href=#same-origin>same origin</a> as the original resource and
    the resource is being obtained using a method that is neither the POST method nor a safe method
    (in HTTP terms), then abort these steps. The user agent may indicate to the user that the
    navigation has been aborted for security reasons.</p>

   </li>

   <li><p>Wait for one or more bytes to be available or for the user agent to establish that the
   resource in question is empty. During this time, the user agent may allow the user to cancel this
   navigation attempt or start other navigation attempts.</li>

   <li>

    <p><strong>Fallback in prefer-online mode</strong>: If the resource was not fetched from an
    <a href=#application-cache>application cache</a>, and was to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, and there are <a href=#relevant-application-cache title="relevant
    application cache">relevant application caches</a> that are identified by a URL with the
    <a href=#same-origin>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 title=concept-appcache-foreign>foreign</a>, and whose
    <a href=#concept-appcache-mode title=concept-appcache-mode>mode</a> is <a href=#concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online>prefer-online</a>, and the user didn't cancel the
    navigation attempt during the earlier step, and the navigation attempt failed (e.g. the server
    returned a 4xx or 5xx status code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or
    equivalent</a>, or there was a DNS error), then:</p>

    <p>Let <var title="">candidate</var> be the resource identified by the URL in question from the
    <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application cache</a> of those that
    match.</p> <!-- note that a redirect can never reach this point as it is handled earlier,
    meaning that a captive portal captures URLs in "prefer-online" caches and you can't ever get to
    the cached resource of a prefer-online cache if you have a captive portal -->

    <p>If <var title="">candidate</var> is not marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then the user agent must discard the failed
    load and instead continue along these steps using <var title="">candidate</var> as the resource.
    The user agent may indicate to the user that the original page load failed, and that the page
    used was a previously cached resource.</p>

    <p class=note>This does not affect the <i>address of the resource from which Request-URIs are
    obtained</i>, as used to set <a href="#the-document's-referrer">the document's referrer</a> in the <a href=#create-a-document-object>create a Document
    object</a> steps below; they still use the value as computed by the original
    <a href=#fetch>fetch</a> algorithm.</p>

   </li>

   <li>

    <p><strong>Fallback for fallback entries</strong>: If the resource was not fetched from an
    <a href=#application-cache>application cache</a>, and was to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, and its URL <a href=#concept-appcache-matches-fallback title=concept-appcache-matches-fallback>matches the fallback namespace</a> of one or more
    <a href=#relevant-application-cache title="relevant application cache">relevant application caches</a>, and the <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application cache</a> of those that match
    does not have an entry in its <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
    whitelist</a> that has the <a href=#same-origin>same origin</a> as the resource's URL and that is a
    <a href=#prefix-match>prefix match</a> for the resource's URL, and the user didn't cancel the navigation
    attempt during the previous step, and the navigation attempt failed (e.g. the server returned a
    4xx or 5xx status code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or
    there was a DNS error), then:</p> <!-- note that a redirect can never reach this point as it is
    handled earlier, meaning that a captive portal captures URLs in fallback namespaces and you
    can't ever get to the fallback file of a resource if you have a captive portal -->

    <p>Let <var title="">candidate</var> be the <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
    resource</a> specified for the <a href=#concept-appcache-fallback-ns title=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 title=concept-appcache-selection>most appropriate application
    cache</a> of those that match.</p>

    <p>If <var title="">candidate</var> is not marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then the user agent must discard the failed
    load and instead continue along these steps using <var title="">candidate</var> as the resource.
    <a href="#the-document's-address">The document's address</a>, if appropriate, will still be the originally requested URL,
    not the fallback URL, but the user agent may indicate to the user that the original page load
    failed, that the page used was a fallback resource, and what the URL of the fallback resource
    actually is.</p>

    <p class=note>This does not affect the <i>address of the resource from which Request-URIs are
    obtained</i>, as used to set <a href="#the-document's-referrer">the document's referrer</a> in the <a href=#create-a-document-object>create a Document
    object</a> steps below; they still use the value as computed by the original
    <a href=#fetch>fetch</a> algorithm.</p>

   </li>

   <li>

    <p><i>Resource handling</i>: If the resource's out-of-band metadata (e.g. HTTP headers), not
    counting any <a href=#content-type title=Content-Type>type information</a> (such as the Content-Type HTTP
    header), requires some sort of processing that will not affect the browsing context, then
    perform that processing and abort these steps.</p>

    <div class=note>
     <p>Such processing might be triggered by, amongst other things, the following:</p>
     <ul class=brief><li>HTTP status codes (e.g. 204 No Content or 205 Reset Content)</li>
      <li>Network errors (e.g. the network interface being unavailable)</li>
      <li>Cryptographic protocol failures (e.g. an incorrect TLS certificate)</li>
      <!-- Other schemes are handled earlier -->
      <!-- Content-Disposition is handled below -->
      <!-- Content-Type is handled in subsequent steps -->
      <!-- ...and I can't think of any others. -->
     </ul></div>

    <p>Responses with HTTP <code title=http-content-disposition>Content-Disposition</code> headers
    specifying the <code title="">attachment</code> disposition type must be handled <a href=#as-a-download>as a
    download</a>.</p>

    <!-- theoretically, HTTP 205 processing would occur here, resetting all forms with no other
    effect. However, it seems nobody actually wants to use this ability, so requiring it here seems
    like unnecessary work. -->

    <p>HTTP 401 responses that do not include a challenge recognized by the user agent must be
    processed as if they had no challenge, e.g. rendering the entity body as if the response had
    been 200 OK.</p>

    <p>User agents may show the entity body of an HTTP 401 response even when the response does
    include a recognized challenge, with the option to login being included in a non-modal fashion,
    to enable the information provided by the server to be used by the user before authenticating.
    Similarly, user agents should allow the user to authenticate (in a non-modal fashion) against
    authentication challenges included in other responses such as HTTP 200 OK responses, effectively
    allowing resources to present HTTP login forms without requiring their use.</p>

   </li>

   <li><p>Let <var title="">type</var> be <a href=#content-type-sniffing-0 title="Content-Type sniffing">the sniffed type of
   the resource</a>.</li>

   <li><p>If the user agent has been configured to process resources of the given <var title="">type</var> using some mechanism other than rendering the content in a <a href=#browsing-context>browsing
   context</a>, then skip this step. Otherwise, if the <var title="">type</var> is one of the
   following types, jump to the appropriate entry in the following list, and process the resource as
   described there:</p>

    <dl class=switch><!-- an <span>HTML MIME type</span> --><dt>"<code><a href=#text/html>text/html</a></code>"</dt>
     <dd>Follow the steps given in the <a href=#read-html title=navigate-html>HTML document</a> section, and
     abort these steps.</dd>

     <!-- an <span>XML MIME type</span> -->
     <dt>"<code>application/xml</code>"</dt>
     <dt>"<code>text/xml</code>"</dt>
     <dt>"<code>image/svg+xml</code>"</dt>
     <dt>"<code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>"</dt>
     <dt>Any other type ending in "<code title="">+xml</code>" that is not an <a href=#explicitly-supported-xml-type>explicitly supported XML type</a></dt> <!-- no need to say that the _subtype_ ends in "+xml" so long as the "sniffed type" algorithm continues to drop parameters -->
     <dd>Follow the steps given in the <a href=#read-xml title=navigate-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, abort these
     steps.</dd>

     <dt>"<code>text/plain</code>"</dt>
     <dd>Follow the steps given in the <a href=#read-text title=navigate-text>plain text file</a> section,
     and abort these steps.</dd>

     <dt>"<code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>"</dt>
     <dd>Follow the steps given in the <a href=#read-multipart-x-mixed-replace title=navigate-multipart-x-mixed-replace>multipart/x-mixed-replace</a> section, and abort
     these steps.</dd>

     <dt>A supported image, video, or audio type</dt>
     <dd>Follow the steps given in the <a href=#read-media title=navigate-media>media</a> section, and abort
     these steps.</dd>

     <dt>A type that will use an external application to render the content in the <a href=#browsing-context>browsing
     context</a></dt>
     <dd>Follow the steps given in the <a href=#read-plugin title=navigate-plugin>plugin</a> section, and
     abort these steps.</dd>

    </dl><p>An <dfn id=explicitly-supported-xml-type>explicitly supported XML type</dfn> is one for which the user agent is configured to
    use an external application to render the content (either a <a href=#plugin>plugin</a> rendering
    directly in the <a href=#browsing-context>browsing context</a>, or a separate application), or one for which the
    user agent has dedicated processing rules (e.g. a Web browser with a built-in Atom feed viewer
    would be said to explicitly support the <code>application/atom+xml</code> MIME type), or one for
    which the user agent has a dedicated handler (e.g. one registered using <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>).</p>

    <p><dfn id="set-the-document's-address" title="set the document's address">Setting the document's address</dfn>: If there is no
    <dfn id=override-url>override URL</dfn>, then any <code><a href=#document>Document</a></code> created by these steps must have its
    <a href="#the-document's-address" title="the document's address">address</a> set to the <a href=#url>URL</a> that was
    originally to be <a href=#fetch title=fetch>fetched</a>, ignoring any other data that was used to
    obtain the resource (e.g. the entity body in the case of a POST submission is not part of
    <a href="#the-document's-address">the document's address</a>, nor is the URL of the fallback resource in the case of the
    original load having failed and that URL having been found to match a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>). However, if there <em>is</em>
    an <a href=#override-url>override URL</a>, then any <code><a href=#document>Document</a></code> created by these steps must have
    its <a href="#the-document's-address" title="the document's address">address</a> set to that <a href=#url>URL</a>
    instead.</p>

    <p class=note>An <a href=#override-url title="override URL">override URL</a> is set when <a href=#concept-js-deref title=concept-js-deref>dereferencing a <code>javascript:</code> URL</a> and when performing
    <a href=#an-overridden-reload>an overridden reload</a>.</p>

    <p><dfn id=create-a-document-object title="create a Document object">Creating a new <code>Document</code> object</dfn>: when
    a <code><a href=#document>Document</a></code> is created as part of the above steps, the user agent must additionally
    run the following algorithm as part of creating the new object:</p>

    <ol><li><p>Create a new <code><a href=#window>Window</a></code> object, and associate it with the
     <code><a href=#document>Document</a></code>, with one exception: if the <a href=#browsing-context>browsing context</a>'s only entry in
     its <a href=#session-history>session history</a> is the <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> that was
     added when the <a href=#browsing-context>browsing context</a> was created, and navigation is occurring with
     <a href=#replacement-enabled>replacement enabled</a>, and that <code><a href=#document>Document</a></code> has the <a href=#same-origin>same
     origin</a> as the new <code><a href=#document>Document</a></code>, then use the <code><a href=#window>Window</a></code> object of that
     <code><a href=#document>Document</a></code> instead, and change the <code title=dom-document><a href=#dom-document-0>document</a></code>
     attribute of the <code><a href=#window>Window</a></code> object to point to the new <code><a href=#document>Document</a></code>.</p>

     <li><p>Set <a href="#the-document's-referrer">the document's referrer</a> to the <i>address of the resource from which
     Request-URIs are obtained</i> as determined when the <a href=#fetch>fetch</a> algorithm obtained the
     resource, if that algorithm was used and determined such a value; otherwise, set it to the
     empty string.</li>

     <li><p><a href=#implement-the-sandboxing>Implement the sandboxing</a> for the <code><a href=#document>Document</a></code>.</li>

     <li id=fullscreen-logic>

      <p>If the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <code><a href=#document>Document</a></code>'s
      <a href=#browsing-context>browsing context</a> or any of its <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor
      browsing contexts</a> (if any) have the <a href=#sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context
      flag</a> set, then skip this step.</p>

      <p>If the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> has a <a href=#browsing-context-container>browsing context
      container</a> and either it is not an <code><a href=#the-iframe-element>iframe</a></code> element, or it does not have the
      <code title=attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code> attribute specified, or its
      <code><a href=#document>Document</a></code> does not have the <a href=#fullscreen-enabled-flag>fullscreen enabled flag</a> set, then also
      skip this step.</p>

      <p>Otherwise, set the <code><a href=#document>Document</a></code>'s <a href=#fullscreen-enabled-flag>fullscreen enabled flag</a>.</p>

    </ol></li>

   <li id=navigate-non-Document>

    <p><i>Non-document content</i>: If, given <var title="">type</var>, the new resource is to be
    handled by displaying some sort of inline content, e.g. a native rendering of the content, an
    error message because the specified type is not supported, or an inline prompt to allow the user
    to select <a href=#dom-navigator-registercontenthandler title=dom-navigator-registerContentHandler>a registered handler</a> for the
    given type, then <a href=#read-ua-inline title=navigate-ua-inline>display the inline content</a> and abort
    these steps.</p>

    <p class=note>In the case of a registered handler being used, the algorithm will be reinvoked
    with a new URL to handle the request.</p>

   </li>

   <li><p>Otherwise, the document's <var title="">type</var> is such that the resource will not
   affect the browsing context, e.g. because the resource is to be handed to an external application
   or because it is an unknown type that will be processed <a href=#as-a-download>as a download</a>. Process the
   resource appropriately.</p>

  </ol><hr><p>Some of the sections below, to which the above algorithm defers in certain cases, require the
  user agent to <dfn id=update-the-session-history-with-the-new-page>update the session history with the new page</dfn>. When a user agent is
  required to do this, it must <a href=#queue-a-task>queue a task</a> (associated with the <code><a href=#document>Document</a></code>
  object of the <a href=#current-entry>current entry</a>, not the new one) to run the following steps:</p>

  <ol><li>

    <p><a href=#unload-a-document title="unload a document">Unload</a> the <code><a href=#document>Document</a></code> object of the
    <a href=#current-entry>current entry</a>, with the <var title="">recycle</var> parameter set to false.</p>

    <p>If this instance of the <a href=#navigate title=navigate>navigation</a> algorithm is canceled while
    this step is running the <a href=#unload-a-document>unload a document</a> algorithm, then the <a href=#unload-a-document>unload a
    document</a> algorithm must be allowed to run to completion, but this instance of the <a href=#navigate title=navigate>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>

   <li>

    <dl><dt>If the navigation was initiated for <dfn id=entry-update>entry update</dfn> of an entry</dt>

     <dd>

      <ol><li><p>Replace the <code><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><a href=#document>Document</a></code>.</li>

       <li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry.</li>

      </ol><p class=note>This can only happen if the entry being updated is not the <a href=#current-entry>current
      entry</a>, and can never happen with <a href=#replacement-enabled>replacement enabled</a>. (It happens when the
      user tried to traverse to a session history entry that no longer had a <code><a href=#document>Document</a></code>
      object.)</p>

     </dd>


     <dt>Otherwise</dt>

     <dd>

      <ol><li>

        <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s <a href=#session-history>session
        history</a> after the <a href=#current-entry>current entry</a>. If the <a href=#current-entry>current entry</a> is
        the last entry in the session history, then no entries are removed.</p>

        <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the
        user agent's user interface.</p>

       </li>

       <li><p>Append a new entry at the end of the <code><a href=#history-0>History</a></code> object representing the new
       resource and its <code><a href=#document>Document</a></code> object and related state.</li>

       <li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry. If
       the navigation was initiated with <a href=#replacement-enabled>replacement
       enabled</a>, then the traversal must itself be initiated
       with <a href=#replacement-enabled>replacement enabled</a>.</p>

       </li>

      </ol></dd>

    </dl></li>

   <li><p>The <a href=#navigate title=navigate>navigation algorithm</a> has now <dfn id=concept-navigate-mature title=concept-navigate-mature>matured</dfn>.</li>

   <li><p><i>Fragment identifier loop</i>: <a href=#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>

   <li><p>If the <code><a href=#document>Document</a></code> object has no parser, or its parser has <a href=#stop-parsing title="stop
   parsing">stopped parsing</a>, or the user agent has reason to believe the user is no longer
   interested in scrolling to the fragment identifier, then abort these steps.</li>

   <li><p><a href=#scroll-to-the-fragment-identifier>Scroll to the fragment identifier</a> given in <a href="#the-document's-address">the document's
   address</a>. If this fails to find <a href=#the-indicated-part-of-the-document title="the indicated part of the document">an
   indicated part of the document</a>, then return to the <i>fragment identifier loop</i>
   step.</li>

  </ol><p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the
  <a href=#networking-task-source>networking task source</a>.</p>


  <h4 id=read-html><span class=secno>6.6.2 </span><dfn title=navigate-html>Page load processing model for HTML files</dfn></h4>

  <p>When an HTML document is to be loaded in a <a href=#browsing-context>browsing context</a>, the user agent must
  <a href=#queue-a-task>queue a task</a> to <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being
  an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to "<code title="">text/html</code>",
  create an <a href=#html-parser>HTML parser</a>, and associate it with the document. Each <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a> places on the
  <a href=#task-queue>task queue</a> while the <a href=#fetch title=fetch>fetching algorithm</a> runs must then
  fill the parser's <a href=#the-input-byte-stream>input byte stream</a> with the fetched bytes and cause the <a href=#html-parser>HTML
  parser</a> to perform the appropriate processing of the input stream.</p>

  <p class=note>The <a href=#the-input-byte-stream>input byte stream</a> converts bytes into characters for use in the
  <a href=#tokenization title=tokenization>tokenizer</a>. This process relies, in part, on character encoding
  information found in the real <a href=#content-type title=Content-Type>Content-Type metadata</a> of the
  resource; the "sniffed type" is not used for this purpose.</p>

  <!-- next two paragraphs are nearly identical to the navigate-text section, keep them in sync -->

  <p>When no more bytes are available, the user agent must <a href=#queue-a-task>queue a task</a> for the parser
  to process the implied EOF character, which eventually causes a <code title=event-load>load</code> event to be fired.</p>

  <p>After creating the <code><a href=#document>Document</a></code> object, but before any script execution, certainly
  before the parser <a href=#stop-parsing title="stop parsing">stops</a>, the user agent must <a href=#update-the-session-history-with-the-new-page>update the
  session history with the new page</a>.</p>

  <p class=note><a href=#concept-appcache-init title=concept-appcache-init>Application cache selection</a> happens <a href=#parser-appcache>in the HTML parser</a>.</p>

  <p>The <a href=#task-source>task source</a> for the two tasks mentioned in this section must be the
  <a href=#networking-task-source>networking task source</a>.</p>



  <h4 id=read-xml><span class=secno>6.6.3 </span><dfn title=navigate-xml>Page load processing model for XML files</dfn></h4>

  <p>When faced with displaying an XML file inline, user agents must first <a href=#create-a-document-object>create a
  <code>Document</code> object</a>, following the requirements of the XML and Namespaces in XML
  recommendations, RFC 3023, DOM, and other relevant specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsRFC3023>[RFC3023]</a> <a href=#refsDOM>[DOM]</a></p>

  <p>The actual HTTP headers and other metadata, not the headers as mutated or implied by the
  algorithms given in this specification, are the ones that must be used when determining the
  character encoding according to the rules given in the above specifications. Once the character
  encoding is established, the <a href="#document's-character-encoding">document's character encoding</a> must be set to that
  character encoding.</p>

  <p>If the root element, as parsed according to the XML specifications cited above, is found to be
  an <code><a href=#the-html-element>html</a></code> element with an attribute <code title=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 title="insert an
  element into a document">inserted into the document</a>, the user agent must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of that attribute relative to that element, and if
  that is successful, must apply the <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a> algorithm to the resulting
  <a href=#parsed-url>parsed URL</a> with the <i>exclude fragment flag</i> set to obtain <var title="">manifest
  URL</var>, and then run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
  algorithm</a> with <var title="">manifest URL</var> as the manifest URL, passing in the
  newly-created <code><a href=#document>Document</a></code>. Otherwise, if the attribute is absent, its value is the empty
  string, or resolving its value fails, then as soon as the root element is <a href=#insert-an-element-into-a-document title="insert an
  element into a document">inserted into the document</a>, the user agent must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection algorithm</a> with no manifest, and
  passing in the <code><a href=#document>Document</a></code>.</p>

  <p class=note>Because the processing of the <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
  attribute happens only once the root element is parsed, any URLs referenced by processing
  instructions before the root element (such as <code title="">&lt;?xml-stylesheet?&gt;</code> and
  <code title="">&lt;?xbl?&gt;</code> PIs) will be fetched from the network and cannot be
  cached.</p><!-- v2: fix this somehow -->

  <p>User agents may examine the namespace of the root <code><a href=#element>Element</a></code> node of this
  <code><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>navigate</a> steps above.</p>

  <p>Otherwise, then, with the newly created <code><a href=#document>Document</a></code>, the user agent must <a href=#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><a href=#document>Document</a></code>.</p>


  <h4 id=read-text><span class=secno>6.6.4 </span><dfn title=navigate-text>Page load processing model for text files</dfn></h4>

  <p>When a plain text document is to be loaded in a <a href=#browsing-context>browsing context</a>, the user agent
  must <a href=#queue-a-task>queue a task</a> to <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as
  being an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to "<code title="">text/plain</code>",
  create an <a href=#html-parser>HTML parser</a>, associate it with the document, 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<!-- to get eaten, so that a leading LF in the text/plain stream doesn't get eaten
  itself-->, and switch the <a href=#html-parser>HTML parser</a>'s tokenizer to the <a href=#plaintext-state>PLAINTEXT
  state</a>. Each <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task
  source</a> places on the <a href=#task-queue>task queue</a> while the <a href=#fetch title=fetch>fetching
  algorithm</a> runs must then fill the parser's <a href=#the-input-byte-stream>input byte stream</a> with the fetched
  bytes and cause the <a href=#html-parser>HTML parser</a> to perform the appropriate processing of the input
  stream.</p>

  <p>The rules for how to convert the bytes of the plain text document into actual characters, and
  the rules for actually rendering the text to the user, are defined in RFC 2046, RFC 3676, and
  subsequent versions thereof. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsRFC3676>[RFC3676]</a></p>

  <p>The <a href="#document's-character-encoding">document's character encoding</a> must be set to the character encoding used to
  decode the document.</p>

  <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection algorithm</a> with no manifest, and
  passing in the newly-created <code><a href=#document>Document</a></code>.</p>

  <!-- next two paragraphs are nearly identical to the navigate-html section and similar to the
  "navigate-ua-inline" section, and the next three are similar to the navigate-media and
  navigate-plugin sections; keep them all in sync -->

  <p>When no more bytes are available, the user agent must <a href=#queue-a-task>queue a task</a> for the parser
  to process the implied EOF character, which eventually causes a <code title=event-load>load</code> event to be fired.</p>

  <p>After creating the <code><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>update the session history with the new page</a>.</p>

  <p>User agents may add content to the <code><a href=#the-head-element>head</a></code> element of the <code><a href=#document>Document</a></code>, e.g.
  linking to a style sheet or an XBL binding, providing script, giving the document a
  <code><a href=#the-title-element>title</a></code>, etc.</p>

  <p class=note>In particular, if the user agent supports the <code title="">Format=Flowed</code>
  feature of RFC 3676 then the user agent would need to apply extra styling to cause the text to
  wrap correctly and to handle the quoting feature. This could be performed using, e.g., an XBL
  binding or a CSS extension.</p>

  <p>The <a href=#task-source>task source</a> for the two tasks mentioned in this section must be the
  <a href=#networking-task-source>networking task source</a>.</p>


  <h4 id=read-multipart-x-mixed-replace><span class=secno>6.6.5 </span><dfn title=navigate-multipart-x-mixed-replace>Page load processing model for <code>multipart/x-mixed-replace</code> resources</dfn></h4>

  <p>When a resource with the type <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> is to be loaded in a
  <a href=#browsing-context>browsing context</a>, the user agent must parse the resource using the rules for
  multipart types. <a href=#refsRFC2046>[RFC2046]</a></p>

  <p>For each body part obtained from the resource, the user agent must run a new instance of the
  <a href=#navigate>navigate</a> algorithm, starting from the <i>resource handling</i> step, using the new
  body part as the resource being navigated, with <a href=#replacement-enabled>replacement enabled</a> if a previous
  body part from the same resource resulted in a <code><a href=#document>Document</a></code> object being <a href=#create-a-document-object title="create a document object">created</a>, and otherwise using the same setup as the
  <a href=#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 class=note>Thus, <code title=event-load>load</code> events (and for that matter <code title=event-unload>unload</code> events) do fire for each body part loaded.</p>


  <h4 id=read-media><span class=secno>6.6.6 </span><dfn title=navigate-media>Page load processing model for media</dfn></h4>

  <p>When an image, video, or audio resource is to be loaded in a <a href=#browsing-context>browsing context</a>, the
  user agent should <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to the sniffed MIME type of the resource
  (<var title="">type</var> in the <a href=#navigate>navigate</a> algorithm), append an <code><a href=#the-html-element>html</a></code>
  element to the <code><a href=#document>Document</a></code>, append a <code><a href=#the-head-element>head</a></code> element and a <code><a href=#the-body-element>body</a></code>
  element to the <code><a href=#the-html-element>html</a></code> element, append an element <var title="">host element</var> for
  the media, as described below, to the <code><a href=#the-body-element>body</a></code> element, and set the appropriate attribute
  of the element <var title="">host element</var>, as described below, to the address of the image,
  video, or audio resource.</p>

  <p>The element <var title="">host element</var> to create for the media is the element given in
  the table below in the second cell of the row whose first cell describes the media. The
  appropriate attribute to set is the one given by the third cell in that same row.</p>

  <table><thead><tr><th> Type of media
         <th> Element for the media
         <th> Appropriate attribute
    <tr><td> Image
         <td> <code><a href=#the-img-element>img</a></code>
         <td> <code title=attr-img-src><a href=#attr-img-src>src</a></code>
    <tr><td> Video
         <td> <code><a href=#the-video-element>video</a></code>
         <td> <code title=attr-media-src><a href=#attr-media-src>src</a></code>
    <tr><td> Audio
         <td> <code><a href=#the-audio-element>audio</a></code>
         <td> <code title=attr-media-src><a href=#attr-media-src>src</a></code>
  </thead></table><!-- next three paragraphs are similar to the navigate-text section, keep them in sync --><p>Then, the user agent must act as if it had <a href=#stop-parsing title="stop parsing">stopped
  parsing</a>.</p>

  <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection algorithm</a> with no manifest, and
  passing in the newly-created <code><a href=#document>Document</a></code>.</p>

  <p>After creating the <code><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>update the session history with the new page</a>.</p>

  <p>User agents may add content to the <code><a href=#the-head-element>head</a></code> element of the <code><a href=#document>Document</a></code>, or
  attributes to the element <var title="">host element</var>, e.g. to link to a style sheet or an
  XBL binding, to provide a script, to give the document a <code><a href=#the-title-element>title</a></code>, to make the media
  <a href=#attr-media-autoplay title=attr-media-autoplay>autoplay</a>, etc.</p>


  <h4 id=read-plugin><span class=secno>6.6.7 </span><dfn title=navigate-plugin>Page load processing model for content that uses plugins</dfn></h4>

  <p>When a resource that requires an external resource to be rendered is to be loaded in a
  <a href=#browsing-context>browsing context</a>, the user agent should <a href=#create-a-document-object>create a <code>Document</code>
  object</a>, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a> and mark it
  as being a <dfn id=plugin-document>plugin document</dfn>, set its <a href=#concept-document-content-type title=concept-document-content-type>content
  type</a> to the sniffed MIME type of the resource (<var title="">type</var> in the
  <a href=#navigate>navigate</a> algorithm), append an <code><a href=#the-html-element>html</a></code> element to the
  <code><a href=#document>Document</a></code>, append a <code><a href=#the-head-element>head</a></code> element and a <code><a href=#the-body-element>body</a></code> element to the
  <code><a href=#the-html-element>html</a></code> element, append an <code><a href=#the-embed-element>embed</a></code> to the <code><a href=#the-body-element>body</a></code> element, and set
  the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute of the <code><a href=#the-embed-element>embed</a></code> element to the
  address of the resource.</p>

  <p class=note>The term <a href=#plugin-document>plugin document</a> is used by the Content Security Policy
  specification as part of the mechanism that ensures <code><a href=#the-iframe-element>iframe</a></code>s can't be used to evade
  <code title="">plugin-types</code> directives. <a href=#refsCSP>[CSP]</a></p>

  <!-- next three paragraphs are similar to the navigate-text section, keep them in sync -->

  <p>Then, the user agent must act as if it had <a href=#stop-parsing title="stop parsing">stopped
  parsing</a>.</p>

  <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection algorithm</a> with no manifest, and
  passing in the newly-created <code><a href=#document>Document</a></code>.</p>

  <p>After creating the <code><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>update the session history with the new page</a>.</p>

  <p>User agents may add content to the <code><a href=#the-head-element>head</a></code> element of the <code><a href=#document>Document</a></code>, or
  attributes to the <code><a href=#the-embed-element>embed</a></code> element, e.g. to link to a style sheet or an XBL binding, or
  to give the document a <code><a href=#the-title-element>title</a></code>.</p>

  <p class=note id=sandboxPluginNavigate>If the <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
  flag set</a> has its <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> set, the synthesized
  <code><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>plugin</a> cannot be <a href=#concept-plugin-secure title=concept-plugin-secure>secured</a>.</p>


  <h4 id=read-ua-inline><span class=secno>6.6.8 </span><dfn title=navigate-ua-inline>Page load processing model for inline content that doesn't have a DOM</dfn></h4>

  <p>When the user agent is to display a user agent page inline in a <a href=#browsing-context>browsing context</a>,
  the user agent should <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being an
  <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to "<code title="">text/html</code>",
  and then either associate that <code><a href=#document>Document</a></code> with a custom rendering that is not rendered
  using the normal <code><a href=#document>Document</a></code> rendering rules, or mutate that <code><a href=#document>Document</a></code> until
  it represents the content the user agent wants to render.</p>

  <!-- next two paragraphs are similar to the navigate-text section, keep them in sync -->

  <p>Once the page has been set up, the user agent must act as if it had <a href=#stop-parsing title="stop
  parsing">stopped parsing</a>.</p>

  <p>Upon creation of the <code><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection algorithm</a> with no manifest,
  passing in the newly-created <code><a href=#document>Document</a></code>.</p>

  <p>After creating the <code><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>update the session history with the new
  page</a>.</p>



  <h4 id=scroll-to-fragid><span class=secno>6.6.9 </span><dfn title=navigate-fragid>Navigating to a fragment identifier</dfn></h4>

  <p>When a user agent is supposed to navigate to a fragment identifier, then the user agent must
  run the following steps:</p>

  <ol><li>

    <p>Remove all the entries in the <a href=#browsing-context>browsing context</a>'s <a href=#session-history>session history</a>
    after the <a href=#current-entry>current entry</a>. If the <a href=#current-entry>current entry</a> is the last entry in the
    session history, then no entries are removed.</p>

    <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
    agent's user interface.</p>

   </li>

   <li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued by the <a href=#history-traversal-task-source>history traversal
   task source</a> that are associated with any <code><a href=#document>Document</a></code> objects in the
   <a href=#top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family>document family</a>.</li>

   <li><p>Append a new entry at the end of the <code><a href=#history-0>History</a></code> object representing the new
   resource and its <code><a href=#document>Document</a></code> object and related state. Its <a href=#url>URL</a> must be set
   to the address to which the user agent was <a href=#navigate title=navigate>navigating</a>. The title
   must be left unset.</li>

   <li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry, with the <i>asynchronous events</i> flag
   set. This will <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
   identifier</a> given in what is now <a href="#the-document's-address">the document's address</a>.</li>

  </ol><p class=note>If the scrolling fails because the relevant <a href=#concept-id title=concept-id>ID</a> has
  not yet been parsed, then the original <a href=#navigate title=navigate>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>update the session history
  with the new page</a> algorithm.</p>

  <hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment identifier</dfn> and <a href=#the-indicated-part-of-the-document>the
  indicated part of the document</a>, if any, is <a href=#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>the indicated part of the document</a> is brought to the
  user's attention. If there is no indicated part, or if the indicated part is not <a href=#being-rendered>being
  rendered</a>, then the user agent must do nothing. The aforementioned algorithm is as
  follows:</p>

  <ol><li><p>Let <var title="">target</var> be <a href=#the-indicated-part-of-the-document>the indicated part of the
   document</a>, as defined below.</li>

   <li><p>If <var title="">target</var> is the top of the document, then <a href=#scroll-to-the-beginning-of-the-document>scroll to the
   beginning of the document</a> for the <code><a href=#document>Document</a></code>. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

   <li><p>Otherwise, use the <a href=#scroll-an-element-into-view>scroll an element into view</a> algorithm to scroll <var title="">target</var> into view, with the <var title="">align to top flag</var> set. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

  </ol><p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
  identifies. The semantics of the fragment identifier in terms of mapping it to a specific DOM Node
  is defined by the specification that defines the <a href=#mime-type>MIME type</a> used by the
  <code><a href=#document>Document</a></code> (for example, the processing of fragment identifiers for <a href=#xml-mime-type title="XML
  MIME type">XML MIME types</a> is the responsibility of RFC3023). <a href=#refsRFC3023>[RFC3023]</a></p>

  <p>For HTML documents (and <a href=#html-mime-type title="HTML MIME type">HTML MIME types</a>), the following
  processing model must be followed to determine what <a href=#the-indicated-part-of-the-document>the indicated part of the
  document</a> is.</p>

  <ol><li><p>Apply the <a href=#url-parser>URL parser</a> algorithm to the <a href=#url>URL</a>, and let <var title="">fragid</var> be the <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> component of the
   resulting <a href=#parsed-url>parsed URL</a>.</li><!-- parsing can't fail, since we checked earlier on
   when navigating -->

   <li><p>If <var title="">fragid</var> is the empty string, then <a href=#the-indicated-part-of-the-document>the indicated part of the
   document</a> is the top of the document; stop the algorithm here.</li>

   <li><p>Let <var title="">fragid bytes</var> be the result of <a href=#percent-decode title="percent
   decode">percent-decoding</a> <var title="">fragid</var>.</li>

   <li><p>Let <var title="">decoded fragid</var> be the result of applying the <a href=#utf-8-decoder>UTF-8
   decoder</a> algorithm to <var title="">fragid bytes</var>. If the <a href=#utf-8-decoder>UTF-8 decoder</a>
   emits a <a href=#decoder-error>decoder error</a>, abort the decoder and instead jump to the step labeled <i>no
   decoded fragid</i>.</li>

   <li><p>If there is an element in the DOM that has an <a href=#concept-id title=concept-id>ID</a> exactly
   equal to <var title="">decoded fragid</var>, then the first such element in tree order is
   <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>; stop the algorithm here.</li>

   <li><p><i>No decoded fragid</i>: If there is an <code><a href=#the-a-element>a</a></code> element in the DOM that has a <code title=attr-a-name><a href=#attr-a-name>name</a></code> attribute whose value is exactly equal to <var title="">fragid</var> (<em>not</em> <var title="">decoded fragid</var>), then the first such
   element in tree order is <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>; stop the algorithm
   here.</li>

   <li><p>If <var title="">fragid</var> is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
   string <code title="">top</code>, then <a href=#the-indicated-part-of-the-document>the indicated part of the document</a> is the top
   of the document; stop the algorithm here.</li>

   <li><p>Otherwise, there is no <a href=#the-indicated-part-of-the-document title="the indicated part of the document">indicated part of
   the document</a>.</li>

  </ol><p>For the purposes of the interaction of HTML with Selectors' <code title=selector-target>:target</code> pseudo-class, the <dfn id=target-element><i>target element</i></dfn> is
  <a href=#the-indicated-part-of-the-document>the indicated part of the document</a>, if that is an element; otherwise there is no
  <i><a href=#target-element>target element</a></i>. <a href=#refsSELECTORS>[SELECTORS]</a></p>

  <p>The <a href=#task-source>task source</a> for the task mentioned in this section must be the <a href=#dom-manipulation-task-source>DOM
  manipulation task source</a>.</p>

  </div>



  <h4 id=history-traversal><span class=secno>6.6.10 </span>History traversal</h4> <!-- session history -->

  <div class=impl>

  <p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn> to a <var title="">specified
  entry</var>, optionally with <a href=#replacement-enabled>replacement enabled</a>, and optionally with the
  <i>asynchronous events</i> flag set, the user agent must act as follows.</p>

  <p class=note>This algorithm is not just invoked when <a href=#traverse-the-history-by-a-delta title="traverse the history by a
  delta">explicitly going back or forwards in the session history</a> &mdash; it is also invoked
  in other situations, for example when <a href=#navigate title=navigate>navigating a browsing context</a>,
  as part of <a href=#update-the-session-history-with-the-new-page title="update the session history with the new page">updating the session history
  with the new page</a>.</p>

  <ol><li>

    <p>If there is no longer a <code><a href=#document>Document</a></code> object for the entry in question,
    <a href=#navigate>navigate</a><!--DONAV history traversal after eviction--> the <a href=#browsing-context>browsing context</a> to the
    resource for that entry to perform an <a href=#entry-update>entry update</a> of that entry, and abort these
    steps. The "<a href=#navigate>navigate</a>" algorithm reinvokes this "traverse" algorithm to complete the
    traversal, at which point there <em>is</em> a <code><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>source browsing context</a> as was
    used the first time this entry was created. (This can never happen with <a href=#replacement-enabled>replacement
    enabled</a>.)</p>

    <p class=note>If the resource was obtained usign a non-idempotent action, for example a POST
    form submission, or if the resource is no longer available, for example because the computer is
    now offline and the page wasn't cached, navigating to it again might not be possible. In this
    case, the navigation will result in a different page than previously; for example, it might be
    an error message explaining the problem or offering to resubmit the form.</p>

   </li>

   <li><p>If the <a href=#current-entry>current entry</a>'s title was not set by the <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> or <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState()</a></code> methods, then set its title to the value
   returned by the <code title=dom-document-title><a href=#document.title>document.title</a></code> IDL attribute.</li>

   <li><p>If appropriate, update the <a href=#current-entry>current entry</a> in the <a href=#browsing-context>browsing
   context</a>'s <code><a href=#document>Document</a></code> object's <code><a href=#history-0>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>an entry with persisted
   user state</a>.</li>

   <li><p>If the <var title="">specified entry</var> has a different <code><a href=#document>Document</a></code> object
   than the <a href=#current-entry>current entry</a>, then run the following substeps:</p>

    <ol><li><p>Remove any <a href=#concept-task title=concept-task>tasks</a> queued by the <a href=#history-traversal-task-source>history traversal
     task source</a> that are associated with any <code><a href=#document>Document</a></code> objects in the
     <a href=#top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family>document family</a>.</li> <!-- so the
     network is racing history.back(), in the case of setting location.href="" and then calling
     history.back() -->

     <li>

      <p>If the <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> of the <var title="">specified
      entry</var> is not the <a href=#same-origin title="same origin">same</a> as the <a href=#origin>origin</a> of the
      <code><a href=#document>Document</a></code> of the <a href=#current-entry>current entry</a>, then run the following
      sub-sub-steps:</p>

      <ol><li><p>The current <a href=#browsing-context-name>browsing context name</a> must be stored with all the entries in
       the history that are associated with <code><a href=#document>Document</a></code> objects with the <a href=#same-origin>same
       origin</a> as the <a href=#active-document>active document</a> <em>and</em> that are contiguous with the
       <a href=#current-entry>current entry</a>.</li>

       <li id=resetBCName><p>If the browsing context is a <a href=#top-level-browsing-context>top-level browsing context</a>,
       but not an <a href=#auxiliary-browsing-context>auxiliary browsing context</a>, then the browsing context's
       <a href=#browsing-context-name>browsing context name</a> must be unset.</li>

      </ol></li>

     <li id=appcache-history-2><p>Make the <var title="">specified entry</var>'s
     <code><a href=#document>Document</a></code> object the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
     context</a>.</li>

     <li>

      <p>If the <var title="">specified entry</var> has a <a href=#browsing-context-name>browsing context name</a> stored
      with it, then run the following sub-sub-steps:</p>

      <ol><li><p>Set the browsing context's <a href=#browsing-context-name>browsing context name</a> to the name stored with
       the specified entry.</li>

       <li><p>Clear any <a href=#browsing-context-name title="browsing context name">browsing context names</a> stored
       with all entries in the history that are associated with <code><a href=#document>Document</a></code> objects with
       the <a href=#same-origin>same origin</a> as the new <a href=#active-document>active document</a> and that are contiguous
       with the specified entry.</li>

      </ol></li>

     <li id=history-autocomplete><p>If the <var title="">specified entry</var>'s
     <code><a href=#document>Document</a></code> has any form controls whose <a href=#autofill-field-name>autofill field name</a> is "<code title=attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>", invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each of those elements.</li>

     <li>

      <p>If the <a href=#current-document-readiness>current document readiness</a> of the <var title="">specified entry</var>'s
      <code><a href=#document>Document</a></code> is "<code title="">complete</code>", <a href=#queue-a-task>queue a task</a> to run
      the following sub-sub-steps:</p>

      <ol><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a> flag is true, then abort this
       task (i.e. don't fire the event below).</li>

       <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a> flag to true.</li>

       <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> at the <code><a href=#window>Window</a></code> object of that
       <code><a href=#document>Document</a></code>, but with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
       <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the <code><a href=#window>Window</a></code> object),
       using the <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialized to true.
       This event must not bubble, must not be cancelable, and has no default action.</li>

      </ol><!-- an interesting thing to test would be to traverse back during onload, before the first
      pageshow has fired, and then to traverse forward again, and see if we get _two_ pageshows. If
      so, it indicates that browsers don't have a "page showing" flag like this and that the history
      traversal task source has a higher priority than the DOM manipulation task source. --></li>

    </ol></li>

   <li><p>Set <a href="#the-document's-address">the document's address</a> to the URL of the <var title="">specified
   entry</var>.</li>

   <li><p>If the <var title="">specified entry</var> has a URL whose fragment identifier differs
   from that of the <a href=#current-entry>current entry</a>'s when compared in a <a href=#case-sensitive>case-sensitive</a>
   manner, and the two share the same <code><a href=#document>Document</a></code> object, then let <var title="">hash
   changed</var> be true, and let <var title="">old URL</var> be the URL of the <a href=#current-entry>current
   entry</a> and <var title="">new URL</var> be the URL of the <var title="">specified
   entry</var>. Otherwise, let <var title="">hash changed</var> be false.</li>

   <li><p>If the traversal was initiated with <dfn id=replacement-enabled>replacement enabled</dfn>, remove the entry
   immediately before the <var title="">specified entry</var> in the session history.</p>

   <li><p>If the <var title="">specified entry</var> is not <a href=#an-entry-with-persisted-user-state>an entry with persisted user
   state</a>, but its URL has a fragment identifier, <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
   identifier</a>.</li>

   <li>

    <p>If the entry is <a href=#an-entry-with-persisted-user-state>an entry with persisted user state</a>, the user agent may update
    aspects of the document and its rendering, for instance the scroll position or values of form
    fields, that it had previously recorded.</p>

    <!-- see similar paragraphs in the textarea and input sections -->
    <p class=note>This can even include updating the <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute
    of <code><a href=#the-textarea-element>textarea</a></code> elements or <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in either the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state or the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a> state, if the persisted state includes the
    directionality of user input in such controls.</p>

   </li>

   <li><p>If the entry is a <a href=#state-object>state object</a> entry, let <var title="">state</var> be a
   <a href=#structured-clone>structured clone</a> of that state object. Otherwise, let <var title="">state</var> be
   null.</li>

   <li><p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to <var title="">state</var>.</li>

   <li><p>Let <var title="">state changed</var> be true if the <code><a href=#document>Document</a></code> of the <var title="">specified entry</var> has a <a href=#latest-entry>latest entry</a>, and that entry is not the <var title="">specified entry</var>; otherwise let it be false.</p>

   <li><p>Let the <a href=#latest-entry>latest entry</a> of the <code><a href=#document>Document</a></code> of the <var title="">specified entry</var> be the <var title="">specified entry</var>.</li>

   <li>

    <p>If the <i>asynchronous events</i> flag is not set, then run the following steps
    synchronously. Otherwise, the <i>asynchronous events</i> flag is set; <a href=#queue-a-task>queue a task</a>
    to run the following substeps.</p>

    <ol><li><p>If <var title="">state changed</var> is true, <a href=#concept-event-fire title=concept-event-fire>fire</a>
     a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-popstate><a href=#event-popstate>popstate</a></code> at the <code><a href=#window>Window</a></code> object of the
     <code><a href=#document>Document</a></code>, using the <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute initialized to the value of <var title="">state</var>. This event must bubble but not be cancelable and has no default
     action.</li>

     <li><p>If <var title="">hash changed</var> is true, then <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
     event with the name <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> at the <a href=#browsing-context>browsing
     context</a>'s <code><a href=#window>Window</a></code> object, using the <code><a href=#hashchangeevent>HashChangeEvent</a></code> interface,
     with the <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute initialized to <var title="">old URL</var> and the <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute
     initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
     no default action.</li>

    </ol></li>

   <li><p>The <a href=#current-entry>current entry</a> is now the <var title="">specified entry</var>.</li>

  </ol><p>The <a href=#task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>


  <h5 id=event-definitions-1><span class=secno>6.6.10.1 </span>Event definitions</h5>

  </div>

  <p>The <dfn id=event-popstate title=event-popstate><code>popstate</code></dfn> event
  is fired in certain cases when navigating to a <a href=#session-history-entry>session history
  entry</a>.</p>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#popstateeventinit>PopStateEventInit</a> eventInitDict)]
interface <dfn id=popstateevent>PopStateEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute any <a href=#dom-popstateevent-state title=dom-PopStateEvent-state>state</a>;
};

dictionary <dfn id=popstateeventinit>PopStateEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  any state;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code></dt>

   <dd>

    <p>Returns a copy of the information that was provided to <code title=dom-history-pushState><a href=#dom-history-pushstate>pushState()</a></code> or <code title=dom-history-replaceState><a href=#dom-history-replacestate>replaceState()</a></code>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-popstateevent-state title=dom-PopStateEvent-state><code>state</code></dfn> attribute must return the
  value it was initialized to. When the object is created, this attribute must be initialized to
  null. It represents the context information for the event, or null, if the state represented is
  the initial state of the <code><a href=#document>Document</a></code>.</p>

  </div>

  <hr><p>The <dfn id=event-hashchange title=event-hashchange><code>hashchange</code></dfn> event is fired when navigating
  to a <a href=#session-history-entry>session history entry</a> whose <a href=#url>URL</a> differs from that of the previous
  one only in the fragment identifier.</p>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#hashchangeeventinit>HashChangeEventInit</a> eventInitDict)]
interface <dfn id=hashchangeevent>HashChangeEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute DOMString <a href=#dom-hashchangeevent-oldurl title=dom-HashChangeEvent-oldURL>oldURL</a>;
  readonly attribute DOMString <a href=#dom-hashchangeevent-newurl title=dom-HashChangeEvent-newURL>newURL</a>;
};

dictionary <dfn id=hashchangeeventinit>HashChangeEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  DOMString oldURL;
  DOMString newURL;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code></dt>

   <dd>

    <p>Returns the <a href=#url>URL</a> of the <a href=#session-history-entry>session history entry</a> that was previously
    current.</p>

   </dd>


   <dt><var title="">event</var> . <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code></dt>

   <dd>

    <p>Returns the <a href=#url>URL</a> of the <a href=#session-history-entry>session history entry</a> that is now
    current.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-hashchangeevent-oldurl title=dom-HashChangeEvent-oldURL><code>oldURL</code></dfn> attribute must return the
  value it was initialized to. When the object is created, this attribute must be initialized to
  null. It represents context information for the event, specifically the URL of the <a href=#session-history-entry>session
  history entry</a> that was traversed from.</p>

  <p>The <dfn id=dom-hashchangeevent-newurl title=dom-HashChangeEvent-newURL><code>newURL</code></dfn> attribute must return the
  value it was initialized to. When the object is created, this attribute must be initialized to
  null. It represents context information for the event, specifically the URL of the <a href=#session-history-entry>session
  history entry</a> that was traversed to.</p>

  </div>

  <hr><p>The <dfn id=event-pageshow title=event-pageshow><code>pageshow</code></dfn> event is fired when traversing
  <em>to</em> a <a href=#session-history-entry>session history entry</a>. The <dfn id=event-pagehide title=event-pagehide><code>pagehide</code></dfn> event is fired when traversing <em>from</em> a
  <a href=#session-history-entry>session history entry</a>. The specification uses the <a href=#page-showing>page showing</a> flag to
  ensure that scripts receive these events in a consistent manner (e.g. that they never receive two
  <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> events in a row without an intervening <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>, or vice versa).</p>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#pagetransitioneventinit>PageTransitionEventInit</a> eventInitDict)]
interface <dfn id=pagetransitionevent>PageTransitionEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute boolean <a href=#dom-pagetransitionevent-persisted title=dom-PageTransitionEvent-persisted>persisted</a>;
};

dictionary <dfn id=pagetransitioneventinit>PageTransitionEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  boolean persisted;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code></dt>

   <dd>

    <p>Returns false if the page is newly being loaded (and the <code title=event-load>load</code>
    event will fire). Otherwise, returns true.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-pagetransitionevent-persisted title=dom-PageTransitionEvent-persisted><code>persisted</code></dfn> attribute must
  return the value it was initialized to. When the object is created, this attribute must be
  initialized to false. It represents the context information for the event.</p>

  </div>



  <h4 id=unloading-documents><span class=secno>6.6.11 </span>Unloading documents</h4>

  <div class=impl>

  <p>A <code><a href=#document>Document</a></code> has a <dfn id=concept-document-salvageable title=concept-document-salvageable><i>salvageable</i></dfn> state, which must initially be
  true, a <dfn id=fired-unload>fired unload</dfn> flag, which must initially be false, and a <dfn id=page-showing>page showing</dfn>
  flag, which must initially be false.</p>

  <p><a href=#event-loop title="event loop">Event loops</a> have a <dfn id=termination-nesting-level>termination nesting level</dfn>
  counter, which must initially be zero.</p>

  <p>When a user agent is to <dfn id=prompt-to-unload-a-document>prompt to unload a document</dfn>, it must run the following
  steps.</p>

  <ol><li><p>Increase the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> by
   one.</li>

   <li><p>Increase the <code><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> by
   one.</li>

   <li><p>Let <var title="">event</var> be a new <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
   <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> event object with the name <code title=event-beforeunload>beforeunload</code>, which does not bubble but is cancelable.</li>

   <li><p><i>Dispatch</i>: <a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> <var title="">event</var> at the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>

   <li><p>Decrease the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> by
   one.</li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <li><p>If any event listeners were triggered by the earlier <i>dispatch</i> step, then set the
   <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to
   false.</li>

   <li>

    <p>If the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute of the
    <var title="">event</var> object is not the empty string, or if the event was canceled, then the
    user agent should ask the user to confirm that they wish to unload the document.</p>

    <p>The prompt shown by the user agent may include the string of the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute, or some leading subset
    thereof. (A user agent may want to truncate the string to 1024 characters for display, for
    instance.)</p>

    <p>The user agent must <a href=#pause>pause</a> while waiting for the user's response.</p>

    <p>If the user did not confirm the page navigation, then the user agent <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow
    the document to be unloaded</dfn>.</p>

   </li>

   <li><p>If this algorithm was invoked by another instance of the "prompt to unload a document"
   algorithm (i.e. through the steps below that invoke this algorithm for all descendant browsing
   contexts), then jump to the step labeled <i>end</i>.</li>

   <li><p>Let <var title="">descendants</var> be the <a href=#list-of-the-descendant-browsing-contexts>list of the descendant browsing
   contexts</a> of the <code><a href=#document>Document</a></code>.</li>

   <li>

    <p>If <var title="">descendants</var> is not an empty list, then for each <a href=#browsing-context>browsing
    context</a> <var title="">b</var> in <var title="">descendants</var> run the following
    substeps:</p>

    <ol><li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to unload</a> the <a href=#active-document>active
     document</a> of the <a href=#browsing-context>browsing context</a> <var title="">b</var>. If the user
     <a href=#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 title="refused to allow the document to be unloaded">refused to allow <em>this</em> document to
     be unloaded</a>; jump to the step labeled <i>end</i>.</p>

<!--CLEANUP-->
     <li><p>If the <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state of the <a href=#active-document>active
     document</a> of the <a href=#browsing-context>browsing context</a> <var title="">b</var> is false, then set
     the <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state of <em>this</em> document
     to false also.</li>

    </ol></li>

   <li><p><i>End</i>: Decrease the <code><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload
   counter</a> by one.</li>

  </ol><p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run the following steps. These
  steps are passed an argument, <var title="">recycle</var>, which is either true or false,
  indicating whether the <code><a href=#document>Document</a></code> object is going to be re-used. (This is set by the
  <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>

  <ol><li><p>Increase the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> by
   one.</li>

   <li><p>Increase the <code><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> by
   one.</li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a> flag is false, then jump to the
   step labeled <i>unload event</i> below (i.e. skip firing the <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event and don't rerun the <a href=#unloading-document-visibility-change-steps>unloading document
   visibility change steps</a>).</li>

   <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a> flag to false.</li>

   <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> at the <code><a href=#window>Window</a></code> object of the
   <code><a href=#document>Document</a></code>, but with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
   <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code>
   set to the <code><a href=#window>Window</a></code> object), using the <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface,
   with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialized
   to true. This event must not bubble, must not be cancelable, and has no default action.</li>

   <li>

    <p>Run any <dfn id=unloading-document-visibility-change-steps>unloading document visibility change steps</dfn> for <code><a href=#document>Document</a></code> that
    are defined by <a href=#other-applicable-specifications>other applicable specifications</a>.</p>

    <p class=note>This is specifically intended for use by the Page Visibility specification. <a href=#refsPAGEVIS>[PAGEVIS]</a></p>

   </li>

   <li><p><i>Unload event</i>: If the <code><a href=#document>Document</a></code>'s <a href=#fired-unload>fired unload</a> flag is
   false, <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-unload>unload</code> at the
   <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>

   <li><p>Decrease the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> by
   one.</li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <li><p>If any event listeners were triggered by the earlier <i>unload event</i> step, then set
   the <code><a href=#document>Document</a></code> object's <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i>
   state to false and set the <code><a href=#document>Document</a></code>'s <a href=#fired-unload>fired unload</a> flag to
   true.</li>

   <li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for <code><a href=#document>Document</a></code> that are
   defined by this specification and <a href=#other-applicable-specifications>other applicable specifications</a>.</li>

   <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>

   <li><p>Let <var title="">descendants</var> be the <a href=#list-of-the-descendant-browsing-contexts>list of the descendant browsing
   contexts</a> of the <code><a href=#document>Document</a></code>.</li>

   <li>

    <p>If <var title="">descendants</var> is not an empty list, then for each <a href=#browsing-context>browsing
    context</a> <var title="">b</var> in <var title="">descendants</var> run the following
    substeps:</p>

    <ol><li><p><a href=#unload-a-document title="unload a document">Unload</a> the <a href=#active-document>active document</a> of the
     <a href=#browsing-context>browsing context</a> <var title="">b</var> with the <var title="">recycle</var>
     parameter set to false.</li>

<!--CLEANUP-->
     <li><p>If the <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state of the <a href=#active-document>active
     document</a> of the <a href=#browsing-context>browsing context</a> <var title="">b</var> is false, then set
     the <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state of <em>this</em> document
     to false also.</li>

    </ol></li>

   <li><p>If both the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state and <var title="">recycle</var> are false, then the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing
   context</a> must <a href=#discard-a-document title="discard a document">discard the
   <code>Document</code></a>.</li>

   <li><p><i>End</i>: Decrease the <code><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload
   counter</a> by one.</li>

  </ol><p>This specification defines the following <dfn id=unloading-document-cleanup-steps>unloading document cleanup steps</dfn>. Other
  specifications can define more.</p>

  <ol><li>

    <p><a href=#make-disappear>Make disappear</a> any <code><a href=#websocket>WebSocket</a></code> objects that were created by the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor whose global object is the
    <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</p>

    <p>If this affected any <code><a href=#websocket>WebSocket</a></code> objects, then set <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.</p>

   </li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i>
   state is false, <a href=#concept-eventsource-forcibly-close title=concept-EventSource-forcibly-close>forcibly close</a> any
   <code><a href=#eventsource>EventSource</a></code> objects that whose constructor was invoked from the
   <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i>
   state is false, empty the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>'s <a href=#list-of-active-timers>list of active
   timers</a>.</li>

  </ol><h5 id=event-definition><span class=secno>6.6.11.1 </span>Event definition</h5>

  </div>

  <pre class=idl>interface <dfn id=beforeunloadevent>BeforeUnloadEvent</dfn> : <a href=#event>Event</a> {
           attribute DOMString <a href=#dom-beforeunloadevent-returnvalue title=dom-BeforeUnloadEvent-returnValue>returnValue</a>;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current return value of the event (the message to show the user).</p>

    <p>Can be set, to update the message.</p>

   </dd>

  </dl><p class=note>There are no <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>-specific
  initialization methods.</p>

  <div class=impl>

  <p>The <dfn id=dom-beforeunloadevent-returnvalue title=dom-BeforeUnloadEvent-returnValue><code>returnValue</code></dfn>
  attribute represents the message to show the user. When the event is
  created, the attribute must be set to the empty string. On getting,
  it must return the last value it was set to. On setting, the
  attribute must be set to the new value.</p>

  </div>


  <div class=impl>

  <h4 id=aborting-a-document-load><span class=secno>6.6.12 </span>Aborting a document load</h4>

  <p>If a <code><a href=#document>Document</a></code> is <dfn id=abort-a-document title="abort a
  document">aborted</dfn>, the user agent must run the following
  steps:</p>

  <ol><li><p><a href=#abort-a-document title="abort a document">Abort</a> the <a href=#active-document title="active document">active
   documents</a> of every <a href=#child-browsing-context>child browsing context</a>. If this results in any of those
   <code><a href=#document>Document</a></code> objects having their <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state set to false, then set this
   <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to
   false also.</li>

   <li><p>Cancel any instances of the <a href=#fetch title=fetch>fetch</a> algorithm in the context of
   this <code><a href=#document>Document</a></code>, discarding any <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> for them, and discarding any further data received from the
   network for them. If this resulted in any instances of the <a href=#fetch title=fetch>fetch</a>
   algorithm being canceled or any <a href=#queue-a-task title="queue a task">queued</a> <a href=#concept-task title=concept-task>tasks</a> or any network data getting discarded, then set the
   <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to
   false.</li>

   <li><p>If the <code><a href=#document>Document</a></code> has an <a href=#active-parser>active parser</a>, then <a href=#abort-a-parser title="abort a
   parser">abort that parser</a> and set the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.</li>

   <!-- we could also stop all script, or stop animations -->

  </ol><p>User agents may allow users to explicitly invoke the <a href=#abort-a-document title="abort a document">abort a document</a> algorithm for a
  <code><a href=#document>Document</a></code>. If the user does so, then, if that
  <code><a href=#document>Document</a></code> is an <a href=#active-document>active document</a>, the user
  agent should <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
  event</a> named <code title=event-abort>abort</code> at that
  <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object before invoking
  the <a href=#abort-a-document title="abort a document">abort</a> algorithm.</p>

  <!-- I'd love to make this more precise, anyone have any suggestions
  on what it should say? -->

  </div>


<!--TOPIC:Offline Web Applications-->
  <h3 id=offline><span class=secno>6.7 </span>Offline Web applications</h3>

  <!-- v2 ideas for appcache:

     * A way to limit what gets download when the user agent is
       updating the application cache and it turns out the server has
       changed EVERY page because every page has a dynamic "site last
       modified" date on it.

       http://groups.google.com/group/gears-users/browse_thread/thread/efbd808325df607a/c73adb34f9b63cf7?hl=en&q=whatwg#c73adb34f9b63cf7


     * Multiuser appcaches.

       If the application code (HTML, JS, CSS) is all the same for two
       users, then appcache works for multiple users by just having
       the data for the users separate from the logic.

       This is the expected model for most apps. For example, your
       typical blog has just one set of CSS for all users.

       For systems where the user affects what HTML, JS, and CSS is
       served back, the spec as written pretty much requires that
       there be one app per user, and one generic "login" app that
       then redirects to one of those other apps - and where each app
       has a different base URL, separate manifest, etc.

       An alternative that we could explore in a future version is to
       have the manifest include a manifest name, and then have script
       that allows you to "activate" a particular manifest name for a
       given appcache.

       So each appcache group would be further subdivided into named
       subgroups, and for a given manifest URL with such a group of
       subgroups, one subgroup would be the default one at a time. The
       inactive ones would just lie dormant, but and the active ones
       would act like now, but there'd be a scripted way to change the
       default (and maybe query what available variants exist for the
       current appcache), so that you could log back in as someone
       else by just making the script pick the other user's variant,
       and then reloading.


     * Add and remove specific additional files from the cache (e.g.
       precaching new master entries).

  -->

  <h4 id=introduction-5><span class=secno>6.7.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>In order to enable users to continue interacting with Web
  applications and documents even when their network connection is
  unavailable &mdash; for instance, because they are traveling outside
  of their ISP's coverage area &mdash; authors can provide a manifest
  which lists the files that are needed for the Web application to
  work offline and which causes the user's browser to keep a copy of
  the files for use offline.</p>

  <p>To illustrate this, consider a simple clock applet consisting of
  an HTML page "<code title="">clock.html</code>", a CSS style sheet
  "<code title="">clock.css</code>", and a JavaScript script "<code title="">clock.js</code>".</p>

  <p>Before adding the manifest, these three files might look like
  this:</p>

  <pre>&lt;!-- clock.html --&gt;
&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Clock&lt;/title&gt;
  &lt;script src="clock.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="clock.css"&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;The time is: &lt;output id="clock"&gt;&lt;/output&gt;&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</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 title="">clock.html</code>"
  page while offline, though, the user agent (unless it happens to
  have it still in the local cache) will fail with an error.</p>

  <p>The author can instead provide a manifest of the three files, say
  "<code title="">clock.appcache</code>":</p>

  <pre>CACHE MANIFEST
clock.html
clock.css
clock.js
</pre>

  <p>With a small change to the HTML file, the manifest (served as
  <code><a href=#text/cache-manifest>text/cache-manifest</a></code>) is linked to the application:</p>

  <pre>&lt;!-- clock.html --&gt;
&lt;!DOCTYPE HTML&gt;
&lt;html manifest="clock.appcache"&gt;
 &lt;head&gt;
  &lt;title&gt;Clock&lt;/title&gt;
  &lt;script src="clock.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="clock.css"&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;The time is: &lt;output id="clock"&gt;&lt;/output&gt;&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  <p>Now, if the user goes to the page, the browser will cache the
  files and make them available even when the user is offline.</p>

  <p class=note>Authors are encouraged to include the main page in
  the manifest also, but in practice the page that referenced the
  manifest is automatically cached even if it isn't explicitly
  mentioned.</p>

  <p class=note>With the exception of "no-store" directive, HTTP
  cache headers and restrictions on caching pages served over TLS
  (encrypted, using <code title="">https:</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=http://www.whatwg.org/demos/offline/clock/live-demo/clock.html>View this example online</a>.</p>



  <h5 id=supporting-offline-caching-for-legacy-applications><span class=secno>6.7.1.1 </span>Supporting offline caching for legacy applications</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The application cache feature works best if the application logic is separate from the
  application and user data, with the logic (markup, scripts, style sheets, images, etc) listed in
  the manifest and stored in the application cache, with a finite number of static HTML pages for
  the application, and with the application and user data stored in Web Storage or a client-side
  Indexed Database, updated dynamically using Web Sockets, <code>XMLHttpRequest</code>, server-sent
  events, or some other similar mechanism.</p>

  <p>This model results in a fast experience for the user: the application immediately loads, and
  fresh data is obtained as fast as the network will allow it (possibly while stale data shows).</p>

  <p>Legacy applications, however, tend to be designed so that the user data and the logic are mixed
  together in the HTML, with each operation resulting in a new HTML page from the server.</p>

  <div class=example>

   <p>For example, consider a news application. The typical architecture of such an application,
   when not using the application cache feature, is that the user fetches the main page, and the
   server returns a dynamically-generated page with the current headlines and the user interface
   logic mixed together.</p>

   <p>A news application designed for the application cache feature, however, would instead have the
   main page just consist of the logic, and would then have the main page fetch the data separately
   from the server, e.g. using <code>XMLHttpRequest</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 title=concept-appcache-mode-prefer-online>prefer-online</a> <a href=#concept-appcache-mode title=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 title=concept-appcache-manifest>application cache manifest</a>, use the <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute to select that manifest from the HTML file,
  and then add the following line at the bottom of the manifest:</p>

  <pre>SETTINGS:
prefer-online
NETWORK:
*</pre>

  <p>This causes the <a href=#application-cache>application cache</a> to only be used for <a href=#concept-appcache-master title=concept-appcache-master>master entries</a> when the user is offline, and causes the
  application cache to be used as an atomic HTTP cache (essentially pinning resources listed in the
  manifest), while allowing all resources not listed in the manifest to be accessed normally when
  the user is online.</p>



  <h5 id=appcacheevents><span class=secno>6.7.1.2 </span>Event summary</h5>

  <p><i>This section is non-normative.</i></p>

  <p>When the user visits a page that declares a manifest, the browser
  will try to update the cache. It does this by fetching a copy of the
  manifest and, if the manifest has changed since the user agent last
  saw it, redownloading all the resources it mentions and caching them
  anew.</p>

  <p>As this is going on, a number of events get fired on the
  <code><a href=#applicationcache>ApplicationCache</a></code> object to keep the script updated as
  to the state of the cache update, so that the user can be notified
  appropriately. The events are as follows:</p>

  <table><thead><tr><th> Event name
     <th> Interface
     <th> Fired when...
     <th> Next events
   <tbody><tr><td> <dfn id=event-appcache-checking title=event-appcache-checking><code>checking</code></dfn>
     <td> <code><a href=#event>Event</a></code>
     <td> The user agent is checking for an update, or attempting to download the manifest for the first time. <strong>This is always the first event in the sequence.</strong>
     <td> <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code>, <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>, <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>, <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>
    <tr><td> <dfn id=event-appcache-noupdate title=event-appcache-noupdate><code>noupdate</code></dfn>
     <td> <code><a href=#event>Event</a></code>
     <td> The manifest hadn't changed.
     <td> Last event in sequence.
    <tr><td> <dfn id=event-appcache-downloading title=event-appcache-downloading><code>downloading</code></dfn>
     <td> <code><a href=#event>Event</a></code>
     <td> The user agent has found an update and is fetching it, or is downloading the resources listed by the manifest for the first time.
     <td> <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>, <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code>, <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
    <tr><td> <dfn id=event-appcache-progress title=event-appcache-progress><code>progress</code></dfn>
     <td> <code><a href=#progressevent>ProgressEvent</a></code>
     <td> The user agent is downloading resources listed by the manifest.
          The event object's <code title=dom-ProgressEvents-total>total</code> attribute returns the total number of files to be downloaded.
          The event object's <code title=dom-ProgressEvents-loaded>loaded</code> attribute returns the number of files processed so far.
     <td> <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>, <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code>, <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
    <tr><td> <dfn id=event-appcache-cached title=event-appcache-cached><code>cached</code></dfn>
     <td> <code><a href=#event>Event</a></code>
     <td> The resources listed in the manifest have been downloaded, and the application is now cached.
     <td> Last event in sequence.
    <tr><td> <dfn id=event-appcache-updateready title=event-appcache-updateready><code>updateready</code></dfn>
     <td> <code><a href=#event>Event</a></code>
     <td> The resources listed in the manifest have been newly redownloaded, and the script can use <code title=dom-appcache-swapCache><a href=#dom-appcache-swapcache>swapCache()</a></code> to switch to the new cache.
     <td> Last event in sequence.
    <tr><td> <dfn id=event-appcache-obsolete title=event-appcache-obsolete><code>obsolete</code></dfn>
     <td> <code><a href=#event>Event</a></code>
     <td> The manifest was found to have become a 404 or 410 page, so the application cache is being deleted.
     <td> Last event in sequence.
    <tr><td rowspan=4> <dfn id=event-appcache-error title=event-appcache-error><code>error</code></dfn>
     <td rowspan=4> <code><a href=#event>Event</a></code>
     <td> The manifest was a 404 or 410 page, so the attempt to cache the application has been aborted.
     <td rowspan=3> Last event in sequence.
    <tr><td> The manifest hadn't changed, but the page referencing the manifest failed to download properly.
    <tr><td> A fatal error occurred while fetching the resources listed in the manifest.
    <tr><td> The manifest changed while the update was being run.
     <td> The user agent will try fetching the files again momentarily.
  </table><p>These events are cancelable; their default action is for the user agent to show download
  progress information. If the page shows its own update UI, canceling the events will prevent the
  user agent from showing redundant progress information.</p>



  <div class=impl>

  <h4 id=appcache><span class=secno>6.7.2 </span>Application caches</h4> <!--APPCACHE-->

  <p>An <dfn id=application-cache>application cache</dfn> is a set of cached resources
  consisting of:</p>

  <ul><li>

    <p>One or more resources (including their out-of-band metadata,
    such as HTTP headers, if any), identified by URLs, each falling
    into one (or more) of the following categories:</p>

    <dl><dt><dfn id=concept-appcache-master title=concept-appcache-master>Master entries</dfn>

     <dd><p class=note>These are documents that were added to the
     cache because a <a href=#browsing-context>browsing context</a> was <a href=#navigate title=navigate>navigated</a> to that document and the
     document indicated that this was its cache, using the <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute.</p>


     <dt><dfn id=concept-appcache-manifest title=concept-appcache-manifest>The manifest</dfn>

     <dd><p class=note>This is the resource corresponding to the URL
     that was given in a master entry's <code><a href=#the-html-element>html</a></code> element's
     <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute. The
     manifest is fetched and processed during the <a href=#application-cache-download-process>application
     cache download process</a>. All the <a href=#concept-appcache-master title=concept-appcache-master>master entries</a> have the
     <a href=#same-origin title="same origin">same origin</a> as the manifest.</p>


     <dt><dfn id=concept-appcache-explicit title=concept-appcache-explicit>Explicit entries</dfn>

     <dd><p class=note>These are the resources that were listed in
     the cache's <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> in an <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit
     section</a>.</p>


     <dt><dfn id=concept-appcache-fallback title=concept-appcache-fallback>Fallback entries</dfn>

     <dd><p class=note>These are the resources that were listed in
     the cache's <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> in a <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback
     section</a>.</p>


    </dl><p><a href=#concept-appcache-explicit title=concept-appcache-explicit>Explicit entries</a>
    and <a href=#concept-appcache-fallback title=concept-appcache-fallback>Fallback
    entries</a> can be marked as <dfn id=concept-appcache-foreign title=concept-appcache-foreign>foreign</dfn>, which means that
    they have a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
    attribute but that it doesn't point at this cache's <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>.</p>

    <p class=note>A URL in the list can be flagged with multiple
    different types, and thus an entry can end up being 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>

   <li>

    <p>Zero or more <dfn id=concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
    namespaces</dfn>, each of which is mapped to a <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entry</a>.</p>

    <p class=note>These are URLs used as <a href=#concept-appcache-matches-fallback title=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 title=concept-appcache-fallback>fallback entry</a> if not.
    Each namespace URL has the <a href=#same-origin>same origin</a> as <a href=#concept-appcache-manifest title=concept-appcache-manifest>the manifest</a>.</p>

   </li>

   <li>

    <p>Zero or more URLs that form the <dfn id=concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist
    namespaces</dfn>.</p>

    <p class=note>These are used as prefix match patterns, and
    declare URLs for which the user agent will ignore the application
    cache, instead fetching them normally (i.e. from the network or
    local HTTP cache as appropriate).</p>

   </li>

   <li>

    <p>An <dfn id=concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
    wildcard flag</dfn>, which is either <i title="">open</i> or <i title="">blocking</i>.</p>

    <p class=note>The <i title="">open</i> state indicates that any
    URL not listed as cached is to be implicitly treated as being in
    the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
    whitelist namespaces</a>; the <i title="">blocking</i> state
    indicates that URLs not listed explicitly in the manifest are to
    be treated as unavailable.</p>

   </li>

   <li>

    <p>A <dfn id=concept-appcache-mode title=concept-appcache-mode>cache mode flag</dfn>, which is either in the <dfn id=concept-appcache-mode-fast title=concept-appcache-mode-fast><i>fast</i></dfn> state or the <dfn id=concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online><i>prefer-online</i></dfn> state.</p>

   </li>

  </ul><p>Each <a href=#application-cache>application cache</a> has a <dfn id=concept-appcache-completeness title=concept-appcache-completeness>completeness flag</dfn>, which is
  either <i>complete</i> or <i>incomplete</i>.</p>

  <hr><p>An <dfn id=application-cache-group>application cache group</dfn> is a group of <a href=#application-cache title="application cache">application caches</a>, identified by
  the <a href=#absolute-url>absolute URL</a> of a resource <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> which is used to
  populate the caches in the group.</p>

  <p>An <a href=#application-cache>application cache</a> is <dfn id=concept-appcache-newer title=concept-appcache-newer>newer</dfn> than another if it was
  created after the other (in other words, <a href=#application-cache title="application
  cache">application caches</a> in an <a href=#application-cache-group>application cache
  group</a> have a chronological order).</p>

  <p>Only the newest <a href=#application-cache>application cache</a> in an
  <a href=#application-cache-group>application cache group</a> can have its <a href=#concept-appcache-completeness title=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>application cache group</a> has an <dfn id=concept-appcache-status title=concept-appcache-status>update status</dfn>, which is one of
  the following: <i>idle</i>, <i>checking</i>, <i>downloading</i>.</p>

  <p>A <dfn id=relevant-application-cache>relevant application cache</dfn> is an <a href=#application-cache>application
  cache</a> that is the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> in its <a href=#application-cache-group title="application cache group">group</a> to be
  <i>complete</i>.</p>

  <p>Each <a href=#application-cache-group>application cache group</a> has a <dfn id=concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
  entries</dfn>. Each entry in this list consists of a resource and a
  corresponding <code><a href=#document>Document</a></code> object. It is used during the
  <a href=#application-cache-download-process>application cache download process</a> to ensure that new
  master entries are cached even if the <a href=#application-cache-download-process>application cache
  download process</a> was already running for their
  <a href=#application-cache-group>application cache group</a> when they were loaded.</p>

  <p>An <a href=#application-cache-group>application cache group</a> can be marked as <dfn id=concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</dfn>, meaning that it
  must be ignored when looking at what <a href=#application-cache-group title="application cache
  group">application cache groups</a> exist.</p>

  <hr><p>A <dfn id=cache-host>cache host</dfn> is a <code><a href=#document>Document</a></code> or a
  <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object. A <a href=#cache-host>cache
  host</a> can be associated with an <a href=#application-cache>application
  cache</a>.
  </p>

  <p>A <code><a href=#document>Document</a></code> initially is not associated with an
  <a href=#application-cache>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 title=navigate>navigation</a> sections cause <a href=#concept-appcache-init title=concept-appcache-init>cache selection</a> to occur.</p>

  <p>A <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> can be associated with an
  <a href=#application-cache>application cache</a> when it is created.
  </p>

  <p>Each <a href=#cache-host>cache host</a> has an associated
  <code><a href=#applicationcache>ApplicationCache</a></code> object.</p>

  <hr><p>Multiple <a href=#application-cache title="application cache">application
  caches</a> in different <a href=#application-cache-group title="application cache
  group">application cache groups</a> can contain the same
  resource, e.g. if the manifests all reference that resource. If the
  user agent is to <dfn id=concept-appcache-selection title=concept-appcache-selection>select an
  application cache</dfn> from a list of <a href=#relevant-application-cache title="relevant
  application cache">relevant application caches</a> that contain a
  resource, the user agent must use the application cache that the
  user most likely wants to see the resource from, taking into account
  the following:</p>

  <ul><li>which application cache was most recently updated,

   <li>which application cache was being used to display the
   resource from which the user decided to look at the new resource,
   and

   <li>which application cache the user prefers.

  </ul><hr><p>A URL <dfn id=concept-appcache-matches-fallback title=concept-appcache-matches-fallback>matches a
  fallback namespace</dfn> if there exists a <a href=#relevant-application-cache>relevant
  application cache</a> whose <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>'s URL has the
  <a href=#same-origin>same origin</a> as the URL in question, and that has a
  <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>
  that is a <a href=#prefix-match>prefix match</a> for the URL being examined. If
  multiple fallback namespaces match the same URL, the longest one is
  the one that matches. A URL looking for a fallback namespace can
  match more than one application cache at a time, but only matches
  one namespace in each cache.</p>

  <div class=example>

   <p>If a manifest <code title="">http://example.com/app1/manifest</code> declares that
   <code title="">http://example.com/resources/images</code> is a
   fallback namespace, and the user navigates to <code title="">HTTP://EXAMPLE.COM:80/resources/images/cat.png</code>,
   then the user agent will decide that the application cache
   identified by <code title="">http://example.com/app1/manifest</code> contains a
   namespace with a match for that URL.</p>

   <!-- "resolve a url" canonicalises the case for the scheme and host
   and removes the port if it is the default -->

  </div>

  </div>



  <h4 id=manifests><span class=secno>6.7.3 </span>The cache manifest syntax</h4>


  <h5 id=some-sample-manifests><span class=secno>6.7.3.1 </span>Some sample manifests</h5>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

   <p>This example manifest requires two images and a style sheet to be
   cached and whitelists a CGI script.</p>

   <pre>CACHE MANIFEST
# the above line is required

# this is a comment
# there can be as many of these anywhere in the file
# they are all ignored
  # comments can have spaces before them
  # but must be alone on the line

# blank lines are ignored too

# these are files that need to be cached they can either be listed
# first, or a "CACHE:" header could be put before them, as is done
# lower down.
images/sound-icon.png
images/background.png
# note that each file has to be put on its own line

# here is a file for the online whitelist -- it isn't cached, and
# references to this file will bypass the cache, always hitting the
# network (or trying to, if the user is offline).
NETWORK:
comm.cgi

# here is another set of files to cache, this time just the CSS file.
CACHE:
style/default.css</pre>

   <p>It could equally well be written as follows:</p>

   <pre>CACHE MANIFEST
NETWORK:
comm.cgi
CACHE:
style/default.css
images/sound-icon.png
images/background.png</pre>

  </div>

  <div class=example>

   <p>Offline application cache manifests can use absolute paths or
   even absolute URLs:</p>

   <pre>CACHE MANIFEST

/main/home
/main/app.js
/settings/home
/settings/app.js
http://img.example.com/logo.png
http://img.example.com/check.png
http://img.example.com/cross.png</pre>

  </div>

  <div class=example>

   <p>The following manifest defines a catch-all error page that is
   displayed for any page on the site while the user is offline. It
   also specifies that the <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
   wildcard flag</a> is <i title="">open</i>, meaning that accesses
   to resources on other sites will not be blocked. (Resources on the
   same site are already not blocked because of the catch-all fallback
   namespace.)</p>

   <p>So long as all pages on the site reference this manifest, they
   will get cached locally as they are fetched, so that subsequent hits
   to the same page will load the page immediately from the
   cache. Until the manifest is changed, those pages will not be
   fetched from the server again. When the manifest changes, then all
   the files will be redownloaded.</p>

   <p>Subresources, such as style sheets, images, etc, would only be
   cached using the regular HTTP caching semantics, however.</p>

   <pre>CACHE MANIFEST
FALLBACK:
/ /offline.html
NETWORK:
*</pre>

  </div>


  <h5 id=writing-cache-manifests><span class=secno>6.7.3.2 </span>Writing cache manifests</h5>

  <p>Manifests must be served using the <code><a href=#text/cache-manifest>text/cache-manifest</a></code> <a href=#mime-type>MIME type</a>. All
  resources served using the <code><a href=#text/cache-manifest>text/cache-manifest</a></code> <a href=#mime-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=#refsRFC3629>[RFC3629]</a></p>

  <p class=note>This is a <a href=#willful-violation>willful violation</a> of RFC 2046, which requires all <code title="">text/*</code> types to only allow CRLF line breaks. This requirement, however, is
  outdated; the use of CR, LF, and CRLF line breaks is commonly supported and indeed sometimes CRLF
  is <em>not</em> supported by text editors. <a href=#refsRFC2046>[RFC2046]</a></p>

  <p>The first line of an application cache manifest must consist of the string "CACHE", a single
  U+0020 SPACE character, the string "MANIFEST", and either a U+0020 SPACE character, a U+0009
  CHARACTER TABULATION (tab) character, a U+000A LINE FEED (LF) character, or a U+000D CARRIAGE
  RETURN (CR) character. The first line may optionally be preceded by a U+FEFF BYTE ORDER MARK (BOM)
  character. If any other text is found on the first line, it is ignored.</p>

  <p>Subsequent lines, if any, must all be one of the following:</p>

  <dl><dt>A blank line
   <dd>
    <p>Blank lines must consist of zero or more U+0020 SPACE and
    U+0009 CHARACTER TABULATION (tab) characters only.</p>

   <dt>A comment
   <dd>
    <p>Comment lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
    characters, followed by a single U+0023 NUMBER SIGN character (#), followed by zero or more
    characters other than U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters.</p>

    <p class=note>Comments must be on a line on their own. If they were to be included on a line
    with a URL, the "#" would be mistaken for part of a fragment identifier.</p>

   <dt>A section header
   <dd>

    <p>Section headers change the current section. There are four possible section headers:

    <dl><dt><code>CACHE:</code>
     <dd>Switches to the <dfn id=concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit section</dfn>.

     <dt><code>FALLBACK:</code>
     <dd>Switches to the <dfn id=concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback section</dfn>.

     <dt><code>NETWORK:</code>
     <dd>Switches to the <dfn id=concept-appcache-manifest-network title=concept-appcache-manifest-network>online whitelist section</dfn>.

     <dt><code>SETTINGS:</code>
     <dd>Switches to the <dfn id=concept-appcache-manifest-settings title=concept-appcache-manifest-settings>settings section</dfn>.

    </dl><p>Section header lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
    TABULATION (tab) characters, followed by one of the names above (including the U+003A COLON
    character (:)) followed by zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
    characters.</p>

    <p>Ironically, by default, the current section is the <a href=#concept-appcache-manifest-explicit title=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 title=concept-appcache-manifest-explicit>explicit
    section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
    TABULATION (tab) characters, a <a href=#valid-url>valid URL</a> identifying a resource other than the
    manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
    characters.</p>

    <p>When the current section is the <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>fallback
    section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
    TABULATION (tab) characters, a <a href=#valid-url>valid URL</a> identifying a resource other than the
    manifest itself, one or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters,
    another <a href=#valid-url>valid URL</a> identifying a resource other than the manifest itself, and then
    zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.</p>

    <p>When the current section is the <a href=#concept-appcache-manifest-network title=concept-appcache-manifest-network>online
    whitelist section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009
    CHARACTER TABULATION (tab) characters, either a single U+002A ASTERISK character (*) <!--
    concept-appcache-onlinewhitelist-wildcard --> or a <a href=#valid-url>valid URL</a> identifying a resource
    other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER
    TABULATION (tab) characters.</p>

    <p>When the current section is the <a href=#concept-appcache-manifest-settings title=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 title=concept-appcache-manifest-setting>setting</a>,
    and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.</p>

    <p>Currently only one <dfn id=concept-appcache-manifest-setting title=concept-appcache-manifest-setting>setting</dfn> is
    defined:</p>

    <dl><dt>The cache mode setting</dt>

     <dd>This consists of the string "<code title="">prefer-online</code>". It sets the <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode</a> to <a href=#concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online>prefer-online</a>. (The <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode</a> defaults to <a href=#concept-appcache-mode-fast title=concept-appcache-mode-fast>fast</a>.)</dd>

    </dl><p>Within a <a href=#concept-appcache-manifest-settings title=concept-appcache-manifest-settings>settings section</a>, each <a href=#concept-appcache-manifest-setting title=concept-appcache-manifest-setting>setting</a> must occur no more than once.</p>

<!--
    <p class="note">The URLs in data lines can't be empty strings, since those would be relative
    URLs to the manifest itself. Such lines would be confused with blank or invalid lines,
    anyway.</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 title=concept-appcache-fallback-ns>fallback namespaces</a>, and those namespaces themselves,
  must be given in <a href=#concept-appcache-manifest-fallback title=concept-appcache-manifest-fallback>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 title=concept-appcache-manifest-explicit>explicit sections</a>.</p>

  <p><a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>Fallback namespaces</a> and <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> must have the <a href=#same-origin>same origin</a>
  as the manifest itself.</p>

  <p>A <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a> must not be listed more
  than once.</p>

  <p>Namespaces that the user agent is to put into the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> must all be specified in <a href=#concept-appcache-manifest-network title=concept-appcache-manifest-network>online whitelist sections</a>. (This is needed for
  any URL that the page is intending to use to communicate back to the server.) To specify that all
  URLs are automatically whitelisted in this way, a U+002A ASTERISK character (*) may be specified
  as one of the URLs. <!-- concept-appcache-onlinewhitelist-wildcard --></p>

  <p>Authors should not include namespaces in the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> for which another namespace in
  the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> is a <a href=#prefix-match>prefix
  match</a>.</p>

  <p><a href=#relative-url title="relative URL">Relative URLs</a> must be given relative to the manifest's own
  URL. All URLs in the manifest must have the same <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> as
  the manifest itself (either explicitly or implicitly, through the use of <a href=#relative-url title="relative
  URL">relative URLs</a>). <a href=#refsURL>[URL]</a></p>

  <p>URLs in manifests must not have fragment identifiers (i.e. the U+0023 NUMBER SIGN character
  isn't allowed in URLs in manifests).</p>

  <p><a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>Fallback namespaces</a> and namespaces in the
  <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a> are matched by <a href=#prefix-match>prefix
  match</a>.</p>


  <div class=impl>

  <h5 id=parsing-cache-manifests><span class=secno>6.7.3.3 </span>Parsing cache manifests</h5>

  <p>When a user agent is to <dfn id=parse-a-manifest>parse a manifest</dfn>, it means that the user agent must run the
  following steps:</p>

  <ol><li>

    <p><a href=#utf-8-decode>UTF-8 decode</a> the byte stream corresponding with the manifest to be parsed.</p>

    <p class=note>The <a href=#utf-8-decode>UTF-8 decode</a> algorithm strips a leading BOM, if any.</p>

    <!--All U+0000 NULL characters must be replaced by U+FFFD REPLACEMENT CHARACTERs. (this isn't
    black-box testable since neither U+0000 nor U+FFFD are valid anywhere in the syntax and thus
    both will be treated the same anyway)-->

   </li>

   <li><p>Let <var title="">base URL</var> be the <a href=#absolute-url>absolute URL</a> representing the
   manifest.</li>

   <li><p>Apply the <a href=#url-parser>URL parser</a> steps to the <var title="">base URL</var>, so that the
   components from its <a href=#parsed-url>parsed URL</a> can be used by the subseqent steps of this
   algorithm.</li>

   <li><p>Let <var title="">explicit URLs</var> be an initially empty list of <a href=#absolute-url title="absolute
   URL">absolute URLs</a> for <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit
   entries</a>.</li>

   <li><p>Let <var title="">fallback URLs</var> be an initially empty mapping of <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespaces</a> to <a href=#absolute-url title="absolute
   URL">absolute URLs</a> for <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
   entries</a>.</li>

   <li><p>Let <var title="">online whitelist namespaces</var> be an initially empty list of <a href=#absolute-url title="absolute URL">absolute URLs</a> for an <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a>.</li>

   <li><p>Let <var title="">online whitelist wildcard flag</var> be <i title="">blocking</i>. <!--
   concept-appcache-onlinewhitelist-wildcard --></li>

   <li><p>Let <var title="">cache mode flag</var> be <i title="">fast</i>. <!--
   concept-appcache-mode-fast --></li>

   <li><p>Let <var title="">input</var> be the decoded text of the manifest's byte stream.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the first character.</li>

   <li><p>If the characters starting from <var title="">position</var> are "CACHE", followed by a
   U+0020 SPACE character, followed by "MANIFEST", then advance <var title="">position</var> to the
   next character after those. Otherwise, this isn't a cache manifest; abort this algorithm with a
   failure while checking for the magic signature.</li>

   <li><p>If the character at <var title="">position</var> is neither a U+0020 SPACE character, a
   U+0009 CHARACTER TABULATION (tab) character, U+000A LINE FEED (LF) character, nor a U+000D
   CARRIAGE RETURN (CR) character, then this isn't a cache manifest; abort this algorithm with a
   failure while checking for the magic signature.</li>

   <li><p>This is a cache manifest. The algorithm cannot fail beyond
   this point (though bogus lines can get ignored).</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <em>not</em> U+000A LINE FEED (LF)
   or U+000D CARRIAGE RETURN (CR) characters, and ignore those characters. (Extra text on the first
   line, after the signature, is ignored.)</li>

   <li><p>Let <var title="">mode</var> be "explicit".</li>

   <li><p><i>Start of line</i>: If <var title="">position</var> is past the end of <var title="">input</var>, then jump to the last step. Otherwise, <a href=#collect-a-sequence-of-characters>collect a sequence of
   characters</a> that are U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, or
   U+0009 CHARACTER TABULATION (tab) characters.</li>
   <!-- strips leading spaces, ignores space-only lines, ignores blank lines -->

   <li><p>Now, <a href=#collect-a-sequence-of-characters>collect a sequence of characters</a> that are <em>not</em> U+000A LINE FEED
   (LF) or U+000D CARRIAGE RETURN (CR) characters, and let the result be <var title="">line</var>.</li>

   <li><p>Drop any trailing U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters at the end
   of <var title="">line</var>.</li>

   <li><p>If <var title="">line</var> is the empty string, then jump back to the step labeled <i>start
   of line</i>.</li>

   <li><p>If the first character in <var title="">line</var> is a U+0023 NUMBER SIGN character (#),
   then jump back to the step labeled <i>start of line</i>.</li>

   <li><p>If <var title="">line</var> equals "CACHE:" (the word "CACHE" followed by a U+003A COLON
   character (:)), then set <var title="">mode</var> to "explicit" and jump back to the step labeled
   <i>start of line</i>.</li>

   <li><p>If <var title="">line</var> equals "FALLBACK:" (the word "FALLBACK" followed by a U+003A
   COLON character (:)), then set <var title="">mode</var> to "fallback" and jump back to the step
   labeled <i>start of line</i>.</li>

   <li><p>If <var title="">line</var> equals "NETWORK:" (the word "NETWORK" followed by a U+003A
   COLON character (:)), then set <var title="">mode</var> to "online whitelist" and jump back to
   the step labeled <i>start of line</i>.</li>

   <li><p>If <var title="">line</var> equals "SETTINGS:" (the word "SETTINGS" followed by a U+003A
   COLON character (:)), then set <var title="">mode</var> to "settings" and jump back to the step
   labeled <i>start of line</i>.</li>

   <li><p>If <var title="">line</var> ends with a U+003A COLON character (:), then set <var title="">mode</var> to "unknown" and jump back to the step labeled <i>start of line</i>.</li>

   <li><p>This is either a data line or it is syntactically incorrect.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">line</var>, initially
   pointing at the start of the string.</li>

   <li><p>Let <var title="">tokens</var> be a list of strings, initially empty.</li>

   <li>

    <p>While <var title="">position</var> doesn't point past the end of <var title="">line</var>:</p>

    <ol><li><p>Let <var title="">current token</var> be an empty string.</li>

     <li><p>While <var title="">position</var> doesn't point past the end of <var title="">line</var> and the character at <var title="">position</var> is neither a U+0020 SPACE
     nor a U+0009 CHARACTER TABULATION (tab) character, add the character at <var title="">position</var> to <var title="">current token</var> and advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

     <li><p>Add <var title="">current token</var> to the <var title="">tokens</var> list.</li>

     <li><p>While <var title="">position</var> doesn't point past the end of <var title="">line</var> and the character at <var title="">position</var> is either a U+0020 SPACE
     or a U+0009 CHARACTER TABULATION (tab) character, advance <var title="">position</var> to the
     next character in <var title="">input</var>.</li>

    </ol></li>

   <li>

    <p>Process <var title="">tokens</var> as follows:</p>

    <dl class=switch><dt>If <var title="">mode</var> is "explicit"</dt>

     <dd>

      <p><a href=#resolve-a-url title="resolve a url">Resolve</a> the first item in <var title="">tokens</var>,
      relative to <var title="">base URL</var>; ignore the rest.</p>

      <p>If this fails, then jump back to the step labeled <i>start of line</i>.</p>

      <p>If the resulting <a href=#parsed-url>parsed URL</a> has a different <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component than <var title="">base URL</var> (the
      manifest's URL), then jump back to the step labeled <i>start of line</i>.</p>

      <p>Let <var title="">new URL</var> be the result of applying the <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a>
      algorithm to the resulting <a href=#parsed-url>parsed URL</a>, with the <i>exclude fragment flag</i>
      set.</p>

      <p>Add <var title="">new URL</var> to the <var title="">explicit URLs</var>.</p>

     </dd>

     <dt>If <var title="">mode</var> is "fallback"</dt>

     <dd>

      <p>Let <var title="">part one</var> be the first token in <var title="">tokens</var>, and let
      <var title="">part two</var> be the second token in <var title="">tokens</var>.</p>

      <p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">part one</var> and <var title="">part two</var>, relative to <var title="">base URL</var>.</p>

      <p>If either fails, then jump back to the step labeled <i>start of line</i>.</p>

      <p>If the <a href=#absolute-url>absolute URL</a> corresponding to either <var title="">part one</var> or
      <var title="">part two</var> does not have the <a href=#same-origin>same origin</a> as the manifest's URL,
      then jump back to the step labeled <i>start of line</i>.</p> <!-- SECURITY -->

      <p>Let <var title="">part one</var> be the result of applying the <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a>
      algorithm to the first resulting <a href=#parsed-url>parsed URL</a>, with the <i>exclude fragment
      flag</i> set.</p>

      <p>Let <var title="">part two</var> be the result of applying the <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a>
      algorithm to the second resulting <a href=#parsed-url>parsed URL</a>, with the <i>exclude fragment
      flag</i> set.</p>

      <p>If <var title="">part one</var> is already in the <var title="">fallback URLs</var> mapping
      as a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>, then jump back to
      the step labeled <i>start of line</i>.</p>

      <p>Otherwise, add <var title="">part one</var> to the <var title="">fallback URLs</var>
      mapping as a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>, mapped to
      <var title="">part two</var> as the <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
      entry</a>.</p>

     </dd>

     <dt>If <var title="">mode</var> is "online whitelist"</dt>

     <dd>

      <p>If the first item in <var title="">tokens</var> is a U+002A ASTERISK character (*), then
      set <var title="">online whitelist wildcard flag</var> to <i title="">open</i> and jump back
      to the step labeled <i>start of line</i>.</p>

      <p>Otherwise, <a href=#resolve-a-url title="resolve a url">resolve</a> the first item in <var title="">tokens</var>, relative to <var title="">base URL</var>; ignore the rest.</p>

      <p>If this fails, then jump back to the step labeled <i>start of line</i>.</p>

      <p>If the resulting <a href=#parsed-url>parsed URL</a> has a different <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component than <var title="">base URL</var> (the
      manifest's URL), then jump back to the step labeled <i>start of line</i>.</p>

      <p>Let <var title="">new URL</var> be the result of applying the <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a>
      algorithm to the resulting <a href=#parsed-url>parsed URL</a>, with the <i>exclude fragment flag</i>
      set.</p>

      <p>Add <var title="">new URL</var> to the <var title="">online whitelist namespaces</var>.</p>

     </dd>

     <dt>If <var title="">mode</var> is "settings"</dt>

     <dd>

      <p>If <var title="">tokens</var> contains a single token, and that token is a
      <a href=#case-sensitive>case-sensitive</a> match for the string "<code title="">prefer-online</code>", then
      set <var title="">cache mode flag</var> to <i title="">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>

     </dd>

     <dt>If <var title="">mode</var> is "unknown"</dt>

     <dd>

      <p>Do nothing. The line is ignored.</p>

     </dd>

    </dl></li>

   <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>

   <li><p>Return the <var title="">explicit URLs</var> list, the <var title="">fallback URLs</var>
   mapping, the <var title="">online whitelist namespaces</var>, the <var title="">online whitelist
   wildcard flag</var>, and the <var title="">cache mode flag</var>.</li>

  </ol><div class=note>

   <p>The resource that declares the manifest (with the <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute) will always get taken from the cache,
   whether it is listed in the cache or not, even if it is listed in an <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist namespace</a>.</p>

   <p>If a resource is listed in the <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit
   section</a> or as a <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entry</a> in the <a href=#concept-appcache-manifest-fallback title=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 title=concept-appcache-fallback-ns>fallback namespaces</a> or <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist namespaces</a>.</p>

   <p>When a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a> and an <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist namespace</a> overlap, the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist namespace</a> has priority.</p>

   <p>The <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard
   flag</a> is applied last, only for URLs that match neither the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist namespace</a> nor the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a> and that are not listed in the
   <a href=#concept-appcache-manifest-explicit title=concept-appcache-manifest-explicit>explicit section</a>.</p>

  </div>


  <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.7.4 </span>Downloading or updating an application cache</h4>

  <p>When the user agent is required (by other parts of this specification) to start the
  <dfn id=application-cache-download-process>application cache download process</dfn> for an <a href=#absolute-url>absolute URL</a> purported to
  identify a <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>, or for an <a href=#application-cache-group>application
  cache group</a>, potentially given a particular <a href=#cache-host>cache host</a>, and potentially given
  a <a href=#concept-appcache-master title=concept-appcache-master>master</a> resource, the user agent must run the steps
  below. These steps are always run asynchronously, in parallel with the <a href=#event-loop>event loop</a>
  <a href=#concept-task title=concept-task>tasks</a>.</p>

  <p>Some of these steps have requirements that only apply if the user agent <dfn id=shows-caching-progress>shows caching
  progress</dfn>. Support for this is optional. Caching progress UI could consist of a progress bar
  or message panel in the user agent's interface, or an overlay, or something else. Certain events
  fired during the <a href=#application-cache-download-process>application cache download process</a> allow the script to override the
  display of such an interface. (Such events are delayed until after the <code title=event-load>load</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>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>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>

   <li>

    <p>Atomically, so as to avoid race conditions, perform the following substeps:</p>

    <ol><li>

      <p>Pick the appropriate substeps:</p>

      <dl class=switch><dt>If these steps were invoked with an <a href=#absolute-url>absolute URL</a> purported to identify a
       <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a></dt>

       <dd>

        <p>Let <var title="">manifest URL</var> be that <a href=#absolute-url>absolute URL</a>.</p>

        <p>If there is no <a href=#application-cache-group>application cache group</a> identified by <var title="">manifest
        URL</var>, then create a new <a href=#application-cache-group>application cache group</a> identified by <var title="">manifest URL</var>. Initially, it has no <a href=#application-cache title="application
        cache">application caches</a>. One will be created later in this algorithm.</p>

       </dd>


       <dt>If these steps were invoked with an <a href=#application-cache-group>application cache group</a></dt>

       <dd>

        <p>Let <var title="">manifest URL</var> be the <a href=#absolute-url>absolute URL</a> of the <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> used to identify the <a href=#application-cache-group>application
        cache group</a> to be updated.</p>

        <p>If that <a href=#application-cache-group>application cache group</a> is <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>, then abort this instance of the
        <a href=#application-cache-download-process>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>

       </dd>

      </dl></li>

     <li><p>Let <var title="">cache group</var> be the <a href=#application-cache-group>application cache group</a>
     identified by <var title="">manifest URL</var>.</li>

     <li><p>If these steps were invoked with a <a href=#concept-appcache-master title=concept-appcache-master>master</a>
     resource, then add the resource, along with the resource's <code><a href=#document>Document</a></code>, to <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending
     master entries</a>.</li>

     <li><p>If these steps were invoked with a <a href=#cache-host>cache host</a>, and the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> is
     <i>checking</i> or <i>downloading</i>, then <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a
     simple event</a> named <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code> that is
     cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host>cache host</a>. The
     default action of this event must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>,
     the display of some sort of user interface indicating to the user that the user agent is
     checking to see if it can download the application.</li>

     <li><p>If these steps were invoked with a <a href=#cache-host>cache host</a>, and the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache group</var> is
     <i>downloading</i>, then also <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple
     event</a> named <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code> that is
     cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host>cache host</a>. The
     default action of this event must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>,
     the display of some sort of user interface indicating to the user the application is being
     downloaded.</li>

     <li><p>If the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of the <var title="">cache
     group</var> is either <i>checking</i> or <i>downloading</i>, then abort this instance of the
     <a href=#application-cache-download-process>application cache download process</a>, as an update is already in progress.</li>

     <li><p>Set the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache
     group</var> to <i>checking</i>.</p>

     <li><p>For each <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in
     <var title="">cache group</var>, <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple
     event</a> that is cancelable named <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code> at
     the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>. The default action
     of these events must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of
     some sort of user interface indicating to the user that the user agent is checking for the
     availability of updates.</li>

    </ol><p class=note>The remainder of the steps run asynchronously.</p>

    <p>If <var title="">cache group</var> already has an <a href=#application-cache>application cache</a> in it, then
    this is an <dfn id=concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</dfn>. Otherwise, this is a
    <dfn id=concept-appcache-cache title=concept-appcache-cache>cache attempt</dfn>.</p>

   </li>

   <li><p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache attempt</a>, then this
   algorithm was invoked with a <a href=#cache-host>cache host</a>; <a href=#queue-a-post-load-task>queue a post-load task</a> to
   <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code> that
   is cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host>cache host</a>. The
   default action of this event must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the
   display of some sort of user interface indicating to the user that the user agent is checking for
   the availability of updates.</li>

   <li>

    <p><i>Fetching the manifest</i>: <a href=#fetch>Fetch</a><!--FETCH--> the resource from <var title="">manifest URL</var> with the <i>synchronous flag</i> set, and let <var title="">manifest</var> be that resource. HTTP caching semantics should be honored for this
    request.</p> <!-- http-origin privacy sensitive, though it doesn't matter, since this can never
    be cross-origin -->

    <p>Parse <var title="">manifest</var> according to the <a href=#parse-a-manifest title="parse a manifest">rules for
    parsing manifests</a>, obtaining a list of <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit
    entries</a>, <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> and the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespaces</a> that map to them, entries for
    the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a>, and values for the
    <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard flag</a>
    and the <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode flag</a>.</p>

    <p class=note>The <a href=#mime-type>MIME type</a> of the resource is ignored &mdash; it is assumed to
    be <code><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 title="">CACHE&nbsp;MANIFEST</code>" string at the top of the
    file).</p>

   </li>

   <li>

    <p>If <i>fetching the manifest</i> fails due to a 404 or 410 response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, then run these substeps:</p>

    <ol><li><p>Mark <var title="">cache group</var> as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>. This <var title="">cache group</var> no
     longer exists for any purpose other than the processing of <code><a href=#document>Document</a></code> objects
     already associated with an <a href=#application-cache>application cache</a> in the <var title="">cache
     group</var>.</li>

     <li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>

     <li><p>For each <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in
     <var title="">cache group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire
     a simple event</a> named <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code> that is
     cancelable at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>, and
     append it to <var title="">task list</var>. The default action of these events must be, if the
     user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface
     indicating to the user that the application is no longer available for offline use.</li>

     <li><p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named
     <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> (not <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>!) at the <code><a href=#applicationcache>ApplicationCache</a></code>
     singleton of the <code><a href=#document>Document</a></code> for this entry, if there still is one, and append it to
     <var title="">task list</var>. The default action of this event must be, if the user agent
     <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface indicating to
     the user that the user agent failed to save the application for offline use.</li>

     <li><p>If <var title="">cache group</var> has an <a href=#application-cache>application cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is <i>incomplete</i>, then
     discard that <a href=#application-cache>application cache</a>.</p>

     <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
     progress.</li>

     <li><p>Let the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache
     group</var> be <i>idle</i>.</li>

     <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load task">queue that task as a post-load task</a>.</li>

     <li><p>Abort the <a href=#application-cache-download-process>application cache download process</a>.</li>

    </ol></li>

   <li>

    <p>Otherwise, if <i>fetching the manifest</i> fails in some other way (e.g. the server returns
    another 4xx or 5xx response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or
    there is a DNS error, or the connection times out, or the user cancels the download, or the
    parser for manifests fails when checking the magic signature), or if the server returned a
    redirect, then run the <a href=#cache-failure-steps>cache failure steps</a>. <a href=#refsHTTP>[HTTP]</a></p>

   </li>

   <li>

    <p>If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a> and the newly
    downloaded <var title="">manifest</var> is byte-for-byte identical to the manifest found in the
    <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application cache</a> in <var title="">cache group</var>, or the server reported it as "304 Not Modified" <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, then run these substeps:</p>

    <ol><li><p>Let <var title="">cache</var> be the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a>
     <a href=#application-cache>application cache</a> in <var title="">cache group</var>.</li>

     <li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>

     <li>
<!--CLEANUP-->
      <p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>, wait for the
      resource for this entry to have either completely downloaded or failed.</p>

      <p>If the download failed (e.g. the server returns a 4xx or 5xx response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or there is a DNS error, the
      connection times out, or the user cancels the download), or if the resource is labeled with
      the "no-store" cache directive, then create a <a href=#concept-task title=concept-task>task</a> to
      <a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of
      the <code><a href=#document>Document</a></code> for this entry, if there still is one, and append it to <var title="">task list</var>. The default action of this event must be, if the user agent
      <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface indicating to
      the user that the user agent failed to save the application for offline use.</p>

      <p>Otherwise, associate the <code><a href=#document>Document</a></code> for this entry with <var title="">cache</var>; store the resource for this entry in <var title="">cache</var>, if it
      isn't already there, and categorize its entry as a <a href=#concept-appcache-master title=concept-appcache-master>master entry</a>. If applying the <a href=#url-parser>URL parser</a>
      algorithm to the resource's <a href=#url>URL</a> results in a <a href=#parsed-url>parsed URL</a> that has a
      non-null <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> component, the <a href=#url>URL</a>
      used for the entry in <var title="">cache</var> must instead be the <a href=#absolute-url>absolute URL</a>
      obtained from applying the <a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a> algorithm to the <a href=#parsed-url>parsed
      URL</a> with the <i>exclude fragment flag</i> set (application caches never include
      fragment identifiers).</p>

     </li>

     <li><p>For each <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in
     <var title="">cache group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire
     a simple event</a> that is cancelable named <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code> at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton
     of the <a href=#cache-host>cache host</a>, and append it to <var title="">task list</var>. The default
     action of these events must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the
     display of some sort of user interface indicating to the user that the application is up to
     date.</li>

     <li><p>Empty <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>.</li>

     <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
     progress.</li>

     <li><p>Let the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache
     group</var> be <i>idle</i>.</li>

     <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load task">queue that task as a post-load task</a>.</li>

     <li><p>Abort the <a href=#application-cache-download-process>application cache download process</a>.</li>

    </ol></li>

   <li><p>Let <var title="">new cache</var> be a newly created <a href=#application-cache>application cache</a> in
   <var title="">cache group</var>. Set its <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness
   flag</a> to <i>incomplete</i>.</li>

   <li><p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>, associate the
   <code><a href=#document>Document</a></code> for this entry with <var title="">new cache</var>.</li>

   <li><p>Set the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache
   group</var> to <i>downloading</i>.</li>

   <li><p>For each <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in <var title="">cache group</var>, <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple
   event</a> that is cancelable named <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>
   at the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>. The default action
   of these events must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of
   some sort of user interface indicating to the user that a new version is being
   downloaded.</li>

   <li><p>Let <var title="">file list</var> be an empty list of URLs with flags.</li>

   <li><p>Add all the URLs in the list of <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit
   entries</a> obtained by parsing <var title="">manifest</var> to <var title="">file list</var>,
   each flagged with "explicit entry".</li>

   <li><p>Add all the URLs in the list of <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
   entries</a> obtained by parsing <var title="">manifest</var> to <var title="">file list</var>,
   each flagged with "fallback entry".</li>

   <li><p>If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>, then add all
   the URLs of <a href=#concept-appcache-master title=concept-appcache-master>master entries</a> in the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application cache</a> in <var title="">cache group</var> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness
   flag</a> is <i>complete</i> to <var title="">file list</var>, each flagged with "master
   entry".</li>

   <li><p>If any URL is in <var title="">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>

   <li>

    <p>For each URL in <var title="">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><a href=#applicationcache>ApplicationCache</a></code> object's <code title=dom-appcache-abort><a href=#dom-appcache-abort>abort()</a></code> method
    <a href=#send-a-signal title="send a signal">sends a signal</a> to this instance of the <a href=#application-cache-download-process>application
    cache download process</a> algorithm, then run the <a href=#cache-failure-steps>cache failure steps</a>
    instead.</p>

    <ol><li>

      <p>If the resource URL being processed was flagged as neither an "explicit entry" nor or a
      "fallback entry", then the user agent may skip this URL.</p>

      <p class=note>This is intended to allow user agents to expire resources not listed in the
      manifest from the cache. Generally, implementors are urged to use an approach that expires
      lesser-used resources first.</p>

     </li>

     <li><p>For each <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in
     <var title="">cache group</var>, <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
     event with the name <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, which does not
     bubble, which is cancelable, and which uses the <code><a href=#progressevent>ProgressEvent</a></code> interface, at the
     <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>. The <code title=dom-ProgressEvents-lengthComputable>lengthComputable</code> attribute must be set to
     true, the <code title=dom-ProgressEvents-total>total</code> attribute must be set to the
     number of files in <var title="">file list</var>, and the <code title=dom-ProgressEvents-loaded>loaded</code> attribute must be set to the number of files in
     <var title="">file list</var> that have been either downloaded or skipped so far. The default
     action of these events must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the
     display of some sort of user interface indicating to the user that a file is being downloaded
     in preparation for updating the application. <a href=#refsXHR>[XHR]</a></li>

     <li>

      <p><a href=#fetch>Fetch</a><!--FETCH--> the resource, from the <a href=#origin>origin</a> of the
      <a href=#url>URL</a> <var title="">manifest URL</var>, with the <i>synchronous flag</i> set and
      the <i>manual redirect flag</i> set. If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>, then use the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application cache</a> in <var title="">cache group</var> as an HTTP cache, and honor HTTP caching semantics (such as
      expiration, ETags, and so forth) with respect to that cache. User agents may also have other
      caches in place that are also honored.</p> <!-- not http-origin privacy sensitive -->

      <p class=note>If the resource in question is already being downloaded for other reasons then
      the existing download process can sometimes be used for the purposes of this step, as defined
      by the <a href=#fetch title=fetch>fetching</a> algorithm.</p>

      <p class=example>An example of a resource that might already be being downloaded is a large
      image on a Web page that is being seen for the first time. The image would get downloaded to
      satisfy the <code><a href=#the-img-element>img</a></code> element on the page, as well as being listed in the cache
      manifest. According to the rules for <a href=#fetch title=fetch>fetching</a> that image only need
      be downloaded once, and it can be used both for the cache and for the rendered Web page.</p>

     </li>

     <li>

      <p>If the previous step fails (e.g. the server returns a 4xx or 5xx response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or there is a DNS error, or the
      connection times out, or the user cancels the download), or if the server returned a redirect,
      or if the resource is labeled with the "no-store" cache directive, then run the first
      appropriate step from the following list: <a href=#refsHTTP>[HTTP]</a></p>

      <dl class=switch><dt>If the URL being processed was flagged as an "explicit entry" or a "fallback entry"</dt>

       <dd>

        <p>If these steps are being run in parallel for any other URLs in <var title="">file
        list</var>, then abort these steps for those other URLs. Run the <a href=#cache-failure-steps>cache failure
        steps</a>.</p>

        <p class=note>Redirects are fatal because they are either indicative of a network problem
        (e.g. a captive portal); or would allow resources to be added to the cache under URLs that
        differ from any URL that the networking model will allow access to, leaving orphan entries;
        or would allow resources to be stored under URLs different than their true URLs. All of
        these situations are bad.</p>

       </dd>

       <dt>If the error was a 404 or 410 HTTP response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a></dt>

       <dt>If the resource was labeled with the "no-store" cache directive</dt>

       <dd>

        <p>Skip this resource. It is dropped from the cache.</p>

       </dd>

       <dt>Otherwise</dt>

       <dd>

        <p>Copy the resource and its metadata from the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application cache</a> in <var title="">cache group</var> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness
        flag</a> is <i>complete</i>, and act as if that was the fetched resource, ignoring the
        resource obtained from the network.</p>

       </dd>

      </dl><p>User agents may warn the user of these errors as an aid to development.</p>

      <p class=note>These rules make errors for resources listed in the manifest fatal, while
      making it possible for other resources to be removed from caches when they are removed from
      the server, without errors, and making non-manifest resources survive server-side errors.</p>

      <p class=note>Except for the "no-store" directive, HTTP caching rules that would cause a
      file to be expired or otherwise not cached are ignored for the purposes of the
      <a href=#application-cache-download-process>application cache download process</a>.</p>

     </li>

     <li>

      <p>Otherwise, the fetching succeeded. Store the resource in the <var title="">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>cache failure steps</a>.</p>

     </li>

     <li><p>If the URL being processed was flagged as an "explicit entry" in <var title="">file
     list</var>, then categorize the entry as an <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit
     entry</a>.</li>

     <li><p>If the URL being processed was flagged as a "fallback entry" in <var title="">file
     list</var>, then categorize the entry as a <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback
     entry</a>.</li>

     <li><p>If the URL being processed was flagged as an "master entry" in <var title="">file
     list</var>, then categorize the entry as a <a href=#concept-appcache-master title=concept-appcache-master>master
     entry</a>.</li>

     <li><p>As an optimization, if the resource is an HTML or XML file whose root element is an
     <code><a href=#the-html-element>html</a></code> element with a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute
     whose value doesn't match the manifest URL of the application cache being processed, then the
     user agent should mark the entry as being <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>.</p>

    </ol></li>

   <li><p>For each <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in <var title="">cache group</var>, <a href=#queue-a-post-load-task>queue a post-load task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
   event with the name <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, which does not bubble,
   which is cancelable, and which uses the <code><a href=#progressevent>ProgressEvent</a></code> interface, at the
   <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>. The <code title=dom-ProgressEvents-lengthComputable>lengthComputable</code> attribute must be set to
   true, the <code title=dom-ProgressEvents-total>total</code> and the <code title=dom-ProgressEvents-loaded>loaded</code> attributes must be set to the number of files in
   <var title="">file list</var>. The default action of these events must be, if the user agent
   <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface indicating to the
   user that all the files have been downloaded. <a href=#refsXHR>[XHR]</a></li>

   <li><p>Store the list of <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespaces</a>,
   and the URLs of the <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> that they map
   to, in <var title="">new cache</var>.</li>

   <li><p>Store the URLs that form the new <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
   whitelist</a> in <var title="">new cache</var>.</li>

   <li><p>Store the value of the new <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online
   whitelist wildcard flag</a> in <var title="">new cache</var>.</li>

   <li><p>Store the value of the new <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode flag</a> in
   <var title="">new cache</var>.</li>

   <li>

    <p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>, wait for the
    resource for this entry to have either completely downloaded or failed.</p>

    <p>If the download failed (e.g. the server returns a 4xx or 5xx response <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or there is a DNS error, the
    connection times out, or the user cancels the download), or if the resource is labeled with the
    "no-store" cache directive, then run these substeps:</p>

    <ol><li><p>Unassociate the <code><a href=#document>Document</a></code> for this entry from <var title="">new
     cache</var>.</li>

     <li><p><a href=#queue-a-post-load-task>Queue a post-load task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that is
     cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the
     <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <code><a href=#document>Document</a></code> for this entry, if there
     still is one. The default action of this event must be, if the user agent <a href=#shows-caching-progress>shows caching
     progress</a>, the display of some sort of user interface indicating to the user that the
     user agent failed to save the application for offline use.</p>

     <li>

      <p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache attempt</a> and this entry is
      the last entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>, then run these
      further substeps:</p>

      <ol><li><p>Discard <var title="">cache group</var> and its only <a href=#application-cache>application cache</a>,
       <var title="">new cache</var>.</p>

       <li><p>If appropriate, remove any user interface indicating that an update for this cache is
       in progress.</li>

       <li><p>Abort the <a href=#application-cache-download-process>application cache download process</a>.</li>

      </ol></li>

     <li><p>Otherwise, remove this entry from <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>.</li>

    </ol><p>Otherwise, store the resource for this entry in <var title="">new cache</var>, if it isn't
    already there, and categorize its entry as a <a href=#concept-appcache-master title=concept-appcache-master>master
    entry</a>.</p>

   </li>

   <li>

    <p><a href=#fetch>Fetch</a><!--FETCH--> the resource from <var title="">manifest URL</var> again, with
    the <i>synchronous flag</i> set, and let <var title="">second manifest</var> be that resource.
    HTTP caching semantics should again be honored for this request.</p> <!-- http-origin privacy
    sensitive, though it doesn't matter, since this can never be cross-origin -->

    <p class=note>Since caching can be honored, authors are encouraged to avoid setting the cache
    headers on the manifest in such a way that the user agent would simply not contact the network
    for this second request; otherwise, the user agent would not notice if the cache had changed
    during the cache update process.</p>

   </li>

   <li>

    <p>If the previous step failed for any reason, or if the fetching attempt involved a redirect,
    or if <var title="">second manifest</var> and <var title="">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>cache failure steps</a>.</p>

   </li>

   <li>

    <p>Otherwise, store <var title="">manifest</var> in <var title="">new cache</var>, if it's not
    there already, and categorize its entry as <a href=#concept-appcache-manifest title=concept-appcache-manifest>the
    manifest</a>.</p>

   </li>

   <li><p>Set the <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> of <var title="">new cache</var> to <i>complete</i>.</li>

   <li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>

   <li>

    <p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache attempt</a>, then for each
    <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in <var title="">cache
    group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
    that is cancelable named <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code> at the
    <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>, and append it to <var title="">task list</var>. The default action of these events must be, if the user agent
    <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface indicating to
    the user that the application has been cached and that they can now use it offline.</p>

    <p>Otherwise, it is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>. For each
    <a href=#cache-host>cache host</a> associated with an <a href=#application-cache>application cache</a> in <var title="">cache
    group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
    that is cancelable named <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code> at the
    <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>, and append it to <var title="">task list</var>. The default action of these events must be, if the user agent
    <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface indicating to
    the user that a new version is available and that they can activate it by reloading the
    page.</p>

   </li>

   <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
   progress.</li>

   <li><p>Set the <a href=#concept-appcache-status title=concept-appcache-status>update status</a> of <var title="">cache
   group</var> to <i>idle</i>.</li>

   <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load task">queue that task as a post-load task</a>.</li>

  </ol><p>The <dfn id=cache-failure-steps>cache failure steps</dfn> are as follows:</p>

  <ol><li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>

   <li>

    <p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>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><a href=#document>Document</a></code> for this entry from its <a href=#application-cache>application
     cache</a>, if it has one.</li>

     <li><p>Create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that
     is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at the
     <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <code><a href=#document>Document</a></code> for this entry, if there
     still is one, and append it to <var title="">task list</var>. The default action of these
     events must be, if the user agent <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort
     of user interface indicating to the user that the user agent failed to save the application for
     offline use.</p>

    </ol></li>

   <li><p>For each <a href=#cache-host>cache host</a> still associated with an <a href=#application-cache>application cache</a>
   in <var title="">cache group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire
   a simple event</a> that is cancelable named <code title=event-appcache-error><a href=#event-appcache-error>error</a></code> at
   the <code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache host</a>, and append it to <var title="">task list</var>. The default action of these events must be, if the user agent
   <a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of user interface indicating to the
   user that the user agent failed to save the application for offline use.</li>

   <li><p>Empty <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master entries</a>.</li>

   <li><p>If <var title="">cache group</var> has an <a href=#application-cache>application cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is <i>incomplete</i>, then discard
   that <a href=#application-cache>application cache</a>.</p>

   <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
   progress.</li>

   <li><p>Let the <a href=#concept-appcache-status title=concept-appcache-status>status</a> of <var title="">cache
   group</var> be <i>idle</i>.</li>

   <li><p>If this was a <a href=#concept-appcache-cache title=concept-appcache-cache>cache attempt</a>, discard <var title="">cache group</var> altogether.</p>

   <li><p>For each <a href=#concept-task title=concept-task>task</a> in <var title="">task list</var>, <a href=#queue-a-post-load-task title="queue a post-load task">queue that task as a post-load task</a>.</li>

   <li><p>Abort the <a href=#application-cache-download-process>application cache download process</a>.</li>

  </ol><p>Attempts to <a href=#fetch>fetch</a> resources as part of the <a href=#application-cache-download-process>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>application cache download process</a>, in the background,
  for any <a href=#application-cache-group>application cache group</a>, at any time (with no <a href=#cache-host>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><a href=#document>Document</a></code> has a list of <dfn id=pending-application-cache-download-process-tasks>pending application cache download process
  tasks</dfn> that is used to delay events fired by the algorithm above until the document's <code title=event-load>load</code> event has fired. When the <code><a href=#document>Document</a></code> is created, the
  list must be empty.</p>

  <p>When the steps above say to <dfn id=queue-a-post-load-task>queue a post-load task</dfn> <var title="">task</var>, where
  <var title="">task</var> is a <a href=#concept-task title=concept-task>task</a> that dispatches an event on a
  target <code><a href=#applicationcache>ApplicationCache</a></code> object <var title="">target</var>, the user agent must run
  the appropriate steps from the following list:</p>

  <dl><dt>If <var title="">target</var>'s <code><a href=#document>Document</a></code> is
   <a href=#ready-for-post-load-tasks>ready for post-load tasks</a></dt>

   <dd><p><a href=#queue-a-task title="queue a task">Queue</a> the task <var title="">task</var>.</dd>

   <dt>Otherwise</dt>

   <dd><p>Add <var title="">task</var> to <var title="">target</var>'s <code><a href=#document>Document</a></code>'s list
   of <a href=#pending-application-cache-download-process-tasks>pending application cache download process tasks</a>.</dd>

  </dl><p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the
  <a href=#networking-task-source>networking task source</a>.</p>




  <h4 id=the-application-cache-selection-algorithm><span class=secno>6.7.5 </span>The application cache selection algorithm</h4>

  <p>When the <dfn id=concept-appcache-init title=concept-appcache-init>application cache
  selection algorithm</dfn> algorithm is invoked with a
  <code><a href=#document>Document</a></code> <var title="">document</var> and optionally a
  manifest <a href=#url>URL</a> <var title="">manifest URL</var>, the user
  agent must run the first applicable set of steps from the following
  list:</p>

  <dl class=switch><dt>If there is a <var title="">manifest URL</var>, and <var title="">document</var> was loaded from an <a href=#application-cache>application
   cache</a>, and the URL of the <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> of that cache's
   <a href=#application-cache-group>application cache group</a> is <em>not</em> the same as
   <var title="">manifest URL</var></dt>

   <dd>

    <p>Mark the entry for the resource from which <var title="">document</var> was taken in the <a href=#application-cache>application
    cache</a> from which it was loaded as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>.</p>

    <p>Restart the current navigation from the top of the <a href=#navigate title=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>update the session history with
    the new page</a> is only ever completed <em>after</em> this
    <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
    algorithm</a> is run, though this is not required).</p>

    <p class=note>The navigation will not result in the same
    resource being loaded, because "foreign" entries are never picked
    during navigation.</p>

    <p>User agents may notify the user of the inconsistency between
    the cache manifest and the document's own metadata, to aid in
    application development.</p>

   </dd>


   <dt>If <var title="">document</var> was loaded from an
   <a href=#application-cache>application cache</a>, and that <a href=#application-cache>application
   cache</a> still exists (it is not now <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>)<!--[redundant],
   and either there is no <var title="">manifest URL</var>, or the URL
   of the <span title="concept-appcache-manifest">manifest</span> of
   the cache's <span>application cache group</span> is the same as
   <var title="">manifest URL</var>--></dt>

   <dd>

    <p>Associate <var title="">document</var> with the
    <a href=#application-cache>application cache</a> from which it was loaded. Invoke,
    in the background, the <a href=#application-cache-download-process>application cache download
    process</a> for that <a href=#application-cache>application cache</a>'s
    <a href=#application-cache-group>application cache group</a>, with <var title="">document</var> as the <a href=#cache-host>cache host</a>.</p>

   </dd>


   <dt>If <var title="">document</var> <!--[redundant] was not loaded
   from an <span>application cache</span>, but it--> was loaded using
   HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
   equivalent</a>, and, there is a <var title="">manifest
   URL</var>, and <var title="">manifest URL</var> has the <a href=#same-origin>same
   origin</a> as <var title="">document</var></dt>

   <dd>

    <p>Invoke, in the background, the <a href=#application-cache-download-process>application cache download
    process</a> for <var title="">manifest URL</var>, with <var title="">document</var> as the <a href=#cache-host>cache host</a> and with
    the resource from which <var title="">document</var> was parsed as
    the <a href=#concept-appcache-master title=concept-appcache-master>master</a>
    resource.</p>

    <p>If there are <a href=#relevant-application-cache title="relevant application cache">relevant
    application caches</a> that are identified by a URL with the
    <a href=#same-origin>same origin</a> as the URL of <var title="">document</var>, and that have this URL as one of their
    entries, excluding entries marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then the user
    agent should use the <a href=#concept-appcache-selection title=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>

   </dd>


   <dt>Otherwise</dt> <!-- not from cache and either no <var
   title="">manifest URL</var>, or non-GET, or wrong-origin manifest -->

   <dd>

    <p>The <code><a href=#document>Document</a></code> is not associated with any
    <a href=#application-cache>application cache</a>.</p>

    <p>If there was a <var title="">manifest URL</var>, the user agent
    may report to the user that it was ignored, to aid in application
    development.</p>

   </dd>

  </dl><h4 id=changesToNetworkingModel><span class=secno>6.7.6 </span>Changes to the networking model</h4>

  <p>When a <a href=#cache-host>cache host</a> is associated with an
  <a href=#application-cache>application cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
  <i>complete</i>, any and all loads for resources related to that
  <a href=#cache-host>cache host</a> other than those for <a href=#child-browsing-context title="child
  browsing context">child browsing contexts</a> must go through the
  following steps instead of immediately invoking the mechanisms
  appropriate to that resource's scheme:</p>

  <ol><!--FETCH--><li><p>If the resource is not to be fetched using the HTTP GET
   mechanism <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
   equivalent</a>, or if applying the <a href=#url-parser>URL parser</a> algorithm to both its <a href=#url>URL</a> and the
   <a href=#application-cache>application cache</a>'s <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a>'s URL results in two <a href=#parsed-url title="parsed URL">parsed URLs</a> with different <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> components, then
   <a href=#fetch>fetch</a> the resource normally and abort these
   steps.</li>

   <li><p>If the resource's URL is <a href=#concept-appcache-master title=concept-appcache-master>a master entry</a>, <a href=#concept-appcache-manifest title=concept-appcache-manifest>the manifest</a>, <a href=#concept-appcache-explicit title=concept-appcache-explicit>an explicit entry</a>, or
   <a href=#concept-appcache-fallback title=concept-appcache-fallback>a fallback entry</a> in
   the <a href=#application-cache>application cache</a>, then get the resource from the
   cache (instead of fetching it), and abort these steps.</li>

   <li><p>If there is an entry in the <a href=#application-cache>application cache</a>'s
   <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online
   whitelist</a> that has the <a href=#same-origin>same origin</a> as the
   resource's URL and that is a <a href=#prefix-match>prefix match</a> for the
   resource's URL, then <a href=#fetch>fetch</a> the resource normally and
   abort these steps.</li>

   <li>

    <p>If the resource's URL has the <a href=#same-origin>same origin</a> as the
    manifest's URL, and there is a <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>
    <var title="">f</var> in the <a href=#application-cache>application cache</a> that
    is a <a href=#prefix-match>prefix match</a> for the resource's URL, then:</p>

    <p><a href=#fetch>Fetch</a> the resource normally. If this results in a
    redirect to a resource with another <a href=#origin>origin</a>
    (indicative of a captive portal), or a 4xx or 5xx status code
    <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>,
    or if there were network errors (but not if the user canceled the
    download), then instead get, from the cache, the resource of the
    <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entry</a>
    corresponding to the <a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback namespace</a>
    <var title="">f</var>. Abort these steps.</p>

   </li>

   <li><p>If the <a href=#application-cache>application cache</a>'s <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
   wildcard flag</a> is <i title="">open</i>, then
   <a href=#fetch>fetch</a> the resource normally and abort these
   steps.</li>

   <li><p>Fail the resource load as if there had been a generic
   network error.</li>

  </ol><p class=note>The above algorithm ensures that so long as the
  <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online
  whitelist wildcard flag</a> is <i title="">blocking</i>,
  resources that are not present in the <a href=#concept-appcache-manifest title=concept-appcache-manifest>manifest</a> will always fail
  to load (at least, after the <a href=#application-cache>application cache</a> has been
  primed the first time), making the testing of offline applications
  simpler.</p>

  </div>


  <div class=impl>

  <h4 id=expiring-application-caches><span class=secno>6.7.7 </span>Expiring application caches</h4>

  <p>As a general rule, user agents should not expire application
  caches, except on request from the user, or after having been left
  unused for an extended period of time.</p>

  <p>Application caches and cookies have similar implications with
  respect to privacy (e.g. if the site can identify the user when
  providing the cache, it can store data in the cache that can be used
  for cookie resurrection). Implementors are therefore encouraged to
  expose application caches in a manner related to HTTP cookies,
  allowing caches to be expunged together with cookies and other
  origin-specific data.</p>

  <p class=example>For example, a user agent could have a "delete
  site-specific data" feature that clears all cookies, application
  caches, local storage, databases, etc, from an origin all at
  once.</p>

  </div>


  <div class=impl>

  <h4 id=disk-space><span class=secno>6.7.8 </span>Disk space</h4>

  <p>User agents should consider applying constraints on disk usage of
  <a href=#application-cache title="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 title="application cache">application caches</a>.</p>

  <p class=note>How quotas are presented to the user is not defined
  by this specification. User agents are encouraged to provide
  features such as allowing a user to indicate that certain sites are
  trusted to use more than the default quota, e.g. by asynchronously
  presenting a user interface while a cache is being updated, or by
  having an explicit whitelist in the user agent's configuration
  interface.</p>

  </div>



  <h4 id=application-cache-api><span class=secno>6.7.9 </span>Application cache API</h4>

  <pre class=idl>interface <dfn id=applicationcache>ApplicationCache</dfn> : <a href=#eventtarget>EventTarget</a> {

  // <a href=#concept-appcache-status title=concept-appcache-status>update status</a>
  const unsigned short <a href=#dom-appcache-uncached title=dom-appcache-UNCACHED>UNCACHED</a> = 0;
  const unsigned short <a href=#dom-appcache-idle title=dom-appcache-IDLE>IDLE</a> = 1;
  const unsigned short <a href=#dom-appcache-checking title=dom-appcache-CHECKING>CHECKING</a> = 2;
  const unsigned short <a href=#dom-appcache-downloading title=dom-appcache-DOWNLOADING>DOWNLOADING</a> = 3;
  const unsigned short <a href=#dom-appcache-updateready title=dom-appcache-UPDATEREADY>UPDATEREADY</a> = 4;
  const unsigned short <a href=#dom-appcache-obsolete title=dom-appcache-OBSOLETE>OBSOLETE</a> = 5;
  readonly attribute unsigned short <a href=#dom-appcache-status title=dom-appcache-status>status</a>;

  // updates
  void <a href=#dom-appcache-update title=dom-appcache-update>update</a>();
  void <a href=#dom-appcache-abort title=dom-appcache-abort>abort</a>();
  void <a href=#dom-appcache-swapcache title=dom-appcache-swapCache>swapCache</a>();

  // events
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-onchecking title=handler-appcache-onchecking>onchecking</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-onerror title=handler-appcache-onerror>onerror</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-onnoupdate title=handler-appcache-onnoupdate>onnoupdate</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-ondownloading title=handler-appcache-ondownloading>ondownloading</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-onprogress title=handler-appcache-onprogress>onprogress</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-onupdateready title=handler-appcache-onupdateready>onupdateready</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-oncached title=handler-appcache-oncached>oncached</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-appcache-onobsolete title=handler-appcache-onobsolete>onobsolete</a>;
};</pre>

  <dl class=domintro><dt><var title="">cache</var> = <var title="">window</var> . <code title=dom-applicationCache><a href=#dom-applicationcache>applicationCache</a></code></dt>
   <dd>

    <p>(In a window.) Returns the <code><a href=#applicationcache>ApplicationCache</a></code> object that applies to the <a href=#active-document>active document</a> of that <code><a href=#window>Window</a></code>.</p>

   </dd>

   <dt><var title="">cache</var> = <var title="">self</var> . <code title=dom-applicationCache><a href=#dom-applicationcache>applicationCache</a></code></dt>
   <dd>

    <p>(In a shared worker.) Returns the <code><a href=#applicationcache>ApplicationCache</a></code> object that applies to the current shared worker.
    </p>

   </dd>

   <dt><var title="">cache</var> . <code title=dom-appcache-status><a href=#dom-appcache-status>status</a></code></dt>
   <dd>

    <p>Returns the current status of the application cache, as given by the constants defined below.</p>

   </dd>

   <dt><var title="">cache</var> . <code title=dom-appcache-update><a href=#dom-appcache-update>update</a></code>()</dt>
   <dd>

    <p>Invokes the <a href=#application-cache-download-process>application cache download process</a>.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if there is no application cache to update.</p>

    <p>Calling this method is not usually necessary, as user agents
    will generally take care of updating <a href=#application-cache title="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>

   </dd>

   <dt><var title="">cache</var> . <code title=dom-appcache-abort><a href=#dom-appcache-abort>abort</a></code>()</dt>
   <dd>

    <p>Cancels the <a href=#application-cache-download-process>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>

   </dd>

   <dt><var title="">cache</var> . <code title=dom-appcache-swapCache><a href=#dom-appcache-swapcache>swapCache</a></code>()</dt>
   <dd>

    <p>Switches to the most recent application cache, if there is a
    newer one. If there isn't, throws an
    <code><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>

    <p>This does not cause previously-loaded resources to be reloaded;
    for example, images do not suddenly get reloaded and style sheets
    and scripts do not get reparsed or reevaluated. The only change is
    that subsequent requests for cached resources will obtain the
    newer copies.</p>

    <p>The <code title=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 title=dom-appcache-swapCache><a href=#dom-appcache-swapcache>swapCache()</a></code> is just to
    reload the entire page at a time suitable for the user, using
    <code title=dom-location-reload><a href=#dom-location-reload>location.reload()</a></code>.</p>

   </dd>

  </dl><div class=impl>

  <p>There is a one-to-one mapping from <a href=#cache-host title="cache host">cache
  hosts</a> to <code><a href=#applicationcache>ApplicationCache</a></code> objects. The <dfn id=dom-applicationcache title=dom-applicationCache><code>applicationCache</code></dfn>
  attribute on <code><a href=#window>Window</a></code> objects must return the
  <code><a href=#applicationcache>ApplicationCache</a></code> object associated with the
  <code><a href=#window>Window</a></code> object's <a href=#active-document>active document</a>. The <dfn id=dom-sharedworkerglobalscope-applicationcache title=dom-SharedWorkerGlobalScope-applicationCache><code>applicationCache</code></dfn>
  attribute on <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects must
  return the <code><a href=#applicationcache>ApplicationCache</a></code> object associated with the
  worker.
  </p>

  <p class=note>A <code><a href=#window>Window</a></code> or
  <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object has an associated
  <code><a href=#applicationcache>ApplicationCache</a></code> object even if that <a href=#cache-host>cache
  host</a> has no actual <a href=#application-cache>application cache</a>.</p>

  <hr><p>The <dfn id=dom-appcache-status title=dom-appcache-status><code>status</code></dfn>
  attribute, on getting, must return the current state of the
  <a href=#application-cache>application cache</a> that the
  <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache host</a> is
  associated with, if any. This must be the appropriate value from the
  following list:</p>

  </div>

  <dl><dt><dfn id=dom-appcache-uncached title=dom-appcache-UNCACHED><code>UNCACHED</code></dfn>
   (numeric value 0)</dt>

   <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
   host</a> is not associated with an <a href=#application-cache>application
   cache</a> at this time.</dd>

   <dt><dfn id=dom-appcache-idle title=dom-appcache-IDLE><code>IDLE</code></dfn>
   (numeric value 1)</dt>

   <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
   host</a> is associated with an <a href=#application-cache>application cache</a>
   whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
   <i>idle</i>, and that <a href=#application-cache>application cache</a> is the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> cache in its
   <a href=#application-cache-group>application cache group</a>, and the <a href=#application-cache-group>application
   cache group</a> is not marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>.</dd>

   <dt><dfn id=dom-appcache-checking title=dom-appcache-CHECKING><code>CHECKING</code></dfn>
   (numeric value 2)</dt>

   <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
   host</a> is associated with an <a href=#application-cache>application cache</a>
   whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
   <i>checking</i>.</dd>

   <dt><dfn id=dom-appcache-downloading title=dom-appcache-DOWNLOADING><code>DOWNLOADING</code></dfn>
   (numeric value 3)</dt>

   <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
   host</a> is associated with an <a href=#application-cache>application cache</a>
   whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
   <i>downloading</i>.</dd>

   <dt><dfn id=dom-appcache-updateready title=dom-appcache-UPDATEREADY><code>UPDATEREADY</code></dfn>
   (numeric value 4)</dt>

   <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
   host</a> is associated with an <a href=#application-cache>application cache</a>
   whose <a href=#application-cache-group>application cache group</a>'s <a href=#concept-appcache-status title=concept-appcache-status>update status</a> is
   <i>idle</i>, and whose <a href=#application-cache-group>application cache group</a> is not
   marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>,
   but that <a href=#application-cache>application cache</a> is <em>not</em> the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> cache in its
   group.</dd>

   <dt><dfn id=dom-appcache-obsolete title=dom-appcache-OBSOLETE><code>OBSOLETE</code></dfn>
   (numeric value 5)</dt>

   <dd><p>The <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache
   host</a> is associated with an <a href=#application-cache>application cache</a>
   whose <a href=#application-cache-group>application cache group</a> is marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>.</dd>

  </dl><div class=impl>

  <hr><p>If the <dfn id=dom-appcache-update title=dom-appcache-update><code>update()</code></dfn> method is
  invoked, the user agent must invoke the <a href=#application-cache-download-process>application cache
  download process</a>, in the background, for the
  <a href=#application-cache-group>application cache group</a> of the <a href=#application-cache>application
  cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object's
  <a href=#cache-host>cache host</a> is associated, but without giving that
  <a href=#cache-host>cache host</a> to the algorithm. If there is no such
  <a href=#application-cache>application cache</a>, or if its <a href=#application-cache-group>application cache
  group</a> is marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>, then the method
  must throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception instead.</p>

  <p>If the <dfn id=dom-appcache-abort title=dom-appcache-abort><code>abort()</code></dfn>
  method is invoked, the user agent must <dfn id=send-a-signal>send a signal</dfn> to
  the current <a href=#application-cache-download-process>application cache download process</a> for the
  <a href=#application-cache-group>application cache group</a> of the <a href=#application-cache>application
  cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object's
  <a href=#cache-host>cache host</a> is associated, if any. If there is no such
  <a href=#application-cache>application cache</a>, or it does not have a current
  <a href=#application-cache-download-process>application cache download process</a>, then do
  nothing.</p>

  <p>If the <dfn id=dom-appcache-swapcache title=dom-appcache-swapCache><code>swapCache()</code></dfn> method
  is invoked, the user agent must run the following steps:

  <ol><li><p>Check that <code><a href=#applicationcache>ApplicationCache</a></code> object's
   <a href=#cache-host>cache host</a> is associated with an <a href=#application-cache>application
   cache</a>. If it is not, then throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
   steps.</li>

   <li><p>Let <var title="">cache</var> be the <a href=#application-cache>application
   cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object's
   <a href=#cache-host>cache host</a> is associated. (By definition, this is the
   same as the one that was found in the previous step.)</li>

   <li><p>If <var title="">cache</var>'s <a href=#application-cache-group>application cache
   group</a> is marked as <a href=#concept-appcache-obsolete title=concept-appcache-obsolete>obsolete</a>, then unassociate
   the <code><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host>cache host</a>
   from <var title="">cache</var> and abort these steps. (Resources
   will now load from the network instead of the cache.)</li>

   <li><p>Check that there is an application cache in the same
   <a href=#application-cache-group>application cache group</a> as <var title="">cache</var>
   whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness
   flag</a> is <i>complete</i> and that is <a href=#concept-appcache-newer title=concept-appcache-newer>newer</a> than <var title="">cache</var>. If there is not, then throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
   steps.</li>

   <li><p>Let <var title="">new cache</var> be the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
   cache</a> in the same <a href=#application-cache-group>application cache group</a> as
   <var title="">cache</var> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
   <i>complete</i>.</li>

   <li><p>Unassociate the <code><a href=#applicationcache>ApplicationCache</a></code> object's
   <a href=#cache-host>cache host</a> from <var title="">cache</var> and instead
   associate it with <var title="">new cache</var>.</li>

  </ol><p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) <span class=impl>that must be</span> supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>, by
  all objects implementing the <code><a href=#applicationcache>ApplicationCache</a></code>
  interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-appcache-onchecking title=handler-appcache-onchecking><code>onchecking</code></dfn> <td> <code title=event-appcache-checking><a href=#event-appcache-checking>checking</a></code>
    <tr><td><dfn id=handler-appcache-onerror title=handler-appcache-onerror><code>onerror</code></dfn> <td> <code title=event-appcache-error><a href=#event-appcache-error>error</a></code>
    <tr><td><dfn id=handler-appcache-onnoupdate title=handler-appcache-onnoupdate><code>onnoupdate</code></dfn> <td> <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code>
    <tr><td><dfn id=handler-appcache-ondownloading title=handler-appcache-ondownloading><code>ondownloading</code></dfn> <td> <code title=event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>
    <tr><td><dfn id=handler-appcache-onprogress title=handler-appcache-onprogress><code>onprogress</code></dfn> <td> <code title=event-appcache-progress><a href=#event-appcache-progress>progress</a></code>
    <tr><td><dfn id=handler-appcache-onupdateready title=handler-appcache-onupdateready><code>onupdateready</code></dfn> <td> <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
    <tr><td><dfn id=handler-appcache-oncached title=handler-appcache-oncached><code>oncached</code></dfn> <td> <code title=event-appcache-cached><a href=#event-appcache-cached>cached</a></code>
    <tr><td><dfn id=handler-appcache-onobsolete title=handler-appcache-onobsolete><code>onobsolete</code></dfn> <td> <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>
  </table></div>


  <h4 id=browser-state><span class=secno>6.7.10 </span>Browser state</h4>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
  readonly attribute boolean <a href=#dom-navigator-online title=dom-navigator-onLine>onLine</a>;
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-onLine><a href=#dom-navigator-online>onLine</a></code></dt>

   <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 title=event-online><a href=#event-online>online</a></code> and <code title=event-offline><a href=#event-offline>offline</a></code> are fired when the value of
    this attribute changes.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-navigator-online title=dom-navigator-onLine><code>navigator.onLine</code></dfn>
  attribute must return false if the user agent will not contact the
  network when the user follows links or when a script requests a
  remote page (or knows that such an attempt would fail), and must
  return true otherwise.</p>

  <p>When the value that would be returned by the <code title=dom-navigator-onLine><a href=#dom-navigator-online>navigator.onLine</a></code> attribute of a
  <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> changes from
  true to false, the user agent must <a href=#queue-a-task>queue a task</a> to
  <a href=#fire-a-simple-event>fire a simple event</a> named <dfn id=event-offline title=event-offline><code>offline</code></dfn> at the
  <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object.</p>

  <p>On the other hand, when the value that would be returned by the
  <code title=dom-navigator-onLine><a href=#dom-navigator-online>navigator.onLine</a></code> attribute
  of a <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> changes
  from false to true, the user agent must <a href=#queue-a-task>queue a task</a> to
  <a href=#fire-a-simple-event>fire a simple event</a> named <dfn id=event-online title=event-online><code>online</code></dfn> at the
  <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object.</p>

  <p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task
  source</a>.</p>

  </div>

  <p class=note>This attribute is inherently unreliable. A computer
  can be connected to a network without having Internet access.</p>

  <div class=example>

   <p>In this example, an indicator is updated as the browser goes
   online and offline.</p>

   <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Online status&lt;/title&gt;
  &lt;script&gt;
   function updateIndicator() {
     document.getElementById('indicator').textContent = navigator.onLine ? 'online' : 'offline';
   }
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body onload="updateIndicator()" ononline="updateIndicator()" onoffline="updateIndicator()"&gt;
  &lt;p&gt;The network is: &lt;span id="indicator"&gt;(state unknown)&lt;/span&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  </div>

<!--TOPIC:HTML-->

  <h2 id=webappapis><span class=secno>7 </span>Web application APIs</h2>

  <h3 id=scripting><span class=secno>7.1 </span>Scripting</h3>

  <h4 id=introduction-6><span class=secno>7.1.1 </span>Introduction</h4>

  <p>Various mechanisms can cause author-provided executable code to
  run in the context of a document. These mechanisms include, but are
  probably not limited to:</p>

  <ul><li>Processing of <code><a href=#the-script-element>script</a></code> elements.</li>

   <li>Processing of inline <code title="javascript
   protocol"><a href=#javascript-protocol>javascript:</a></code> URLs (e.g. the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of <code><a href=#the-img-element>img</a></code>
   elements, or an <code title="">@import</code> rule in a CSS
   <code><a href=#the-style-element>style</a></code> element block).</li>

   <li>Event handlers, whether registered through the DOM using <code title="">addEventListener()</code>, by explicit <a href=#event-handler-content-attributes>event handler
   content attributes</a>, by <a href=#event-handler-idl-attributes>event handler IDL
   attributes</a>, or otherwise.</li>

   <li>Processing of technologies like XBL or SVG that have their own
   scripting features.</li>

  </ul><div class=impl>

  <h4 id=enabling-and-disabling-scripting><span class=secno>7.1.2 </span>Enabling and disabling scripting</h4>

  <p><dfn id=concept-bc-script title=concept-bc-script>Scripting is enabled</dfn> in a
  <em><a href=#browsing-context><span>browsing context</span></a></em> when all of the
  following conditions are true:</p>

  <ul><li>The user agent supports scripting.</li>

   <li>The user has not disabled scripting for this <a href=#browsing-context>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 class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
   </li>

   <li id=sandboxScriptBlocked>The <a href=#browsing-context>browsing context</a>'s
   <a href=#active-document>active document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag
   set</a> does not have its <a href=#sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing
   context flag</a> set.</li>

  </ul><p><dfn id=concept-bc-noscript title=concept-bc-noscript>Scripting is disabled</dfn> in a
  <a href=#browsing-context>browsing context</a> when any of the above conditions are
  false (i.e. when scripting is not <a href=#concept-bc-script title=concept-bc-script>enabled</a>).</p>

  <hr><p><dfn id=concept-n-script title=concept-n-script>Scripting is enabled</dfn> for a
  <em><a href=#node>node</a></em> if the <code><a href=#document>Document</a></code> object of the node (the
  node itself, if it is itself a <code><a href=#document>Document</a></code> object) has an
  associated <a href=#browsing-context>browsing context</a>, and <a href=#concept-bc-script title=concept-bc-script>scripting is enabled</a> in that
  <a href=#browsing-context>browsing context</a>.</p>

  <p><dfn id=concept-n-noscript title=concept-n-noscript>Scripting is disabled</dfn> for a
  node if there is no such <a href=#browsing-context>browsing context</a>, or if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> in that
  <a href=#browsing-context>browsing context</a>.</p>

  </div>


  <div class=impl>

  <!-- SCRIPT EXEC (marks areas related to creation of scripts) -->
  <h4 id=processing-model-3><span class=secno>7.1.3 </span>Processing model</h4>

  <h5 id=definitions-0><span class=secno>7.1.3.1 </span>Definitions</h5>

  <p>This specification describes three kinds of <a href=#javascript-global-environment title="JavaScript global
  environment">JavaScript global environments</a>: the <dfn id=document-environment>document environment</dfn>, the
  <dfn id=dedicated-worker-environment>dedicated worker environment</dfn>, and the <dfn id=shared-worker-environment>shared worker environment</dfn>. The
  <a href=#dedicated-worker-environment>dedicated worker environment</a> and the <a href=#shared-worker-environment>shared worker environment</a> are both
  types of <dfn id=worker-environment title="worker environment">worker environments</dfn>.</p>

  <p>Except where otherwise specified, a <a href=#javascript-global-environment>JavaScript global environment</a> is a
  <a href=#document-environment>document environment</a>.</p> <!-- note that we never actually say where one of these is
  created... -->

  <hr><p>A <dfn id=concept-script title=concept-script>script</dfn> has:</p>

  <dl><dt>A <dfn id=code-entry-point>code entry-point</dfn></dt>

   <dd>

    <p>A code entry-point represents a block of executable code that the script exposes to other
    scripts and to the user agent. Typically, the code corresponding to the code entry-point is
    executed immediately after the script is parsed, but for event handlers, it is called each time
    the handler is invoked.</p>

    <p class=example>In JavaScript <code><a href=#the-script-element>script</a></code> blocks, this corresponds to the execution
    context of the global code.</p>

   </dd>

   <dt>Optionally, a <dfn id=muted-errors>muted errors</dfn> flag</dt>

   <dd>

    <p>A flag which, if set, means that error information will not be provided for errors in this
    script (used to mute errors for cross-origin scripts, since that can leak private
    information).</p>

   </dd>
<!--
   <dt>A relationship with a <span>script settings object</span></dt>

   <dd>

    <p>An object (defined below) that describes various settings that can be shared with other
    scripts.</p>

   </dd>

  </dl>

  <hr>

  <p>Each global object has a <dfn>script settings object</dfn> shared by the scripts that use that
  global object. A <span>script settings object</span> consists of the following:</p>

  <dl>
-->
   <dt>A <dfn id=script-execution-environment>script execution environment</dfn></dt>

   <dd>

    <p>The characteristics of the script execution environment depend on the language, and are not
    defined by this specification.</p>

    <p class=example>In JavaScript, the script execution environment consists of the interpreter,
    the stack of <i>execution contexts</i>, the <i>global code</i> and <i>function code</i> and the
    <code>Function</code> objects resulting, and so forth.</p>

   </dd>

   <dt>A relationship with the <dfn id="script's-global-object">script's global object</dfn></dt>

   <dd>

    <p>An object that provides the APIs that the code can use.</p>

    <p class=example>This is typically a <code><a href=#window>Window</a></code> object. In JavaScript, this
    corresponds to the <i>global object</i>.</p>

    <p class=note>When a <a href="#script's-global-object">script's global object</a> is an empty object, it can't do
    anything that interacts with the environment.</p>

    <p>If the <a href="#script's-global-object">script's global object</a> is a <code><a href=#window>Window</a></code> object, then in
    JavaScript, the ThisBinding of the global execution context for this script must be the
    <code><a href=#window>Window</a></code> object's <code><a href=#windowproxy>WindowProxy</a></code> object, rather than the global object. <a href=#refsECMA262>[ECMA262]</a></p>

    <p class=note>This is a <a href=#willful-violation>willful violation</a> of the JavaScript specification current
    at the time of writing (ECMAScript edition 5, as defined in section 10.4.1.1 Initial Global
    Execution Context, step 3). The JavaScript specification requires that the <code title="">this</code> keyword in the global scope return the global object, but this is not
    compatible with the security design prevalent in implementations as specified herein. <a href=#refsECMA262>[ECMA262]</a></p>

   </dd>

   <dt>A relationship with the <dfn id="script's-browsing-context">script's browsing context</dfn></dt>

   <dd>

    <p>A <a href=#browsing-context>browsing context</a> that is assigned responsibility for actions taken by the
    script.</p>

    <p class=example>When a script creates and <a href=#navigate title=navigate>navigates</a> a new
    <a href=#top-level-browsing-context>top-level browsing context</a>, the <code title=dom-opener><a href=#dom-opener>opener</a></code> attribute of
    the new <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object will be set to the
    <a href="#script's-browsing-context">script's browsing context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>

   </dd>

   <dt>A relationship with the <dfn id="script's-document">script's document</dfn></dt>

   <dd>

    <p>A <code><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the script.</p>

    <p class=example>For example, the <a href="#the-document's-address" title="the document's address">address</a> of the
    <a href="#script's-document">script's document</a> is used to set the <a href="#the-document's-address" title="the document's
    address">address</a> of any <code><a href=#document>Document</a></code> elements created using <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>.</p>

   </dd>

   <dt>The <dfn id="script's-referrer-source">script's referrer source</dfn></dt>

   <dd>

    <p>Either a <code><a href=#document>Document</a></code> (specifically, the <a href="#script's-document">script's document</a>), or a
    <a href=#url>URL</a>, which is used by some APIs to determine what value to use for the <code title=http-referer>Referer</code> (sic) header in calls to the <a href=#fetch title=fetch>fetching</a> algorithm.</p>

   </dd>

   <dt>A <dfn id="script's-url-character-encoding" title="script's URL character encoding">URL character encoding</dfn></dt>

   <dd>

    <p>A character encoding, set when the script is created, used to encode URLs. <span id=sce-not-copy title="">If the character encoding is set from another source, e.g. a
    <a href="#document's-character-encoding">document's character encoding</a>, then the <a href="#script's-url-character-encoding">script's URL character
    encoding</a> must follow the source, so that if the source's changes, so does the
    script's.</span></p>

   </dd>

   <dt>A <dfn id="script's-base-url" title="script's base URL">base URL</dfn></dt>

   <dd>

    <p>A <a href=#url>URL</a>, set when the script is created, used to resolve <a href=#relative-url title="relative
    URL">relative URLs</a>. <span id=sbu-not-copy title="">If the base URL is set from another
    source, e.g. a <a href=#document-base-url>document base URL</a>, then the <a href="#script's-base-url">script's base URL</a> must
    follow the source, so that if the source's changes, so does the script's.</span></p>

   </dd>

  </dl></div>


  <div class=impl>

  <h5 id=calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</h5>

  <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=stack-of-incumbent-scripts>stack of
  incumbent scripts</dfn>, which must be initially empty. When a new script is <i>pushed</i> onto
  this stack, the specified script is to be added to the stack; when the script on this stack that
  was most recently pushed onto it is to be <i>popped</i> from the stack, it must be removed.
  Entries on this stack can be labeled as <dfn id=candidate-entry-scripts>candidate entry scripts</dfn>.</p>

  <p>When a user agent is to <dfn id=jump-to-a-code-entry-point>jump to a code entry-point</dfn> for a <a href=#concept-script title=concept-script>script</a>, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">s</var> be the given <a href=#concept-script title=concept-script>script</a>.</li>

   <li><p><a href=#prepare-to-run-a-script-based-callback>Prepare to run a script-based callback</a> with <var title="">s</var> as both the
   new incumbent <a href=#concept-script title=concept-script>script</a> and the owner <a href=#concept-script title=concept-script>script</a>. If this returns "do not run" then abort these
   steps.</li>

   <li><p>Make the <a href=#script-execution-environment title="script execution environment">script execution environment</a>
   for <var title="">s</var> execute the <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
   entry-point</a>.</li>

   <li><p><a href=#clean-up-after-running-a-callback>Clean up after running a callback</a>.</li>

  </ol><p>The <dfn id=prepare-to-run-a-script-based-callback>prepare to run a script-based callback</dfn> steps are as follows. They are invoked
  with a new incumbent <a href=#concept-script title=concept-script>script</a> <var title="">s</var> and an owner
  <a href=#concept-script title=concept-script>script</a> <var title="">o</var>, and return either "run" or "do
  not run".</p>

  <ol><li><p>If the <a href="#script's-global-object" title="script's global object">global object</a> of <var title="">o</var>
   is a <code><a href=#window>Window</a></code> object whose <code><a href=#document>Document</a></code> object is not <a href=#fully-active>fully
   active</a>, then return "do not run" and abort these steps.</p>

   <li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> for <var title="">o</var>'s <a href="#script's-browsing-context" title="script's browsing context">browsing context</a>, then return
   "do not run" and abort these steps.</p>

   <li><p>Push <var title="">s</var> onto the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a>, and label it
   as a <a href=#candidate-entry-scripts title="candidate entry scripts">candidate entry script</a>.</li>

   <li><p>Return "run".</li>

  </ol><p>The steps to <dfn id=prepare-to-run-a-non-script-based-callback>prepare to run a non-script-based callback</dfn> are as follows. They are
  invoked with a new incumbent <a href=#concept-script title=concept-script>script</a> <var title="">s</var> and,
  in principle, return either "run" or "do not run" (though in practice they always return
  "run").</p>

  <ol><li><p>Push <var title="">s</var> onto the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a>.</li>

   <li><p>Return "run".</li>

  </ol><p>The steps to <dfn id=clean-up-after-running-a-callback>clean up after running a callback</dfn> are as follows:</p>

  <ol><li><p>Pop the current <a href=#incumbent-script>incumbent script</a> from the <a href=#stack-of-incumbent-scripts>stack of incumbent
   scripts</a>.</li>

   <li><p>If the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> is now empty, <a href=#run-the-global-script-clean-up-jobs>run the global script
   clean-up jobs</a>. (These cannot run scripts.)</li>

   <li><p>If the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> is now empty, <a href=#perform-a-microtask-checkpoint>perform a microtask
   checkpoint</a>. (If this runs scripts, these algorithms will be invoked reentrantly.)</li>

  </ol><p class=note>These algorithms are not invoked by one script directly calling another, but they can be invoked
  reentrantly in an indirect manner, e.g. if a script dispatches an event which has event listeners
  registered.</p>

  <p>When a JavaScript <i>SourceElements</i> production is to be evaluated, the <a href=#concept-script title=concept-script>script</a> corresponding to that <i>SourceElements</i> must be pushed
  onto the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> before the evaluation begins, and popped when the
  evaluation ends (regardless of whether it's an abrupt completion or not).</p>

  <p>The <dfn id=entry-script>entry script</dfn> is the most-recently added <a href=#concept-script title=concept-script>script</a> in the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> that is
  labeled as a <a href=#candidate-entry-scripts title="candidate entry scripts">candidate entry script</a>. If the stack is
  empty, or has no entries labeled as such, then there is no <a href=#entry-script>entry script</a>. It is used
  to obtain, amongst other things, the <a href="#script's-base-url">script's base URL</a> to <a href=#resolve-a-url title="resolve a
  url">resolve</a> relative <a href=#url title=URL>URLs</a> used in scripts running in that
  <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>

  <p>The <dfn id=incumbent-script>incumbent script</dfn> is the <a href=#concept-script title=concept-script>script</a> in the
  <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> that was most-recently added (i.e. the last one on the
  stack). If the stack is empty, then there is no <a href=#incumbent-script>incumbent script</a>. It is used in some
  security checks.</p>

  <p class=note>The WebIDL specification also uses these algorithms. <a href=#refsWEBIDL>[WEBIDL]</a></p>

  <hr><p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=running-mutation-observers>running mutation
  observers</dfn> flag, which must initially be false. It is used to prevent reentrant invocation of
  the algorithm to <a href=#concept-mo-invoke title=concept-mo-invoke>invoke <code>MutationObserver</code>
  objects</a>. For the purposes of <code><a href=#mutationobserver>MutationObserver</a></code> objects, each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of
  related similar-origin browsing contexts</a> is a distinct <var title="MutationObserver
  scripting environment"><a href=#mutationobserver-scripting-environment>scripting environment</a></var>.</p>

  <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=global-script-clean-up-jobs-list>global script
  clean-up jobs list</dfn>, which must initially be empty. A global script clean-up job cannot run
  scripts, and cannot be sensitive to the order in which other clean-up jobs are executed. The File
  API uses this to release <code title="">blob:</code> URLs. <a href=#refsFILEAPI>[FILEAPI]</a></p>

  <p>When the user agent is to <dfn id=run-the-global-script-clean-up-jobs>run the global script clean-up jobs</dfn>, the user agent must
  perform each of the jobs in the <a href=#global-script-clean-up-jobs-list>global script clean-up jobs list</a> and then empty the
  list.</p>

  </div>


  <div class=impl>

  <h5 id=creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</h5>

  <p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script title="create a script">created</dfn>, given some script source, a script source URL, its
  scripting language, a global object, a browsing context, a document, a referrer source, a URL
  character encoding, a base URL, and optionally a <var title="">muted errors</var> flag, the user
  agent must run the following steps:</p>

  <ol><!--CLEANUP--><li><p>Let <var title="">script</var> be a new <a href=#concept-script title=concept-script>script</a> that
   this algorithm will subsequently initialize.</li>

   <li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is
   disabled</a> for <a href=#browsing-context>browsing context</a> passed to this
   algorithm, then abort these steps, as if the script source described a program that did nothing but
   return void.</p>

   <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> as
   appropriate for the given scripting language.</li>

   <li><p>Parse/compile/initialize the source of the script using the
   <a href=#script-execution-environment>script execution environment</a>, as appropriate for the
   scripting language, and thus obtain <var title="">script</var>'s <a href=#code-entry-point>code entry-point</a>.</li>

   <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the
   <a href="#script's-browsing-context">script's browsing context</a>, the <a href="#script's-document">script's
   document</a>, the <a href="#script's-referrer-source">script's referrer source</a>, the
   <a href="#script's-url-character-encoding">script's URL character encoding</a>, and the
   <a href="#script's-base-url">script's base URL</a> from the settings passed to this
   algorithm.</li>

   <li><p>If the <var title="">muted errors</var> flag was set, then set <var title="">script</var>'s <a href=#muted-errors>muted
   errors</a> flag.</li>

   <li>
 
    <p>If all the steps above succeeded (in particular, if the script
    was compiled successfully), <a href=#jump-to-a-code-entry-point title="jump to a code
    entry-point">Jump</a> to <var title="">script</var>'s <a href=#code-entry-point>code
    entry-point</a>.</p>

    <p>Otherwise, <a href=#report-the-error>report the error</a> for <var title="">script</var>,
    with the problematic position (line number and column number), using the <a href="#script's-global-object">script's global object</a> as the target. If the
    error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error
    may be reported to the user.</p>

   </li>

  </ol><hr><p>When the user agent is to <dfn id=create-an-impotent-script>create an impotent script</dfn>,
  given some script source and URL, its scripting language, and a
  browsing context, the user agent must <a href=#create-a-script>create a script</a>,
  using the given script source, URL, and scripting language, using a
  new empty object as the global object, and using the given browsing
  context as the browsing context. The referrer source, URL character
  encoding, and base URL for the resulting <a href=#concept-script title=concept-script>script</a> are not important as no APIs
  are exposed to the script.</p>

  <hr><p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script-from-a-node title="create a script from a node">created from a node</dfn> <var title="">node</var>, given some
  script source, its URL, its scripting language, and optionally a <var title="">muted errors</var>
  flag, the user agent must <a href=#create-a-script>create a script</a>, using the given script source, URL, and
  scripting language, <a href=#the-script-settings-determined-from-the-node>the script settings determined from the node</a> <var title="">node</var>, and, if the <var title="">muted errors</var> flag was set in the call to this
  algorithm, the <var title="">muted errors</var> flag.</p>

  <p><dfn id=the-script-settings-determined-from-the-node>The script settings determined from the node</dfn> <var title="">node</var> are computed as follows:</p>

  <ol><li><p>Let <var title="">document</var> be the
   <code><a href=#document>Document</a></code> of <var title="">node</var> (or <var title="">node</var> itself if it is a
   <code><a href=#document>Document</a></code>).</li>

   <li><p>The global object is the <code><a href=#window>Window</a></code> object of <var title="">document</var>.</li>

   <li><p>The browsing context is the <a href=#browsing-context>browsing context</a> of
   <var title="">document</var>.</p>

   <li><p>The document is <var title="">document</var>.</p>

   <li><p>The referrer source is <var title="">document</var>.</p>

   <li><p>The URL character encoding is the <a href="#document's-character-encoding" title="document's
   character encoding">character encoding</a> of <var title="">document</var>. (<a href=#sce-not-copy>This is a
   reference, not a copy</a>.)</li>

   <li><p>The base URL is the <a href=#document-base-url title="document base URL">base
   URL</a> of <var title="">document</var>. (<a href=#sbu-not-copy>This is a reference, not a copy</a>.)</li>

  </ol></div>


  <div class=impl>

  <h5 id=killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</h5>

  <p>User agents may impose resource limitations on scripts, for
  example CPU quotas, memory limits, total execution time limits, or
  bandwidth limitations. When a script exceeds a limit, the user agent
  may either throw a <code><a href=#quotaexceedederror>QuotaExceededError</a></code> exception, abort
  the script without an exception, prompt the user, or throttle script
  execution.</p>

  <div class=example>

   <p>For example, the following script never terminates. A user agent
   could, after waiting for a few seconds, prompt the user to either
   terminate the script or let it continue.</p>

   <pre>&lt;script&gt;
 while (true) { /* loop */ }
&lt;/script&gt;</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 title=dom-alert><a href=#dom-alert>window.alert()</a></code> API) or because of a
  script's actions (e.g. because it has exceeded a time limit).</p>

  <p>If scripting is disabled while a script is executing, the script
  should be terminated immediately.</p>

  <p>User agents may allow users to specifically disable scripts just
  for the purposes of closing a <a href=#browsing-context>browsing context</a>.</p>

  <p class=example>For example, the prompt mentioned in the example
  above could also offer the user with a mechanism to just close the
  page entirely, without running any <code title=event-unload>unload</code> event handlers.</p>

  </div>


  <div class=impl>

  <h5 id=runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script errors</h5>

  <p>When the user agent is required to <dfn id=report-the-error title="report the error">report an error</dfn> for a
  particular <a href=#concept-script title=concept-script>script</a> <var title="">script</var> with a particular
  position <var title="">line</var>:<var title="">col</var>, using a particular target <var title="">target</var>, it must run these steps, after which the error is either <dfn id=concept-error-handled title=concept-error-handled><i>handled</i></dfn> or <dfn id=concept-error-nothandled title=concept-error-nothandled><i>not
  handled</i></dfn>:</p>

  <ol><li><p>If <var title="">target</var> is <a href=#in-error-reporting-mode>in error reporting mode</a>, then abort these
   steps; the error is <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.</li>

   <li><p>Let <var title="">target</var> be <dfn id=in-error-reporting-mode>in error reporting mode</dfn>.</li>

   <li><p>Let <var title="">message</var> be a user-agent-defined
   string describing the error in a helpful manner.
   <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
   </li>

   <li><p>Let <var title="">error object</var> be the object that represents the error: in the case
   of an uncaught exception, that would be the object that was thrown; in the case of a JavaScript
   error that would be an <code>Error</code> object. If there is no corresponding object, then the
   null value must be used instead.</li>

   <li>

    <p>Let <var title="">location</var> be an <a href=#absolute-url>absolute URL</a> that corresponds to the
    resource from which <var title="">script</var> was obtained.</p>

    <p class=note>The resource containing the script will typically be the file
    from which the <code><a href=#document>Document</a></code> was parsed, e.g. for inline
    <code><a href=#the-script-element>script</a></code> elements or <a href=#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 title=dom-document-write><a href=#dom-document-write>document.write()</a></code> API to
    insert an inline <code><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 title=dom-document-write><a href=#dom-document-write>document.write()</a></code> call or where the
    string passed to that call was first constructed. Naturally,
    implementing this can be somewhat non-trivial.</p>

    <p class=note>User agents are similarly encouraged to keep careful track of the
    original line numbers, even in the face of <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> calls mutating
    the document as it is parsed, or <a href=#event-handler-content-attributes>event handler content
    attributes</a> spanning multiple lines.</p>

   </li>

   <li><p>If <var title="">script</var> has <a href=#muted-errors>muted errors</a>, then set <var title="">message</var> to "<code title="">Script error.</code>", set <var title="">location</var> to the empty string, set <var title="">line</var> and <var title="">col</var> to 0, and set <var title="">error object</var> to null.</li>

   <li><p>Let <var title="">event</var> be a new <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code><a href=#errorevent>ErrorEvent</a></code> object that does not
   bubble but is cancelable, and which has the event name <code title=event-error>error</code>.</li>

   <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code> attribute to <var title="">message</var>.</li>

   <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute to <var title="">location</var>.</li>

   <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attribute to <var title="">line</var>.</li>

   <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-colno><a href=#dom-errorevent-colno>colno</a></code> attribute to <var title="">col</var>.</li>

   <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-object>error</code> attribute to <var title="">error object</var>.</li>

   <li><p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> <var title="">event</var> at <var title="">target</var>.</li>

   <li><p>Let <var title="">target</var> no longer be <a href=#in-error-reporting-mode>in error reporting mode</a>.</li>

   <li><p>If <var title="">event</var> was canceled, then the error is <i title=concept-error-handled><a href=#concept-error-handled>handled</a></i>. Otherwise, the error is <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.</p>

  </ol><h6 id=runtime-script-errors-in-documents><span class=secno>7.1.3.5.1 </span>Runtime script errors in documents</h6>

  <p>Whenever an uncaught runtime script error occurs in one of the scripts associated with a
  <code><a href=#document>Document</a></code>, the user agent must <a href=#report-the-error>report the error</a> for the relevant <a href=#concept-script title=concept-script>script</a>, with the problematic position (line number and column
  number) in the resource containing the script, using
  the <a href="#script's-global-object">script's global object</a> as the target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error may be reported to the
  user.</p>

  </div>



  <h6 id=the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code><a href=#errorevent>ErrorEvent</a></code> interface</h6>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#erroreventinit>ErrorEventInit</a> eventInitDict)]
interface <dfn id=errorevent>ErrorEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute DOMString <a href=#dom-errorevent-message title=dom-ErrorEvent-message>message</a>;
  readonly attribute DOMString <a href=#dom-errorevent-filename title=dom-ErrorEvent-filename>filename</a>;
  readonly attribute unsigned long <a href=#dom-errorevent-lineno title=dom-ErrorEvent-lineno>lineno</a>;
  readonly attribute unsigned long <a href=#dom-errorevent-colno title=dom-ErrorEvent-colno>colno</a>;
  readonly attribute any <a href=#dom-errorevent-error title=dom-ErrorEvent-error>error</a>;
};

dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  DOMString message;
  DOMString filename;
  unsigned long lineno;
  unsigned long colno;
  any error;
};</pre>

  <p>The <dfn id=dom-errorevent-message title=dom-ErrorEvent-message><code>message</code></dfn> attribute
  must return the value it was initialized to. When the object is
  created, this attribute must be initialized to the empty string. It
  represents the error message.</p>

  <p>The <dfn id=dom-errorevent-filename title=dom-ErrorEvent-filename><code>filename</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to the empty
  string. It represents the <a href=#absolute-url>absolute URL</a> of the script in
  which the error originally occurred.</p>

  <p>The <dfn id=dom-errorevent-lineno title=dom-ErrorEvent-lineno><code>lineno</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to zero. It
  represents the line number where the error occurred in the
  script.</p>

  <p>The <dfn id=dom-errorevent-colno title=dom-ErrorEvent-colno><code>colno</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to zero. It
  represents the column number where the error occurred in the
  script.</p>

  <p>The <dfn id=dom-errorevent-error title=dom-ErrorEvent-error><code>error</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to null.
  Where appropriate, it is set to the object representing the error (e.g. the exception object in
  the case of an uncaught DOM exception).</p>



  <div class=impl>

  <h4 id=event-loops><span class=secno>7.1.4 </span>Event loops</h4>

  <h5 id=definitions-1><span class=secno>7.1.4.1 </span>Definitions</h5>

  <p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user
  agents must use <dfn id=event-loop title="event loop">event loops</dfn> as described in this section.</p>

  <p>There must be at least one <a href=#event-loop>event loop</a> per user agent, and at most one <a href=#event-loop>event
  loop</a> per <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>

  <p class=note>When there is more than one <a href=#event-loop>event loop</a> for a <a href=#unit-of-related-browsing-contexts>unit of related
  browsing contexts</a>, complications arise when a <a href=#browsing-context>browsing context</a> in that group
  is <a href=#navigate title=navigate>navigated</a> such that it switches from one <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related
  similar-origin browsing contexts</a> to another. This specification does not currently describe
  how to handle these complications.</p>

  <p>An <a href=#event-loop>event loop</a> always has at least one <a href=#browsing-context>browsing context</a>. If an
  <a href=#event-loop>event loop</a>'s <a href=#browsing-context title="browsing context">browsing contexts</a> all go away,
  then the <a href=#event-loop>event loop</a> goes away as well. A <a href=#browsing-context>browsing context</a> always has an
  <a href=#event-loop>event loop</a> coordinating its activities.</p>

  <p>An <a href=#event-loop>event loop</a> has one or more <dfn id=task-queue title="task queue">task queues</dfn>. A
  <a href=#task-queue>task queue</a> is an ordered list of <dfn id=concept-task title=concept-task>tasks</dfn>, which can
  be:</p>

  <dl><dt>Events</dt>

   <dd>

    <p>Asynchronously dispatching an <code><a href=#event>Event</a></code> object at a particular
    <code><a href=#eventtarget>EventTarget</a></code> object is a task.</p>

    <p class=note>Not all events are dispatched using the <a href=#task-queue>task queue</a>, many are
    dispatched synchronously during other tasks.</p>

   </dd>


   <dt>Parsing</dt>

   <dd><p>The <a href=#html-parser>HTML parser</a> tokenizing one or more bytes, and then processing any
   resulting tokens, is typically a task.</dd>


   <dt>Callbacks</dt>

   <dd><p>Calling a callback asynchronously is a task.</dd>


   <dt>Using a resource</dt>

   <dd><p>When an algorithm <a href=#fetch title=fetch>fetches</a> a resource, if the fetching occurs
   asynchronously then the processing of the resource once some or all of the resource is available
   is a task.</dd>


   <dt>Reacting to DOM manipulation</dt>

   <dd><p>Some elements have tasks that trigger in response to DOM manipulation, e.g. when that
   element is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into the document</a>.</p>

  </dl><p>Each <a href=#concept-task title=concept-task>task</a> is associated with a <code><a href=#document>Document</a></code>; if the
  task was queued in the context of an element, then it is the element's <code><a href=#document>Document</a></code>; if
  the task was queued in the context of a <a href=#browsing-context>browsing context</a>, then it is the
  <a href=#browsing-context>browsing context</a>'s <a href=#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 title=concept-script>script</a> then the document is
  the <a href="#script's-document">script's document</a>.</p>

  <p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
  the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>

  <p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the given task to one of the <a href=#task-queue title="task queue">task queues</a> of the relevant <a href=#event-loop>event loop</a>.</p>

  <p>Each <a href=#concept-task title=concept-task>task</a> is defined as coming from a specific <dfn id=task-source>task
  source</dfn>. All the tasks from one particular <a href=#task-source>task source</a> and destined to a
  particular <a href=#event-loop>event loop</a> (e.g. the callbacks generated by timers of a
  <code><a href=#document>Document</a></code>, the events fired for mouse movements over that <code><a href=#document>Document</a></code>, the
  tasks queued for the parser of that <code><a href=#document>Document</a></code>) must always be added to the same
  <a href=#task-queue>task queue</a>, but <a href=#concept-task title=concept-task>tasks</a> from different <a href=#task-source title="task source">task sources</a> may be placed in different <a href=#task-queue title="task queue">task
  queues</a>.</p>

  <p class=example>For example, a user agent could have one <a href=#task-queue>task queue</a> for mouse and
  key events (the <a href=#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>task source</a> out of order.</p>

  <hr><p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
  shared state like cookies. At any one point, the <a href=#storage-mutex>storage mutex</a> is either free, or
  owned by a particular <a href=#event-loop>event loop</a> or instance of the <a href=#fetch title=fetch>fetching</a> algorithm.</p>

  <p>If a user agent does not implement a <a href=#storage-mutex>storage mutex</a>, it is exempt from implementing
  the requirements that require it to acquire or release it.</p>

  <p class=note>User agent implementors have to make a choice between two evils. On the one hand,
  not implementing the storage mutex means that there is a risk of data corruption: a site could,
  for instance, try to read a cookie, increment its value, then write it back out, using the new
  value of the cookie as a unique identifier for the session; if the site does this twice in two
  different browser windows at the same time, it might end up using the same "unique" identifier for
  both sessions, with potentially disastrous effects. On the other hand, implementing the storage
  mutex has potentially serious performance implications: whenever a site uses Web Storage or
  cookies, all other sites that try to use Web Storage or cookies are blocked until the first site
  finishes.</p>

  <p>Whenever a <a href=#concept-script title=concept-script>script</a> calls into a <a href=#plugin>plugin</a>, and
  whenever a <a href=#plugin>plugin</a> calls into a <a href=#concept-script title=concept-script>script</a>, the user
  agent must release the <a href=#storage-mutex>storage mutex</a>.</p>


  <h5 id=processing-model-4><span class=secno>7.1.4.2 </span>Processing model</h5>

  <p>An <a href=#event-loop>event loop</a> must continually run through the following steps for as long as it
  exists:</p>

  <ol><!-- if you add a step here, make sure to go through the spec updating references to the "first
   step" or "step 1" of the event loop --><li><p>Run the oldest <a href=#concept-task title=concept-task>task</a> on one of the <a href=#event-loop>event
   loop</a>'s <a href=#task-queue title="task queue">task queues</a>, if any, ignoring tasks whose
   associated <code><a href=#document>Document</a></code>s are not <a href=#fully-active>fully active</a>. The user agent may pick any
   <a href=#task-queue>task queue</a>.</li>

   <!-- warning! if you renumber these steps, make sure to update the "spin the event loop"
   algorithm below! -->

   <li><p>If the <a href=#storage-mutex>storage mutex</a> is now owned by the <a href=#event-loop>event loop</a>, release it
   so that it is once again free.</li>

   <li><p>If a task was run in the first step above, remove that task from its <a href=#task-queue>task
   queue</a>.</li>

   <li>

    <p>If this <a href=#event-loop>event loop</a> is not a worker's <a href=#event-loop>event loop</a>, run these
    substeps:</p>

    <ol><li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>

     <li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>

     <li><p>If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
     <a href=#browsing-context>browsing context</a> to reflect the current state.</li>

    </ol></li>

   <li><p>Otherwise, if this <a href=#event-loop>event loop</a> is running for a
   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, but there are no events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
   loop</a>, aborting these steps.</li>

   <li><p>Return to the first step of the <a href=#event-loop>event loop</a>.</li>

  </ol><hr><p>When a user agent is to <dfn id=perform-a-microtask-checkpoint>perform a microtask checkpoint</dfn>, if the <a href=#running-mutation-observers>running
  mutation observers</a> flag is false, then the user agent must run the following steps:</p>

  <ol><li><p>Let the <a href=#running-mutation-observers>running mutation observers</a> flag be true.</li>

   <li><p><a href=#sort-the-tables-with-pending-sorts>Sort the tables with pending sorts</a>.</li>

   <li>

    <p><a href=#concept-mo-invoke title=concept-mo-invoke>Invoke <code>MutationObserver</code> objects</a> for the
    <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> to which the <a href="#script's-browsing-context">script's
    browsing context</a> belongs, using the <a href=#task-wrapper-algorithm>task wrapper algorithm</a> as the steps to
    invoke each callback.</p>

    <p class=note>This will typically invoke scripted callbacks, which calls the <a href=#jump-to-a-code-entry-point>jump to a
    code entry-point</a> algorithm, which calls this <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>
    algorithm again, which is why we use the <a href=#running-mutation-observers>running mutation observers</a> flag to avoid
    reentrancy.</p>

   </li>

   <li><p>Let the <a href=#running-mutation-observers>running mutation observers</a> flag be false.</li>

  </ol><hr><p>When the user agent is to <dfn id=provide-a-stable-state>provide a stable state</dfn>, if any asynchronously-running
  algorithms are <dfn id=await-a-stable-state title="await a stable state">awaiting a stable state</dfn>, then the user
  agent must run their <dfn id=synchronous-section>synchronous section</dfn> and then resume running their asynchronous
  algorithm (if appropriate).</p>

  <p class=note>A <a href=#synchronous-section>synchronous section</a> never mutates the DOM, runs any script, or has
  any side-effects detectable from another <a href=#synchronous-section>synchronous section</a>, and thus <a href=#synchronous-section title="synchronous section">synchronous sections</a> can be run in any order, and cannot
  <a href=#spin-the-event-loop>spin the event loop</a>.</p>

  <p class=note>Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are marked
  with &#x231b;.</p>

  <hr><p>The <dfn id=task-wrapper-algorithm>task wrapper algorithm</dfn>, which is implicitly invoked in the context of an
  <a href=#event-loop>event loop</a> and is used to invoke a given <var title="">callback</var> in a specific
  way, is as follows:</p>

  <ol><li><p>Invoke <var title="">callback</var> as specified.</li>

  </ol><p class=XXX>The above will change shortly.</p>

  <hr><p>When an algorithm says to <dfn id=spin-the-event-loop>spin the event loop</dfn> until a condition <var title="">goal</var> is met, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">task source</var> be the <a href=#task-source>task source</a> of the currently
   running <a href=#concept-task title=concept-task>task</a>.</li>

   <li>

    <p>Stop the currently running <a href=#concept-task title=concept-task>task</a>, allowing the <a href=#event-loop>event
    loop</a> to resume, but continue these steps asynchronously.</p>

    <p class=note>This causes the <a href=#event-loop>event loop</a> to move on to the second step of its
    processing model (defined above).</p>

   </li>

   <li><p>Wait until the condition <var title="">goal</var> is met.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to continue running these steps, using the <a href=#task-source>task
   source</a> <var title="">task source</var>. Wait until this task runs before continuing these
   steps.</li>

   <li><p>Return to the caller.</li>

  </ol><hr><p>Some of the algorithms in this specification, for historical reasons, require the user agent to
  <dfn id=pause>pause</dfn> while running a <a href=#concept-task title=concept-task>task</a> until a condition <var title="">goal</var> is met. This means running the following steps:</p>

  <ol><li><p>If any asynchronously-running algorithms are <a href=#await-a-stable-state title="await a stable state">awaiting a
   stable state</a>, then run their <a href=#synchronous-section>synchronous section</a> and then resume running
   their asynchronous algorithm. (See the <a href=#event-loop>event loop</a> processing model definition above
   for details.)</p>

   <li><p>If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
   <a href=#browsing-context>browsing context</a> to reflect the current state.</li>

   <li><p>Wait until the condition <var title="">goal</var> is met. While a user agent has a paused
   <a href=#concept-task title=concept-task>task</a>, the corresponding <a href=#event-loop>event loop</a> must not run
   further <a href=#concept-task title=concept-task>tasks</a>, and any script in the currently running <a href=#concept-task title=concept-task>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>event loop</a> will not be
   doing anything.</li>

  </ol><hr><p>When a user agent is to <dfn id=obtain-the-storage-mutex>obtain the storage mutex</dfn> as part of running a <a href=#concept-task title=concept-task>task</a>, it must run through the following steps:</p>

  <ol><li><p>If the <a href=#storage-mutex>storage mutex</a> is already owned by this <a href=#concept-task title=concept-task>task</a>'s <a href=#event-loop>event loop</a>, then abort these steps.</li>

   <li><p>Otherwise, <a href=#pause>pause</a> until the <a href=#storage-mutex>storage mutex</a> can be taken by the
   <a href=#event-loop>event loop</a>.</li>

   <li><p>Take ownership of the <a href=#storage-mutex>storage mutex</a>.</li>

  </ol></div>


  <div class=impl>

  <h5 id=generic-task-sources><span class=secno>7.1.4.3 </span>Generic task sources</h5>

  <p>The following <a href=#task-source title="task source">task sources</a> are used by a number of mostly
  unrelated features in this and other specifications.</p>

  <dl><dt>The <dfn id=dom-manipulation-task-source>DOM manipulation task source</dfn></dt>

   <dd>

    <p>This <a href=#task-source>task source</a> is used for features that react to DOM manipulations, such as
    things that happen asynchronously when an element is <a href=#insert-an-element-into-a-document title="insert an element into a
    document">inserted into the document</a>.</p>

   </dd>

   <dt>The <dfn id=user-interaction-task-source>user interaction task source</dfn></dt>

   <dd>

    <p>This <a href=#task-source>task source</a> is used for features that react to user interaction, for
    example keyboard or mouse input.</p>

    <p>Asynchronous events sent in response to user input (e.g. <code title=event-click><a href=#event-click>click</a></code> events) must be fired using <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> with the <a href=#user-interaction-task-source>user
    interaction task source</a>. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p> <!-- user
    interaction events integration point -->

   </dd>

   <dt>The <dfn id=networking-task-source>networking task source</dfn></dt>

   <dd>

    <p>This <a href=#task-source>task source</a> is used for features that trigger in response to network
    activity.</p>

   </dd>

   <dt>The <dfn id=history-traversal-task-source>history traversal task source</dfn></dt>

   <dd>

    <p>This <a href=#task-source>task source</a> is used to queue calls to <code title=dom-history-back><a href=#dom-history-back>history.back()</a></code> and similar APIs.</p>

   </dd>

  </dl></div>


<!--CLEANUP-->

  <div class=impl>

  <!-- SCRIPT EXEC -->
  <h4 id=javascript-protocol><span class=secno>7.1.5 </span><dfn title="javascript protocol">The <code title="">javascript:</code> URL scheme</dfn></h4>

  <p>When a <a href=#url>URL</a> using the <code title="">javascript:</code> scheme is <dfn id=concept-js-deref title=concept-js-deref>dereferenced</dfn>, the user agent must run the following steps:</p>

  <ol><li><p>Let the script source be the string obtained using the content retrieval operation defined
   for <code title="">javascript:</code> URLs. <a href=#refsJSURL>[JSURL]</a></li>

   <li>

    <p>Use the appropriate step from the following list:</p>

    <dl><dt>If a <a href=#browsing-context>browsing context</a> is being <a href=#navigate title=navigate>navigated</a> to a
     <code>javascript:</code> URL, and the <a href=#source-browsing-context>source browsing context</a> for that navigation,
     if any, has <a href=#concept-bc-noscript title=concept-bc-noscript>scripting disabled</a></dt>

     <dd>

      <p>Let <var title="">result</var> be void.</p>

     </dd>

     <dt>If a <a href=#browsing-context>browsing context</a> is being <a href=#navigate title=navigate>navigated</a> to a
     <code>javascript:</code> URL, and the <a href=#active-document>active document</a> of that browsing context has
     the <a href=#same-origin>same origin</a> as the script given by that URL</dt>

     <dd>

      <!-- http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/ -->

      <p>Let <var title="">address</var> be the <a href="#the-document's-address" title="the document's address">address</a>
      of the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a> being navigated.</p>

      <p>If <var title="">address</var> is <code><a href=#about:blank>about:blank</a></code>, and the <a href=#browsing-context>browsing
      context</a> being navigated has a <a href=#creator-browsing-context>creator browsing context</a>, then let <var title="">address</var> be the <a href="#the-document's-address" title="the document's address">address</a> of the
      <a href=#creator-document>creator <code>Document</code></a> instead.</p>

      <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a script</a> from the
      <code><a href=#document>Document</a></code> node of the <a href=#active-document>active document</a>, using the aforementioned
      script source, the <a href=#url>URL</a> of the resource where the <code>javascript:</code> URL,
      was found, and assuming the scripting language is JavaScript.</p>

      <p>Let <var title="">result</var> be the return value of the <a href=#code-entry-point>code entry-point</a>
      of this <a href=#concept-script title=concept-script>script</a>. If an exception was thrown, let <var title="">result</var> be void instead. (The result will be void also if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a>.)</p>

      <p>When it comes time to <a href="#set-the-document's-address">set the document's address</a> in the <a href=#navigate title=navigate>navigation algorithm</a>, use <var title="">address</var> as the
      <a href=#override-url>override URL</a>.</p>

     </dd>

<!--(turns out only Firefox does this, and only for <img src=""> and a few others, so it's commented
     out for now pending someone having a convincing use case)

     <dt>If the <code>Document</code> object of the element, attribute, or style sheet from which
     the <code>javascript:</code> URL was reached has an associated <span>browsing
     context</span></dt>

     <dd>

      <p><span>Create an impotent script</span> using the aforementioned script source, with the
      scripting language set to JavaScript, and with the <code>Document</code>'s object's
      <span>browsing context</span> as the browsing context.</p>

      <p>Let <var title="">result</var> be the return value of the <span>code entry-point</span>
      of this <span title="concept-script">script</span>. If an exception was thrown, let <var
      title="">result</var> be void instead. (The result will be void also if <span
      title="concept-bc-noscript">scripting is disabled</span>.)</p>

     </dd>
-->

     <dt>Otherwise</dt>

     <dd>

      <p>Let <var title="">result</var> be void.</p>

     </dd>

    </dl></li>

   <li>

    <p>If the result of executing the script is void (there is no return value), then the URL must
    be treated in a manner equivalent to an HTTP resource with an HTTP 204 No Content response.</p>

    <p>Otherwise, the URL must be treated in a manner equivalent to an HTTP resource with a 200 OK
    response whose <a href=#content-type title=Content-Type>Content-Type metadata</a> is <code><a href=#text/html>text/html</a></code>
    and whose response body is the return value converted to a string value.</p>

    <p class=note>Certain contexts, in particular <code><a href=#the-img-element>img</a></code> elements, ignore the <a href=#content-type title=Content-Type>Content-Type metadata</a>.</p>

   </li>

  </ol><div class=example>

   <p>So for example a <code title="">javascript:</code> URL for a <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute of an <code><a href=#the-img-element>img</a></code> element would be evaluated in
   the context of an empty object as soon as the attribute is set; it would then be sniffed to
   determine the image type and decoded as an image.</p>

   <p>A <code title="">javascript:</code> URL in an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
   attribute of an <code><a href=#the-a-element>a</a></code> element would only be evaluated when the link was <a href=#following-hyperlinks title="following hyperlinks">followed</a>.</p>

   <p>The <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute of an <code><a href=#the-iframe-element>iframe</a></code> element would
   be evaluated in the context of the <code><a href=#the-iframe-element>iframe</a></code>'s own <a href=#browsing-context>browsing context</a>; once
   evaluated, its return value (if it was not void) would replace that <a href=#browsing-context>browsing
   context</a>'s document, thus changing the variables visible in that <a href=#browsing-context>browsing
   context</a>.</p>

  </div>

  </div>



  <h4 id=events><span class=secno>7.1.6 </span>Events</h4>

  <h5 id=event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers</h5>

  <!--test: <a href="http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E">test</a>-->

  <p>Many objects can have <dfn id=event-handlers>event handlers</dfn> specified. These act as non-capture event
  listeners for the object on which they are specified. <a href=#refsDOM>[DOM]</a></p>

  <p>An <a href=#event-handlers title="event handlers">event handler</a> has a name, which always starts with
  "<code title="">on</code>" and is followed by the name of the event for which it is intended.</p>

  <p>An <a href=#event-handlers title="event handlers">event handler</a> can either have the value null or be set
  to a callback object. This is defined using the <code><a href=#eventhandler>EventHandler</a></code> callback function type.
  <span class=impl>Initially, event handlers must be set to null.</span></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 title="event handler IDL
  attributes">event handler IDL attribute</a>.</p>

  <p>The second way is as an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
  attribute</a>. Event handlers on <a href=#html-elements>HTML elements</a> and some of the event handlers on
  <code><a href=#window>Window</a></code> objects are exposed in this way.</p>

  <div class=impl>

  <hr><p>An <dfn id=event-handler-idl-attributes title="event handler IDL attributes">event handler IDL attribute</dfn> is an IDL
  attribute for a specific <a href=#event-handlers title="event handlers">event handler</a>. The name of the IDL
  attribute is the same as the name of the <a href=#event-handlers title="event handlers">event handler</a>.</p>

  <p><a href=#event-handler-idl-attributes>Event handler IDL attributes</a>, on setting, must set the corresponding event handler
  to their new value, and on getting, must return whatever the current value of the corresponding
  event handler is (possibly null).</p>

  <p>If an <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler IDL attribute</a> exposes an
  <a href=#event-handlers title="event handlers">event handler</a> of an object that doesn't exist, it must always
  return null on getting and must do nothing on setting.</p>

  <p class=note>This can happen in particular for <a href=#event-handler-idl-attributes title="event handler IDL attributes">event
  handler IDL attribute</a> on <code><a href=#the-body-element>body</a></code> elements that do not have corresponding
  <code><a href=#window>Window</a></code> objects.</p>

  <p class=note>Certain event handler IDL attributes have additional requirements, in particular
  the <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
  <code><a href=#messageport>MessagePort</a></code> objects.</p>

  <p>On getting, <a href=#event-handler-idl-attributes>event handler IDL attributes</a> must return the value of their
  corresponding <a href=#event-handlers>event handlers</a>, except when the value is an <a href=#concept-handler-error title=concept-handler-error>internal error value</a>, in which case the user agent must set
  the corresponding event handler to null, and then throw an exception corresponding to the error
  condition.</p>

  <hr></div>

  <p>An <dfn id=event-handler-content-attributes title="event handler content attributes">event handler content attribute</dfn> is a
  content attribute for a specific <a href=#event-handlers title="event handlers">event handler</a>. The name of
  the content attribute is the same as the name of the <a href=#event-handlers title="event handlers">event
  handler</a>.</p>

  <p><a href=#event-handler-content-attributes>Event handler content attributes</a>, when specified, must contain valid JavaScript
  code which, when parsed, would match the <code title="">FunctionBody</code> production after
  automatic semicolon insertion. <a href=#refsECMA262>[ECMA262]</a></p>

  <div class=impl>

  <!-- SCRIPT EXEC -->
  <p>When an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a>
  is set, if the element is owned by a <code><a href=#document>Document</a></code> that is in a <a href=#browsing-context>browsing
  context</a>, and <a href=#concept-bc-script title=concept-bc-script>scripting is enabled</a> for that
  <a href=#browsing-context>browsing context</a>, the user agent must run the following steps to create a <a href=#concept-script title=concept-script>script</a> after setting the content attribute to its new value:</p>

  <ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to null.</li>

   <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for JavaScript.</li>

   <li><p>Let <var title="">body</var> be the <a href=#event-handler-content-attributes title="event handler content attributes">event
   handler content attribute</a>'s new value.</li>

   <li>

    <p>If <var title="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects an
    <i>early error</i> then <a href=#set-the-event-handler-content-attribute-to-an-error>set the event handler content attribute to an error</a> as
    defined below, and abort these steps.</p>

    <p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
    Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>

   </li>

   <li>

    <p>If <var title="">body</var> begins with a Directive Prologue that contains a Use Strict
    Directive then let <var title="">strict</var> be true, otherwise let <var title="">strict</var>
    be false.</p> <!-- we can't defer to 10.1.1 since we're not using a Function constructor but
    doing it ourselves. -->

    <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
    ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>

   </li>

<!--
currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
   <li>

    <p>If <var title="">strict</var> is true, and anything in <var title="">body</var> is a
    <code>SyntaxError</code> according to the Strict Mode Restrictions, then <span>set the event
    handler content attribute to an error</span> as defined below, and abort these steps.</p>

    <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
    13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>

   </li>
-->

   <li>

    <p>Using the script execution environment created above, create a function object (as defined in
    ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>

    <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>

     <dd>

      <dl class=switch><dt>If the attribute is an <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> content attribute
       corresponding to an <span>event handler</span> of a <code><a href=#window>Window</a></code> object (that is, the
       <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> content attributes on <code><a href=#the-body-element>body</a></code> and
       <code><a href=#frameset>frameset</a></code> elements)</dt>

       <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">colno</code>,
       and <code title="">error</code>.</dd>
       <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
       <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->

       <dt>Otherwise</dt>

       <dd>Let the function have a single argument called <code title="">event</code>.</dd>

      </dl></dd>

     <dt>Function body <var title="">FunctionBody</var></dt>

     <dd>The result of parsing <var title="">body</var> above.</dd>

     <dt>Lexical Environment <var title="">Scope</var></dt>

     <dd>

      <ol><li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(the element's
       <code><a href=#document>Document</a></code>, the <var title="">global environment</var>).</li>

       <li>If the element has a <a href=#form-owner>form owner</a>, let <var title="">Scope</var> be the result
       of NewObjectEnvironment(the element's <a href=#form-owner>form owner</a>, <var title="">Scope</var>).</li>

       <li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(the element's object,
       <var title="">Scope</var>).</li>

      </ol><p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
      NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>

     </dd>

     <dt>Boolean flag <var title="">Strict</var></dt>

     <dd>The value of <var title="">strict</var>.</dd>

    </dl><p>Let this new function be the script's <a href=#code-entry-point>code entry-point</a>.</p>

   </li>

   <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the <a href="#script's-browsing-context">script's browsing
   context</a>, the <a href="#script's-document">script's document</a>, the <a href="#script's-referrer-source">script's referrer source</a>,
   the <a href="#script's-url-character-encoding">script's URL character encoding</a>, and the <a href="#script's-base-url">script's base URL</a> from
   <a href=#the-script-settings-determined-from-the-node>the script settings determined from the node</a> on which the attribute is being
   set.</li>

   <li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to the
   aforementioned function.</li>

  </ol><p>When a user agent is required, by the steps above, to <dfn id=set-the-event-handler-content-attribute-to-an-error>set the event handler content
  attribute to an error</dfn>, the user agent must set the corresponding <a href=#event-handlers title="event
  handlers">event handler</a> to an <dfn id=concept-handler-error title=concept-handler-error>internal error value</dfn>
  representing the error condition, keeping track of the <a href=#url>URL</a> of the resource where the
  <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a> was set, and
  the relevant line number inside that resource where the error occurred.</p>

  <p>When an event handler content attribute is removed, the user agent must set the corresponding
  <a href=#event-handlers title="event handlers">event handler</a> to null.</p>
  <!--
  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/245 onload
  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/247 onclick
  see http://www.w3.org/Bugs/Public/show_bug.cgi?id=7626#c5 for reasoning
  -->

  </div>

  <p class=note>When an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
  attribute</a> is set on an element owned by a <code><a href=#document>Document</a></code> that is not in a
  <a href=#browsing-context>browsing context</a>, the corresponding event handler is not changed.</p>

  <!-- v2: we should probably support HTML4's Content-Script-Type header here. -->

  <div class=impl>

  <hr><p>When an <a href=#event-handlers title="event handlers">event handler</a> <var title="">H</var> of an element
  or object <var title="">T</var> implementing the <code><a href=#eventtarget>EventTarget</a></code> interface is first set
  to a non-null value, the user agent must append an <a href=#concept-event-listener title=concept-event-listener>event
  listener</a> to the list of <a href=#concept-event-listener title=concept-event-listener>event listeners</a>
  associated with <var title="">T</var> with <i>type</i> set to the <dfn id=event-handler-event-type>event handler event
  type</dfn> corresponding to <var title="">H</var>, <i>capture</i> set to false, and
  <i>listener</i> set to <a href=#the-event-handler-processing-algorithm>the event handler processing algorithm</a> defined below. <a href=#refsDOM>[DOM]</a></p>

  <p class=note>The <i>listener</i> is emphatically <em>not</em> the <a href=#event-handlers title="event
  handlers">event handler</a> itself. Every event handler ends up registering the same
  <i>listener</i>, the algorithm defined below, which takes care of invoking the right callback, and
  processing the callback's return value.</p>

  <p class=note>This only happens the first time the <a href=#event-handlers title="event handlers">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 title=dom-EventTarget-addEventListener>addEventListener()</code> before
  the first time the <a href=#event-handlers title="event handlers">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 title=dom-EventTarget-addEventListener>addEventListener()</code> <em>after</em> the
  first time the <a href=#event-handlers title="event handlers">event handler</a> was set to a non-null value.</p>

  </div>

  <div class=example>

   <p>This example demonstrates the order in which event listeners are invoked. If the button in
   this example is clicked by the user, the page will show four alerts, with the text "ONE", "TWO",
   "THREE", and "FOUR" respectively.</p>

   <pre>&lt;button id="test"&gt;Start Demo&lt;/button&gt;
&lt;script&gt;
 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);
&lt;/script&gt;</pre>

  </div>

  <div class=impl>

  <p class=note>The interfaces implemented by the event object do not influence whether an <a href=#event-handlers title="event handlers">event handler</a> is triggered or not.</p>

  <p><dfn id=the-event-handler-processing-algorithm>The event handler processing algorithm</dfn> for an <a href=#event-handlers title="event handlers">event
  handler</a> <var title="">H</var> and an <code><a href=#event>Event</a></code> object <var title="">E</var> is as
  follows:</p>

  <ol><li><p>If <var title="">H</var>'s value is null, then abort these steps.</li>

   <li><p>If <var title="">H</var>'s value is an <a href=#concept-handler-error title=concept-handler-error>internal error
   value</a>, then: set the <a href=#event-handlers title="event handlers">event handler</a> to null and then
   <a href=#report-the-error>report the error</a> for the appropriate <a href=#concept-script title=concept-script>script</a> and
   with the appropriate position (line number and column number), as established when the error was
   detected, using the <code><a href=#window>Window</a></code> object of that <code><a href=#document>Document</a></code> as the target. If
   the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error
   may be reported to the user. Finally, abort these steps.</li>

   <li><p>Let <var title="">callback</var> be <var title="">H</var>'s value, the callback that the
   <a href=#event-handlers title="event handlers">event handler</a> was last set to.</li>

   <li>

    <p>Process the <code><a href=#event>Event</a></code> object <var title="">E</var> as follows:</p>

    <dl class=switch><dt>If <var title="">E</var> is an <code><a href=#errorevent>ErrorEvent</a></code> object and the <a href=#event-handler-idl-attributes title="event
     handler IDL attributes">event handler IDL attribute</a>'s type is
     <code><a href=#onerroreventhandler>OnErrorEventHandler</a></code></dt>

     <dd>

      <p><a href=#concept-invoke-event-handler title=concept-invoke-event-handler>Invoke</a> <var title="">callback</var> with five arguments,
      the first one having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code> attribute,
      the second having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute,
      the third having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attribute,
      the fourth having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-colno><a href=#dom-errorevent-colno>colno</a></code> attribute,
      the fifth having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-error><a href=#dom-errorevent-error>error</a></code> attribute, and
      with the <i title=dfn-callback-this-value>callback this value</i> set to <var title="">E</var>'s <code title=dom-Event-currentTarget>currentTarget</code>. Let 
      <var title="">return value</var> be the callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>

     </dd>

     <dt>Otherwise</dt>

     <dd>

      <p><a href=#concept-invoke-event-handler title=concept-invoke-event-handler>Invoke</a> <var title="">callback</var> with one argument, the value of which is the
      <code><a href=#event>Event</a></code> object <var title="">E</var>, with the <i title=dfn-callback-this-value>callback this value</i> set to <var title="">E</var>'s <code title=dom-Event-currentTarget>currentTarget</code>. Let <var title="">return value</var> be the callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>

     </dd>

    </dl><p>In this step, <dfn id=concept-invoke-event-handler title=concept-invoke-event-handler>invoke</dfn> means to run the
    <a href=#jump-to-a-code-entry-point>jump to a code entry-point</a> alorithm.</p>

   </li>

   <li>

    <p>Process <var title="">return value</var> as follows:</p>

    <dl class=switch><dt>If the event type is <code class=event-mouseover>mouseover</code></dt>
     <dt>If the event type is <code class=event-error>error</code> and <var title="">E</var> is an <code><a href=#errorevent>ErrorEvent</a></code> object</dt>

     <dd><p>If <var title="">return value</var> is a WebIDL boolean true value, then cancel the event.</dd>


     <dt>If the event type is <code class=event-beforeunload>beforeunload</code></dt>

     <dd>

<!--CLEANUP-->
      <p class=note>The <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler IDL attribute</a>'s type is
      <code><a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a></code>, and the <var title="">return value</var> will
      therefore have been coerced into either the value null or a DOMString.</p>

      <p>If the <var title="">return value</var> is null, then cancel the event.</p>

      <p>Otherwise, If the <code><a href=#event>Event</a></code> object <var title="">E</var> is a
      <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> object, and the <code><a href=#event>Event</a></code> object <var title="">E</var>'s <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
      attribute's value is the empty string, then set the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute's value to <var title="">return value</var>.</p>

     </dd>

     <dt>Otherwise</dt>

     <dd><p>If <var title="">return value</var> is a WebIDL boolean false value, then cancel the event.</dd>

     <!-- IE actually uncancels the event if the function returns true -->

    </dl></li>

  </ol></div>

  <hr><p>The <code><a href=#eventhandler>EventHandler</a></code> callback function type represents a callback used for event
  handlers. It is represented in Web IDL as follows:</p>

  <pre class=idl>[TreatNonCallableAsNull]
callback <dfn id=eventhandlernonnull>EventHandlerNonNull</dfn> = any (<a href=#event>Event</a> event);
typedef <a href=#eventhandlernonnull>EventHandlerNonNull</a>? <dfn id=eventhandler>EventHandler</dfn>;</pre>

  <p class=note>In JavaScript, any <code>Function</code> object implements this interface.</p>

  <div class=example>

   <p>For example, the following document fragment:</p>

   <pre>&lt;body onload="alert(this)" onclick="alert(this)"&gt;</pre>

   <p>...leads to an alert saying "<code title="">[object&nbsp;Window]</code>" when the document is
   loaded, and an alert saying "<code title="">[object&nbsp;HTMLBodyElement]</code>" whenever the
   user clicks something in the page.</p>

  </div>

  <p class=note>The return value of the function affects whether the event is canceled or not:
  <span class=impl>as described above,</span> if the return value is false, the event is canceled
  (except for <code class=event-mouseover>mouseover</code> events, where the return value has to
  be true to cancel the event). With <code title=event-beforeunload>beforeunload</code> events,
  the value is instead used to determine the message to show the user.</p>

  <p>For historical reasons, the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> handler has different
  arguments:</p>

  <pre class=idl>[TreatNonCallableAsNull]
callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
typedef <a href=#onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>

  <p>Similarly, the <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
  different return value:</p>

  <pre class=idl>[TreatNonCallableAsNull]
callback <dfn id=onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</dfn> = DOMString (<a href=#event>Event</a> event);
typedef <a href=#onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</a>? <dfn id=onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</dfn>;</pre>

  <!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->


  <h5 id=event-handlers-on-elements,-document-objects,-and-window-objects><span class=secno>7.1.6.2 </span>Event handlers on elements, <code><a href=#document>Document</a></code> objects, and <code><a href=#window>Window</a></code> objects</h5>

  <p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) <span class=impl>that must be</span>
  supported by all <a href=#html-elements>HTML elements</a>, as both <a href=#event-handler-content-attributes>event handler content attributes</a>
  and <a href=#event-handler-idl-attributes>event handler IDL attributes</a>; and <span class=impl>that must be</span> supported by
  all <code><a href=#document>Document</a></code> and <code><a href=#window>Window</a></code> objects, as <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-onabort title=handler-onabort><code>onabort</code></dfn> <td> <code title=event-abort>abort</code>
    <tr><td><dfn id=handler-oncancel title=handler-oncancel><code>oncancel</code></dfn> <td> <code title=event-media-cancel>cancel</code>
    <tr><td><dfn id=handler-oncanplay title=handler-oncanplay><code>oncanplay</code></dfn> <td> <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code>
    <tr><td><dfn id=handler-oncanplaythrough title=handler-oncanplaythrough><code>oncanplaythrough</code></dfn> <td> <code title=event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code>
    <tr><td><dfn id=handler-onchange title=handler-onchange><code>onchange</code></dfn> <td> <code title=event-change>change</code> <!-- widely used -->
    <tr><td><dfn id=handler-onclick title=handler-onclick><code>onclick</code></dfn> <td> <code title=event-click><a href=#event-click>click</a></code> <!-- widely used -->
    <tr><td><dfn id=handler-onclose title=handler-onclose><code>onclose</code></dfn> <td> <code title=event-close><a href=#event-close>close</a></code> <!-- new for <dialog> -->
    <tr><td><dfn id=handler-oncontextmenu title=handler-oncontextmenu><code>oncontextmenu</code></dfn> <td> <code title=event-contextmenu>contextmenu</code> <!-- widely used -->
    <tr><td><dfn id=handler-oncuechange title=handler-oncuechange><code>oncuechange</code></dfn> <td> <code title=event-cuechange>cuechange</code>
    <tr><td><dfn id=handler-ondblclick title=handler-ondblclick><code>ondblclick</code></dfn> <td> <code title=event-dblclick>dblclick</code> <!-- widely used -->
    <tr><td><dfn id=handler-ondrag title=handler-ondrag><code>ondrag</code></dfn> <td> <code title=event-drag><a href=#event-drag>drag</a></code>
    <tr><td><dfn id=handler-ondragend title=handler-ondragend><code>ondragend</code></dfn> <td> <code title=event-dragend><a href=#event-dragend>dragend</a></code>
    <tr><td><dfn id=handler-ondragenter title=handler-ondragenter><code>ondragenter</code></dfn> <td> <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code>
    <tr><td><dfn id=handler-ondragexit title=handler-ondragexit><code>ondragexit</code></dfn> <td> <code title=event-dragexit><a href=#event-dragexit>dragexit</a></code>
    <tr><td><dfn id=handler-ondragleave title=handler-ondragleave><code>ondragleave</code></dfn> <td> <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code>
    <tr><td><dfn id=handler-ondragover title=handler-ondragover><code>ondragover</code></dfn> <td> <code title=event-dragover><a href=#event-dragover>dragover</a></code>
    <tr><td><dfn id=handler-ondragstart title=handler-ondragstart><code>ondragstart</code></dfn> <td> <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> <!-- widely used -->
    <tr><td><dfn id=handler-ondrop title=handler-ondrop><code>ondrop</code></dfn> <td> <code title=event-drop><a href=#event-drop>drop</a></code>
    <tr><td><dfn id=handler-ondurationchange title=handler-ondurationchange><code>ondurationchange</code></dfn> <td> <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code>
    <tr><td><dfn id=handler-onemptied title=handler-onemptied><code>onemptied</code></dfn> <td> <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code>
    <tr><td><dfn id=handler-onended title=handler-onended><code>onended</code></dfn> <td> <code title=event-media-ended><a href=#event-media-ended>ended</a></code>
    <tr><td><dfn id=handler-oninput title=handler-oninput><code>oninput</code></dfn> <td> <code title=event-input>input</code>
    <tr><td><dfn id=handler-oninvalid title=handler-oninvalid><code>oninvalid</code></dfn> <td> <code title=event-invalid>invalid</code>
    <tr><td><dfn id=handler-onkeydown title=handler-onkeydown><code>onkeydown</code></dfn> <td> <code title=event-keydown>keydown</code> <!-- widely used -->
    <tr><td><dfn id=handler-onkeypress title=handler-onkeypress><code>onkeypress</code></dfn> <td> <code title=event-keypress>keypress</code> <!-- widely used -->
    <tr><td><dfn id=handler-onkeyup title=handler-onkeyup><code>onkeyup</code></dfn> <td> <code title=event-keyup>keyup</code> <!-- widely used -->
    <tr><td><dfn id=handler-onloadeddata title=handler-onloadeddata><code>onloadeddata</code></dfn> <td> <code title=event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code>
    <tr><td><dfn id=handler-onloadedmetadata title=handler-onloadedmetadata><code>onloadedmetadata</code></dfn> <td> <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code>
    <tr><td><dfn id=handler-onloadstart title=handler-onloadstart><code>onloadstart</code></dfn> <td> <code title=event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code>
    <tr><td><dfn id=handler-onmousedown title=handler-onmousedown><code>onmousedown</code></dfn> <td> <code title=event-mousedown>mousedown</code> <!-- widely used -->
    <tr><td><dfn id=handler-onmouseenter title=handler-onmouseenter><code>onmouseenter</code></dfn> <td> <code title=event-mouseenter>mouseenter</code> <!-- compat -->
    <tr><td><dfn id=handler-onmouseleave title=handler-onmouseleave><code>onmouseleave</code></dfn> <td> <code title=event-mouseleave>mouseleave</code> <!-- compat -->
    <tr><td><dfn id=handler-onmousemove title=handler-onmousemove><code>onmousemove</code></dfn> <td> <code title=event-mousemove>mousemove</code> <!-- widely used -->
    <tr><td><dfn id=handler-onmouseout title=handler-onmouseout><code>onmouseout</code></dfn> <td> <code title=event-mouseout>mouseout</code> <!-- widely used -->
    <tr><td><dfn id=handler-onmouseover title=handler-onmouseover><code>onmouseover</code></dfn> <td> <code title=event-mouseover>mouseover</code> <!-- widely used -->
    <tr><td><dfn id=handler-onmouseup title=handler-onmouseup><code>onmouseup</code></dfn> <td> <code title=event-mouseup>mouseup</code> <!-- widely used -->
    <tr><td><dfn id=handler-onmousewheel title=handler-onmousewheel><code>onmousewheel</code></dfn> <td> <code title=event-mousewheel>mousewheel</code> <!-- widely used -->
    <tr><td><dfn id=handler-onpause title=handler-onpause><code>onpause</code></dfn> <td> <code title=event-media-pause><a href=#event-media-pause>pause</a></code>
    <tr><td><dfn id=handler-onplay title=handler-onplay><code>onplay</code></dfn> <td> <code title=event-media-play><a href=#event-media-play>play</a></code>
    <tr><td><dfn id=handler-onplaying title=handler-onplaying><code>onplaying</code></dfn> <td> <code title=event-media-playing><a href=#event-media-playing>playing</a></code>
    <tr><td><dfn id=handler-onprogress title=handler-onprogress><code>onprogress</code></dfn> <td> <code title=event-media-progress><a href=#event-media-progress>progress</a></code>
    <tr><td><dfn id=handler-onratechange title=handler-onratechange><code>onratechange</code></dfn> <td> <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code>
    <tr><td><dfn id=handler-onreset title=handler-onreset><code>onreset</code></dfn> <td> <code title=event-reset>reset</code>
    <tr><td><dfn id=handler-onseeked title=handler-onseeked><code>onseeked</code></dfn> <td> <code title=event-media-seeked><a href=#event-media-seeked>seeked</a></code>
    <tr><td><dfn id=handler-onseeking title=handler-onseeking><code>onseeking</code></dfn> <td> <code title=event-media-seeking><a href=#event-media-seeking>seeking</a></code>
    <tr><td><dfn id=handler-onselect title=handler-onselect><code>onselect</code></dfn> <td> <code title=event-select>select</code> <!-- widely used --> <!-- [CSSOM] -->
    <tr><td><dfn id=handler-onshow title=handler-onshow><code>onshow</code></dfn> <td> <code title=event-show>show</code>
    <tr><td><dfn id=handler-onsort title=handler-onsort><code>onsort</code></dfn> <td> <code title=event-sort>sort</code>
    <tr><td><dfn id=handler-onstalled title=handler-onstalled><code>onstalled</code></dfn> <td> <code title=event-media-stalled><a href=#event-media-stalled>stalled</a></code>
    <tr><td><dfn id=handler-onsubmit title=handler-onsubmit><code>onsubmit</code></dfn> <td> <code title=event-submit>submit</code> <!-- widely used -->
    <tr><td><dfn id=handler-onsuspend title=handler-onsuspend><code>onsuspend</code></dfn> <td> <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code>
    <tr><td><dfn id=handler-ontimeupdate title=handler-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code>
    <tr><td><dfn id=handler-onvolumechange title=handler-onvolumechange><code>onvolumechange</code></dfn> <td> <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code>
    <tr><td><dfn id=handler-onwaiting title=handler-onwaiting><code>onwaiting</code></dfn> <td> <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code>

<!-- not supported, use dnd: -->
<!--<tr><td><dfn title="handler-onbeforecopy"><code>onbeforecopy</code></dfn> <td> <code title="event-beforecopy">beforecopy</code>--> <!-- widely used -->
<!--<tr><td><dfn title="handler-oncopy"><code>oncopy</code></dfn> <td> <code title="event-copy">copy</code>--> <!-- widely used -->
<!--<tr><td><dfn title="handler-onpaste"><code>onpaste</code></dfn> <td> <code title="event-paste">paste</code>--> <!-- widely used -->
<!-- not supported yet (v2?): -->
<!--<tr><td><dfn title="handler-onselectstart"><code>onselectstart</code></dfn> <td> <code title="event-selectstart">selectstart</code>--> <!-- widely used -->
  </table><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) <span class=impl>that must be</span> supported
  by all <a href=#html-elements>HTML elements</a> other than <code><a href=#the-body-element>body</a></code> and
  <code><a href=#frameset>frameset</a></code> elements, as both <a href=#event-handler-content-attributes>event handler content attributes</a> and <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>; <span class=impl>that must be</span> supported
  by all <code><a href=#document>Document</a></code> objects, as <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>; and <span class=impl>that must be</span> supported
  by all <code><a href=#window>Window</a></code> objects, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a> on the
  <code><a href=#window>Window</a></code> objects themselves, and with corresponding <a href=#event-handler-content-attributes>event handler content
  attributes</a> and <a href=#event-handler-idl-attributes>event handler IDL attributes</a> exposed on all <code><a href=#the-body-element>body</a></code> and
  <code><a href=#frameset>frameset</a></code> elements that are owned by <a href=#concept-document-window title=concept-document-window>that <code>Window</code> object's <code>Document</code>s</a>:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-onblur title=handler-onblur><code>onblur</code></dfn> <td> <code title=event-blur>blur</code> <!-- widely used -->
    <tr><td><dfn id=handler-onerror title=handler-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
    <tr><td><dfn id=handler-onfocus title=handler-onfocus><code>onfocus</code></dfn> <td> <code title=event-focus>focus</code> <!-- widely used -->
    <tr><td><dfn id=handler-onload title=handler-onload><code>onload</code></dfn> <td> <code title=event-load>load</code>
    <tr><td><dfn id=handler-onscroll title=handler-onscroll><code>onscroll</code></dfn> <td> <code title=event-scroll>scroll</code>
  </table><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) <span class=impl>that must be</span> supported
  by <code><a href=#window>Window</a></code> objects, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a> on the
  <code><a href=#window>Window</a></code> objects themselves, and with corresponding <a href=#event-handler-content-attributes>event handler content
  attributes</a> and <a href=#event-handler-idl-attributes>event handler IDL attributes</a> exposed on all <code><a href=#the-body-element>body</a></code> and
  <code><a href=#frameset>frameset</a></code> elements that are owned by <a href=#concept-document-window title=concept-document-window>that <code>Window</code> object's <code>Document</code>s</a>:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-window-onafterprint title=handler-window-onafterprint><code>onafterprint</code></dfn> <td> <code title=event-afterprint>afterprint</code>
    <tr><td><dfn id=handler-window-onbeforeprint title=handler-window-onbeforeprint><code>onbeforeprint</code></dfn> <td> <code title=event-beforeprint>beforeprint</code>
    <tr><td><dfn id=handler-window-onbeforeunload title=handler-window-onbeforeunload><code>onbeforeunload</code></dfn> <td> <code title=event-beforeunload>beforeunload</code>
    <tr><td><dfn id=handler-window-onhashchange title=handler-window-onhashchange><code>onhashchange</code></dfn> <td> <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-onmessage title=handler-window-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code> <!-- new for postMessage -->
    <tr><td><dfn id=handler-window-onoffline title=handler-window-onoffline><code>onoffline</code></dfn> <td> <code title=event-offline><a href=#event-offline>offline</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-ononline title=handler-window-ononline><code>ononline</code></dfn> <td> <code title=event-online><a href=#event-online>online</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-onpagehide title=handler-window-onpagehide><code>onpagehide</code></dfn> <td> <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-onpageshow title=handler-window-onpageshow><code>onpageshow</code></dfn> <td> <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-onpopstate title=handler-window-onpopstate><code>onpopstate</code></dfn> <td> <code title=event-popstate><a href=#event-popstate>popstate</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-onresize title=handler-window-onresize><code>onresize</code></dfn> <td> <code title=event-resize>resize</code> <!-- widely used --> <!-- [CSSOM] -->
    <tr><td><dfn id=handler-window-onstorage title=handler-window-onstorage><code>onstorage</code></dfn> <td> <code title=event-storage><a href=#event-storage>storage</a></code> <!-- new -->
    <tr><td><dfn id=handler-window-onunload title=handler-window-onunload><code>onunload</code></dfn> <td> <code title=event-unload>unload</code> <!-- widely used -->
  </table><hr><!-- this guy is only on Document and not on HTMLElement because
  otherwise HTMLScriptElement would have it and that causes
  compatibility issues since IE fires readystatechange events on
  <script>, not load events, and we can't fire both, and some sites
  try to decide which to look for based on the presence of
  script.onreadystatechange on HTMLScriptElement.
     http://www.w3.org/Bugs/Public/show_bug.cgi?id=13965
     http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-September/033136.html
  --><p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) <span class=impl>that must be</span> supported
  on <code><a href=#document>Document</a></code> objects as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-onreadystatechange title=handler-onreadystatechange><code>onreadystatechange</code></dfn> <td> <code title=event-readystatechange><a href=#event-readystatechange>readystatechange</a></code>
  </table><h6 id=idl-definitions><span class=secno>7.1.6.2.1 </span>IDL definitions</h6>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=globaleventhandlers>GlobalEventHandlers</dfn> {
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onblur title=handler-onblur>onblur</a>;
           attribute <a href=#onerroreventhandler>OnErrorEventHandler</a> <a href=#handler-onerror title=handler-onerror>onerror</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onfocus title=handler-onfocus>onfocus</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oncancel title=handler-oncancel>oncancel</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oncanplay title=handler-oncanplay>oncanplay</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oncanplaythrough title=handler-oncanplaythrough>oncanplaythrough</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onchange title=handler-onchange>onchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onclick title=handler-onclick>onclick</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onclose title=handler-onclose>onclose</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oncontextmenu title=handler-oncontextmenu>oncontextmenu</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oncuechange title=handler-oncuechange>oncuechange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondblclick title=handler-ondblclick>ondblclick</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondrag title=handler-ondrag>ondrag</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondragend title=handler-ondragend>ondragend</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondragenter title=handler-ondragenter>ondragenter</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondragexit title=handler-ondragexit>ondragexit</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondragleave title=handler-ondragleave>ondragleave</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondragover title=handler-ondragover>ondragover</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondragstart title=handler-ondragstart>ondragstart</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondrop title=handler-ondrop>ondrop</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ondurationchange title=handler-ondurationchange>ondurationchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onemptied title=handler-onemptied>onemptied</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onended title=handler-onended>onended</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oninput title=handler-oninput>oninput</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-oninvalid title=handler-oninvalid>oninvalid</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onkeydown title=handler-onkeydown>onkeydown</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onload title=handler-onload>onload</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onloadeddata title=handler-onloadeddata>onloadeddata</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onloadedmetadata title=handler-onloadedmetadata>onloadedmetadata</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onloadstart title=handler-onloadstart>onloadstart</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmousedown title=handler-onmousedown>onmousedown</a>;
  [LenientThis] attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmouseenter title=handler-onmouseenter>onmouseenter</a>;
  [LenientThis] attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmouseleave title=handler-onmouseleave>onmouseleave</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmousemove title=handler-onmousemove>onmousemove</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmouseout title=handler-onmouseout>onmouseout</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmouseover title=handler-onmouseover>onmouseover</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmouseup title=handler-onmouseup>onmouseup</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onmousewheel title=handler-onmousewheel>onmousewheel</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onpause title=handler-onpause>onpause</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onplay title=handler-onplay>onplay</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onplaying title=handler-onplaying>onplaying</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onprogress title=handler-onprogress>onprogress</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onratechange title=handler-onratechange>onratechange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onreset title=handler-onreset>onreset</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onscroll title=handler-onscroll>onscroll</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onseeked title=handler-onseeked>onseeked</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onseeking title=handler-onseeking>onseeking</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onselect title=handler-onselect>onselect</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onshow title=handler-onshow>onshow</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onsort title=handler-onsort>onsort</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onstalled title=handler-onstalled>onstalled</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onsubmit title=handler-onsubmit>onsubmit</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onsuspend title=handler-onsuspend>onsuspend</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-ontimeupdate title=handler-ontimeupdate>ontimeupdate</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onvolumechange title=handler-onvolumechange>onvolumechange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-onwaiting title=handler-onwaiting>onwaiting</a>;
};

[NoInterfaceObject]
interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onafterprint title=handler-window-onafterprint>onafterprint</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
           attribute <a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-ononline title=handler-window-ononline>ononline</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onpagehide title=handler-window-onpagehide>onpagehide</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onpageshow title=handler-window-onpageshow>onpageshow</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onpopstate title=handler-window-onpopstate>onpopstate</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onresize title=handler-window-onresize>onresize</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onstorage title=handler-window-onstorage>onstorage</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onunload title=handler-window-onunload>onunload</a>;
};</pre>



  <div class=impl>

  <h5 id=event-firing><span class=secno>7.1.6.3 </span>Event firing</h5>

  <p>Certain operations and methods are defined as firing events on elements. For example, the <code title=dom-click><a href=#dom-click>click()</a></code> method on the <code><a href=#htmlelement>HTMLElement</a></code> interface is defined as
  firing a <code title=event-click><a href=#event-click>click</a></code> event on the element. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>

  <p><dfn id=fire-a-simple-event title="fire a simple event">Firing a simple event named <var title="">e</var></dfn> means
  that a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <var title="">e</var>, which does not bubble (except where otherwise stated) and is not cancelable
  (except where otherwise stated), and which uses the <code><a href=#event>Event</a></code> interface, must be created
  and dispatched at the given target.</p>

  <p><dfn id=fire-a-synthetic-mouse-event title="fire a synthetic mouse event">Firing a synthetic mouse event named <var title="">e</var></dfn> means that an event with the name <var title="">e</var>, which is <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> (except where otherwise stated), does not bubble
  (except where otherwise stated), is not cancelable (except where otherwise stated), and which uses
  the <code><a href=#mouseevent>MouseEvent</a></code> interface, must be created and dispatched at the given target. The
  event object must have its <code title="">screenX</code>, <code title="">screenY</code>, <code title="">clientX</code>, <code title="">clientY</code>, and <code title="">button</code>
  attributes initialized to 0, its <code title="">ctrlKey</code>, <code title="">shiftKey</code>,
  <code title="">altKey</code>, and <code title="">metaKey</code> attributes initialized according
  to the current state of the key input device, if any (false for any keys that are not available),
  its <code title="">detail</code> attribute initialized to 1, and its <code title="">relatedTarget</code> attribute initialized to null (except where otherwise stated). The
  <code title="">getModifierState()</code> method on the object must return values appropriately
  describing the state of the key input device at the time the event is created.</p>

  <p><dfn id=fire-a-click-event title="fire a click event">Firing a <code title=event-click>click</code> event</dfn>
  means <a href=#fire-a-synthetic-mouse-event title="fire a synthetic mouse event">firing a synthetic mouse event named <code title=event-click>click</code></a>, which bubbles and is cancelable.</p>

  <p>The default action of these events is to do nothing except where otherwise stated.</p>

  </div>


  <div class=impl>

  <h5 id=events-and-the-window-object><span class=secno>7.1.6.4 </span>Events and the <code><a href=#window>Window</a></code> object</h5>

  <p>When an event is dispatched at a DOM node in a <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing
  context</a>, if the event is not a <code title=event-load>load</code> event, the user agent
  must act as if, for the purposes of <a href=#concept-event-dispatch title=concept-event-dispatch>event dispatching</a>,
  the <code><a href=#window>Window</a></code> object is the parent of the <code><a href=#document>Document</a></code> object. <a href=#refsDOM>[DOM]</a></p>

  <!-- If Anne does this: http://krijnhoetmer.nl/irc-logs/whatwg/20121205#l-4 (see bug 18780)
  <p>If a <code>Document</code> object is associated with a <code>Window</code> object, its
  <span>event parent</span> is that <code>Window</code> object.</p>
  -->

  </div>


  <h3 id=atob><span class=secno>7.2 </span>Base64 utility methods</h3>

  <p>The <code title=dom-windowbase64-atob><a href=#dom-windowbase64-atob>atob()</a></code> and <code title=dom-windowbase64-btoa><a href=#dom-windowbase64-btoa>btoa()</a></code> methods allow authors to transform content to and from
  the base64 encoding.</p>

  <!-- v2: actual binary support -->

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=windowbase64>WindowBase64</dfn> {
  DOMString <a href=#dom-windowbase64-btoa title=dom-windowbase64-btoa>btoa</a>(DOMString btoa);
  DOMString <a href=#dom-windowbase64-atob title=dom-windowbase64-atob>atob</a>(DOMString atob);
};
<a href=#window>Window</a> implements <a href=#windowbase64>WindowBase64</a>;</pre>

  <p class=note>In these APIs, for mnemonic purposes, the "b" can be considered to stand for
  "binary", and the "a" for "ASCII". In practice, though, for primarily historical reasons, both the
  input and output of these functions are Unicode strings.</p>

  <dl class=domintro><dt><var title="">result</var> = <var title="">window</var> . <code title=dom-windowbase64-btoa><a href=#dom-windowbase64-btoa>btoa</a></code>( <var title="">data</var> )</dt>

   <dd>

    <p>Takes the input data, in the form of a Unicode string containing only characters in the range
    U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, and
    converts it to its base64 representation, which it returns.</p>

    <p>Throws an <code><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the input string contains any
    out-of-range characters.</p>

   </dd>

   <dt><var title="">result</var> = <var title="">window</var> . <code title=dom-windowbase64-atob><a href=#dom-windowbase64-atob>atob</a></code>( <var title="">data</var> )</dt>

   <dd>

    <p>Takes the input data, in the form of a Unicode string containing base64-encoded binary data,
    decodes it, and returns a string consisting of characters in the range U+0000 to U+00FF, each
    representing a binary byte with values 0x00 to 0xFF respectively, corresponding to that binary
    data.</p>

    <p>Throws an <code><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the input string is not valid
    base64 data.</p>

   </dd>

  </dl><div class=impl>

  <p class=note>The <code><a href=#windowbase64>WindowBase64</a></code> interface adds to the <code><a href=#window>Window</a></code> interface
  and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface (part of Web Workers).</p>

  <p>The <dfn id=dom-windowbase64-btoa title=dom-windowbase64-btoa><code>btoa()</code></dfn> method must throw an
  <code><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the method's first argument contains any character
  whose code point is greater than U+00FF. Otherwise, the user agent must convert that argument to a
  sequence of octets whose <var title="">n</var>th octet is the eight-bit representation of the code
  point of the <var title="">n</var>th character of the argument, and then must apply the base64
  algorithm to that sequence of octets, and return the result. <a href=#refsRFC4648>[RFC4648]</a><!--base64--></p> <!-- Aryeh says: This seems to be what all
  browsers do as of January 2011 (except IE, which doesn't support these functions at all). -->


  <p>The <dfn id=dom-windowbase64-atob title=dom-windowbase64-atob><code>atob()</code></dfn> method must run the following
  steps to parse the string passed in the method's first argument:</p>

  <ol><!-- Aryeh says: Copies Firefox behavior as of January 2011 (4.0b8). WebKit is somewhat laxer,
   and Opera throws no exceptions at all. gsnedders reports Opera's behavior causes site-compat
   problems, and I figure most sites depend on Firefox if on anything, so go with that. --><!-- Since updated to drop whitespace, based on the arguments here:
      http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-May/031613.html
   --><li><p>Let <var title="">input</var> be the string being parsed.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially
   pointing at the start of the string.</li>

   <li><p>Remove all <a href=#space-character title="space character">space characters</a> from <var title="">input</var>.</li>

   <li><p>If the length of <var title="">input</var> divides by 4 leaving no remainder, then: if
   <var title="">input</var> ends with one or two U+003D EQUALS SIGN (=) characters, remove them
   from <var title="">input</var>.</li>

   <li><p>If the length of <var title="">input</var> divides by 4 leaving a remainder of 1, throw an
   <code><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception and abort these steps.</p>

   <li>

    <p>If <var title="">input</var> contains a character that is not in the following list of
    characters and character ranges, throw an <code><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception and abort
    these steps:</p>

    <ul class=brief><li>U+002B PLUS SIGN (+)
     <li>U+002F SOLIDUS (/)
     <li><a href=#alphanumeric-ascii-characters>Alphanumeric ASCII characters</a>
    </ul></li>

   <li><p>Let <var title="">output</var> be a string, initially empty.</li>

   <li><p>Let <var title="">buffer</var> be a buffer that can have bits appended to it, initially
   empty.</li>

   <li>

    <p>While <var title="">position</var> does not point past the end of <var title="">input</var>,
    run these substeps:</p>

    <ol><li>

      <p>Find the character pointed to by <var title="">position</var> in the first column of the
      following table. Let <var title="">n</var> be the number given in the second cell of the same
      row.</p>

      <div id=base64-table>
       <table><thead><tr><th>Character
          <th>Number
        <tbody><tr><td>A<td>0
         <tr><td>B<td>1
         <tr><td>C<td>2
         <tr><td>D<td>3
         <tr><td>E<td>4
         <tr><td>F<td>5
         <tr><td>G<td>6
         <tr><td>H<td>7
         <tr><td>I<td>8
         <tr><td>J<td>9
         <tr><td>K<td>10
         <tr><td>L<td>11
         <tr><td>M<td>12
         <tr><td>N<td>13
         <tr><td>O<td>14
         <tr><td>P<td>15
         <tr><td>Q<td>16
         <tr><td>R<td>17
         <tr><td>S<td>18
         <tr><td>T<td>19
         <tr><td>U<td>20
         <tr><td>V<td>21
         <tr><td>W<td>22
         <tr><td>X<td>23
         <tr><td>Y<td>24
         <tr><td>Z<td>25
         <tr><td>a<td>26
         <tr><td>b<td>27
         <tr><td>c<td>28
         <tr><td>d<td>29
         <tr><td>e<td>30
         <tr><td>f<td>31
         <tr><td>g<td>32
         <tr><td>h<td>33
         <tr><td>i<td>34
         <tr><td>j<td>35
         <tr><td>k<td>36
         <tr><td>l<td>37
         <tr><td>m<td>38
         <tr><td>n<td>39
         <tr><td>o<td>40
         <tr><td>p<td>41
         <tr><td>q<td>42
         <tr><td>r<td>43
         <tr><td>s<td>44
         <tr><td>t<td>45
         <tr><td>u<td>46
         <tr><td>v<td>47
         <tr><td>w<td>48
         <tr><td>x<td>49
         <tr><td>y<td>50
         <tr><td>z<td>51
         <tr><td>0<td>52
         <tr><td>1<td>53
         <tr><td>2<td>54
         <tr><td>3<td>55
         <tr><td>4<td>56
         <tr><td>5<td>57
         <tr><td>6<td>58
         <tr><td>7<td>59
         <tr><td>8<td>60
         <tr><td>9<td>61
         <tr><td>+<td>62
         <tr><td>/<td>63
       </table></div>

     </li>

     <li><p>Append to <var title="">buffer</var> the six bits corresponding to <var title="">number</var>, most significant bit first.</li>

     <li><p>If <var title="">buffer</var> has accumulated 24 bits, interpret them as three 8-bit
     big-endian numbers. Append the three characters with code points equal to those numbers to <var title="">output</var>, in the same order, and then empty <var title="">buffer</var>.</li>

     <li><p>Advance <var title="">position</var> by one character.</li>

    </ol></li>

   <li>

    <p>If <var title="">buffer</var> is not empty, it contains either 12 or 18 bits. If it contains
    12 bits, discard the last four and interpret the remaining eight as an 8-bit big-endian number.
    If it contains 18 bits, discard the last two and interpret the remaining 16 as two 8-bit
    big-endian numbers. Append the one or two characters with code points equal to those one or two
    numbers to <var title="">output</var>, in the same order.</p>

    <p class=note>The discarded bits mean that, for instance, <code title="">atob("YQ")</code> and
    <code title="">atob("YR")</code> both return "<code title="">a</code>".</p>

   </li>

   <li><p>Return <var title="">output</var>.</li>

  </ol><!-- Note: this function is defined explicitly here because RFC4648 does not specify how to handle
  erroneous input, and no preexisting browser implementation simply throws an exception on all
  erroneous input. --></div>



  <h3 id=timers><span class=secno>7.3 </span>Timers</h3>

  <p>The <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
  and <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval()</a></code>
  methods allow authors to schedule timer-based callbacks.</p>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=windowtimers>WindowTimers</dfn> {
  long <a href=#dom-windowtimers-settimeout title=dom-windowtimers-setTimeout>setTimeout</a>(<span>Function</span> handler, optional long timeout, any... arguments);
  long <a href=#dom-windowtimers-settimeout title=dom-windowtimers-setTimeout>setTimeout</a>(DOMString handler, optional long timeout, any... arguments);
  void <a href=#dom-windowtimers-cleartimeout title=dom-windowtimers-clearTimeout>clearTimeout</a>(long handle);
  long <a href=#dom-windowtimers-setinterval title=dom-windowtimers-setInterval>setInterval</a>(<span>Function</span> handler, optional long timeout, any... arguments);
  long <a href=#dom-windowtimers-setinterval title=dom-windowtimers-setInterval>setInterval</a>(DOMString handler, optional long timeout, any... arguments);
  void <a href=#dom-windowtimers-clearinterval title=dom-windowtimers-clearInterval>clearInterval</a>(long handle);
};
<a href=#window>Window</a> implements <a href=#windowtimers>WindowTimers</a>;</pre>

  <!-- Demonstrating the need for wrapping of the timeout argument value treated as long rather than clamping or treating as double:
          http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1228
       Demonstrating the need for the timeout argument to be signed rather than unsigned:
          http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1229
  -->

  <dl class=domintro><dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout</a></code>( <var title="">handler</var> [, <var title="">timeout</var> [, <var title="">arguments</var>... ] ] )</dt>

   <dd>

    <p>Schedules a timeout to run <var title="">handler</var> after <var title="">timeout</var>
    milliseconds. Any <var title="">arguments</var> are passed straight through to the <var title="">handler</var>.</p>

   </dd>

   <dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout</a></code>( <var title="">code</var> [, <var title="">timeout</var> ] )</dt>

   <dd>

    <p>Schedules a timeout to compile and run <var title="">code</var> after <var title="">timeout</var> milliseconds.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-windowtimers-clearTimeout><a href=#dom-windowtimers-cleartimeout>clearTimeout</a></code>( <var title="">handle</var> )</dt>

   <dd>

    <p>Cancels the timeout set with <code title=dom-windowtimers-setTimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
    identified by <var title="">handle</var>.</p>

   </dd>

   <dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval</a></code>( <var title="">handler</var> [, <var title="">timeout</var> [, <var title="">arguments</var>... ] ] )</dt>

   <dd>

    <p>Schedules a timeout to run <var title="">handler</var> every <var title="">timeout</var>
    milliseconds. Any <var title="">arguments</var> are passed straight through to the <var title="">handler</var>.</p>

   </dd>

   <dt><var title="">handle</var> = <var title="">window</var> . <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval</a></code>( <var title="">code</var> [, <var title="">timeout</var> ] )</dt>

   <dd>

    <p>Schedules a timeout to compile and run <var title="">code</var> every <var title="">timeout</var> milliseconds.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-windowtimers-clearInterval><a href=#dom-windowtimers-clearinterval>clearInterval</a></code>( <var title="">handle</var> )</dt>

   <dd>

    <p>Cancels the timeout set with <code title=dom-windowtimers-setInterval><a href=#dom-windowtimers-setinterval>setInterval()</a></code> identified by <var title="">handle</var>.</p>

   </dd>

  </dl><p class=note>Timers can be nested; after five such nested timers, however, the interval is
  forced to be at least four milliseconds.</p>

  <p class=note>This API does not guarantee that timers will run exactly on schedule. Delays due
  to CPU load, other tasks, etc, are to be expected.</p>

  <div class=impl>

  <p class=note>The <code><a href=#windowtimers>WindowTimers</a></code> interface adds to the <code><a href=#window>Window</a></code> interface
  and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface (part of Web Workers).</p>

  <p>Each object that implements the <code><a href=#windowtimers>WindowTimers</a></code> interface has a <dfn id=list-of-active-timers>list of active
  timers</dfn>. Each entry in this lists is identified by a number, which must be unique within the
  list for the lifetime of the object that implements the <code><a href=#windowtimers>WindowTimers</a></code> interface.</p>

  <hr><p>The <dfn id=dom-windowtimers-settimeout title=dom-windowtimers-setTimeout><code>setTimeout()</code></dfn> method must return
  the value returned by the <a href=#timer-initialization-steps>timer initialization steps</a>, passing them the method's
  arguments, the object on which the method for which the algorithm is running is implemented (a
  <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object) as the <var title="">method
  context</var>, and the <var title="">repeat</var> flag set to false.</p>

  <p>The <dfn id=dom-windowtimers-setinterval title=dom-windowtimers-setInterval><code>setInterval()</code></dfn> method must
  return the value returned by the <a href=#timer-initialization-steps>timer initialization steps</a>, passing them the
  method's arguments, the object on which the method for which the algorithm is running is
  implemented (a <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object) as the <var title="">method context</var>, and the <var title="">repeat</var> flag set to true.</p>

  <p>The <dfn id=dom-windowtimers-cleartimeout title=dom-windowtimers-clearTimeout><code>clearTimeout()</code></dfn> and <dfn id=dom-windowtimers-clearinterval title=dom-windowtimers-clearInterval><code>clearInterval()</code></dfn> methods must clear the
  entry identified as <var title="">handle</var> from the <a href=#list-of-active-timers>list of active timers</a> of the
  <code><a href=#windowtimers>WindowTimers</a></code> object on which the method was invoked, where <var title="">handle</var>
  is the argument passed to the method, if any. (If <var title="">handle</var> does not identify an
  entry in the <a href=#list-of-active-timers>list of active timers</a> of the <code><a href=#windowtimers>WindowTimers</a></code> object on which
  the method was invoked, the method does nothing.)</p>

  <hr><p>The <dfn id=timer-initialization-steps>timer initialization steps</dfn>, which are invoked with some method arguments, a <var title="">method context</var>, a <var title="">repeat</var> flag which can be true or false, and
  optionally (and only if the <var title="">repeat</var> flag is true) a <var title="">previous
  handle</var>, are as follows:</p>

  <ol><li><p>Let <var title="">method context proxy</var> be <var title="">method context</var> if that
   is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, or else the <code><a href=#windowproxy>WindowProxy</a></code> that corresponds
   to <var title="">method context</var>.</li>

   <li><p>If <var title="">previous handle</var> was provided, let <var title="">handle</var> be
   <var title="">previous handle</var>; otherwise, let <var title="">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>list of active timers</a>.</li>

   <li><p>If <var title="">previous handle</var> was not provided, add an entry to the <a href=#list-of-active-timers>list of
   active timers</a> for <var title="">handle</var>.</li>

   <li>

    <p>Let <var title="">task</var> be a <a href=#concept-task title=concept-task>task</a> that runs the
    following substeps:</p>

    <ol><li>

      <p>If the entry for <var title="">handle</var> in the <a href=#list-of-active-timers>list of active timers</a> has
      been cleared, then abort this <a href=#concept-task title=concept-task>task</a>'s substeps.</p>

     </li>

     <li>

      <p>Run the appropriate set of steps from the following list:</p>

      <dl class=switch><dt>If the first method argument is a <code>Function</code></dt>

       <dd>

        <p>Call the <code>Function</code>. Use the third and subsequent method arguments (if any) as
        the arguments for invoking the <code>Function</code>. Use <var title="">method context
        proxy</var> as the <var title="">thisArg</var> for invoking the <code>Function</code>. <a href=#refsECMA262>[ECMA262]</a></p>

       </dd>

       <dt>Otherwise</dt>

       <dd>

        <ol><li><p>Let <var title="">script source</var> be the first method argument.</li>

         <li><p>Let <var title="">script language</var> be JavaScript.</li>

         <li>

          <p>If <var title="">method context</var> is a <code><a href=#window>Window</a></code> object, let <var title="">global object</var> be <var title="">method context</var>, let <var title="">browsing context</var> be the <a href=#browsing-context>browsing context</a> with which <var title="">global object</var> is associated, let <var title="">document</var> and <var title="">referrer source</var> be the <code><a href=#document>Document</a></code> associated with <var title="">global object</var>, let <var title="">character encoding</var> be the <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> of the <code><a href=#document>Document</a></code>
          associated with <var title="">global object</var> (<a href=#sce-not-copy>this is a
          reference, not a copy</a>), and let <var title="">base URL</var> be the <a href=#document-base-url title="document base URL">base URL</a> of the <code><a href=#document>Document</a></code> associated with <var title="">global object</var> (<a href=#sbu-not-copy>this is a reference, not a
          copy</a>).</p>

          <p>Otherwise, <var title="">method context</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object;
          let <var title="">global object</var>, <var title="">browsing context</var>, <var title="">document</var>, <var title="">referrer source</var>, <var title="">character
          encoding</var>, and <var title="">base URL</var> be the <a href="#script's-global-object">script's global object</a>,
          <a href="#script's-browsing-context">script's browsing context</a>, <a href="#script's-document">script's document</a>, <a href="#script's-referrer-source">script's
          referrer source</a>, <a href="#script's-url-character-encoding">script's URL character encoding</a>, and <a href="#script's-base-url">script's
          base URL</a> (respectively) of the <a href=#concept-script title=concept-script>script</a> that the
          <a href=#run-a-worker>run a worker</a> algorithm created when it created <var title="">method
          context</var>.</p>

         </li>

         <li>

          <p><a href=#create-a-script>Create a script</a> using <var title="">script source</var> as the script
          source, the <a href=#url>URL</a> where <var title="">script source</var> can be found, <var title="">scripting language</var> as the scripting language, <var title="">global
          object</var> as the global object, <var title="">browsing context</var> as the browsing
          context, <var title="">document</var> as the document, <var title="">referrer source</var>
          as the referrer source, <var title="">character encoding</var> as the URL character
          encoding, and <var title="">base URL</var> as the base URL.</p>

         </li>

        </ol></dd>

      </dl></li>

     <li>

      <p>If the <var title="">repeat</var> flag is true, then call <a href=#timer-initialization-steps>timer initialization
      steps</a> again, passing them the same method arguments, the same <var title="">method
      context</var>, with the <var title="">repeat</var> flag still set to true, and with the <var title="">previous handle</var> set to <var title="">handler</var>.</p>

     </li>

    </ol></li>

   <li><p>Let <var title="">timeout</var> be the second method argument, or zero if the argument was
   omitted.</li>

   <li><p>If the currently running <a href=#concept-task title=concept-task>task</a> is a task that was created
   by this algorithm, then let <var title="">nesting level</var> be the <a href=#concept-task title=concept-task>task</a>'s <a href=#timer-nesting-level>timer nesting level</a>. Otherwise, let <var title="">nesting level</var> be zero.</li>

   <li><p>If <var title="">nesting level</var> is greater than 5, and <var title="">timeout</var> is
   less than 4, then increase <var title="">timeout</var> to 4.</li>

   <li><p>Increment <var title="">nesting level</var> by one.</li>

   <li><p>Let <var title="">task</var>'s <dfn id=timer-nesting-level>timer nesting level</dfn> be <var title="">nesting
   level</var>.</li>

   <li><p>Return <var title="">handle</var>, and then continue running this algorithm
   asynchronously.</li>

   <li>

    <p>If <var title="">method context</var> is a <code><a href=#window>Window</a></code> object, wait until the
    <code><a href=#document>Document</a></code> associated with <var title="">method context</var> has been <a href=#fully-active>fully
    active</a> for a further <var title="">timeout</var> milliseconds (not necessarily
    consecutively).</p>

    <p>Otherwise, <var title="">method context</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object;
    wait until <var title="">timeout</var> milliseconds have passed with the worker not suspended
    (not necessarily consecutively).</p>

   </li>

   <li>

    <p>Wait until any invocations of this algorithm that had the same <var title="">method
    context</var>, that started before this one, and whose <var title="">timeout</var> is equal to
    or less than this one's, have completed.</p>

    <p class=note>Argument conversion as defined by Web IDL (for example, invoking <code title="">toString()</code> methods on objects passed as the first argument) happens in the
    algorithms defined in Web IDL, before this algorithm is invoked.</p>

    <div class=example>

     <p>So for example, the following rather silly code will result in the log containing "<code title="">ONE&nbsp;TWO&nbsp;</code>":</p>

     <pre>var log = '';
function logger(s) { log += s + ' '; }

setTimeout({ toString: function () {
  setTimeout("logger('ONE')", 100);
  return "logger('TWO')";
} }, 100);</pre>

    </div>

   </li>

   <li>

    <p>Optionally, wait a further user-agent defined length of time.</p>

    <p class=note>This is intended to allow user agents to pad timeouts as needed to optimise the
    power usage of the device. For example, some processors have a low-power mode where the
    granularity of timers is reduced; on such platforms, user agents can slow timers down to fit
    this schedule instead of requiring the processor to use the more accurate mode with its
    associated higher power usage.</p>

   </li>

   <li>

    <p><a href=#queue-a-task title="queue a task">Queue</a> the <a href=#concept-task title=concept-task>task</a> <var title="">task</var>.</p>

    <p class=note>Once the task has been processed, if the <var title="">repeat</var> flag is
    false, it is safe to remove the entry for <var title="">handle</var> from the <a href=#list-of-active-timers>list of
    active timers</a> (there is no way for the entry's existence to be detected past this point,
    so it does not technically matter one way or the other).</p>

   </li>

  </ol><p>The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the
  <dfn id=timer-task-source>timer task source</dfn>.</p>

  </div>

  <div class=example>

   <p>To run tasks of several milliseconds back to back without any delay, while still yielding back
   to the browser to avoid starving the user interface (and to avoid the browser killing the script
   for hogging the CPU), simply queue the next timer before performing work:</p>

   <pre>function doExpensiveWork() {
  var done = false;
  // ...
  // this part of the function takes up to five milliseconds
  // set done to true if we're done
  // ...
  return done;
}

function rescheduleWork() {
  var handle = setTimeout(rescheduleWork, 0); // preschedule next iteration
  if (doExpensiveWork())
    clearTimeout(handle); // clear the timeout if we don't need it
}

function scheduleWork() {
  setTimeout(rescheduleWork, 0);
}

scheduleWork(); // queues a task to do lots of work</pre>

  </div>


  <h3 id=user-prompts><span class=secno>7.4 </span>User prompts</h3>

  <!--
   v2 ideas:
    * in-window modal dialogs
       - escape/enter handling
       - dragging the window out of the tab
    * in-window non-modal palettes
       - with a solution for the mobile space
  -->

  <h4 id=simple-dialogs><span class=secno>7.4.1 </span>Simple dialogs</h4>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-alert><a href=#dom-alert>alert</a></code>(<var title="">message</var>)</dt>
   <dd>

    <p>Displays a modal alert with the given message, and waits for the user to dismiss it.</p>

    <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
    implied when this method is invoked.</p>

   </dd>

   <dt><var title="">result</var> = <var title="">window</var> . <code title=dom-confirm><a href=#dom-confirm>confirm</a></code>(<var title="">message</var>)</dt>
   <dd>

    <p>Displays a modal OK/Cancel prompt with the given message, waits for the user to dismiss it,
    and returns true if the user clicks OK and false if the user clicks Cancel.</p>

    <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
    implied when this method is invoked.</p>

   </dd>

   <dt><var title="">result</var> = <var title="">window</var> . <code title=dom-prompt><a href=#dom-prompt>prompt</a></code>(<var title="">message</var> [, <var title="">default</var>] )</dt>
   <dd>

    <p>Displays a modal text field prompt with the given message, waits for the user to dismiss it,
    and returns the value that the user entered. If the user cancels the prompt, then returns null
    instead. If the second argument is present, then the given value is used as a default.</p>

    <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
    implied when this method is invoked.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-alert title=dom-alert><code>alert(<var title="">message</var>)</code></dfn> method, when
  invoked, must run the following steps:</p>

  <ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> is non-zero,
   optionally abort these steps.</li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <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>

   <li><p>Show the given <var title="">message</var> to the user.</li>

   <li><p>Optionally, <a href=#pause>pause</a> while waiting for the user to acknowledge the
   message.</li>

  </ol><p>The <dfn id=dom-confirm title=dom-confirm><code>confirm(<var title="">message</var>)</code></dfn> method,
  when invoked, must run the following steps:</p>

  <ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> is non-zero,
   optionally abort these steps, returning false.</li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <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>

   <li><p>Show the given <var title="">message</var> to the user, and ask the user to respond with a
   positive or negative response.</li>

   <li><p><a href=#pause>Pause</a> until the user responds either positively or negatively.</li>

   <li><p>If the user responded positively, return true; otherwise, the user responded negatively:
   return false.</li>

  </ol><p>The <dfn id=dom-prompt title=dom-prompt><code>prompt(<var title="">message</var>, <var title="">default</var>)</code></dfn> method, when invoked, must run the following steps:</p>

  <ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> is non-zero,
   optionally abort these steps, returning null.</li>

   <li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

   <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>

   <li><p>Show the given <var title="">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 title="">default</var>.</li>

   <li><p><a href=#pause>Pause</a> while waiting for the user's response.</li>

   <li><p>If the user aborts, then return null; otherwise, return the string that the user responded
   with.</li>

  </ol></div>


  <h4 id=printing><span class=secno>7.4.2 </span>Printing</h4>

<!--TOPIC:DOM APIs-->
  <dl class=domintro><dt><var title="">window</var> . <code title=dom-print><a href=#dom-print>print</a></code>()</dt>

   <dd>

    <p>Prompts the user to print the page.</p>

    <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
    implied when this method is invoked.</p>

   </dd>

  </dl><div class=impl>

  <p>When the <dfn id=dom-print title=dom-print><code>print()</code></dfn> method is invoked, if the
  <code><a href=#document>Document</a></code> is <a href=#ready-for-post-load-tasks>ready for post-load tasks</a>, then the user agent must
  synchronously run the <a href=#printing-steps>printing steps</a>. Otherwise, the user agent must only set the
  <dfn id=print-when-loaded>print when loaded</dfn> flag on the <code><a href=#document>Document</a></code>.</p>
<!--TOPIC:HTML-->

  <p>User agents should also run the <a href=#printing-steps>printing steps</a> whenever the user asks for the
  opportunity to <a href=#obtain-a-physical-form>obtain a physical form</a> (e.g. printed copy), or the representation of a
  physical form (e.g. PDF copy), of a document.</p>

  <p>The <dfn id=printing-steps>printing steps</dfn> are as follows:</p>

  <ol><li>

    <p>The user agent may display a message to the user or abort these steps (or both).</p>

    <p class=example>For instance, a kiosk browser could silently ignore any invocations of the
    <code title=dom-print><a href=#dom-print>print()</a></code> method.</p>

    <p class=example>For instance, a browser on a mobile device could detect that there are no
    printers in the vicinity and display a message saying so before continuing to offer a "save to
    PDF" option.</p>

   </li>

   <li>

    <p>The user agent must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-beforeprint>beforeprint</code> at the <code><a href=#window>Window</a></code> object of the
    <code><a href=#document>Document</a></code> that is being printed, as well as any <a href=#nested-browsing-context title="nested browsing
    context">nested browsing contexts</a> in it.</p>

    <p class=example>The <code title=event-beforeprint>beforeprint</code> event can be used to
    annotate the printed copy, for instance adding the time at which the document was printed.</p>

   </li>

   <li>

    <p>The user agent must release the <a href=#storage-mutex>storage mutex</a>.</p>

   </li>

   <li>

    <p>The user agent should offer the user the opportunity to <a href=#obtain-a-physical-form>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>pause</a>
    while the method is waiting. Even if the user agent doesn't wait at this point, the user agent
    must use the state of the relevant documents as they are at this point in the algorithm if and
    when it eventually creates the alternate form.</p>

   </li>

   <li>

    <p>The user agent must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-afterprint>afterprint</code> at the <code><a href=#window>Window</a></code> object of the
    <code><a href=#document>Document</a></code> that is being printed, as well as any <a href=#nested-browsing-context title="nested browsing
    context">nested browsing contexts</a> in it.</p>

    <p class=example>The <code title=event-afterprint>afterprint</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>

   </li>

  </ol></div>


<!--TOPIC:DOM APIs-->
  <h4 id=dialogs-implemented-using-separate-documents><span class=secno>7.4.3 </span>Dialogs implemented using separate documents</h4>

  <dl class=domintro><dt><var title="">result</var> = <var title="">window</var> . <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog</a></code>(<var title="">url</var> [, <var title="">argument</var>] )</dt>

   <dd>

    <p>Prompts the user with the given page, waits for that page to
    close, and returns the return value.</p>

    <p>A call to the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code>
    method is implied when this method is invoked.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-showmodaldialog title=dom-showModalDialog><code>showModalDialog(<var title="">url</var>, <var title="">argument</var><!--, <var title="">features</var>-->)</code></dfn> method, when invoked,
  must cause the user agent to run the following steps:</p>

  <ol><li>

    <p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">url</var> relative to the
    <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</p>

    <p>If this fails, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>

   </li>

   <li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting level</a> is non-zero,
   optionally abort these steps, returning the empty string.</li>

   <li>

    <p>Release the <a href=#storage-mutex>storage mutex</a>.</p>

   </li>

   <li>

    <p>If the user agent is configured such that this invocation of <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> is somehow disabled, then return the empty
    string and abort these steps.</p>

    <p class=note>User agents are expected to disable this method in certain cases to avoid user
    annoyance (e.g. as part of their popup blocker feature). For instance, a user agent could
    require that a site be white-listed before enabling this method, or the user agent could be
    configured to only allow one modal dialog at a time.</p>

   </li>

   <li>

    <p>If the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document>active document</a> of the
    <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
    script</a> has its <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> set,
    then return the empty string and abort these steps.</p>

   </li>

   <li>

    <p>Let <var title="">incumbent origin</var> be the <a href=#effective-script-origin>effective script origin</a> of the
    <a href=#incumbent-script>incumbent script</a> at the time the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was called.</p>

   </li>

   <li>

    <p>Let <var title="">the list of background browsing contexts</var> be a list of all the
    browsing contexts that:</p>

    <ul><li>are part of the same <a href=#unit-of-related-browsing-contexts>unit of related browsing contexts</a> as the browsing context
     of the <code><a href=#window>Window</a></code> object on which the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was called, and that</li>

     <li>have an <a href=#active-document>active document</a> whose <a href=#origin>origin</a> is the <a href=#same-origin title="same
     origin">same</a> as <var title="">incumbent origin</var>,</li> <!-- Note that changing
     document.domain to talk to another domain doesn't make you able to block that domain -->

    </ul><p>...as well as any browsing contexts that are nested inside any of the browsing contexts
    matching those conditions.</p>

   </li>

   <li>

    <p>Disable the user interface for all the browsing contexts in <var title="">the list of
    background browsing contexts</var>. This should prevent the user from navigating those browsing
    contexts, causing events to be sent to those browsing context, or editing any content in those
    browsing contexts. However, it does not prevent those browsing contexts from receiving events
    from sources other than the user, from running scripts, from running animations, and so
    forth.</p>

   </li>

   <li>

    <p>Create a new <a href=#auxiliary-browsing-context>auxiliary browsing context</a>, with the <a href=#opener-browsing-context>opener browsing
    context</a> being the browsing context of the <code><a href=#window>Window</a></code> object on which the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was called. The new auxiliary
    browsing context has no name.</p>

    <p class=note>This <a href=#browsing-context>browsing context</a>'s <code><a href=#document>Document</a></code>s' <code><a href=#window>Window</a></code>
    objects all implement the <code><a href=#windowmodal>WindowModal</a></code> interface.</p>

   </li>

   <li>

    <p>Set all the flags in the new browsing context's <a href=#popup-sandboxing-flag-set>popup sandboxing flag set</a> that
    are set in the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document>active document</a> of
    the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
    script</a>. The <a href="#script's-browsing-context" title="script's browsing
    context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a>
    must be set as the new browsing context's <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed
    navigator</a>.</p>

   </li>

   <li>

    <p>Let the <a href=#dialog-arguments>dialog arguments</a> of the new browsing context be set to the value of <var title="">argument</var>, or the <i>undefined</i> value if the argument was omitted.</p>

   </li>

   <li>

    <p>Let the <a href="#dialog-arguments'-origin">dialog arguments' origin</a> be <var title="">incumbent origin</var>.</p>

   </li>

   <li>

    <p>Let the <a href=#return-value>return value</a> of the new browsing context be the <i>undefined</i> value.</p>

   </li>

   <li>

    <p>Let the <a href=#return-value-origin>return value origin</a> be <var title="">incumbent origin</var>.</p>

   </li>

   <li>

    <p><a href=#navigate>Navigate</a><!--DONAV showModalDialog--> the new <a href=#browsing-context>browsing context</a> to
    the <a href=#absolute-url>absolute URL</a> that resulted from <a href=#resolve-a-url title="resolve a url">resolving</a>
    <var title="">url</var> earlier, with <a href=#replacement-enabled>replacement enabled</a>, and with the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a>
    as the <a href=#source-browsing-context>source browsing context</a>.</p>

   </li>

   <li>

    <p><a href=#spin-the-event-loop>Spin the event loop</a> until the new <a href=#browsing-context>browsing context</a> is <a href=#close-a-browsing-context title="close a browsing context">closed</a>. The user agent must allow the user to indicate
    that the <a href=#browsing-context>browsing context</a> is to be closed.</p>

   </li>

   <li>

    <p>Reenable the user interface for all the browsing contexts in <var title="">the list of
    background browsing contexts</var>.</p>

   </li>

   <li>

    <p>If the <a href=#auxiliary-browsing-context>auxiliary browsing context</a>'s <a href=#return-value-origin>return value origin</a> at the time
    the browsing context was <a href=#close-a-browsing-context title="close a browsing context">closed</a> was the <a href=#same-origin title="same origin">same</a> as <var title="">incumbent origin</var>, then let <var title="">return value</var> be the <a href=#auxiliary-browsing-context>auxiliary browsing context</a>'s <a href=#return-value>return
    value</a> as it stood when the browsing context was <a href=#close-a-browsing-context title="close a browsing
    context">closed</a>.</p>

    <p>Otherwise, let <var title="">return value</var> be undefined.</p>

   </li>

   <li>

    <p>Return <var title="">return value</var>.</p>

   </li>

  </ol><p>The <code><a href=#window>Window</a></code> objects of <code><a href=#document>Document</a></code>s hosted by <a href=#browsing-context title="browsing
  context">browsing contexts</a> created by the above algorithm must also implement the
  <code><a href=#windowmodal>WindowModal</a></code> interface.</p>

  <p class=note>When this happens, the members of the <code><a href=#windowmodal>WindowModal</a></code> interface, in
  JavaScript environments, appear to actually be part of the <code><a href=#window>Window</a></code> interface (e.g.
  they are on the same prototype chain as the <code title=dom-alert><a href=#dom-alert>window.alert()</a></code>
  method).</p>

  </div>

  <pre class=idl>[NoInterfaceObject] interface <dfn id=windowmodal>WindowModal</dfn> {
  readonly attribute any <a href=#dom-windowmodal-dialogarguments title=dom-WindowModal-dialogArguments>dialogArguments</a>;
           attribute any <a href=#dom-windowmodal-returnvalue title=dom-WindowModal-returnValue>returnValue</a>;
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-WindowModal-dialogArguments><a href=#dom-windowmodal-dialogarguments>dialogArguments</a></code></dt>

   <dd>

    <p>Returns the <var title="">argument</var> argument that was passed to the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-WindowModal-returnValue><a href=#dom-windowmodal-returnvalue>returnValue</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the current return value for the window.</p>

    <p>Can be set, to change the value that will be returned by the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>

   </dd>

  </dl><div class=impl>

  <p>Such browsing contexts have associated <dfn id=dialog-arguments>dialog arguments</dfn>, which are stored along with
  the <dfn id="dialog-arguments'-origin">dialog arguments' origin</dfn>. These values are set by the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method in the algorithm above, when the
  browsing context is created, based on the arguments provided to the method.</p>

  <p>The <dfn id=dom-windowmodal-dialogarguments title=dom-WindowModal-dialogArguments><code>dialogArguments</code></dfn> IDL
  attribute, on getting, must check whether its browsing context's <a href=#active-document>active document</a>'s
  <a href=#effective-script-origin>effective script origin</a> is the <a href=#same-origin title="same origin">same</a> as the <a href="#dialog-arguments'-origin">dialog arguments'
  origin</a>. If it is, then the browsing context's <a href=#dialog-arguments>dialog arguments</a> must be
  returned unchanged. Otherwise, the IDL attribute must return <i>undefined</i>.</p>

  <p>These browsing contexts also have an associated <dfn id=return-value>return value</dfn> and <dfn id=return-value-origin>return value
  origin</dfn>. As with the previous two values, these values are set by the <code title=dom-showModalDialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method in the algorithm above, when the
  browsing context is created.</p>

  <p>The <dfn id=dom-windowmodal-returnvalue title=dom-WindowModal-returnValue><code>returnValue</code></dfn> IDL attribute, on
  getting, must check whether its browsing context's <a href=#active-document>active document</a>'s <a href=#effective-script-origin>effective
  script origin</a> is the <a href=#same-origin title="same origin">same</a> as the current <a href=#return-value-origin>return
  value origin</a>. If it is, then the browsing context's <a href=#return-value>return value</a> must be
  returned unchanged. Otherwise, the IDL attribute must return <i>undefined</i>. On setting, the
  attribute must set the <a href=#return-value>return value</a> to the given new value, and the <a href=#return-value-origin>return
  value origin</a> to the browsing context's <a href=#active-document>active document</a>'s <a href=#effective-script-origin>effective
  script origin</a>.</p>

  </div>

  <p class=note>The <code title=dom-window-close><a href=#dom-window-close>window.close()</a></code> method can be used to
  close the browsing context.</p>


  <h3 id=system-state-and-capabilities><span class=secno>7.5 </span>System state and capabilities</h3>

  <h4 id=the-navigator-object><span class=secno>7.5.1 </span>The <code><a href=#navigator>Navigator</a></code> object</h4>

  <div class=impl>

  <p>The <dfn id=dom-navigator title=dom-navigator><code>navigator</code></dfn> attribute of the
  <code><a href=#window>Window</a></code> interface must return an instance of the <code><a href=#navigator>Navigator</a></code> interface,
  which represents the identity and state of the user agent (the client), and allows Web pages to
  register themselves as potential protocol and content handlers:</p>

  </div>

  <pre class=idl>interface <dfn id=navigator>Navigator</dfn> {
  // objects implementing this interface also implement the interfaces given below
};
<a href=#navigator>Navigator</a> implements <a href=#navigatorid>NavigatorID</a>;
<a href=#navigator>Navigator</a> implements <a href=#navigatorlanguage>NavigatorLanguage</a>;
<a href=#navigator>Navigator</a> implements <a href=#navigatoronline>NavigatorOnLine</a>;
<a href=#navigator>Navigator</a> implements <a href=#navigatorcontentutils>NavigatorContentUtils</a>;
<a href=#navigator>Navigator</a> implements <a href=#navigatorstorageutils>NavigatorStorageUtils</a>;
<a href=#navigator>Navigator</a> implements <a href=#navigatorplugins>NavigatorPlugins</a>;</pre>

<!-- v2:
  geolocator mozIsLocallyAvailable preference
-->

  <div class=impl>

  <p>These interfaces are defined separately so that other specifications can re-use parts of the
  <code><a href=#navigator>Navigator</a></code> interface.</p>

  </div>


  <h5 id=client-identification><span class=secno>7.5.1.1 </span>Client identification</h5>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=navigatorid>NavigatorID</dfn> {
  readonly attribute DOMString <a href=#dom-navigator-appcodename title=dom-navigator-appCodeName>appCodeName</a>; // constant "Mozilla"
  readonly attribute DOMString <a href=#dom-navigator-appname title=dom-navigator-appName>appName</a>;
  readonly attribute DOMString <a href=#dom-navigator-appversion title=dom-navigator-appVersion>appVersion</a>;
  readonly attribute DOMString <a href=#dom-navigator-platform title=dom-navigator-platform>platform</a>;
  readonly attribute DOMString <a href=#dom-navigator-product title=dom-navigator-product>product</a>; // constant "Gecko"
  boolean <a href=#dom-navigator-taintenabled title=dom-navigator-taintEnabled>taintEnabled</a>(); // constant false
  readonly attribute DOMString <a href=#dom-navigator-useragent title=dom-navigator-userAgent>userAgent</a>;
};</pre>

  <p>In certain cases, despite the best efforts of the entire industry, Web browsers have bugs and
  limitations that Web authors are forced to work around.</p>

  <p>This section defines a collection of attributes that can be used to determine, from script, the
  kind of user agent in use, in order to work around these issues.</p>

  <p>Client detection should always be limited to detecting known current versions; future versions
  and unknown versions should always be assumed to be fully compliant.</p>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-appCodeName><a href=#dom-navigator-appcodename>appCodeName</a></code></dt>
   <dd>
    <p>Returns the string "<code title="">Mozilla</code>".</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-appName><a href=#dom-navigator-appname>appName</a></code></dt>
   <dd>
    <p>Returns the name of the browser.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-appVersion><a href=#dom-navigator-appversion>appVersion</a></code></dt>
   <dd>
    <p>Returns the version of the browser.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-platform><a href=#dom-navigator-platform>platform</a></code></dt>
   <dd>
    <p>Returns the name of the platform.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-product><a href=#dom-navigator-product>product</a></code></dt>
   <dd>
    <p>Returns the string "<code title="">Gecko</code>".</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-taintEnabled><a href=#dom-navigator-taintenabled>taintEnabled</a></code>()</dt>
   <dd>
    <p>Returns false.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-userAgent><a href=#dom-navigator-useragent>userAgent</a></code></dt>
   <dd>
    <p>Returns the complete User-Agent header.</p>
   </dd>

  </dl><div class=impl>

  <dl><dt><dfn id=dom-navigator-appcodename title=dom-navigator-appCodeName><code>appCodeName</code></dfn></dt>
   <dd><p>Must return the string "<code title="">Mozilla</code>".</dd>

   <!-- appMinorVersion: IE only. In IE8b1, returns " Beta" (with the space) -->

   <dt><dfn id=dom-navigator-appname title=dom-navigator-appName><code>appName</code></dfn></dt>
   <dd><p>Must return either the string "<code title="">Netscape</code>" or the full name of the browser, e.g. "<code title="">Mellblom Browsernator</code>".</dd>

   <dt><dfn id=dom-navigator-appversion title=dom-navigator-appVersion><code>appVersion</code></dfn></dt>
   <dd><p>Must return either the string "<code title="">4.0</code>" or a string representing the version of the browser in detail, e.g. "<code title="">1.0 (VMS; en-US) Mellblomenator/9000</code>".</dd>

   <!-- buildID: Mozilla only -->

   <!-- oscpu: Mozilla only -->

   <dt><dfn id=dom-navigator-platform title=dom-navigator-platform><code>platform</code></dfn></dt>
   <dd><p>Must return either the empty string or a string representing the platform on which the browser is executing, e.g. "<code title="">MacIntel</code>", "<code title="">Win32</code>", "<code title="">FreeBSD i386</code>", "<code title="">WebTV OS</code>".</dd>

   <dt><dfn id=dom-navigator-product title=dom-navigator-product><code>product</code></dfn></dt>
   <dd><p>Must return the string "<code title="">Gecko</code>".</dd>

   <!-- productSub: Mozilla and Safari only; returns same as buildID in Mozilla, and returns the fixed string "20030107" in Safari -->

   <!-- securityPolicy: Mozilla only; always returns "" -->

   <dt><dfn id=dom-navigator-taintenabled title=dom-navigator-taintEnabled><code>taintEnabled()</code></dfn></dt>
   <dd><p>Must return false.</dd>

   <dt><dfn id=dom-navigator-useragent title=dom-navigator-userAgent><code>userAgent</code></dfn></dt>
   <dd><p>Must return the string used for the value of the "<code title="">User-Agent</code>" header in HTTP requests, or the empty string if no such header is ever sent.</dd>

   <!-- vendor: Mozilla and Safari only; always returns "" in Mozilla, and returns the fixed string "Apple Computer, Inc." in Safari -->

   <!-- vendorSub: Mozilla and Safari only; always returns "" -->

  </dl><!-- similar paragraph in next section --><p class=warning>Any information in this API that varies from user to user can be used to
  profile the user. In fact, if enough such information is available, a user can actually be
  uniquely identified. For this reason, user agent implementors are strongly urged to include as
  little information in this API as possible.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  </div>

  <!-- next section refers to previous section as "previous section" -->

  <h5 id=language-preferences><span class=secno>7.5.1.2 </span>Language preferences</h5>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=navigatorlanguage>NavigatorLanguage</dfn> {
  readonly attribute DOMString? <a href=#dom-navigator-language title=dom-navigator-language>language</a>;
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-language><a href=#dom-navigator-language>language</a></code></dt>
   <dd>
    <p>Returns a language tag representing the user's preferred language.</p>
   </dd>

  </dl><div class=impl>

  <dl><!--
   <dt><dfn title="dom-navigator-browserLanguage"><code>browserLanguage</code></dfn></dt> <!- - Opera and IE only - ->
   <dd><p>Must return either the string "<code title="">en</code>" or a language tag representing the language the browser uses in its interface.</p></dd>


   <dt><dfn title="dom-navigator-userLanguage"><code>userLanguage</code></dfn></dt> <!- - Opera and IE only - ->
   --><!-- at time of testing, this was supported by Opera, Safari, and Mozilla only --><dt><dfn id=dom-navigator-language title=dom-navigator-language><code>language</code></dfn></dt>
   <dd><p>Must return either the string "<code title="">en</code>" or a valid BCP 47 language tag representing the user's preferred language. <a href=#refsBCP47>[BCP47]</a></dd>

  </dl><p class=warning>As for the API in the previous section, any information in this API that varies
  from user to user can be used to profile or identify the user. For this reason, user agent
  implementors are encouraged to return "en" unless the user has explicitly indicated that the site
  in question is allowed access to the information.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  </div>



  <h5 id=custom-handlers><span class=secno>7.5.1.3 </span>Custom scheme and content handlers</h5>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=navigatorcontentutils>NavigatorContentUtils</dfn> {
  // content handler registration
  void <a href=#dom-navigator-registerprotocolhandler title=dom-navigator-registerProtocolHandler>registerProtocolHandler</a>(DOMString scheme, DOMString url, DOMString title);
  void <a href=#dom-navigator-registercontenthandler title=dom-navigator-registerContentHandler>registerContentHandler</a>(DOMString mimeType, DOMString url, DOMString title);
  DOMString <a href=#dom-navigator-isprotocolhandlerregistered title=dom-navigator-isProtocolHandlerRegistered>isProtocolHandlerRegistered</a>(DOMString scheme, DOMString url);
  DOMString <a href=#dom-navigator-iscontenthandlerregistered title=dom-navigator-isContentHandlerRegistered>isContentHandlerRegistered</a>(DOMString mimeType, DOMString url);
  void <a href=#dom-navigator-unregisterprotocolhandler title=dom-navigator-unregisterProtocolHandler>unregisterProtocolHandler</a>(DOMString scheme, DOMString url);
  void <a href=#dom-navigator-unregistercontenthandler title=dom-navigator-unregisterContentHandler>unregisterContentHandler</a>(DOMString mimeType, DOMString url);
};</pre>

  <p>The <dfn id=dom-navigator-registerprotocolhandler title=dom-navigator-registerProtocolHandler><code>registerProtocolHandler()</code></dfn> method
  allows Web sites to register themselves as possible handlers for particular schemes. For example,
  an online telephone messaging service could register itself as a handler of the <code>sms:</code>
  scheme, so that if the user clicks on such a link, he is given the opportunity to use that Web
  site. Analogously, the <dfn id=dom-navigator-registercontenthandler title=dom-navigator-registerContentHandler><code>registerContentHandler()</code></dfn> method
  allows Web sites to register themselves as possible handlers for content in a particular
  <a href=#mime-type>MIME type</a>. For example, the same online telephone messaging service could register
  itself as a handler for <code>text/vcard</code> files, so that if the user has no native
  application capable of handling vCards, his Web browser can instead suggest he use that site to
  view contact information stored on vCards that he opens. <a href=#refsRFC5724>[RFC5724]</a> <a href=#refsRFC6350>RFC6350</a></p>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler</a></code>(<var title="">scheme</var>, <var title="">url</var>, <var title="">title</var>)</dt>
   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler</a></code>(<var title="">mimeType</var>, <var title="">url</var>, <var title="">title</var>)</dt>

   <dd>

    <p>Registers a handler for the given scheme or content type, at the given URL, with the given
    title.</p>

    <p>The string "<code title="">%s</code>" in the URL is used as a placeholder for where to put
    the URL of the content to be handled.</p>

    <p>Throws a <code><a href=#securityerror>SecurityError</a></code> exception if the user agent blocks the registration (this
    might happen if trying to register as a handler for "http", for instance).</p>

    <p>Throws a <code><a href=#syntaxerror>SyntaxError</a></code> exception if the "<code title="">%s</code>" string is
    missing in the URL.</p>

   </dd>

  </dl><div class=impl>

  <p>User agents may, within the constraints described in this section, do whatever they like when
  the methods are called. A UA could, for instance, prompt the user and offer the user the
  opportunity to add the site to a shortlist of handlers, or make the handlers his default, or
  cancel the request. UAs could provide such a UI through modal UI or through a non-modal transient
  notification interface. UAs could also simply silently collect the information, providing it only
  when relevant to the user.</p>

  <p>User agents should keep track of which sites have registered handlers (even if the user has
  declined such registrations) so that the user is not repeatedly prompted with the same
  request.</p>

  <p>The arguments to the methods have the following meanings and corresponding implementation
  requirements. The requirements that involve throwing exceptions must be processed in the order
  given below, stopping at the first exception thrown. (So the exceptions for the first argument
  take precedence over the exceptions for the second argument.)</p>

  <dl><dt><var title="">scheme</var> (<code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> only)</dt>

   <dd>

    <p>A scheme, such as <code>mailto</code> or <code>web+auth</code>. The scheme must be compared
    in an <a href=#ascii-case-insensitive>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 title="">scheme</var> value, if it contains a colon (as in "<code>mailto:</code>"),
    will never match anything, since schemes don't contain colons.</p>

    <p>If the <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code>
    method is invoked with a scheme that is neither a <a href=#whitelisted-scheme>whitelisted scheme</a> nor a scheme
    whose value starts with the substring "<code title="">web+</code>" and otherwise contains only
    <a href=#lowercase-ascii-letters>lowercase ASCII letters</a>, and whose length is at least five characters (including
    the "<code title="">web+</code>" prefix), the user agent must throw a <code><a href=#securityerror>SecurityError</a></code>
    exception.</p>

    <p>The following schemes are the <dfn id=whitelisted-scheme title="whitelisted scheme">whitelisted schemes</dfn>:</p>

    <ul class=brief><li><code title="">bitcoin</code></li> <!-- https://en.bitcoin.it/wiki/BIP_0021 -->
     <li><code title="">geo</code></li>
     <li><code title="">im</code></li>
     <li><code title="">irc</code></li>
     <li><code title="">ircs</code></li>
     <li><code title="">magnet</code></li>
     <li><code title="">mailto</code></li>
     <li><code title="">mms</code></li>
     <li><code title="">news</code></li>
     <li><code title="">nntp</code></li>
     <li><code title="">sip</code></li>
     <li><code title="">sms</code></li>
     <li><code title="">smsto</code></li>
     <li><code title="">ssh</code></li>
     <li><code title="">tel</code></li>
     <li><code title="">urn</code></li>
     <li><code title="">webcal</code></li>
     <li><code title="">wtai</code></li>
     <li><code title="">xmpp</code></li>
    </ul><p class=note>This list can be changed. If there are schemes that should be added, please send
    feedback.</p>

    <p class=note>This list excludes any schemes that could reasonably be expected to be supported
    inline, e.g. in an <code><a href=#the-iframe-element>iframe</a></code>, such as <code title="">http</code> or (more
    theoretically) <code title="">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>

   </dd>

   <dt><var title="">mimeType</var> (<code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> only)</dt>

   <dd>

    <p>A <a href=#mime-type>MIME type</a>, such as <code>model/vnd.flatland.3dml</code> or
    <code>application/vnd.google-earth.kml+xml</code>. The <a href=#mime-type>MIME type</a> must be compared
    in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> manner by user agents for the purposes of comparing
    with MIME types of documents that they consider against the list of registered handlers.</p>

    <p>User agents must compare the given values only to the MIME type/subtype parts of content
    types, not to the complete type including parameters. Thus, if <var title="">mimeType</var>
    values passed to this method include characters such as commas or whitespace, or include MIME
    parameters, then the handler being registered will never be used.</p>

    <p class=note>The type is compared to the <a href=#mime-type>MIME type</a> used by the user agent
    <em>after</em> the sniffing algorithms have been applied.</p>

    <p>If the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>
    method is invoked with a <a href=#mime-type>MIME type</a> that is in the <a href=#type-blacklist>type blacklist</a> or
    that the user agent has deemed a privileged type, the user agent must throw a
    <code><a href=#securityerror>SecurityError</a></code> exception.</p>

    <p>The following <a href=#mime-type title="MIME type">MIME types</a> are in the <dfn id=type-blacklist>type
    blacklist</dfn>:</p>

    <ul class=brief><li><code><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code></li>
     <li><code><a href=#application/xhtml+xml>application/xhtml+xml</a></code></li>
     <li><code>application/xml</code></li>
     <li><code>image/gif</code></li>
     <li><code>image/jpeg</code></li>
     <li><code>image/png</code></li>
     <li><code>image/svg+xml</code></li>
     <li><code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code></li>
     <li><code><a href=#text/cache-manifest>text/cache-manifest</a></code></li>
     <li><code>text/css</code></li>
     <li><code><a href=#text/html>text/html</a></code></li>
     <li><code><a href=#text/ping>text/ping</a></code></li>
     <li><code>text/plain</code></li>
     <li><code>text/xml</code></li>
     <li>All types that the user agent supports displaying natively in a <a href=#browsing-context>browsing context</a> during <a href=#navigate title=navigate>navigation</a>, except for <code>application/rss+xml</code> and <code>application/atom+xml</code></li>

    </ul><p class=note>This list can be changed. If there are MIME types that should be added, please
    send feedback.</p>

   </dd>


   <dt><var title="">url</var></dt>

   <dd>

    <p>A string used to build the <a href=#url>URL</a> of the page that will handle the requests.</p>

    <p>User agents must throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception if the <var title="">url</var>
    argument passed to one of these methods does not contain the exact literal string
    "<code>%s</code>".</p>

    <p>User agents must throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception if <a href=#resolve-a-url title="resolve a
    url">resolving</a> the <var title="">url</var> argument relative to the <a href=#entry-script>entry
    script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, is not successful.</p>

    <p class=note>The resulting <a href=#absolute-url>absolute URL</a> would by definition not be a <a href=#valid-url>valid
    URL</a> as it would include the string "<code title="">%s</code>" which is not a valid
    component in a URL.</p>

    <p>User agents must throw a <code><a href=#securityerror>SecurityError</a></code> exception if the resulting <a href=#absolute-url>absolute
    URL</a> has an <a href=#origin>origin</a> that differs from the <a href=#origin>origin</a> of the
    <a href=#entry-script>entry script</a>.</p>

    <p class=note>This is forcibly the case if the <code title="">%s</code> placeholder is in the
    scheme, host, or port parts of the URL.</p>

    <p>The resulting <a href=#absolute-url>absolute URL</a> is the <dfn id=proto-url>proto-URL</dfn>. It identifies the
    handler for the purposes of the methods described below.</p>

    <p>When the user agent uses this handler, it must replace the first occurrence of the exact
    literal string "<code title="">%s</code>" in the <var title="">url</var> argument with an
    escaped version of the <a href=#absolute-url>absolute URL</a> of the content in question (as defined below),
    then <a href=#resolve-a-url title="resolve a url">resolve</a> the resulting URL, relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry script</a> at the time the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> or <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> methods were
    invoked, and then <a href=#navigate>navigate</a><!--DONAV user--> an appropriate <a href=#browsing-context>browsing
    context</a> to the resulting URL using the GET method (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a> for non-HTTP URLs).</p>

    <p>To get the escaped version of the <a href=#absolute-url>absolute URL</a> of the content in question, the
    user agent must replace every character in that <a href=#absolute-url>absolute URL</a> that is not a
    character in the URL <a href=#default-encode-set>default encode set</a> with the result of <a href=#utf-8-percent-encode title="UTF-8
    percent encode">UTF-8 percent encoding</a> that character.</p>

    <div class=example>

     <p>If the user had visited a site at <code title="">http://example.com/</code> that made the
     following call:</p>

     <pre>navigator.registerContentHandler('application/x-soup', 'soup?url=%s', 'SoupWeb&trade;')</pre>

     <p>...and then, much later, while visiting <code title="">http://www.example.net/</code>,
     clicked on a link such as:</p>

     <pre>&lt;a href="chickenk&iuml;wi.soup"&gt;Download our Chicken K&iuml;wi soup!&lt;/a&gt;</pre>

     <p>...then, assuming this <code>chickenk&iuml;wi.soup</code> file was served with the
     <a href=#mime-type>MIME type</a> <code>application/x-soup</code>, the UA might navigate to the following
     URL:</p>

     <pre>http://example.com/soup?url=http://www.example.net/chickenk%C3%AFwi.soup</pre>

     <p>This site could then fetch the <code>chickenk&iuml;wi.soup</code> file and do whatever it is
     that it does with soup (synthesize it and ship it to the user, or whatever).</p>

    </div>

   </dd>

   <dt><var title="">title</var></dt>

   <dd>

    <p>A descriptive title of the handler, which the UA might use to remind the user what the site
    in question is.</p>

   </dd>

  </dl><p>This section does not define how the pages registered by these methods are used, beyond the
  requirements on how to process the <var title="">url</var> value (see above). To some extent, the
  <a href=#navigate title=navigate>processing model for navigating across documents</a> defines some cases
  where these methods are relevant, but in general UAs may use this information wherever they would
  otherwise consider handing content to native plugins or helper applications.</p>

  <p>UAs must not use registered content handlers to handle content that was returned as part of a
  non-GET transaction (or rather, as part of any non-idempotent transaction), as the remote site
  would not be able to fetch the same data.</p>

  <hr></div>

  <p>In addition to the registration methods, there are also methods for determining if particular
  handlers have been registered, and for unregistering handlers.</p>

  <dl class=domintro><dt><var title="">state</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-isProtocolHandlerRegistered><a href=#dom-navigator-isprotocolhandlerregistered>isProtocolHandlerRegistered</a></code>(<var title="">scheme</var>, <var title="">url</var>)</dt>
   <dt><var title="">state</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-isContentHandlerRegistered><a href=#dom-navigator-iscontenthandlerregistered>isContentHandlerRegistered</a></code>(<var title="">mimeType</var>, <var title="">url</var>)</dt>

   <dd>

    <p>Returns one of the following strings describing the state of the handler given by the
    arguments:</p>

    <dl><dt><code title="">new</code>

     <dd>Indicates that no attempt has been made to register the given handler (or that the handler
     has been unregistered). It would be appropriate to promote the availability of the handler or
     to just automatically register the handler.

     <dt><code title="">registered</code>

     <dd>Indicates that the given handler has been registered or that the site is blocked from
     registering the handler. Trying to register the handler again would have no effect.

     <dt><code title="">declined</code>

     <dd>Indicates that the given handler has been offered but was rejected. Trying to register the
     handler again may prompt the user again.

    </dl></dd>

   <dt><var title="">state</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-unregisterProtocolHandler><a href=#dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler</a></code>(<var title="">scheme</var>, <var title="">url</var>)</dt>
   <dt><var title="">state</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-unregisterContentHandler><a href=#dom-navigator-unregistercontenthandler>unregisterContentHandler</a></code>(<var title="">mimeType</var>, <var title="">url</var>)</dt>

   <dd>

    <p>Unregisters the handler given by the arguments.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-navigator-isprotocolhandlerregistered title=dom-navigator-isProtocolHandlerRegistered><code>isProtocolHandlerRegistered()</code></dfn>
  method must return the <a href=#handler-state-string>handler state string</a> that most closely describes the current
  state of the handler described by the two arguments to the method, where the first argument gives
  the scheme and the second gives the string used to build the <a href=#url>URL</a> of the page that
  will handle the requests.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The first argument must be compared to the schemes for which custom protocol handlers are
  registered in an <a href=#ascii-case-insensitive>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 title=proto-URL>proto-URLs</a> of the relevant handlers to
  find the described handler.</p>

  <hr><p>The <dfn id=dom-navigator-iscontenthandlerregistered title=dom-navigator-isContentHandlerRegistered><code>isContentHandlerRegistered()</code></dfn>
  method must return the <a href=#handler-state-string>handler state string</a> that most closely describes the current
  state of the handler described by the two arguments to the method, where the first argument gives
  the <a href=#mime-type>MIME type</a> and the second gives the string used to build the <a href=#url>URL</a> of
  the page that will handle the requests.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The first argument must be compared to the <a href=#mime-type title="MIME type">MIME types</a> for which
  custom content handlers are registered in an <a href=#ascii-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 title=proto-URL>proto-URLs</a> of the relevant handlers to
  find the described handler.</p>

  <hr><p>The <dfn id=handler-state-string title="handler state string">handler state strings</dfn> are the following strings.
  Each string describes several situations, as given by the following list.</p>

  <dl><dt><code title="">new</code>

   <dd>The described handler has never been registered for the given scheme or type.

   <dd>The described handler was once registered for the given scheme or type, but the site has
   since unregistered it. If the handler were to be reregistered, the user would be notified
   accordingly.

   <dd>The described handler was once registered for the given scheme or type, but the site has
   since unregistered it, but the user has indicated that the site is to be blocked from registering
   the type again, so the user agent would ignore further registration attempts.


   <dt><code title="">registered</code>

   <dd>An attempt was made to register the described handler for the given scheme or type, but the
   user has not yet been notified, and the user agent would ignore further registration attempts.
   (Maybe the user agent batches registration requests to display them when the user requests to be
   notified about them, and the user has not yet requested that the user agent notify it of the
   previous registration attempt.)

   <dd>The described handler is registered for the given scheme or type (maybe, or maybe not, as the
   default handler).

   <dd>The described handler is permanently blocked from being (re)registered. (Maybe the user
   marked the registration attempt as spam, or blocked the site for other reasons.)


   <dt><code title="">declined</code>

   <dd>An attempt was made to register the described handler for the given scheme or type, but the
   user has not yet been notified; however, the user might be notified if another registration
   attempt were to be made. (Maybe the last registration attempt was made while the page was in the
   background and the user closed the page without looking at it, and the user agent requires
   confirmation for this registration attempt.)

   <dd>An attempt was made to register the described handler for the given scheme or type, but the
   user has not yet responded.

   <dd>An attempt was made to register the described handler for the given scheme or type, but the
   user declined the offer. The user has not indicated that the handler is to be permanently
   blocked, however, so another attempt to register the described handler might result in the user
   being prompted again.

   <dd>The described handler was once registered for the given scheme or type, but the user has
   since removed it. The user has not indicated that the handler is to be permanently blocked,
   however, so another attempt to register the described handler might result in the user being
   prompted again.

  </dl><hr><p>The <dfn id=dom-navigator-unregisterprotocolhandler title=dom-navigator-unregisterProtocolHandler><code>unregisterProtocolHandler()</code></dfn>
  method must unregister the handler described by the two arguments to the method, where the first
  argument gives the scheme and the second gives the string used to build the <a href=#url>URL</a> of
  the page that will handle the requests.</p>

  <p>The first argument must be compared to the schemes for which custom protocol handlers are
  registered in an <a href=#ascii-case-insensitive>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 title=proto-URL>proto-URLs</a> of the relevant handlers to
  find the described handler.</p>

  <hr><p>The <dfn id=dom-navigator-unregistercontenthandler title=dom-navigator-unregisterContentHandler><code>unregisterContentHandler()</code></dfn>
  method must unregister the handler described by the two arguments to the method, where the first
  argument gives the <a href=#mime-type>MIME type</a> and the second gives the string used to build the
  <a href=#url>URL</a> of the page that will handle the requests.</p>

  <p>The first argument must be compared to the <a href=#mime-type title="MIME type">MIME types</a> for which
  custom content handlers are registered in an <a href=#ascii-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 title=proto-URL>proto-URLs</a> of the relevant handlers to
  find the described handler.</p>

  <hr><p>The second argument of the four methods described above must be preprocessed as follows:</p>

  <ol><li><p>If the string does not contain the substring "<code title="">%s</code>", abort these
   steps. There's no matching handler.</li>

   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> the string relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry script</a>.</li>

   <li><p>If this fails, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception, aborting the
   method.</li>

   <li><p>If the resulting <a href=#absolute-url>absolute URL</a>'s <a href=#origin>origin</a> is not the <a href=#same-origin>same
   origin</a> as that of the <a href=#entry-script>entry script</a>, throw a <code><a href=#securityerror>SecurityError</a></code>
   exception, aborting the method.</li>

   <li><p>Return the resulting <a href=#absolute-url>absolute URL</a> as the result of preprocessing the
   argument.</li>

  </ol></div>



<!--ADD-TOPIC:Security-->
  <div class=impl>

  <h6 id=security-and-privacy><span class=secno>7.5.1.3.1 </span>Security and privacy</h6>

  <p>These mechanisms can introduce a number of concerns, in particular privacy concerns.</p>

  <p><strong>Hijacking all Web usage.</strong> User agents should not allow schemes that are key to
  its normal operation, such as <code>http</code> or <code>https</code>, to be rerouted through
  third-party sites. This would allow a user's activities to be trivially tracked, and would allow
  user information, even in secure connections, to be collected.</p>

  <p><strong>Hijacking defaults.</strong> User agents are strongly urged to not automatically change
  any defaults, as this could lead the user to send data to remote hosts that the user is not
  expecting. New handlers registering themselves should never automatically cause those sites to be
  used.</p>

  <p><strong>Registration spamming.</strong> User agents should consider the possibility that a site
  will attempt to register a large number of handlers, possibly from multiple domains (e.g. by
  redirecting through a series of pages each on a different domain, and each registering a handler
  for <code>video/mpeg</code> &mdash; 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="">title</var> argument to the methods when presenting the registered handlers to the user,
  since sites could easily lie. For example, a site <code>hostile.example.net</code> could claim
  that it was registering the "Cuddly Bear Happy Content Handler". User agents should therefore use
  the handler's domain in any UI along with any title.</p>

  <p><strong>Hostile handler metadata.</strong> User agents should protect against typical attacks
  against strings embedded in their interface, for example ensuring that markup or escape characters
  in such strings are not executed, that null bytes are properly handled, that over-long strings do
  not cause crashes or buffer overruns, and so forth.</p>

  <p><strong>Leaking Intranet URLs.</strong> The mechanism described in this section can result in
  secret Intranet URLs being leaked, in the following manner:</p>

  <ol><li>The user registers a third-party content handler as the default handler for a content
   type.</li>

   <li>The user then browses his corporate Intranet site and accesses a document that uses that
   content type.</li>

   <li>The user agent contacts the third party and hands the third party the URL to the Intranet
   content.</li>

  </ol><p>No actual confidential file data is leaked in this manner, but the URLs themselves could
  contain confidential information. For example, the URL could be
  <code>http://www.corp.example.com/upcoming-aquisitions/the-sample-company.egf</code>, which might
  tell the third party that Example Corporation is intending to merge with The Sample Company.
  Implementors might wish to consider allowing administrators to disable this feature for certain
  subdomains, content types, or schemes.</p>

  <p><strong>Leaking secure URLs.</strong> User agents should not send HTTPS URLs to third-party
  sites registered as content handlers without the user's informed consent, for the same reason that
  user agents sometimes avoid sending <code title=http-referer>Referer</code> (sic) HTTP headers
  from secure sites to third-party sites.</p>

  <p><strong>Leaking credentials.</strong> User agents must never send username or password
  information in the URLs that are escaped and included sent to the handler sites. User agents may
  even avoid attempting to pass to Web-based handlers the URLs of resources that are known to
  require authentication to access, as such sites would be unable to access the resources in
  question without prompting the user for credentials themselves (a practice that would require the
  user to know whether to trust the third-party handler, a decision many users are unable to make or
  even understand).</p>

  <p><strong>Interface interference.</strong> User agents should be prepared to handle intentionally
  long arguments to the methods. For example, if the user interface exposed consists of an "accept"
  button and a "deny" button, with the "accept" binding containing the name of the handler, it's
  important that a long name not cause the "deny" button to be pushed off the screen.</p>

  <p><strong>Fingerprinting users.</strong> Since a site can detect if it has attempted to register
  a particular handler or not, whether or not the user responds, the mechanism can be used to store
  data. User agents are therefore strongly urged to treat registrations in the same manner as
  cookies: clearing cookies for a site should also clear all registrations for that site, and
  disabling cookies for a site should also disable registrations.</p>

  </div>
<!--REMOVE-TOPIC:Security-->


  <div class=impl>

  <h6 id=sample-handler-impl><span class=secno>7.5.1.3.2 </span>Sample user interface</h6>

  <p><i>This section is non-normative.</i></p>

  <p>A simple implementation of this feature for a desktop Web browser might work as follows.</p>

  <p>The <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> method
  could display a modal dialog box:</p>

  <p><img src=http://images.whatwg.org/sample-content-handler-registration.png width=534 alt="The modal dialog box could have the title 'Content Handler Registration', and could say 'This Web page: Kittens at work http://kittens.example.org/ ...would like permission to handle files of type: application/x-meowmeow using the following Web-based application: Kittens-at-work displayer http://kittens.example.org/?show=%s Do you trust the administrators of the &quot;kittens.example.org&quot; domain?' with two buttons, 'Trust kittens.example.org' and 'Cancel'." height=374></p>

  <p>In this dialog box, "Kittens at work" is the title of the page that invoked the method,
  "http://kittens.example.org/" is the URL of that page, "application/x-meowmeow" is the string that
  was passed to the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> method as its first
  argument (<var title="">mimeType</var>), "http://kittens.example.org/?show=%s" was the second
  argument (<var title="">url</var>), and "Kittens-at-work displayer" was the third argument (<var title="">title</var>).</p>

  <p>If the user clicks the Cancel button, then nothing further happens. If the user clicks the
  "Trust" button, then the handler is remembered.</p>

  <p>When the user then attempts to fetch a URL that uses the "application/x-meowmeow" <a href=#mime-type>MIME
  type</a>, then it might display a dialog as follows:</p>

  <p><img src=http://images.whatwg.org/sample-content-handler.png width=577 alt="The dialog box could have the title 'Unknown File Type' and could say 'You have attempted to access:' followed by a URL, followed by a prompt such as 'How would you like FerretBrowser to handle this resource?' with three radio buttons, one saying 'Contact the FerretBrowser plugin registry to see if there is an official way to handle this resource.', one saying 'Pass this URL to a local application' with an application selector, and one saying 'Pass this URL to the &quot;Kittens-at-work displayer&quot; application at &quot;kittens.example.org&quot;', with a checkbox labeled 'Always do this for resources using the &quot;application/x-meowmeow&quot; type in future.', and with two buttons, 'Ok' and 'Cancel'." height=428></p>

  <p>In this dialog, the third option is the one that was primed by the site registering itself
  earlier.</p>

  <p>If the user does select that option, then the browser, in accordance with the requirements
  described in the previous two sections, will redirect the user to
  "http://kittens.example.org/?show=data%3Aapplication/x-meowmeow;base64,S2l0dGVucyBhcmUgdGhlIGN1dGVzdCE%253D".</p>

  <p>The <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> method
  would work equivalently, but for schemes instead of unknown content types.</p>

  </div>



  <h5 id=manually-releasing-the-storage-mutex><span class=secno>7.5.1.4 </span>Manually releasing the storage mutex</h5>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=navigatorstorageutils>NavigatorStorageUtils</dfn> {
  readonly attribute <a href=#dom-navigator-cookieenabled title=dom-navigator-cookieEnabled>cookieEnabled</a>;
  void <a href=#dom-navigator-yieldforstorageupdates title=dom-navigator-yieldForStorageUpdates>yieldForStorageUpdates</a>();
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-cookieEnabled><a href=#dom-navigator-cookieenabled>cookieEnabled</a></code></dt>

   <dd>

    <p>Returns false if setting a cookie will be ignored, and true otherwise.</p>

   </dd>


   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>yieldForStorageUpdates</a></code>()</dt>

   <dd>

    <p>If a script uses the <code title=dom-document-cookie><a href=#dom-document-cookie>document.cookie</a></code> API, or the
    <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> API, the browser will block other scripts
    from accessing cookies or storage until the first script finishes.
    </p>

    <p>Calling the <code title=dom-navigator-yieldForStorageUpdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method
    tells the user agent to unblock any other scripts that may be blocked, even though the script
    hasn't returned.</p>

    <p>Values of cookies and items in the <code><a href=#storage-0>Storage</a></code> objects of <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attributes can change after calling this method,
    whence its name.
    </p>

   </dd>

  </dl><div class=impl>

   <p>The <dfn id=dom-navigator-cookieenabled title=dom-navigator-cookieEnabled><code>cookieEnabled</code></dfn> attribute must
   return true if the user agent attempts to handle cookies according to the cookie specification,
   and false if it ignores cookie change requests. <a href=#refsCOOKIES>[COOKIES]</a></p>

   <p>The <dfn id=dom-navigator-yieldforstorageupdates title=dom-navigator-yieldForStorageUpdates><code>yieldForStorageUpdates()</code></dfn> method,
   when invoked, must, if the <a href=#storage-mutex>storage mutex</a> is owned by the <a href=#event-loop>event loop</a> of
   the <a href=#concept-task title=concept-task>task</a> that resulted in the method being called, release the
   <a href=#storage-mutex>storage mutex</a> so that it is once again free. Otherwise, it must do nothing.</p>

  </div>



  <h5 id=plugins-0><span class=secno>7.5.1.5 </span>Plugins</h5>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=navigatorplugins>NavigatorPlugins</dfn> {
  readonly attribute <a href=#pluginarray>PluginArray</a> <a href=#dom-navigator-plugins title=dom-navigator-plugins>plugins</a>;
  readonly attribute <a href=#mimetypearray>MimeTypeArray</a> <a href=#dom-navigator-mimetypes title=dom-navigator-mimeTypes>mimeTypes</a>;
  readonly attribute boolean <a href=#dom-navigator-javaenabled title=dom-navigator-javaEnabled>javaEnabled</a>;
};

interface <dfn id=pluginarray>PluginArray</dfn> {
  void <a href=#dom-pluginarray-refresh title=dom-PluginArray-refresh>refresh</a>(optional boolean reload = false);
  readonly attribute unsigned long <a href=#dom-pluginarray-length title=dom-PluginArray-length>length</a>;
  getter <a href=#dom-plugin title=dom-Plugin>Plugin</a>? <a href=#dom-pluginarray-item title=dom-PluginArray-item>item</a>(unsigned long index);
  getter <a href=#dom-plugin title=dom-Plugin>Plugin</a>? <a href=#dom-pluginarray-nameditem title=dom-PluginArray-namedItem>namedItem</a>(DOMString name);
};

interface <dfn id=mimetypearray>MimeTypeArray</dfn> {
  readonly attribute unsigned long <a href=#dom-mimetypearray-length title=dom-MimeTypeArray-length>length</a>;
  getter <a href=#mimetype>MimeType</a>? <a href=#dom-mimetypearray-item title=dom-MimeTypeArray-item>item</a>(unsigned long index);
  getter <a href=#mimetype>MimeType</a>? <a href=#dom-mimetypearray-nameditem title=dom-MimeTypeArray-namedItem>namedItem</a>(DOMString name);
};

interface <dfn id=dom-plugin title=dom-Plugin>Plugin</dfn> {
  readonly attribute DOMString <a href=#dom-plugin-name title=dom-Plugin-name>name</a>;
  readonly attribute DOMString <a href=#dom-plugin-description title=dom-Plugin-description>description</a>;
  readonly attribute DOMString <a href=#dom-plugin-filename title=dom-Plugin-filename>filename</a>;
  readonly attribute unsigned long <a href=#dom-plugin-length title=dom-Plugin-length>length</a>;
  getter <a href=#mimetype>MimeType</a>? <a href=#dom-plugin-item title=dom-Plugin-item>item</a>(unsigned long index);
  getter <a href=#mimetype>MimeType</a>? <a href=#dom-plugin-nameditem title=dom-Plugin-namedItem>namedItem</a>(DOMString name);
};

interface <dfn id=mimetype>MimeType</dfn> {
  readonly attribute DOMString <a href=#dom-mimetype-type title=dom-MimeType-type>type</a>;
  readonly attribute DOMString <a href=#dom-mimetype-description title=dom-MimeType-description>description</a>;
  readonly attribute DOMString <a href=#dom-mimetype-suffixes title=dom-MimeType-suffixes>suffixes</a>; // comma-separated
  readonly attribute <a href=#dom-plugin title=dom-Plugin>Plugin</a> <a href=#dom-mimetype-enabledplugin title=dom-MimeType-enabledPlugin>enabledPlugin</a>;
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-plugins><a href=#dom-navigator-plugins>plugins</a></code> . <code title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>refresh</a></code>( [ <var title="">refresh</var> ] )</dt>
   <dd>
    <p>Updates the lists of supported plugins and MIME types for this page, and reloads the page if the lists have changed.</p>
    <!-- that's not quite what all browsers have always done -->
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-plugins><a href=#dom-navigator-plugins>plugins</a></code> . <code title=dom-PluginArray-length><a href=#dom-pluginarray-length>length</a></code></dt>
   <dd>
    <p>Returns the number of plugins, represented by <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> objects, that the user agent reports.</p>
   </dd>

   <dt><var title="">plugin</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-plugins><a href=#dom-navigator-plugins>plugins</a></code> . <code title=dom-PluginArray-item><a href=#dom-pluginarray-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-plugins><a href=#dom-navigator-plugins>plugins</a></code>[<var title="">index</var>]</dt>
   <dd>
    <p>Returns the specified <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object.</p>
   </dd>

   <dt><var title="">plugin</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-plugins><a href=#dom-navigator-plugins>plugins</a></code> . <code title=dom-PluginArray-item><a href=#dom-pluginarray-item>item</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-plugins><a href=#dom-navigator-plugins>plugins</a></code>[<var title="">name</var>]</dt>
   <dd>
    <p>Returns the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object for the plugin with the given name.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-mimeTypes>mimeTypes</code> . <code title=dom-MimeTypeArray-length><a href=#dom-mimetypearray-length>length</a></code></dt>
   <dd>
    <p>Returns the number of MIME types, represented by <code><a href=#mimetype>MimeType</a></code> objects, supported by the plugins that the user agent reports.</p>
   </dd>

   <dt><var title="">mimeType</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-mimeTypes>mimeTypes</code> . <code title=dom-MimeTypeArray-item><a href=#dom-mimetypearray-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-mimeTypes>mimeTypes</code>[<var title="">index</var>]</dt>
   <dd>
    <p>Returns the specified <code><a href=#mimetype>MimeType</a></code> object.</p>
   </dd>

   <dt><var title="">mimeType</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-mimeTypes>mimeTypes</code> . <code title=dom-MimeTypeArray-item><a href=#dom-mimetypearray-item>item</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-mimeTypes>mimeTypes</code>[<var title="">name</var>]</dt>
   <dd>
    <p>Returns the <code><a href=#mimetype>MimeType</a></code> object for the given MIME type.</p>
   </dd>

   <dt><var title="">plugin</var> . <code title=dom-Plugin-name><a href=#dom-plugin-name>name</a></code>
   <dd>
    <p>Returns the plugin's name.</p>
   </dd>

   <dt><var title="">plugin</var> . <code title=dom-Plugin-description><a href=#dom-plugin-description>description</a></code>
   <dd>
    <p>Returns the plugin's description.</p>
   </dd>

   <dt><var title="">plugin</var> . <code title=dom-Plugin-filename><a href=#dom-plugin-filename>filename</a></code>
   <dd>
    <p>Returns the plugin library's filename, if applicable on the current platform.</p>
   </dd>

   <dt><var title="">plugin</var> . <code title=dom-Plugin-length><a href=#dom-plugin-length>length</a></code></dt>
   <dd>
    <p>Returns the number of MIME types, represented by <code><a href=#mimetype>MimeType</a></code> objects, supported by the plugin.</p>
   </dd>

   <dt><var title="">mimeType</var> = <var title="">plugin</var> . <code title=dom-Plugin-item><a href=#dom-plugin-item>item</a></code>(<var title="">index</var>)</dt>
   <dt><var title="">plugin</var>[<var title="">index</var>]</dt>
   <dd>
    <p>Returns the specified <code><a href=#mimetype>MimeType</a></code> object.</p>
   </dd>

   <dt><var title="">mimeType</var> = <var title="">plugin</var> . <code title=dom-Plugin-item><a href=#dom-plugin-item>item</a></code>(<var title="">name</var>)</dt>
   <dt><var title="">plugin</var>[<var title="">name</var>]</dt>
   <dd>
    <p>Returns the <code><a href=#mimetype>MimeType</a></code> object for the given MIME type.</p>
   </dd>

   <dt><var title="">mimeType</var> . <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code>
   <dd>
    <p>Returns the MIME type.</p>
   </dd>

   <dt><var title="">mimeType</var> . <code title=dom-MimeType-description><a href=#dom-mimetype-description>description</a></code>
   <dd>
    <p>Returns the MIME type's description.</p>
   </dd>

   <dt><var title="">mimeType</var> . <code title=dom-MimeType-suffixes><a href=#dom-mimetype-suffixes>suffixes</a></code>
   <dd>
    <p>Returns the MIME type's typical file extensions, in a comma-separated list.</p>
   </dd>

   <dt><var title="">mimeType</var> . <code title=dom-MimeType-enabledPlugin><a href=#dom-mimetype-enabledplugin>enabledPlugin</a></code>
   <dd>
    <p>Returns the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object that implements this MIME type.</p>
   </dd>

   <dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-javaEnabled><a href=#dom-navigator-javaenabled>javaEnabled</a></code></dt>
   <dd>
    <p>Returns true if there's a plugin that supports the MIME type "<code title="">application/x-java-vm</code>".</p>
   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-navigator-plugins title=dom-navigator-plugins><code>navigator.plugins</code></dfn> attribute must
  return a <code><a href=#pluginarray>PluginArray</a></code> object. The same object must be returned each time.</p>

  <p>The <dfn id=dom-navigator-mimetypes title=dom-navigator-mimeTypes><code>navigator.mimeTypes</code></dfn> attribute must
  return a <code><a href=#mimetypearray>MimeTypeArray</a></code> object. The same object must be returned each time.</p>

  <hr><p>A <code><a href=#pluginarray>PluginArray</a></code> object represents none, some, or all of the <a href=#plugin title=plugin>plugins</a> supported by the user agent, each of which is represented by a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object. Each of these <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code>
  objects may be <dfn id=hidden-plugin title="hidden plugin">hidden plugins</dfn>. A <a href=#hidden-plugin>hidden plugin</a> can't
  be enumerated, but can still be inspected by using its name.</p>

  <p class=note>The fewer <a href=#plugin title=plugin>plugins</a> are represented by the
  <code><a href=#pluginarray>PluginArray</a></code> object, and of those, the more that are <a href=#hidden-plugin title="hidden
  plugin">hidden</a>, the more the user's privacy will be protected. Each exposed plugin
  increases the number of bits that can be derived for fingerprinting. Hiding a plugin helps, but
  unless it is an extremely rare plugin, it is likely that a site attempting to derive the list of
  plugins can still determine whether the plugin is supported or not by probing for it by name (the
  names of popular plugins are widely known). Therefore not exposing a plugin at all is preferred.
  Unfortunately, many legacy sites use this feature to determine, for example, which plugin to use
  to play video. Not exposing any plugins at all might therefore not be entirely plausible.</p>

  <p>The <code><a href=#pluginarray>PluginArray</a></code> objects created by a user agent must not be <a href=#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 title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>refresh()</a></code> method.</p>

  <p>Each <a href=#plugin>plugin</a> represented by a <code><a href=#pluginarray>PluginArray</a></code> can support a number of
  <a href=#mime-type title="MIME type">MIME types</a>. For each such <a href=#plugin>plugin</a>, the user agent must
  pick one or more of these <a href=#mime-type title="MIME type">MIME types</a> to be those that are
  <dfn id=explicitly-supported>explicitly supported</dfn>.</p>

  <p class=note>The <a href=#explicitly-supported>explicitly supported</a> <a href=#mime-type title="MIME type">MIME types</a> of
  a <a href=#plugin>plugin</a> are those that are exposed through the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> and <code><a href=#mimetypearray>MimeTypeArray</a></code> interfaces. As with <a href=#plugin title=plugin>plugins</a> themselves, any variation between users regarding what is exposed
  allows sites to fingerprint users. User agents are therefore encouraged to expose the same <a href=#mime-type title="MIME type">MIME types</a> for all users of a <a href=#plugin>plugin</a>, regardless of the
  actual types supported... at least, within the constraints imposed by compatibility with legacy
  content.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> of a <code><a href=#pluginarray>PluginArray</a></code> object are the
  numbers from zero to the number of non-<a href=#hidden-plugin title="hidden plugin">hidden</a> <a href=#plugin title=plugin>plugins</a> represented by the object, if any.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-pluginarray-length title=dom-PluginArray-length><code>length</code></dfn> attribute must return the
  number of non-<a href=#hidden-plugin title="hidden plugin">hidden</a> <a href=#plugin title=plugin>plugins</a>
  represented by the object.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-pluginarray-item title=dom-PluginArray-item><code>item()</code></dfn> method of a
  <code><a href=#pluginarray>PluginArray</a></code> object must return null if the argument is not one of the object's
  <a href=#supported-property-indices>supported property indices</a>, and otherwise must return the result of running the
  following steps, using the method's argument as <var title="">index</var>:</p>

  <ol><li><p>Let <var title="">list</var> be the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> objects
   representing the non-<a href=#hidden-plugin title="hidden plugin">hidden</a> <a href=#plugin title=plugin>plugins</a> represented by the <code><a href=#pluginarray>PluginArray</a></code> object.</li>

   <li><p>Sort <var title="">list</var> alphabetically by the <code title=dom-Plugin-name><a href=#dom-plugin-name>name</a></code> of each <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code>.</li>

   <li><p>Return the <var title="">index</var>th entry in <var title="">list</var>.</li>

  </ol><p class=note>It is important <a href=#fingerprinting-vector class=no-backref title="fingerprinting vector">for
  privacy</a> that the order of plugins not leak additional information, e.g. the order in which
  plugins were installed.</p>

  <p>The <a href=#supported-property-names>supported property names</a> of a <code><a href=#pluginarray>PluginArray</a></code> object are the values
  of the <code title=dom-Plugin-name><a href=#dom-plugin-name>name</a></code> attributes of all the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> objects represented by the <code><a href=#pluginarray>PluginArray</a></code> object. The
  properties exposed in this way must not be enumerable.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-pluginarray-nameditem title=dom-PluginArray-namedItem><code>namedItem()</code></dfn> method of a
  <code><a href=#pluginarray>PluginArray</a></code> object must return null if the argument is not one of the object's
  <a href=#supported-property-names>supported property names</a>, and otherwise must return the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object, of those represented by the <code><a href=#pluginarray>PluginArray</a></code>
  object, that has a <code title=dom-Plugin-name><a href=#dom-plugin-name>name</a></code> equal to the method's argument.</p>

  <p>The <dfn id=dom-pluginarray-refresh title=dom-PluginArray-refresh><code>refresh()</code></dfn> method of the
  <code><a href=#pluginarray>PluginArray</a></code> object of a <code><a href=#navigator>Navigator</a></code> object, when invoked, must check to
  see if any <a href=#plugin title=plugin>plugins</a> have been installed or reconfigured since the user
  agent created the <code><a href=#pluginarray>PluginArray</a></code> object. If so, and the method's argument is true, then
  the user agent must act as if the <code title=dom-location-reload><a href=#dom-location-reload>location.reload()</a></code>
  method was called instead. Otherwise, the user agent must update the <code><a href=#pluginarray>PluginArray</a></code>
  object and <code><a href=#mimetypearray>MimeTypeArray</a></code> object created for attributes of that <code><a href=#navigator>Navigator</a></code>
  object, and the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> and <code><a href=#mimetype>MimeType</a></code> objects created
  for those <code><a href=#pluginarray>PluginArray</a></code> and <code><a href=#mimetypearray>MimeTypeArray</a></code> objects, using the same <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> objects for cases where the <code title=dom-Plugin-name><a href=#dom-plugin-name>name</a></code> is the same, and the same <code><a href=#mimetype>MimeType</a></code> objects for
  cases where the <code title=dom-MimeType-type><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 title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>refresh()</a></code> call. Old <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code>
  and <code><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><a href=#mimetype>MimeType</a></code> entry might list as its <code title=dom-MimeType-enabledPlugin><a href=#dom-mimetype-enabledplugin>enabledPlugin</a></code> a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code>
  object that no longer lists that <code><a href=#mimetype>MimeType</a></code> as a supported <code><a href=#mimetype>MimeType</a></code>).</p>

  <hr><p>A <code><a href=#mimetypearray>MimeTypeArray</a></code> object represents the <a href=#mime-type title="MIME type">MIME types</a>
  <a href=#explicitly-supported>explicitly supported</a> by <a href=#plugin title=plugin>plugins</a> supported by the user
  agent, each of which is represented by a <code><a href=#mimetype>MimeType</a></code> object.</p>

  <p>The <code><a href=#mimetypearray>MimeTypeArray</a></code> objects created by a user agent must not be <a href=#live>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><a href=#pluginarray>PluginArray</a></code> object's <code title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>refresh()</a></code> method.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> of a <code><a href=#mimetypearray>MimeTypeArray</a></code> object are the
  numbers from zero to the number of <a href=#mime-type title="MIME type">MIME types</a> <a href=#explicitly-supported>explicitly
  supported</a> by non-<a href=#hidden-plugin title="hidden plugin">hidden</a> <a href=#plugin title=plugin>plugins</a> represented by the corresponding <code><a href=#pluginarray>PluginArray</a></code> object, if
  any.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-mimetypearray-length title=dom-MimeTypeArray-length><code>length</code></dfn> attribute must return the
  number of <a href=#mime-type title="MIME type">MIME types</a> <a href=#explicitly-supported>explicitly supported</a> by non-<a href=#hidden-plugin title="hidden plugin">hidden</a> <a href=#plugin title=plugin>plugins</a> represented by the
  corresponding <code><a href=#pluginarray>PluginArray</a></code> object, if any.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-mimetypearray-item title=dom-MimeTypeArray-item><code>item()</code></dfn> method of a
  <code><a href=#mimetypearray>MimeTypeArray</a></code> object must return null if the argument is not one of the object's
  <a href=#supported-property-indices>supported property indices</a>, and otherwise must return the result of running the
  following steps, using the method's argument as <var title="">index</var>:</p>

  <ol><li><p>Let <var title="">list</var> be the <code><a href=#mimetype>MimeType</a></code> objects representing the <a href=#mime-type title="MIME type">MIME types</a> <a href=#explicitly-supported>explicitly supported</a> by non-<a href=#hidden-plugin title="hidden
   plugin">hidden</a> <a href=#plugin title=plugin>plugins</a> represented by the corresponding
   <code><a href=#pluginarray>PluginArray</a></code> object, if any.</li>

   <li><p>Sort <var title="">list</var> alphabetically by the <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> of each <code><a href=#mimetype>MimeType</a></code>.</li>

   <li><p>Return the <var title="">index</var>th entry in <var title="">list</var>.</li>

  </ol><p class=note>It is important <a href=#fingerprinting-vector class=no-backref title="fingerprinting vector">for
  privacy</a> that the order of MIME types not leak additional information, e.g. the order in
  which plugins were installed.</p>

  <p>The <a href=#supported-property-names>supported property names</a> of a <code><a href=#mimetypearray>MimeTypeArray</a></code> object are the values
  of the <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> attributes of all the <code><a href=#mimetype>MimeType</a></code>
  objects represented by the <code><a href=#mimetypearray>MimeTypeArray</a></code> object. The properties exposed in this way
  must not be enumerable.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-mimetypearray-nameditem title=dom-MimeTypeArray-namedItem><code>namedItem()</code></dfn> method of a
  <code><a href=#mimetypearray>MimeTypeArray</a></code> object must return null if the argument is not one of the object's
  <a href=#supported-property-names>supported property names</a>, and otherwise must return the <code><a href=#mimetype>MimeType</a></code> object
  that has a <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> equal to the method's argument.</p>

  <hr><p>A <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object represents a <a href=#plugin>plugin</a>. It has
  several attributes to provide details about the plugin, and can be enumerated to obtain the list
  of <a href=#mime-type title="MIME type">MIME types</a> that it <a href=#explicitly-supported title="explicitly supported">explicitly
  supports</a>.</p>

  <p>The <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> objects created by a user agent must not be
  <a href=#live>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><a href=#pluginarray>PluginArray</a></code> object's <code title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>refresh()</a></code>
  method.</p>

  <p>The <dfn id=reported-mime-types>reported MIME types</dfn> for a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object are the
  <a href=#mime-type title="MIME type">MIME types</a> <a href=#explicitly-supported>explicitly supported</a> by the corresponding
  <a href=#plugin>plugin</a> when this object was last created or updated by <code title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code>, whichever happened most
  recently.</p>

  <p>The <a href=#supported-property-indices>supported property indices</a> of a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object
  are the numbers from zero to the number of <a href=#reported-mime-types>reported MIME types</a>.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-plugin-length title=dom-Plugin-length><code>length</code></dfn> attribute must return the number
  of <a href=#reported-mime-types>reported MIME types</a>.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-plugin-item title=dom-Plugin-item><code>item()</code></dfn> method of a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object must return null if the argument is not one of the
  object's <a href=#supported-property-indices>supported property indices</a>, and otherwise must return the result of running
  the following steps, using the method's argument as <var title="">index</var>:</p>

  <ol><li><p>Let <var title="">list</var> be the <code><a href=#mimetype>MimeType</a></code> objects representing the
   <a href=#reported-mime-types>reported MIME types</a>.</li>

   <li><p>Sort <var title="">list</var> alphabetically by the <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> of each <code><a href=#mimetype>MimeType</a></code>.</li>

   <li><p>Return the <var title="">index</var>th entry in <var title="">list</var>.</li>

  </ol><p class=note>It is important <a href=#fingerprinting-vector class=no-backref title="fingerprinting vector">for
  privacy</a> that the order of MIME types not leak additional information, e.g. the order in
  which plugins were installed.</p>

  <p>The <a href=#supported-property-names>supported property names</a> of a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object
  are the values of the <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> attributes of the
  <code><a href=#mimetype>MimeType</a></code> objects representing the <a href=#reported-mime-types>reported MIME types</a>. The properties
  exposed in this way must not be enumerable.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>The <dfn id=dom-plugin-nameditem title=dom-Plugin-namedItem><code>namedItem()</code></dfn> method of a <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object must return null if the argument is not one of the
  object's <a href=#supported-property-names>supported property names</a>, and otherwise must return the
  <code><a href=#mimetype>MimeType</a></code> object that has a <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> equal to the
  method's argument.</p>

  <p>The <dfn id=dom-plugin-name title=dom-Plugin-name><code>name</code></dfn> attribute must return the
  <a href=#plugin>plugin</a>'s name.</p>

  <p>The <dfn id=dom-plugin-description title=dom-Plugin-description><code>description</code></dfn> and <dfn id=dom-plugin-filename title=dom-Plugin-filename><code>filename</code></dfn> attributes must return user-agent-defined
  (or, in all likelihood, <a href=#plugin>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 title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code> method updates the object.</p>

  <p class=warning>If the values returned by the <code title=dom-Plugin-description><a href=#dom-plugin-description>description</a></code> or <code title=dom-Plugin-filename><a href=#dom-plugin-filename>filename</a></code> attributes vary between versions of a
  <a href=#plugin>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>plugin</a> (and thus a
  browser) may have. It is thus highly recommended that the <code title=dom-Plugin-description><a href=#dom-plugin-description>description</a></code> attribute just return the same value as the
  <code title=dom-Plugin-name><a href=#dom-plugin-name>name</a></code> attribute, and that the <code title=dom-Plugin-filename><a href=#dom-plugin-filename>filename</a></code> attribute return the empty string.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <hr><p>A <code><a href=#mimetype>MimeType</a></code> object represents a <a href=#mime-type>MIME type</a> that is, or was,
  <a href=#explicitly-supported>explicitly supported</a> by a <a href=#plugin>plugin</a>.</p>

  <p>The <code><a href=#mimetype>MimeType</a></code> objects created by a user agent must not be <a href=#live>live</a>. The
  values of the objects' attributes must not change once an object is created, except when updated
  by the <code><a href=#pluginarray>PluginArray</a></code> object's <code title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>refresh()</a></code>
  method.</p>

  <p>The <dfn id=dom-mimetype-type title=dom-MimeType-type><code>type</code></dfn> attribute must return the
  <a href=#valid-mime-type-with-no-parameters>valid MIME type with no parameters</a> describing the <a href=#mime-type>MIME type</a>.</p>

  <p>The <dfn id=dom-mimetype-description title=dom-MimeType-description><code>description</code></dfn> and <dfn id=dom-mimetype-suffixes title=dom-MimeType-suffixes><code>suffixes</code></dfn> attributes must return
  user-agent-defined (or, in all likelihood, <a href=#plugin>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 title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code> method updates the object.</p>

  <p class=warning>If the values returned by the <code title=dom-MimeType-description><a href=#dom-mimetype-description>description</a></code> or <code title=dom-MimeType-suffixes><a href=#dom-mimetype-suffixes>suffxies</a></code> attributes vary between versions of a
  <a href=#plugin>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>plugin</a> (and thus a
  browser) may have. It is thus highly recommended that the <code title=dom-MimeType-description><a href=#dom-mimetype-description>description</a></code> attribute just return the same value as the
  <code title=dom-MimeType-type><a href=#dom-mimetype-type>type</a></code> attribute, and that the <code title=dom-MimeType-suffixes><a href=#dom-mimetype-suffixes>suffixes</a></code> attribute return the empty string.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p class=note>Commas in the <code title=dom-MimeType-suffixes><a href=#dom-mimetype-suffixes>suffixes</a></code> attribute are
  interpreted as separating subsequent filename extensions, as in "<code title="">htm,html</code>".</p>

  <p>The <dfn id=dom-mimetype-enabledplugin title=dom-MimeType-enabledPlugin><code>enabledPlugin</code></dfn> attribute must
  return the <code title=dom-Plugin><a href=#dom-plugin>Plugin</a></code> object that represents the <a href=#plugin>plugin</a>
  that <a href=#explicitly-supported>explicitly supported</a> the <a href=#mime-type>MIME type</a> that this <code><a href=#mimetype>MimeType</a></code>
  object represents when this object was last created or updated by <code title=dom-PluginArray-refresh><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code>, whichever happened most
  recently.</p>

  <hr><p>The <dfn id=dom-navigator-javaenabled title=dom-navigator-javaEnabled><code>navigator.javaEnabled</code></dfn> attribute
  must return true if the user agent supports a <a href=#plugin>plugin</a> that supports the <a href=#mime-type>MIME
  type</a> "<code title="">application/x-java-vm</code>".
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  </div>



  <h4 id=the-external-interface><span class=secno>7.5.2 </span>The <code><a href=#external>External</a></code> interface</h4>

  <div class=impl>

  <p>The <dfn id=dom-external title=dom-external><code>external</code></dfn> attribute of the <code><a href=#window>Window</a></code>
  interface must return an instance of the <code><a href=#external>External</a></code> interface. The same object must be
  returned each time.</p>

  </div>

  <pre class=idl>interface <dfn id=external>External</dfn> {
  void <a href=#dom-external-addsearchprovider title=dom-external-AddSearchProvider>AddSearchProvider</a>(DOMString engineURL);
  unsigned long <a href=#dom-external-issearchproviderinstalled title=dom-external-IsSearchProviderInstalled>IsSearchProviderInstalled</a>(DOMString engineURL);
};</pre>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-external><a href=#dom-external>external</a></code> . <code title=dom-external-AddSearchProvider><a href=#dom-external-addsearchprovider>AddSearchProvider</a></code>( <var title="">url</var> )</dt>
   <dd>

    <p>Adds the search engine described by the OpenSearch description
    document at <var title="">url</var>. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>

    <p>The OpenSearch description document has to be on the same
    server as the script that calls this method.</p>

   </dd>

   <dt><var title="">installed</var> = <var title="">window</var> . <code title=dom-external><a href=#dom-external>external</a></code> . <code title=dom-external-IsSearchProviderInstalled><a href=#dom-external-issearchproviderinstalled>IsSearchProviderInstalled</a></code>( <var title="">url</var> )</dt>
   <dd>

    <p>Returns a value based on comparing <var title="">url</var> to
    the URLs of the results pages of the installed search engines.</p>

    <dl><dt>0 <dd>None of the installed search engines match <var title="">url</var>.
     <dt>1 <dd>One or more installed search engines match <var title="">url</var>, but none are the user's default search engine.
     <dt>2 <dd>The user's default search engine matches <var title="">url</var>.
    </dl><p>The <var title="">url</var> is compared to the URLs of the
    results pages of the installed search engines using a prefix
    match. Only results pages on the same domain as the script that
    calls this method are checked.</p>

   </dd>

  </dl><p class=note>Another way of exposing search engines using
  OpenSearch description documents is using a <code><a href=#the-link-element>link</a></code>
  element with the <code title=rel-search><a href=#link-type-search>search</a></code> link
  type.</p>

  <div class=impl>

   <p>The <dfn id=dom-external-addsearchprovider title=dom-external-AddSearchProvider><code>AddSearchProvider()</code></dfn>
   method, when invoked, must run the following steps:</p>

   <ol><li><p>Optionally, abort these steps. User agents may implement
    the method as a stub method that never does anything, or may
    arbitrarily ignore invocations with particular arguments for
    security, privacy, or usability reasons.</li>

    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the
    method's first argument relative to the <a href=#entry-script>entry
    script</a>'s <a href="#script's-base-url" title="script's base URL">base
    URL</a>.</li>

    <li><p>If this fails, abort these steps.</li>

    <li><p>Process the resulting <a href=#absolute-url>absolute URL</a> as the
    <a href=#url>URL</a> to an OpenSearch description document. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></li>

   </ol><p>The <dfn id=dom-external-issearchproviderinstalled title=dom-external-IsSearchProviderInstalled><code>IsSearchProviderInstalled()</code></dfn>
   method, when invoked, must run the following steps:
   <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
   </p>

   <ol><li><p>Optionally, return 0 and abort these steps. User agents may
    implement the method as a stub method that never returns a
    non-zero value, or may arbitrarily ignore invocations with
    particular arguments for security, privacy, or usability
    reasons.</li>

    <li><p>If the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a>
    is an opaque identifier (i.e. it has no host component), then
    return 0 and abort these steps.</li>

    <li><p>Let <var title="">host1</var> be the host component of the
    <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a>.</li>

    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var> argument relative to the <a href=#entry-script>entry
    script</a>'s <a href="#script's-base-url" title="script's base URL">base
    URL</a>.</li>

    <li><p>If this fails, return 0 and abort these steps.</li>

    <li><p>Let <var title="">host2</var> be the <a href=#concept-url-host title=concept-url-host>host</a> component of the resulting
    <a href=#parsed-url>parsed URL</a>.</li>

    <li>

     <p>If the longest suffix in the Public Suffix List that matches
     the end of <var title="">host1</var> is different than the
     longest suffix in the Public Suffix List that matches the end of
     <var title="">host2</var>, then return 0 and abort these steps.
     <a href=#refsPSL>[PSL]</a></p>

     <p>If the next domain component of <var title="">host1</var> and
     <var title="">host2</var> after their common suffix are not the
     same, then return 0 and abort these steps.</p>

     <!-- host1 is ascii here because origins are ascii. host2 is ascii because resolve urls
     punycodes idna. -->

    </li>

    <li><p>Let <var title="">search engines</var> be the list of
    search engines known by the user agent and made available to the
    user by the user agent for which the resulting <a href=#absolute-url>absolute
    URL</a> is a <a href=#prefix-match>prefix match</a> of the search engine's
    <a href=#url>URL</a>, if any. For search engines registered using
    OpenSearch description documents, the <a href=#url>URL</a> of the
    search engine corresponds to the URL given in a <code title="">Url</code> element whose <code title="">rel</code>
    attribute is "<code title="">results</code>" (the default). <a href=#refsOPENSEARCH>[OPENSEARCH]</a></li>

    <li><p>If <var title="">search engines</var> is empty, return 0
    and abort these steps.</li>

    <li><p>If the user's default search engine (as determined by the
    user agent) is one of the search engines in <var title="">search
    engines</var>, then return 2 and abort these steps.</li>

    <li><p>Return 1.</li>

   </ol></div>


<!--TOPIC:Canvas-->

  <h3 id=images><span class=secno>7.6 </span>Images</h3>

  <pre class=idl>interface <dfn id=imagebitmap>ImageBitmap</dfn> {
  readonly attribute unsigned long <a href=#dom-imagebitmap-width title=dom-ImageBitmap-width>width</a>;
  readonly attribute unsigned long <a href=#dom-imagebitmap-height title=dom-ImageBitmap-height>height</a>;
  readonly attribute double <a href=#dom-imagebitmap-resolution title=dom-ImageBitmap-resolution>resolution</a>;
};

typedef (<a href=#htmlimageelement>HTMLImageElement</a> or
         <a href=#htmlvideoelement>HTMLVideoElement</a> or
         <a href=#htmlcanvaselement>HTMLCanvasElement</a> or
         <a href=#blob>Blob</a> or
         <a href=#imagedata>ImageData</a> or
         <a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> or
         <a href=#imagebitmap>ImageBitmap</a>) <dfn id=imagebitmapsource>ImageBitmapSource</dfn>;

[NoInterfaceObject]
interface <dfn id=imagebitmapfactories>ImageBitmapFactories</dfn> {
  <a href=#promise>Promise</a> <a href=#dom-createimagebitmap title=dom-createImageBitmap>createImageBitmap</a>(<a href=#imagebitmapsource>ImageBitmapSource</a> image, optional long sx, long sy, long sw, long sh);
};
<a href=#window>Window</a> implements <a href=#imagebitmapfactories>ImageBitmapFactories</a>;
<a href=#workerglobalscope>WorkerGlobalScope</a> implements <a href=#imagebitmapfactories>ImageBitmapFactories</a>;</pre>

  <p>An <code><a href=#imagebitmap>ImageBitmap</a></code> object represents a bitmap image that can be painted to a canvas
  without undue latency.</p>

  <p class=note>The exact judgement of what is undue latency of this is left up to the
  implementer, but in general if making use of the bitmap requires network I/O, or even local disk
  I/O, then the latency is probably undue; whereas if it only requires a blocking read from a GPU or
  system RAM, the latency is probably acceptable.</p>

  <dl class=domintro><dt><var title="">promise</var> = <var title="">Window</var> . <code title=dom-createImageBitmap><a href=#dom-createimagebitmap>createImageBitmap</a></code>(<var title="">image</var> [, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var> ] )</dt>

   <dd>

    <p>Takes <var title="">image</var>, which can be an <code><a href=#the-img-element>img</a></code> element,
    <code><a href=#the-video-element>video</a></code>, or <code><a href=#the-canvas-element>canvas</a></code> element, a <code><a href=#blob>Blob</a></code> object, an
    <code><a href=#imagedata>ImageData</a></code> object, a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object, or another
    <code><a href=#imagebitmap>ImageBitmap</a></code> object, and returns a <code><a href=#promise>Promise</a></code> that is resolved when a
    new <code><a href=#imagebitmap>ImageBitmap</a></code> is created.</p>

    <p>If no <code><a href=#imagebitmap>ImageBitmap</a></code> object can be constructed, for example because the provided
    <var title="">image</var> data is not actually an image, then the promise is rejected instead.</p>

    <p>If <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, and <var title="">sh</var> arguments are provided, the source image is cropped to the given pixels, with
    any pixels missing in the original replaced by transparent black. These coordinates are in the
    source image's pixel coordinate space, <em>not</em> in CSS pixels.</p>

    <p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the source image is not in a valid
    state (e.g. an <code><a href=#the-img-element>img</a></code> element that hasn't finished loading, or a
    <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose bitmap data has zero length along one or both
    dimensions). Throws a <code><a href=#securityerror>SecurityError</a></code> exception if the script is not allowed to
    access the image data of the source image (e.g. a <code><a href=#the-video-element>video</a></code> that is
    <a href=#cors-cross-origin>CORS-cross-origin</a>, or a <code><a href=#the-canvas-element>canvas</a></code> being drawn on by a script in a worker
    from another <a href=#origin>origin</a>).</p>

   </dd>

   <dt><var title="">imageBitmap</var> . <code title=dom-ImageBitmap-width><a href=#dom-imagebitmap-width>width</a></code></dt>

   <dd>

    <p>Returns the intrinsic width of the image, in CSS pixels.</p>

   </dd>

   <dt><var title="">imageBitmap</var> . <code title=dom-ImageBitmap-height><a href=#dom-imagebitmap-height>height</a></code></dt>

   <dd>

    <p>Returns the intrinsic height of the image, in CSS pixels.</p>

   </dd>

   <dt><var title="">imageBitmap</var> . <code title=dom-ImageBitmap-resolution><a href=#dom-imagebitmap-resolution>resolution</a></code></dt>

   <dd>

    <p>Returns the intrinsic linear pixel density of the image, in image pixels per CSS pixels.</p>

   </dd>

  </dl><div class=impl>

  <p>An <code><a href=#imagebitmap>ImageBitmap</a></code> object always has associated bitmap data, with a width, a
  height, and a pixel density. However, it is possible for this data to be corrupted. If an <code><a href=#imagebitmap>ImageBitmap</a></code>
  object's media data can be decoded without errors, it is said to be <dfn id=concept-imagebitmap-good title=concept-ImageBitmap-good>fully decodable</dfn>.</p>

  <p>An <code><a href=#imagebitmap>ImageBitmap</a></code> object can be obtained from a variety of different objects, using
  the <dfn id=dom-createimagebitmap title=dom-createImageBitmap><code>createImageBitmap()</code></dfn> method. When invoked, the
  method must act as follows:</p>
  <!-- the canvas createPattern() and drawImage() methods have similar requirements -->

  <dl><dt>If <var title="">image</var> is an <code><a href=#the-img-element>img</a></code> element

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

     <li><p>If the <code><a href=#the-img-element>img</a></code> element is not <a href=#img-all title=img-all>completely
     available</a>, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
     steps.</li>

<!--ADD-TOPIC:Security-->
     <li><p>If the <a href=#origin>origin</a> of the <code><a href=#the-img-element>img</a></code> element's image is not the <a href=#same-origin>same
     origin</a> as the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a>, then throw a
     <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>
<!--REMOVE-TOPIC:Security-->

     <li><p>If the <code><a href=#the-img-element>img</a></code> element's media data is not a bitmap (e.g. it's a vector
     graphic), then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
     steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the <code><a href=#the-img-element>img</a></code>
     element's media data, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>. If this is an animated
     image, the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data must only be taken from the default
     image of the animation (the one that the format defines is to be used when animation is not
     supported or is disabled), or, if there is no such image, the first frame of the
     animation.</li>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps
     asynchronously.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>

   <dt>If <var title="">image</var> is a <code><a href=#the-video-element>video</a></code> element

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

     <li><p>If the <code><a href=#the-video-element>video</a></code> element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute is <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then throw an
     <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

<!--ADD-TOPIC:Security-->
     <li><p>If the <a href=#origin>origin</a> of the <code><a href=#the-video-element>video</a></code> element is not the <a href=#same-origin>same
     origin</a> as the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a>, then throw a
     <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>
<!--REMOVE-TOPIC:Security-->

     <li><p>If the <code><a href=#the-video-element>video</a></code> element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
     attribute is either <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, then throw an
     <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the frame at the
     <a href=#current-playback-position>current playback position</a>, at the <a href=#media-resource>media resource</a>'s <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> and <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a> (i.e. after any aspect-ratio
     correction has been applied), <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>.</p>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>

   <dt>If <var title="">image</var> is a <code><a href=#the-canvas-element>canvas</a></code> element

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

<!--ADD-TOPIC:Security-->
     <li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap data does not have its <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag set, then throw an
     <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>
<!--REMOVE-TOPIC:Security-->

     <li><p>If the <code><a href=#the-canvas-element>canvas</a></code> element's bitmap has either a horizontal dimension or a
     vertical dimension equal to zero, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and
     abort these steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the
     <code><a href=#the-canvas-element>canvas</a></code> element's bitmap data, <a href=#cropped-to-the-source-rectangle>cropped to the source
     rectangle</a>.</li>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>


   <dt>If <var title="">image</var> is a <code><a href=#blob>Blob</a></code> object

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

     <li><p>If the <code><a href=#blob>Blob</a></code> object has been neutered through the <code title=dom-Blob-close>close</code> method, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
     exception and abort these steps.</li>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.</li>

     <li><p>Read the <code><a href=#blob>Blob</a></code> object's data. If an <a href=#file-error-read title=file-error-read>error
     occurs during reading of the object</a>, then <a href=#concept-resolver-reject title=concept-resolver-reject>reject</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with null as the value, and abort these steps.</li>

     <li><p>Apply the <a href=#content-type-sniffing:-image title="Content-Type sniffing: image">image sniffing rules</a> to
     determine the file format of the image data, with MIME type of the <code><a href=#blob>Blob</a></code> (as given
     by the <code><a href=#blob>Blob</a></code> object's <code title=dom-Blob-type>type</code> attribute) giving the
     official type.</li>

     <li><p>If the image data is not in a supported file format (e.g. it's not actually an image at
     all), or if the image data is corrupted in some fatal way such that the image dimensions cannot
     be obtained, then <a href=#concept-resolver-reject title=concept-resolver-reject>reject</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with null as the value, and abort these steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data read from the
     <code><a href=#blob>Blob</a></code> object, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>. If this is an animated
     image, the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data must only be taken from the default
     image of the animation (the one that the format defines is to be used when animation is not
     supported or is disabled), or, if there is no such image, the first frame of the
     animation.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>


   <dt>If <var title="">image</var> is an <code><a href=#imagedata>ImageData</a></code> object

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data given by the
     <code><a href=#imagedata>ImageData</a></code> object, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>, using the value
     of the object's <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute as the
     object's pixel density.</li>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>

   <dt>If <var title="">image</var> is a <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

<!--ADD-TOPIC:Security-->
     <li><p>If the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a> does
     not have its <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a> flag set, then throw
     an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>
<!--REMOVE-TOPIC:Security-->

     <li><p>If the <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a> has
     either a horizontal dimension or a vertical dimension equal to zero, then throw an
     <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the
     <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap>scratch bitmap</a>, <a href=#cropped-to-the-source-rectangle>cropped to
     the source rectangle</a>.</li>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>


   <dt>If <var title="">image</var> is an <code><a href=#imagebitmap>ImageBitmap</a></code> object

   <dd>

    <ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
     but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

     <li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

     <li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the <var title="">image</var> argument's bitmap data, <a href=#cropped-to-the-source-rectangle>cropped to the source
     rectangle</a>.</li>

     <li><p>Return a new <code><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.</li>

     <li><p><a href=#concept-resolver-fulfill title=concept-resolver-fulfill>Fulfill</a> the <code><a href=#promise>Promise</a></code>'s
     associated <a href=#concept-resolver title=concept-resolver>resolver</a>, with the new
     <code><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</li>

    </ol></dd>


  </dl><p>When the steps above require that the user agent <dfn id=cropped-to-the-source-rectangle title="cropped to the source
  rectangle">crop bitmap data to the source rectangle</dfn>, the user agent must run the following
  steps:</p>

  <ol><li><p>Let <var title="">input</var> be the image data being cropped.</li>

   <li><p>If the <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, and <var title="">sh</var> arguments are omitted, return <var title="">input</var>.</li>

   <li><p>Place <var title="">input</var> on an infinite transparent black grid plane, positioned so
   that it's top left corner is at the origin of the plane, with the <var title="">x</var>-coordinate increasing to the right, and the <var title="">y</var>-coordinate
   increasing down, and with each pixel in the <var title="">input</var> image data occupying a cell
   on the plane's grid.</li>

   <li>

    <p>Let <var title="">output</var> be the rectangle on the plane denoted by the rectangle whose
    corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>).</p>

    <p class=note>If either <var title="">sw</var> or <var title="">sh</var> are negative, then
    the top-left corner of this rectangle will be to the left or above the (<var title="">sx</var>,
    <var title="">sy</var>) point. If any of the pixels on this rectangle are outside the area where
    the <var title="">input</var> bitmap was placed, then they will be transparent black in <var title="">output</var>.</p>

   </li>

   <li><p>Let <var title="">output</var>'s pixel density be <var title="">input</var>'s pixel
   density.</li>

   <li><p>Return <var title="">output</var>.</li>

  </ol><p>The <dfn id=dom-imagebitmap-width title=dom-ImageBitmap-width><code>width</code></dfn> attribute must return the
  <code><a href=#imagebitmap>ImageBitmap</a></code> object's width, in CSS pixels.</p>

  <p>The <dfn id=dom-imagebitmap-height title=dom-ImageBitmap-height><code>height</code></dfn> attribute must return the
  <code><a href=#imagebitmap>ImageBitmap</a></code> object's height, in CSS pixels.</p>

  <p>The <dfn id=dom-imagebitmap-resolution title=dom-ImageBitmap-resolution><code>resolution</code></dfn> attribute must return the
  <code><a href=#imagebitmap>ImageBitmap</a></code> object's linear pixel density, in image data pixels per CSS pixel.</p>

  </div>

  <div class=example>

   <p>Using this API, a sprite sheet can be precut and prepared:</p>

   <pre>var sprites = {};
function loadMySprites() {
  var image = new Image();
  image.src = 'mysprites.png';
  var resolver;
  var promise = new Promise(function (arg) { resolver = arg });
  image.onload = function () {
    resolver.resolve(Promise.every(
      createImageBitmap(image,  0,  0, 40, 40).then(function (image) { sprites.woman = image }),
      createImageBitmap(image, 40,  0, 40, 40).then(function (image) { sprites.man   = image }),
      createImageBitmap(image, 80,  0, 40, 40).then(function (image) { sprites.tree  = image }),
      createImageBitmap(image,  0, 40, 40, 40).then(function (image) { sprites.hut   = image }),
      createImageBitmap(image, 40, 40, 40, 40).then(function (image) { sprites.apple = image }),
      createImageBitmap(image, 80, 40, 40, 40).then(function (image) { sprites.snake = image }),
    ));
  };
  return promise;
}

function runDemo() {
  var canvas = document.querySelector('canvas#demo');
  var context = canvas.getContext('2d');
  context.drawImage(sprites.tree, 30, 10);
  context.drawImage(sprites.snake, 70, 10);
}

loadMySprites().then(runDemo);</pre>

  </div>


<!--TOPIC:HTML-->

  <h2 id=editing><span class=secno>8 </span><dfn>User interaction</dfn></h2>


  <h3 id=the-hidden-attribute><span class=secno>8.1 </span>The <dfn title=attr-hidden><code>hidden</code></dfn> attribute</h3>

  <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> content attribute set. The <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute is a <a href=#boolean-attribute>boolean
  attribute</a>. When specified on an element, it indicates that
  the element is not yet, or is no longer, directly relevant to the
  page's current state, or that it is being used to declare content to
  be reused by other parts of the page as opposed to being directly
  accessed by the user. <span class=impl>User agents should not
  render elements that have the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute specified.</span></p>

  <div class=example>

   <p>In the following skeletal example, the attribute is used to hide
   the Web game's main screen until the user logs in:</p>

   <pre>  &lt;h1&gt;The Example Game&lt;/h1&gt;
  &lt;section id="login"&gt;
   &lt;h2&gt;Login&lt;/h2&gt;
   &lt;form&gt;
    ...
    &lt;!-- calls login() once the user's credentials have been checked --&gt;
   &lt;/form&gt;
   &lt;script&gt;
    function login() {
      // switch screens
      document.getElementById('login').hidden = true;
      document.getElementById('game').hidden = false;
    }
   &lt;/script&gt;
  &lt;/section&gt;
  &lt;section id="game" hidden&gt;
   ...
  &lt;/section&gt;</pre>

  </div>

  <p>The <code title=attr-hidden><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 title=attr-hidden><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 &mdash; 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
  &mdash; if something is marked <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>, it is hidden from all
  presentations, including, for instance, screen readers.</p>

  <!-- for example, "<a hidden href=#content>Skip to content</a>" would be inappropriate. -->
  <!-- (but only add that example if you first add some more good valid examples -->

  <p>Elements that are not themselves <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> must not <a href=#hyperlink>hyperlink</a> to
  elements that are <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code>. The <code title="">for</code> attributes of <code><a href=#the-label-element>label</a></code> and
  <code><a href=#the-output-element>output</a></code> elements that are not themselves <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> must similarly not refer to
  elements that are <code title=attr-hidden><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 title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> in other contexts.</p>

  <div class=example>

   <p>For example, it would be incorrect to use the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute to link to a
   section marked with the <code title=attr-hidden><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 title=attr-aria-describedby>aria-describedby</code> attribute to
   refer to descriptions that are themselves <code title=attr-hidden><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><a href=#the-canvas-element>canvas</a></code> element with the <code title=attr-hidden><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><a href=#the-form-element>form</a></code> element using its
   <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute.</p>

  </div>

  <p>Elements in a section hidden by the <code title=attr-hidden><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>

  <div class=impl>

  <p>The <dfn id=dom-hidden title=dom-hidden><code>hidden</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name.</p>

  </div>



  <h3 id=inert-subtrees><span class=secno>8.2 </span>Inert subtrees</h3>

  <p>A subtree of a <code><a href=#document>Document</a></code> can be marked as
  <dfn id=inert>inert</dfn>. When a node or one of its ancestors is
  <a href=#inert>inert</a>, then the user agent must act as if the element
  was absent for the purposes of targeting user interaction events,
  may ignore the node for the purposes of text search user interfaces
  (commonly known as "find in page"), and may prevent the user from
  selecting text in that node. User agents should allow the user to
  override the restrictions on search and text selection, however.</p>

  <p class=example>For example, consider a page that consists of
  just a single <a href=#inert>inert</a> paragraph positioned in the middle
  of a <code><a href=#the-body-element>body</a></code>. If a user moves their pointing device from
  the <code><a href=#the-body-element>body</a></code> over to the <a href=#inert>inert</a> paragraph and
  clicks on the paragraph, no <code title=event-mouseover>mouseover</code> event would be fired, and
  the <code title=event-mousemove>mousemove</code> and <code title=event-click><a href=#event-click>click</a></code> events would be fired on the
  <code><a href=#the-body-element>body</a></code> element rather than the paragraph.</p>

  <p class=note>When a node or one of its ancestors is inert, it
  also can't be <a href=#focusable>focusable</a>, and it is disabled if it is a
  <a href=#concept-command title=concept-command>command</a>.</p>

  <p>An entire <code><a href=#document>Document</a></code> can be marked as <dfn id=blocked-by-a-modal-dialog>blocked by
  a modal dialog</dfn> <var title="">subject</var>. While a
  <code><a href=#document>Document</a></code> is so marked, every node that is <a href=#in-a-document title="in a Document">in the <code>Document</code></a>, with the
  exception of the <var title="">subject</var> element, its ancestors,
  and its descendants, must be marked <a href=#inert>inert</a>. (The
  elements excepted by this paragraph can additionally be marked
  <a href=#inert>inert</a> through other means; being part of a modal dialog
  does not "protect" a node from being marked <a href=#inert>inert</a>.)</p>

  <p>Only one element at a time can mark a <code><a href=#document>Document</a></code> as
  being <a href=#blocked-by-a-modal-dialog>blocked by a modal dialog</a>. When a new
  <code><a href=#the-dialog-element>dialog</a></code> is made to <a href=#blocked-by-a-modal-dialog title="blocked by a modal
  dialog">block</a> a <code><a href=#document>Document</a></code>, the previous element,
  if any, stops blocking the <code><a href=#document>Document</a></code>.</p>

  <p class=note>The <code><a href=#the-dialog-element>dialog</a></code> element's <code title=dom-dialog-showModal><a href=#dom-dialog-showmodal>showModal()</a></code> method makes use of
  this mechanism.</p>


  <h4 id=the-inert-attribute><span class=secno>8.2.1 </span>The <dfn title=attr-inert><code>inert</code></dfn> attribute</h4>

  <p>The <code title=attr-inert><a href=#the-inert-attribute>inert</a></code> attribute is a
  <a href=#boolean-attribute>boolean attribute</a> that indicates, by its presence, that
  the element is to be made <a href=#inert>inert</a>.</p>

  <div class=impl>

  <p>When an element has an <code title=attr-inert><a href=#the-inert-attribute>inert</a></code>
  attribute, the user agent must mark that element as
  <a href=#inert>inert</a>.</p>

  </div>

  <p class=note>By default, there is no visual indication of a
  subtree being inert. Authors are encouraged to clearly mark what
  parts of their document are active and which are inert, to avoid
  user confusion. In particular, it is worth remembering that not all
  users can see all parts of a page at once; for example, users of
  screen readers, users on small devices or with magnifiers, and even
  users just using particularly small windows might not be able to see
  the active part of a page and may get frustrated if inert sections
  are not obviously inert. For individual controls, the <code title=attr-input-disabled>disabled</code> attribute is probably
  more appropriate.</p>

  <p>The <dfn id=dom-inert title=dom-inert><code>inert</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name.</p>


<!--TOPIC:DOM APIs-->
  <h3 id=activation><span class=secno>8.3 </span>Activation</h3>

  <!-- v2 idea: HTMLImageElement.click(x, y); or clickPoint(), if
       click() can't be done in IE; can this be emulated in IE by
       posting a synthetic mouse click event with those X and Y
       coords? (ack Csaba Gabor)
  -->

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-click><a href=#dom-click>click</a></code>()</dt>

   <dd>

    <p>Acts as if the element was clicked.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-click title=dom-click><code>click()</code></dfn> method must
  <a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the
  element.</p>

  </div>
<!--TOPIC:HTML-->


  <h3 id=focus><span class=secno>8.4 </span>Focus</h3>

  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%20%0A...%3Cform%3E%3Cinput%20name%3Da%20onfocus%3D%22value%2B%3D1%3Bd.name%3D%27a%27%3Bname%3D%27d%27%3Bb.focus()%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22value%2B%3D1%3Bc.focus()%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22value%2B%3D1%3Bd.focus()%22%3E%0A%3Cinput%20name%3Dd%20onfocus%3D%22value%2B%3D1%3Ba.focus()%22%3E -->

  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af1%20%27%3Bb.focus()%3Balert(document.activeElement.name)%3Bt.value%2B%3D%27af2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22t.value%2B%3D%27cf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27cf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27cb%20%27%3B%22%3E%0A -->

  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%20onload%3D%22document.forms%5B0%5D.a.focus()%22%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onblur%3D%22t.value%2B%3D'ab%20'%3B%20b.focus()%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D'bf1%20'%3Ba.focus()%3Bt.value%2B%3D'bf2%20'%3B%22%20onblur%3D%22t.value%2B%3D'bb%20'%3B%22%3E -->

  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%3E...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab1%20%27%3Bb.focus()%3Bt.value%2B%3D%27ab2%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Ba.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E -->

  <!-- v2: more things to define, if no other specs define them:
   - define onfocus/onblur behaviour for Window
   - Other things to look at are IE's focus APIs (HTMLElement.setActive(),
     onBeforeActivate, onActivate, onBeforeDeactivate, onDeactivate):
       https://bugzilla.mozilla.org/show_bug.cgi?id=296471
       https://bugzilla.mozilla.org/show_bug.cgi?id=296469
       http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setactive.asp
       http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onbeforeactivate.asp
  -->

  <div class=impl>

  <p>When an element is <i>focused</i>, key events received by the
  document must be targeted at that element. There may be no element
  focused; when no element is focused, key events received by the
  document must be targeted at <a href=#the-body-element-0>the body element</a>, if there
  is one, or else at the <code><a href=#document>Document</a></code>'s root element, if
  there is one. If there is no root element, key events must not be
  fired.</p>

  <p>User agents may track focus for each <a href=#browsing-context>browsing
  context</a> or <code><a href=#document>Document</a></code> individually, or may support
  only one focused element per <a href=#top-level-browsing-context>top-level browsing context</a>
  &mdash; user agents should follow platform conventions in this
  regard.</p>

  <p>Which elements within a <a href=#top-level-browsing-context>top-level browsing context</a>
  currently have focus must be independent of whether or not the
  <a href=#top-level-browsing-context>top-level browsing context</a> itself has the <i>system
  focus</i>.</p>

  <p id=bc-focus-ergo-bcc-focus>When a <a href=#child-browsing-context>child browsing
  context</a> is focused, its <a href=#browsing-context-container>browsing context
  container</a> must also have focus.</p>

  <p class=note>When an element is focused, the element matches the
  CSS <code>:focus</code> pseudo-class.</p>

  </div>


  <h4 id=sequential-focus-navigation-and-the-tabindex-attribute><span class=secno>8.4.1 </span>Sequential focus navigation and the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute</h4>

  <p>The <dfn id=attr-tabindex title=attr-tabindex><code>tabindex</code></dfn>
  content attribute allows authors to control whether an element is
  supposed to be focusable, whether it is supposed to be reachable
  using sequential focus navigation, and what is to be the relative
  order of the element for the purposes of sequential focus
  navigation. The name "tab index" comes from the common use of the
  "tab" key to navigate through the focusable elements. The term
  "tabbing" refers to moving forward through the focusable elements
  that can be reached using sequential focus navigation.</p>

  <p>The <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute, if
  specified, must have a value that is a <a href=#valid-integer>valid
  integer</a>.</p>

  <div class=impl>

  <p>Each element can have a <dfn id=specially-focusable>tabindex focus flag</dfn> set, as defined
  below. This flag is a factor that contributes towards determining whether an element is
  <a href=#focusable>focusable</a>, as described in the next section.</p>

  <p>If the attribute is specified, it must be parsed using the
  <a href=#rules-for-parsing-integers>rules for parsing integers</a>. The attribute's values have
  the following meanings:</p>

  <dl><dt>If the attribute is omitted or parsing the value returns an
   error</dt>

   <dd>

    <p>The user agent should follow platform conventions to determine
    if the element's <a href=#specially-focusable>tabindex focus flag</a> is set and, if
    so, whether the element can be reached using sequential focus
    navigation, and if so, what its relative order should be.</p>

    <p>Modulo platform conventions, it is suggested that for the following elements, the
    <a href=#specially-focusable>tabindex focus flag</a> be set:</p>

    <ul><li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>

     <li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute</li>

     <li><code><a href=#the-button-element>button</a></code> elements</li>

     <li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute are not in the
     <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state</li>

     <li><code><a href=#the-select-element>select</a></code> elements</li>

     <li><code><a href=#the-textarea-element>textarea</a></code> elements</li>

     <li><code><a href=#the-menuitem-element>menuitem</a></code> elements</li>

     <li>Elements with a <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
     attribute set, if that would enable the user agent to allow the
     user to begin a drag operations for those elements without the use
     of a pointing device</li>

     <li><a href=#editing-host title="editing host">Editing hosts</a></li>

     <li><a href=#browsing-context-container title="browsing context container">Browsing context
     containers</a></li> <!-- like <iframe>s -->

     <li><a href=#sorting-interface-th-element title="sorting interface th element">Sorting interface <code>th</code>
     elements</a></li>

    </ul><p class=note>One valid reason to ignore the platform
    conventions and always allow an element to be focused (by setting
    its <a href=#specially-focusable>tabindex focus flag</a>) would be if the user's only
    mechanism for activating an element is through a keyboard action
    that triggers the focused element.</p>

   </dd>

   <dt id=negative-tabindex>If the value is a negative integer</dt>

   <dd>

    <p>The user agent must set the element's <a href=#specially-focusable>tabindex focus
    flag</a>, but should not allow the element to be reached using
    sequential focus navigation.</p>

    <p class=note>One valid reason to ignore the requirement that
    sequential focus navigation not allow the author to lead to the
    element would be if the user's only mechanism for moving the focus
    is sequential focus navigation. For instance, a keyboard-only user
    would be unable to click on a text field with a negative <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code>, so that user's user agent
    would be well justified in allowing the user to tab to the control
    regardless.</p>

   </dd>

   <dt>If the value is a zero</dt>

   <dd>

    <p>The user agent must set the element's <a href=#specially-focusable>tabindex focus
    flag</a>, should allow the element to be reached using
    sequential focus navigation, and should follow platform
    conventions to determine the element's relative order.</p>

   </dd>

   <dt>If the value is greater than zero</dt>

   <dd>

    <p>The user agent must set the element's <a href=#specially-focusable>tabindex focus
    flag</a>, should allow the element to be reached using
    sequential focus navigation, and should place the element in the
    sequential focus navigation order so that it is:</p>

    <ul><li>before any <a href=#focusable>focusable</a> element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has been omitted
     or whose value, when parsed, returns an error,</li>

     <li>before any <a href=#focusable>focusable</a> element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal
     to or less than zero,</li>

     <li>after any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value
     greater than zero but less than the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute on the
     element,</li>

     <li>after any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal
     to the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code>
     attribute on the element but that is earlier in the document in
     <a href=#tree-order>tree order</a> than the element,</li>

     <li>before any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal
     to the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code>
     attribute on the element but that is later in the document in
     <a href=#tree-order>tree order</a> than the element, and</li>

     <li>before any element whose <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute has a value
     greater than the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute on the
     element.</li>

    </ul></dd>

  </dl><p>An element that has its <a href=#specially-focusable>tabindex focus flag</a> set but
  does not otherwise have an <a href=#activation-behavior>activation behavior</a> defined
  has an <a href=#activation-behavior>activation behavior</a> that does nothing.</p>

  <p class=note>This means that an element that is only focusable
  because of its <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute
  will fire a <code title=event-click><a href=#event-click>click</a></code> event in response
  to a non-mouse activation (e.g. hitting the "enter" key while the
  element is focused).</p>

  <p>The <dfn id=dom-tabindex title=dom-tabIndex><code>tabIndex</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> content attribute. Its default
  value is 0 for elements that are focusable and &minus;1 for
  elements that are not focusable.</p>

  </div>



  <div class=impl>

  <h4 id=focus-management><span class=secno>8.4.2 </span>Focus management</h4>

  <p>An element is <dfn id=focusable>focusable</dfn> if all of the following conditions are met:</p>

  <ul><li>The element's <a href=#specially-focusable>tabindex focus flag</a> is set.</li>

   <li>The element is either <a href=#being-rendered>being rendered</a> or <!-- CANVAS-FOCUS-FALLBACK --> is a
   descendant of a <code><a href=#the-canvas-element>canvas</a></code> element that <a href=#represents>represents</a> <a href=#embedded-content>embedded
   content</a>.</li>

   <li>Neither the element nor any of its ancestors are <a href=#inert>inert</a>.</li>

   <li>The element is not <a href=#concept-element-disabled title=concept-element-disabled>disabled</a>.</li>

  </ul><p>In addition, each shape that is generated for an <code><a href=#the-area-element>area</a></code> element, any
  user-agent-provided interface components of <a href=#media-element title="media element">media elements</a>
  (e.g. a play button), and distinct user interface components of form controls (e.g. "up" and
  "down" buttons on an <code title=attr-input-type-number><a href="#number-state-(type=number)">&lt;input type=number&gt;</a></code> spin
  control), should be <a href=#focusable>focusable</a>, unless platform conventions dictate otherwise or
  unless their corresponding element is <a href=#concept-element-disabled title=concept-element-disabled>disabled</a>. (A
  single <code><a href=#the-area-element>area</a></code> element can correspond to multiple shapes, since image maps can be reused
  with multiple images on a page.)</p>

  <p>The user agent may also make part of a <code><a href=#the-details-element>details</a></code> element's rendering
  <a href=#focusable>focusable</a>, to enable the element to be opened or closed using keyboard input.
  However, this is distinct from the <code><a href=#the-details-element>details</a></code> or <code><a href=#the-summary-element>summary</a></code> element being
  focusable.</p>

  <p>Notwithstanding the above, user agents may make <em>any</em> element or part of an element
  focusable, especially to aid with accessibility or to better match platform conventions.</p>

  <hr><p>The <dfn id=focusing-steps>focusing steps</dfn> for an element are as follows:</p>

  <ol><li><p>If the element is not <a href=#in-a-document title="in a Document">in a
   <code>Document</code></a>, or if the element's
   <code><a href=#document>Document</a></code> has no <a href=#browsing-context>browsing context</a>, or if
   the element's <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a>
   has no <a href=#top-level-browsing-context>top-level browsing context</a>, or if the element
   is not <a href=#focusable>focusable</a>, or if the element is already
   focused, then abort these steps.</p>

   <li><p>If focusing the element will remove the focus from another
   element, then run the <a href=#unfocusing-steps>unfocusing steps</a> for that
   element.</li>

   <li>

    <p>Make the element the currently focused element in its
    <a href=#top-level-browsing-context>top-level browsing context</a>.</p>

    <p>Some elements, most notably <code><a href=#the-area-element>area</a></code>, can correspond
    to more than one distinct focusable area. If a particular area was
    indicated when the element was focused, then that is the area that
    must get focus; otherwise, e.g. when using the <code title=dom-focus><a href=#dom-focus>focus()</a></code> method, the first such region in
    tree order is the one that must be focused.</p>

   </li>

   <li>

    <p>The user agent may apply relevant platform-specific conventions
    for focusing widgets.</p>

    <p class=note>For example, some platforms select the contents of
    a text field when that field is focused.</p>

   </li>

   <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-focus>focus</code> at the element.</li>
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/723 -->

  </ol><p>User agents must synchronously run the <a href=#focusing-steps>focusing
  steps</a> for an element whenever the user moves the focus to a
  <a href=#focusable>focusable</a> element.</p>

  <p>The <dfn id=unfocusing-steps>unfocusing steps</dfn> for an element are as
  follows:</p>

  <ol><li><p>If the element is an <code><a href=#the-input-element>input</a></code> element, and the
   <code title=event-input-change><a href=#event-input-change>change</a></code> event applies to the
   element, and the element does not have a defined <a href=#activation-behavior>activation
   behavior</a>, and the user has changed the element's <a href=#concept-fe-value title=concept-fe-value>value</a> or its list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>
   while the control was focused without committing that change, then
   <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at the element.</p>

   <li><p>Unfocus the element.</li>

   <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-blur>blur</code> at the element.</li>
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/723 -->

  </ol><p>When an element that is focused stops being a
  <a href=#focusable>focusable</a> element, or stops being focused without
  another element being explicitly focused in its stead, the user
  agent should synchronously run the <a href=#unfocusing-steps>unfocusing steps</a> for
  the affected element only.</p>

  <p class=example>For example, this might happen because the
  element is removed from its <code><a href=#document>Document</a></code>, or has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute added. It would also
  happen to an <code><a href=#the-input-element>input</a></code> element when the element gets <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</p>

  </div>


<!--TOPIC:DOM APIs-->
  <h4 id=document-level-focus-apis><span class=secno>8.4.3 </span>Document-level focus APIs</h4>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-activeElement><a href=#dom-document-activeelement>activeElement</a></code></dt>

   <dd>

    <p>Returns the currently focused element.</p>

   </dd>

   <dt><var title="">document</var> . <code title=dom-document-hasFocus><a href=#dom-document-hasfocus>hasFocus</a></code>()</dt>

   <dd>

    <p>Returns true if the document has focus; otherwise, returns false.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-window-focus><a href=#dom-window-focus>focus</a></code>()</dt>

   <dd>

    <p>Focuses the window. Use of this method is discouraged. Allow the user to control window focus instead.</p>

   </dd>

   <dt><var title="">window</var> . <code title=dom-window-blur><a href=#dom-window-blur>blur</a></code>()</dt>

   <dd>

    <p>Unfocuses the window. Use of this method is discouraged. Allow the user to control window focus instead.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-document-activeelement title=dom-document-activeElement><code>activeElement</code></dfn>
  attribute on <code><a href=#document>Document</a></code> objects must return the
  element in the document that is focused. If no element in the
  <code><a href=#document>Document</a></code> is focused, this must return <a href=#the-body-element-0>the body
  element</a>.</p>

  <p class=note>When a <a href=#child-browsing-context>child browsing context</a> is
  focused, its <a href=#browsing-context-container>browsing context container</a> is also
  focused, <a href=#bc-focus-ergo-bcc-focus>by definition</a>. For
  example, if the user moves the focus to a text field in an
  <code><a href=#the-iframe-element>iframe</a></code>, the <code><a href=#the-iframe-element>iframe</a></code> is the element with
  focus in the <a href=#parent-browsing-context>parent browsing context</a>.</p>

  <p>The <dfn id=dom-document-hasfocus title=dom-document-hasFocus><code>hasFocus()</code></dfn> method
  on <code><a href=#document>Document</a></code> objects must return true if the
  <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is focused,
  and all its <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor
  browsing contexts</a> are also focused, and the <a href=#top-level-browsing-context>top-level
  browsing context</a> has the <i>system focus</i>. If the
  <code><a href=#document>Document</a></code> has no <a href=#browsing-context>browsing context</a> or if its
  <a href=#browsing-context>browsing context</a> has no <a href=#top-level-browsing-context>top-level browsing
  context</a>, then the method will always return false.</p>

  <p>The <dfn id=dom-window-focus title=dom-window-focus><code>focus()</code></dfn>
  method on the <code><a href=#window>Window</a></code> object, when invoked, provides a
  hint to the user agent that the script believes the user might be
  interested in the contents of the <a href=#browsing-context>browsing context</a> of
  the <code><a href=#window>Window</a></code> object on which the method was invoked.</p>

  <p>User agents are encouraged to have this <code title=dom-window-focus><a href=#dom-window-focus>focus()</a></code> method trigger some kind of
  notification.</p>

  <p>The <dfn id=dom-window-blur title=dom-window-blur><code>blur()</code></dfn> method
  on the <code><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>browsing
  context</a> of the <code><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 title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> method entirely.</p>

  <p class=note>Historically the <code title=dom-window-blur><a href=#dom-window-blur>focus()</a></code> and <code title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> methods actually affected the
  system focus, but hostile sites widely abuse this behavior to the
  user's detriment.</p>

  </div>


  <h4 id=element-level-focus-apis><span class=secno>8.4.4 </span>Element-level focus APIs</h4>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-focus><a href=#dom-focus>focus</a></code>()</dt>

   <dd>

    <p>Focuses the element.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-blur><a href=#dom-blur>blur</a></code>()</dt>

   <dd>

    <p>Unfocuses the element. Use of this method is discouraged. Focus
    another element instead.</p>

    <p>Do not use this method to hide the focus ring if you find the focus ring unsightly. Instead,
    use a CSS rule to override the 'outline' property. Be aware, however, that if an alternative
    focusing style isn't made available instead, 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>

    <!-- we suggest using CSS here because users can override CSS, so
    it's no the end of the world, unlike using .blur(), which cannot
    be easily overridden by users and completely breaks tab
    navigation. -->

    <div class=example>

     <p>For example, to hide the outline from links and instead use a yellow background, you could use:</p>

     <pre>:link:focus, :visited:focus { outline: none; background: yellow; color: black; }</pre>

    </div>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-focus title=dom-focus><code>focus()</code></dfn> method,
  when invoked, must run the following algorithm:</p>

  <ol><li><p>If the element is marked as <i><a href=#locked-for-focus>locked for focus</a></i>, then abort
   these steps.</li>

   <li><p>Mark the element as <dfn id=locked-for-focus>locked for focus</dfn>.</li>

   <li><p>Run the <a href=#focusing-steps>focusing steps</a> for the
   element.</li>

   <li><p>Unmark the element as <i><a href=#locked-for-focus>locked for focus</a></i>.</li>

  </ol><p>The <dfn id=dom-blur title=dom-blur><code>blur()</code></dfn> method, when
  invoked, should run the <a href=#unfocusing-steps>unfocusing steps</a> for the
  element on which the method was called instead. User agents may
  selectively or uniformly ignore calls to this method for usability
  reasons.</p>

  <p class=example>For example, if the <code title=dom-blur><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>

  </div>
<!--TOPIC:HTML-->



  <h3 id=assigning-keyboard-shortcuts><span class=secno>8.5 </span>Assigning keyboard shortcuts</h3>

  <h4 id=introduction-7><span class=secno>8.5.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>Each element that can be activated or focused can be assigned a
  single key combination to activate it, using the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute.</p>

  <p>The exact shortcut is determined by the user agent, based on
  information about the user's keyboard, what keyboard shortcuts
  already exist on the platform, and what other shortcuts have been
  specified on the page, using the information provided in the <code title=attr-accesskey><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 title=attr-accesskey><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 title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute
  returns a string representing the actual key combination assigned by
  the user agent.</p>

  <div class=example>

   <p>In this example, an author has provided a button that can be
   invoked using a shortcut key. To support full keyboards, the author
   has provided "C" as a possible key. To support devices equipped
   only with numeric keypads, the author has provided "1" as another
   possibly key.</p>

   <pre>&lt;input type=button value=Collect onclick="collect()"
       <strong>accesskey="C 1"</strong> id=c&gt;</pre>

  </div>

  <div class=example>

   <p>To tell the user what the shortcut key is, the author has 
   this script here opted to explicitly add the key combination to the
   button's label:</p>

   <pre>function addShortcutKeyLabel(button) {
<strong>  if (button.accessKeyLabel != '')
    button.value += ' (' + button.accessKeyLabel + ')';</strong>
}
addShortcutKeyLabel(document.getElementById('c'));</pre>

   <p>Browsers on different platforms will show different labels, even
   for the same key combination, based on the convention prevalent on
   that platform. For example, if the key combination is the Control
   key, the Shift key, and the letter C, a Windows browser might
   display "<samp>Ctrl+Shift+C</samp>", whereas a Mac browser might
   display "<samp>^&#x21e7;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>&#x2325;&#x238b;</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 title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute.</p>

  </div>


  <h4 id=the-accesskey-attribute><span class=secno>8.5.2 </span>The <dfn title=attr-accesskey><code>accesskey</code></dfn> attribute</h4>

  <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute set. The
  <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute's value is
  used by the user agent as a guide for creating a keyboard shortcut
  that activates or focuses the element.</p>

  <p>If specified, the value must be an <a href=#ordered-set-of-unique-space-separated-tokens>ordered set of unique
  space-separated tokens</a> that are <a href=#case-sensitive>case-sensitive</a>,
  each of which must be exactly one Unicode code point in length.</p>

  <div class=example>

   <p>In the following example, a variety of links are given with
   access keys so that keyboard users familiar with the site can
   more quickly navigate to the relevant pages:</p>

   <pre>&lt;nav&gt;
 &lt;p&gt;
  &lt;a title="Consortium Activities" accesskey="A" href="/Consortium/activities"&gt;Activities&lt;/a&gt; |
  &lt;a title="Technical Reports and Recommendations" accesskey="T" href="/TR/"&gt;Technical Reports&lt;/a&gt; |
  &lt;a title="Alphabetical Site Index" accesskey="S" href="/Consortium/siteindex"&gt;Site Index&lt;/a&gt; |
  &lt;a title="About This Site" accesskey="B" href="/Consortium/"&gt;About Consortium&lt;/a&gt; |
  &lt;a title="Contact Consortium" accesskey="C" href="/Consortium/contact"&gt;Contact&lt;/a&gt;
 &lt;/p&gt;
&lt;/nav&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, the search field is given two possible
   access keys, "s" and "0" (in that order). A user agent on a device
   with a full keyboard might pick
   <kbd><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd><a href=#the-s-element>S</a></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>&lt;form action="/search"&gt;
 &lt;label&gt;Search: &lt;input type="search" name="q" accesskey="s 0"&gt;&lt;/label&gt;
 &lt;input type="submit"&gt;
&lt;/form&gt;</pre>

  </div>

  <div class=example>

   <p>In the following example, a button has possible access keys
   described. A script then tries to update the button's label to
   advertise the key combination the user agent selected.</p>

   <pre>&lt;input type=submit accesskey="N @ 1" value="Compose"&gt;
...
&lt;script&gt;
 function labelButton(button) {
   if (button.accessKeyLabel)
     button.value += ' (' + button.accessKeyLabel + ')';
 }
 var inputs = document.getElementsByTagName('input');
 for (var i = 0; i &lt; inputs.length; i += 1) {
   if (inputs[i].type == "submit")
     labelButton(inputs[i]);
 }
&lt;/script&gt;</pre>

   <p>On one user agent, the button's label might become
   "<samp>Compose (&#x2318;N)</samp>". On another, it might become
   "<samp>Compose (Alt+&#x21e7;+1)</samp>". If the user agent doesn't
   assign a key, it will be just "<samp>Compose</samp>". The exact
   string depends on what the <a href=#assigned-access-key>assigned access key</a> is, and
   on how the user agent represents that key combination.</p>

  </div>


  <div class=impl>

  <h4 id=processing-model-5><span class=secno>8.5.3 </span>Processing model</h4>

  <p>An element's <dfn id=assigned-access-key>assigned access key</dfn> is a key combination
  derived from the element's <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute.
  Initially, an element must not have an <a href=#assigned-access-key>assigned access
  key</a>.</p>

  <p>Whenever an element's <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute is set, changed,
  or removed, the user agent must update the element's <a href=#assigned-access-key>assigned
  access key</a> by running the following steps:</p>

  <ol><li><p>If the element has no <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> attribute, then skip to the
   <i>fallback</i> step below.</li>

   <li><p>Otherwise, <a href=#split-a-string-on-spaces title="split a string on spaces">split the
   attribute's value on spaces</a>, and let <var title="">keys</var> be the resulting tokens.</li>

   <li>

    <p>For each value in <var title="">keys</var> in turn, in the
    order the tokens appeared in the attribute's value, run the
    following substeps:</p>

    <ol><li><p>If the value is not a string exactly one Unicode code
     point in length, then skip the remainder of these steps for this
     value.</li>

     <li><p>If the value does not correspond to a key on the system's
     keyboard, then skip the remainder of these steps for this
     value.</li>

     <li><p>If the user agent can find a mix of zero or more modifier
     keys that, combined with the key that corresponds to the value
     given in the attribute, can be used as the access key, then the
     user agent may assign that combination of keys as the element's
     <a href=#assigned-access-key>assigned access key</a> and abort these steps.</li>

    </ol></li>

   <li><p><i>Fallback</i>: Optionally, the user agent may assign a key
   combination of its choosing as the element's <a href=#assigned-access-key>assigned access
   key</a> and then abort these steps.</li>

   <li><p>If this step is reached, the element has no <a href=#assigned-access-key>assigned
   access key</a>.</li>

  </ol><p>Once a user agent has selected and assigned an access key for an
  element, the user agent should not change the element's
  <a href=#assigned-access-key>assigned access key</a> unless the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute is changed
  or the element is moved to another <code><a href=#document>Document</a></code>.</p>

  <p>When the user presses the key combination corresponding to the <a href=#assigned-access-key>assigned access key</a>
  for an element, if the element <a href=#concept-command title=concept-command>defines a command</a>, the
  command's <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a> facet is false (visible),
  the command's <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> facet is also false
  (enabled), the element is <a href=#in-a-document>in a <code>Document</code></a> that has an associated
  <a href=#browsing-context>browsing context</a>, and neither the element nor any of its ancestors has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute specified, then the user agent must trigger the <a href=#command-facet-action title=command-facet-Action>Action</a> of the command.</p>

  <p class=note>User agents <a href=#expose-commands-in-ui>might expose</a> elements that have
  an <code title=attr-accesskey><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> <!-- the actual conformance criteria for
  this is in the section that defines commands -->

  <hr><p>The <dfn id=dom-accesskey title=dom-accessKey><code>accessKey</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute.</p>

  <p>The <dfn id=dom-accesskeylabel title=dom-accessKeyLabel><code>accessKeyLabel</code></dfn> IDL
  attribute must return a string that represents the element's
  <a href=#assigned-access-key>assigned access key</a>, if any. If the element does not
  have one, then the IDL attribute must return the empty string.</p>

  </div>



  <h3 id=editing-0><span class=secno>8.6 </span>Editing</h3>

  <h4 id=contenteditable><span class=secno>8.6.1 </span>Making document regions editable: The <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> content attribute</h4>

  <p>The <dfn id=attr-contenteditable title=attr-contenteditable><code>contenteditable</code></dfn> attribute is an
  <a href=#enumerated-attribute>enumerated attribute</a> whose keywords are the empty string, <code title="">true</code>,
  and <code title="">false</code>. The empty string and the <code title="">true</code> keyword map
  to the <i>true</i> state. The <code title="">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>missing value
  default</i> (and the <i>invalid value default</i>).</p>

  <p>The <i>true</i> state indicates that the element is editable. The <i>inherit</i> state
  indicates that the element is editable if its parent is. The <i>false</i> state indicates that the
  element is not editable.</p>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-contentEditable><a href=#dom-contenteditable>contentEditable</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns "<code title="">true</code>", "<code title="">false</code>", or "<code title="">inherit</code>", based on the state of the <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute.</p>

    <p>Can be set, to change that state.</p>

    <p>Throws a <code><a href=#syntaxerror>SyntaxError</a></code> exception if the new value isn't one of those strings.</p>

   </dd>

   <dt><var title="">element</var> . <code title=dom-isContentEditable><a href=#dom-iscontenteditable>isContentEditable</a></code></dt>

   <dd>

    <p>Returns true if the element is editable; otherwise, returns false.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-contenteditable title=dom-contentEditable><code>contentEditable</code></dfn> IDL attribute, on
  getting, must return the string "<code title="">true</code>" if the content attribute is set to
  the true state, "<code title="">false</code>" if the content attribute is set to the false state,
  and "<code title="">inherit</code>" otherwise. On setting, if the new value is an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> match for the string "<code title="">inherit</code>" then the content
  attribute must be removed, if the new value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
  the string "<code title="">true</code>" then the content attribute must be set to the string
  "<code title="">true</code>", if the new value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
  the string "<code title="">false</code>" then the content attribute must be set to the string
  "<code title="">false</code>", and otherwise the attribute setter must throw a
  <code><a href=#syntaxerror>SyntaxError</a></code> exception.</p>

  <p>The <dfn id=dom-iscontenteditable title=dom-isContentEditable><code>isContentEditable</code></dfn> IDL attribute, on
  getting, must return true if the element is either an <a href=#editing-host>editing host</a> or
  <a href=#editable>editable</a>, and false otherwise.</p>

  </div>


  <h4 id=making-entire-documents-editable:-the-designmode-idl-attribute><span class=secno>8.6.2 </span>Making entire documents editable: The <code title=dom-document-designMode><a href=#designMode>designMode</a></code> IDL attribute</h4>

  <div class=impl>

  <p>Documents have a <dfn id=designMode title=dom-document-designMode><code>designMode</code></dfn>, which can be either enabled or
  disabled.</p>

  </div>

  <dl class=domintro><dt><var title="">document</var> . <code title=dom-document-designMode><a href=#designMode>designMode</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns "<code title="">on</code>" if the document is editable,
    and "<code title="">off</code>" if it isn't.</p>

    <p>Can be set, to change the document's current state. This focuses the document and resets the
    selection in that document.</p>

   </dd>

  </dl><div class=impl>

  <p>The <code title=dom-document-designMode><a href=#designMode>designMode</a></code> IDL attribute on the
  <code><a href=#document>Document</a></code> object takes two values, "<code title="">on</code>" and "<code title="">off</code>". On setting, the new value must be compared in an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> manner to these two values; if it matches the "<code title="">on</code>"
  value, then <code title=dom-document-designMode><a href=#designMode>designMode</a></code> must be enabled, and if it
  matches the "<code title="">off</code>" value, then <code title=dom-document-designMode><a href=#designMode>designMode</a></code> must be disabled. Other values must be
  ignored.</p>

  <p>On getting, if <code title=dom-document-designMode><a href=#designMode>designMode</a></code> is enabled, the IDL
  attribute must return the value "<code title="">on</code>"; otherwise it is disabled, and the
  attribute must return the value "<code title="">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 title=dom-document-designMode><a href=#designMode>designMode</a></code>
  disabled.</p>

  <p>When the <code title=dom-document-designMode><a href=#designMode>designMode</a></code> changes from being disabled to
  being enabled, the user agent must synchronously reset the document's <a href=#active-range>active range</a>'s
  start and end boundary points to be at the start of the <code><a href=#document>Document</a></code> and then run the
  <a href=#focusing-steps>focusing steps</a> for the root element of the <code><a href=#document>Document</a></code>, if any.</p>

  </div>


  <h4 id=best-practices-for-in-page-editors><span class=secno>8.6.3 </span>Best practices for in-page editors</h4>

  <p>Authors are encouraged to set the 'white-space' property on <a href=#editing-host title="editing host">editing
  hosts</a> and on markup that was originally created through these editing mechanisms to the
  value 'pre-wrap'. Default HTML whitespace handling is not well suited to WYSIWYG editing, and line
  wrapping will not work correctly in some corner cases if 'white-space' is left at its default
  value.</p>

  <div class=example>

   <p>As an example of problems that occur if the default 'normal' value is used instead, consider
   the case of the user typing "<kbd>yellow&blank;&blank;ball</kbd>", with two spaces (here
   represented by "&blank;") between the words. With the editing rules in place for the default
   value of 'white-space' ('normal'), the resulting markup will either consist of
   "<samp>yellow&amp;nbsp;&nbsp;ball</samp>" or "<samp>yellow&nbsp;&amp;nbsp;ball</samp>"; i.e.,
   there will be a non-breaking space between the two words in addition to the regular space. This
   is necessary because the 'normal' value for 'white-space' requires adjacent regular spaces to be
   collapsed together.</p>

   <p>In the former case, "<samp>yellow&#x237d;</samp>" might wrap to the next line ("&#x237d;"
   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>&#x237d;ball</samp>", if wrapped to the
   start of the line, would have visible indentation from the non-breaking space.</p>

   <p>When 'white-space' is set to 'pre-wrap', however, the editing rules will instead simply put
   two regular spaces between the words, and should the two words be split at the end of a line, the
   spaces would be neatly removed from the rendering.</p>

  </div>



  <h4 id=editing-apis><span class=secno>8.6.4 </span>Editing APIs</h4>

  <p>The definition of the terms <dfn id=active-range>active range</dfn>, <dfn id=editing-host>editing
  host</dfn>, and <dfn id=editable>editable</dfn>, the user interface requirements
  of elements that are <a href=#editing-host title="editing host">editing hosts</a>
  or <a href=#editable>editable</a>, the

  <dfn id=execCommand title=dom-document-execCommand><code>execCommand()</code></dfn>,
  <dfn id=dom-document-querycommandenabled title=dom-document-queryCommandEnabled><code>queryCommandEnabled()</code></dfn>,
  <dfn id=dom-document-querycommandindeterm title=dom-document-queryCommandIndeterm><code>queryCommandIndeterm()</code></dfn>,
  <dfn id=dom-document-querycommandstate title=dom-document-queryCommandState><code>queryCommandState()</code></dfn>,
  <dfn id=dom-document-querycommandsupported title=dom-document-queryCommandSupported><code>queryCommandSupported()</code></dfn>, and
  <dfn id=dom-document-querycommandvalue title=dom-document-queryCommandValue><code>queryCommandValue()</code></dfn>

  methods, text selections, and the <dfn id=delete-the-selection>delete the selection</dfn>
  algorithm are defined in the HTML Editing APIs specification. The
  interaction of editing and the undo/redo features in user agents is
  defined by the UndoManager and DOM Transaction specification. <a href=#refsEDITING>[EDITING]</a> <a href=#refsUNDO>[UNDO]</a></p>

  <!-- those might get merged in here eventually -->



  <h4 id=spelling-and-grammar-checking><span class=secno>8.6.5 </span>Spelling and grammar checking</h4>

  <div class=impl>

  <p>User agents can support the checking of spelling and grammar of
  editable text, either in form controls (such as the value of
  <code><a href=#the-textarea-element>textarea</a></code> elements), or in elements in an <a href=#editing-host>editing
  host</a> (e.g. using <code title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>).</p>

  <p>For each element, user agents must establish a <dfn id=concept-spellcheck-default title=concept-spellcheck-default>default behavior</dfn>, either
  through defaults or through preferences expressed by the user. There
  are three possible default behaviors for each element:</p>

  <dl><dt><dfn id=concept-spellcheck-default-true title=concept-spellcheck-default-true>true-by-default</dfn>

   <dd>The element will be checked for spelling and grammar if its
   contents are editable.

   <dt><dfn id=concept-spellcheck-default-false title=concept-spellcheck-default-false>false-by-default</dfn>

   <dd>The element will never be checked for spelling and grammar.

   <dt><dfn id=concept-spellcheck-default-inherit title=concept-spellcheck-default-inherit>inherit-by-default</dfn>

   <dd>The element's default behavior is the same as its parent
   element's. Elements that have no parent element cannot have this as
   their default behavior.

  </dl><hr></div>

  <p>The <dfn id=attr-spellcheck title=attr-spellcheck><code>spellcheck</code></dfn>
  attribute is an <a href=#enumerated-attribute>enumerated attribute</a> whose keywords are
  the empty string, <code title="">true</code> and <code title="">false</code>. The empty string and the <code title="">true</code> keyword map to the <i>true</i> state. The <code title="">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>missing value default</i> (and the <i>invalid value
  default</i>).</p>

  <p class=note>The <i>true</i> state indicates that the element is
  to have its spelling and grammar checked. The <i>default</i> state
  indicates that the element is to act according to a default
  behavior, possibly based on the parent element's own <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> state, as defined below.
  The <i>false</i> state indicates that the element is not to be
  checked.</p>

  <div class=impl>

  <hr></div>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-spellcheck><a href=#dom-spellcheck>spellcheck</a></code> [ = <var title="">value</var> ]</dt>

   <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 title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute.</p>

   </dd>


   <dt><var title="">element</var> . <code title=dom-forceSpellCheck><a href=#dom-forcespellcheck>forceSpellCheck</a></code>()</dt>

   <dd>

    <p>Forces the user agent to report spelling and grammar errors on the element (if checking is
    enabled), even if the user has never focused the element. (If the method is not invoked, user
    agents can hide errors in text that wasn't just entered by the user.)</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-spellcheck title=dom-spellcheck><code>spellcheck</code></dfn> IDL
  attribute, on getting, must return true if the element's <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute is in
  the <i>true</i> state, or if the element's <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute is in
  the <i>default</i> state and the element's <a href=#concept-spellcheck-default title=concept-spellcheck-default>default behavior</a> is <a href=#concept-spellcheck-default-true title=concept-spellcheck-default-true>true-by-default</a>, or
  if the element's <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code>
  content attribute is in the <i>default</i> state and the element's
  <a href=#concept-spellcheck-default title=concept-spellcheck-default>default behavior</a> is
  <a href=#concept-spellcheck-default-inherit title=concept-spellcheck-default-inherit>inherit-by-default</a>
  and the element's parent element's <code title=dom-spellcheck><a href=#dom-spellcheck>spellcheck</a></code> IDL attribute would return
  true; otherwise, if none of those conditions applies, then the
  attribute must instead return false.</p>

  <p class=note>The <code title=dom-spellcheck><a href=#dom-spellcheck>spellcheck</a></code>
  IDL attribute is not affected by user preferences that override the
  <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute,
  and therefore might not reflect the actual spellchecking state.</p>

  <p>On setting, if the new value is true, then the element's <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute must be
  set to the literal string "<code title="">true</code>", otherwise it
  must be set to the literal string "<code title="">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 title=concept-fe-value>value</a> of <code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attributes are in the
   <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>,
   <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>,
   <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>, or
   <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> states
   and that are <i title=concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i> (i.e.
   that do not have the <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute specified and
   that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>).</li>

   <li>The <a href=#concept-fe-value title=concept-fe-value>value</a> of <code><a href=#the-textarea-element>textarea</a></code> elements that do not have a
   <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute and
   that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</li>

   <li>Text in <code><a href=#text>Text</a></code> nodes that are
   children of <a href=#editing-host title="editing host">editing hosts</a> or
   <a href=#editable>editable</a> elements.</li>

   <li>Text in attributes of <a href=#editable>editable</a> elements.</li>

  </ul><p>For text that is part of a <code><a href=#text>Text</a></code> node, the element
  with which the text is associated is the element that is the
  immediate parent of the first character of the word, sentence, or
  other piece of text. For text in attributes, it is the attribute's
  element. For the values of <code><a href=#the-input-element>input</a></code> and
  <code><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><!-- user override --><li>If the user has disabled the checking for this text, then the
   checking is disabled.</li>

   <li>Otherwise, if the user has forced the checking for this text to
   always be enabled, then the checking is enabled.</li>

   <!-- content attribute: on, off -->

   <li>Otherwise, if the element with which the text is associated has
   a <code title=attr-spellcheck><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>

   <!-- inherit, if there is one to inherit from -->

   <li>Otherwise, if there is an ancestor element with a <code title=attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> content attribute that is
   not in the <i>default</i> state, then: if the nearest such
   ancestor's <code title=attr-spellcheck><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>

   <!-- default -->

   <li>Otherwise, if the element's <a href=#concept-spellcheck-default title=concept-spellcheck-default>default behavior</a> is <a href=#concept-spellcheck-default-true title=concept-spellcheck-default-true>true-by-default</a>,
   then checking is enabled.</li>

   <li>Otherwise, if the element's <a href=#concept-spellcheck-default title=concept-spellcheck-default>default behavior</a> is <a href=#concept-spellcheck-default-false title=concept-spellcheck-default-false>false-by-default</a>,
   then checking is disabled.</li>

   <!-- default inheritance -->

   <li>Otherwise, if the element's parent element has <em>its</em>
   checking enabled, then checking is enabled.</li>

   <li>Otherwise, checking is disabled.</li>

  </ol><p>If the checking is enabled for a word/sentence/text, the user agent should indicate spelling
  and grammar errors in that text. User agents should take into account the other semantics given in
  the document when suggesting spelling and grammar corrections. User agents may use the language of
  the element to determine what spelling and grammar rules to use, or may use the user's preferred
  language settings. UAs should use <code><a href=#the-input-element>input</a></code> element attributes such as <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> to ensure that the resulting value is valid, where
  possible.</p>

  <p>If checking is disabled, the user agent should not indicate spelling or grammar errors for that
  text.</p>

  <p>Even when checking is enabled, user agents may opt to not report spelling or grammar errors in
  text that the user agent deems the user has no interest in having checked (e.g. text that was
  already present when the page was loaded, or that the user did not type, or text in controls that
  the user has not focused, or in parts of e-mail addresses that the user agent is not confident were misspelt). The <dfn id=dom-forcespellcheck title=dom-forceSpellCheck><code>forceSpellCheck()</code></dfn> method, when invoked on an
  element, must override this behavior, forcing the user agent to consider all spelling and grammar
  errors in text in that element for which checking is enabled to be of interest to the user.</p>

  <div class=example>

   <p>The element with ID "a" in the following example would be the
   one used to determine if the word "Hello" is checked for spelling
   errors. In this example, it would not be.</p>

   <pre>&lt;div contenteditable="true"&gt;
 &lt;span spellcheck="false" id="a"&gt;Hell&lt;/span&gt;&lt;em&gt;o!&lt;/em&gt;
&lt;/div&gt;</pre>

   <p>The element with ID "b" in the following example would have
   checking enabled (the leading space character in the attribute's
   value on the <code><a href=#the-input-element>input</a></code> element causes the attribute to be
   ignored, so the ancestor's value is used instead, regardless of the
   default).</p>

   <pre class=bad>&lt;p spellcheck="true"&gt;
 &lt;label&gt;Name: &lt;input spellcheck=" false" id="b"&gt;&lt;/label&gt;
&lt;/p&gt;</pre>

  </div>

  </div>

  <p class=note>This specification does not define the user
  interface for spelling and grammar checkers. A user agent could
  offer on-demand checking, could perform continuous checking while
  the checking is enabled, or could use other interfaces.</p>


  <h3 id=dnd><span class=secno>8.7 </span><dfn>Drag and drop</dfn></h3>

<!-- v2: ideas for drag and drop:

     * being able to animate a drop target:

       > To implement this with simple interface I've proposed, events
       > should be handled either by existing elements (like list
       > items that compare their size and position of dragged element
       > to decide whether element should be dropped before or after)
       > or handled by container that would probably need to calculate
       > positions of it's children and create new element to show
       > drop target. Smooth Mac-like drag'n'drop can be implemented
       > by animating drop target's padding/margin. So that's quite a
       > bit of code that's going to be reinvented each time someone
       > implements reordering.

       <hyatt> :droptarget
       <hyatt> or something
       <hyatt> we don't support a pseudo-class for the drop target but that's a great idea
       <Hixie_> yeah, thinking about that too
       <Hixie_> :drop-target, :drop-target(above), :drop-target(below) and having ondragover be able to say "not on me, but next to me maybe"

       - some way to be able to match an element that is being dragged over.

       - some way to be able to animate an element as it goes into and out of   
         this state (CSS transitions?), e.g. to be able to animate something
         "getting out of the way" to let you drop an item between others.

       - as an extension to the previous feature, a way to distinguish being    
         dragged above or to the left of the drag target vs below or to the
         right of the drag target.

     * We should let drop targets communicate back to drag sources if
       they want to communicate. (e.g. expose Window, and thus
       postMessage(), on the dataTransfer object on drop.)
       Or maybe just use a MessagePort!

       We should let drag sources provide a set of options via a
       context menu when the drop happens. (So that, e.g., the source
       can know whether a capabilities URI that it is passing along is
       supposed to be read-write access or read-only access to the
       object being dragged.)

       We should let potential drop targets see the types (but not the
       contents!) of dragged data so they can establish if they care
       or not. (dataTransfer.hasType())

       Ack: Ben Laurie (@g)

     * Interop with native apps. In particular, we probably want to
       whitelist the list of types that a Web page can see, since
       otherwise we'll end up exposing things like the username (if a
       user drags a file from their desktop, the path is exposed on
       some OSes).

     * Alex Velkov suggests that drags to and from the same origin should be able to read the data
       even before the drop.

     Other things listed below:
      DND-v2: more native support: text/html from selections, etc
      DND-v3: add Blob support
      DND-v4: add structured clone support
      DND-v5: add promises (should be able to say "if you accept this
              drop, then I can provide the File object that
              corresponds to it eventually")

         DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
                            .onneeddata - can wait until this fires to provide data
                            .setData() - call this once you have data, must be the right type

-->

  <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 title=event-mousedown>mousedown</code> event that is followed by a
  series of <code title=event-mousemove>mousemove</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>

  <div class=impl>

  <p>However it is implemented, drag-and-drop operations must have a
  starting point (e.g. where the mouse was clicked, or the start of
  the selection or element that was selected for the drag), may have
  any number of intermediate steps (elements that the mouse moves over
  during a drag, or elements that the user picks as possible drop
  points as he cycles through possibilities), and must either have an
  end point (the element above which the mouse button was released, or
  the element that was finally selected), or be canceled. The end
  point must be the last element selected as a possible drop point
  before the drop occurs (so if the operation is not canceled, there
  must be at least one element in the middle step).</p>

  </div>


  <h4 id=introduction-8><span class=secno>8.7.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>To make an element draggable is simple: give the element a <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> attribute, and set an event
  listener for <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> that
  stores the data being dragged.</p>

  <p>The event handler typically needs to check that it's not a text
  selection that is being dragged, and then needs to store data into
  the <code><a href=#datatransfer>DataTransfer</a></code> object and set the allowed effects
  (copy, move, link, or some combination).</p>

  <p>For example:</p>

  <pre>&lt;p&gt;What fruits do you like?&lt;/p&gt;
&lt;ol ondragstart="dragStartHandler(event)"&gt;
 &lt;li draggable="true" data-value="fruit-apple"&gt;Apples&lt;/li&gt;
 &lt;li draggable="true" data-value="fruit-orange"&gt;Oranges&lt;/li&gt;
 &lt;li draggable="true" data-value="fruit-pear"&gt;Pears&lt;/li&gt;
&lt;/ol&gt;
&lt;script&gt;
  var internalDNDType = 'text/x-example'; // set this to something specific to your site
  function dragStartHandler(event) {
    if (event.target instanceof HTMLLIElement) {
      // use the element's data-value="" attribute as the value to be moving:
      event.dataTransfer.setData(internalDNDType, event.target.dataset.value);
      event.dataTransfer.effectAllowed = 'move'; // only allow moves
    } else {
      event.preventDefault(); // don't allow selection to be dragged
    }
  }
&lt;/script&gt;</pre>

  <hr><p>To accept a drop, the drop target has to have a <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute and listen to the
  <code title=drop-event>drop</code> event.</p>

  <p>The value of the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code>
  attribute specifies what kind of data to accept (e.g. "<code title="">string:text/plain</code>" to accept any text strings, or
  "<code>file:image/png</code>" to accept a PNG image file) and what
  kind of feedback to give (e.g. "<code>move</code>" to indicate that
  the data will be moved).</p>

  <p class=note>Instead of using the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute, a drop target can
  handle the <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event (to
  report whether or not the drop target is to accept the drop) and the
  <code title=event-dragover><a href=#event-dragover>dragover</a></code> event (to specify what
  feedback is to be shown to the user).</p>

  <p>The <code title=event-drop><a href=#event-drop>drop</a></code> event allows the actual
  drop to be performed. This event needs to be canceled, so that the
  <code title=dom-DataTransfer-DropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code>
  attribute's value can be used by the source (otherwise it's
  reset).</p>

  <p>For example:</p>

  <pre>&lt;p&gt;Drop your favorite fruits below:&lt;/p&gt;
&lt;ol dropzone="move string:text/x-example" ondrop="dropHandler(event)"&gt;
 &lt;!-- don't forget to change the "text/x-example" type to something
 specific to your site --&gt;
&lt;/ol&gt;
&lt;script&gt;
  var internalDNDType = 'text/x-example'; // set this to something specific to your site
  function dropHandler(event) {
    var li = document.createElement('li');
    var data = event.dataTransfer.getData(internalDNDType);
    if (data == 'fruit-apple') {
      li.textContent = 'Apples';
    } else if (data == 'fruit-orange') {
      li.textContent = 'Oranges';
    } else if (data == 'fruit-pear') {
      li.textContent = 'Pears';
    } else {
      li.textContent = 'Unknown Fruit';
    }
    event.target.appendChild(li);
  }
&lt;/script&gt;</pre>

  <hr><p>To remove the original element (the one that was dragged) from
  the display, the <code title=event-dragend><a href=#event-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>&lt;p&gt;What fruits do you like?&lt;/p&gt;
&lt;ol ondragstart="dragStartHandler(event)" ondragend="dragEndHandler(event)"&gt;
 <em>...as before...</em>
&lt;/ol&gt;
&lt;script&gt;
  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);
    }
  }
&lt;/script&gt;</pre>



  <h4 id=the-drag-data-store><span class=secno>8.7.2 </span>The drag data store</h4>

  <p>The data that underlies a drag-and-drop operation, known as the
  <dfn id=drag-data-store>drag data store</dfn>, consists of the following information:</p>

  <ul><li><p>A <dfn id=drag-data-store-item-list>drag data store item list</dfn>, which is a list of
   items representing the dragged data, each consisting of the
   following information:</p>

    <dl><dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn></dt>

     <dd>

      <p>The kind of data:</p>

      <dl><dt><i>Plain Unicode string</i></dt>
       <dd>
        <p>Text.</p>
       </dd>

<!-- DND-v3:
       <dt><i title="">Blob</i></dt>
       <dd>
        <p>Binary data.</p>
       </dd>
-->

       <dt><i title="">File</i></dt>
       <dd>
        <p>Binary data with a file name.</p>
       </dd>

<!-- DND-v4:
       <dt><i>Structured object</i></dt>
       <dd>
        <p>An object that will be cloned using the <span>structured clone</span> algorithm.</p>
       </dd>
-->

      </dl></dd>

     <dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn></dt>

     <dd>

      <p>A Unicode string giving the type or format of the data,
      generally given by a <a href=#mime-type>MIME type</a>. Some values that
      are not <a href=#mime-type title="MIME type">MIME types</a> are
      special-cased for legacy reasons. The API does not enforce the
      use of <a href=#mime-type title="MIME type">MIME types</a>; other values
      can be used as well. In all cases, however, the values are all
      <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> by the API.</p>

      <p class=note>Strings that contain <a href=#space-character title="space
      character">space characters</a> cannot be used with the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute, so authors are
      encouraged to use only <a href=#mime-type title="MIME type">MIME types</a>
      or custom strings (without spaces).</p>

      <p>There is a limit of one <i>Plain Unicode string</i> item per
      <a href=#the-drag-data-item-type-string title="The drag data item type string">item type
      string</a>.</p> <!-- DND-v4: consider limiting the structured
      objects too -->

     </dd>

     <dt>The actual data</dt>

     <dd><p>A Unicode or binary string, in some cases with a file name
     (itself a Unicode string), <!-- (DND-v4:) or an object, --> as
     per <a href=#the-drag-data-item-kind>the drag data item kind</a>.</dd>

    </dl><p>The <a href=#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>

   <li>

    <p>The following information, used to generate the UI feedback
    during the drag:</p>

    <ul><li>User-agent-defined default feedback information, known as the
     <dfn id=drag-data-store-default-feedback>drag data store default feedback</dfn>.</li>

     <li>Optionally, a bitmap image and the coordinate of a point
     within that image, known as the <dfn id=drag-data-store-bitmap>drag data store bitmap</dfn>
     and <dfn id=drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate</dfn>.</li>

    </ul></li>

   <li>

    <p>A <dfn id=drag-data-store-mode>drag data store mode</dfn>, which is one of the
    following:</p>

    <dl><dt><dfn id=concept-dnd-rw title=concept-dnd-rw>Read/write mode</dfn></dt>
     <dd>

      <p>For the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event.
      New data can be added to the <a href=#drag-data-store>drag data store</a>.</p>

     </dd>

     <dt><dfn id=concept-dnd-ro title=concept-dnd-ro>Read-only mode</dfn></dt>
     <dd>

      <p>For the <code title=event-drop><a href=#event-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>

     </dd>

     <dt><dfn id=concept-dnd-p title=concept-dnd-p>Protected mode</dfn></dt>
     <dd>

      <p>For all other events. The formats and kinds in the <a href=#drag-data-store>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>

     </dd>

    </dl></li>

   <li>

    <p>A <dfn id=drag-data-store-allowed-effects-state>drag data store allowed effects state</dfn>, which is a
    string.</p>

   </li>

  </ul><p>When a <a href=#drag-data-store>drag data store</a> is <dfn id=create-a-drag-data-store title="create a drag
  data store">created</dfn>, it must be initialized such that its
  <a href=#drag-data-store-item-list>drag data store item list</a> is empty, it has no
  <a href=#drag-data-store-default-feedback>drag data store default feedback</a>, it has no <a href=#drag-data-store-bitmap>drag
  data store bitmap</a> and <a href=#drag-data-store-hot-spot-coordinate>drag data store hot spot
  coordinate</a>, its <a href=#drag-data-store-mode>drag data store mode</a> is <a href=#concept-dnd-p title=concept-dnd-p>protected mode</a>, and its <a href=#drag-data-store-allowed-effects-state>drag data
  store allowed effects state</a> is the string "<code title="">uninitialized</code>".</p>


  <h4 id=the-datatransfer-interface><span class=secno>8.7.3 </span>The <code><a href=#datatransfer>DataTransfer</a></code> interface</h4>

  <p><code><a href=#datatransfer>DataTransfer</a></code> objects are used to expose the
  <a href=#drag-data-store>drag data store</a> that underlies a drag-and-drop
  operation.</p>

  <pre class=idl>interface <dfn id=datatransfer>DataTransfer</dfn> {
           attribute DOMString <a href=#dom-datatransfer-dropeffect title=dom-DataTransfer-dropEffect>dropEffect</a>;
           attribute DOMString <a href=#dom-datatransfer-effectallowed title=dom-DataTransfer-effectAllowed>effectAllowed</a>;

  readonly attribute <a href=#datatransferitemlist>DataTransferItemList</a> <a href=#dom-datatransfer-items title=dom-DataTransfer-items>items</a>;

  void <a href=#dom-datatransfer-setdragimage title=dom-DataTransfer-setDragImage>setDragImage</a>(Element image, long x, long y);

  /* old interface */
  readonly attribute DOMString[] <a href=#dom-datatransfer-types title=dom-DataTransfer-types>types</a>;
  DOMString <a href=#dom-datatransfer-getdata title=dom-DataTransfer-getData>getData</a>(DOMString format);
  void <a href=#dom-datatransfer-setdata title=dom-DataTransfer-setData>setData</a>(DOMString format, DOMString data);
  void <a href=#dom-datatransfer-cleardata title=dom-DataTransfer-clearData>clearData</a>(optional DOMString format);
  readonly attribute <a href=#filelist>FileList</a> <a href=#dom-datatransfer-files title=dom-DataTransfer-files>files</a>;
};</pre>

  <dl class=domintro><dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the kind of operation that is currently selected. If
    the kind of operation isn't one of those that is allowed by the
    <code title=dom-DataTransfer-effectAllowed><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 title="">none</code>", "<code title="">copy</code>", "<code title="">link</code>", and "<code title="">move</code>".</p>

   </dd>


   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> [ = <var title="">value</var> ]</dt>

   <dd>

    <p>Returns the kinds of operations that are to be allowed.</p>

    <p>Can be set (during the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event), to change the
    allowed operations.</p>

    <p>The possible values are "<code title="">none</code>", "<code title="">copy</code>", "<code title="">copyLink</code>", "<code title="">copyMove</code>", "<code title="">link</code>", "<code title="">linkMove</code>", "<code title="">move</code>", "<code title="">all</code>", and "<code title="">uninitialized</code>",</p>

   </dd>


   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-items><a href=#dom-datatransfer-items>items</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object, with the drag data.</p>

   </dd>


   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-setDragImage><a href=#dom-datatransfer-setdragimage>setDragImage</a></code>(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>)</dt>

   <dd>

    <p>Uses the given element to update the drag feedback, replacing any previously specified feedback.</p>

   </dd>
   

   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-types><a href=#dom-datatransfer-types>types</a></code></dt>

   <dd>

    <p>Returns an array listing the formats that were set in the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event. In addition, if
    any files are being dragged, then one of the types will be the
    string "<code title="">Files</code>".</p>

   </dd>


   <dt><var title="">data</var> = <var title="">dataTransfer</var> . <code title=dom-DataTransfer-getData><a href=#dom-datatransfer-getdata>getData</a></code>(<var title="">format</var>)</dt>

   <dd>

    <p>Returns the specified data. If there is no such data, returns the empty string.</p>

   </dd>


   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-setData><a href=#dom-datatransfer-setdata>setData</a></code>(<var title="">format</var>, <var title="">data</var>)</dt>

   <dd>

    <p>Adds the specified data.</p>

   </dd>


   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData</a></code>( [ <var title="">format</var> ] )</dt>

   <dd>

    <p>Removes the data of the specified formats. Removes all data if
    the argument is omitted.</p>

   </dd>


   <dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-files><a href=#dom-datatransfer-files>files</a></code></dt>

   <dd>

    <p>Returns a <code><a href=#filelist>FileList</a></code> of the files being dragged, if any.</p>

   </dd>

  </dl><p><code><a href=#datatransfer>DataTransfer</a></code> objects are used during the <a href=#dndevents>drag-and-drop events</a>, and are only valid while
  those events are being fired.</p>

  <div class=impl>

  <p>A <code><a href=#datatransfer>DataTransfer</a></code> object is associated with a
  <a href=#drag-data-store>drag data store</a> while it is valid.</p>

  <p>The <dfn id=dom-datatransfer-dropeffect title=dom-DataTransfer-dropEffect><code>dropEffect</code></dfn>
  attribute controls the drag-and-drop feedback that the user is given
  during a drag-and-drop operation. When the <code><a href=#datatransfer>DataTransfer</a></code>
  object is created, the <code title=dom-DataTransfer-dropEffect><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 "<code title="">none</code>",
  "<code title="">copy</code>", "<code title="">link</code>", or
  "<code title="">move</code>", then the attribute's current value
  must be set to the new value. Other values must be ignored.</p>

  <p>The <dfn id=dom-datatransfer-effectallowed title=dom-DataTransfer-effectAllowed><code>effectAllowed</code></dfn>
  attribute is used in the drag-and-drop processing model to
  initialize the <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute
  during the <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> and <code title=event-dragover><a href=#event-dragover>dragover</a></code> events. When the
  <code><a href=#datatransfer>DataTransfer</a></code> object is created, the <code title=dom-DataTransfer-effectAllowed><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>drag data store</a>'s <a href=#drag-data-store-mode title="drag data store mode">mode</a> is the <a href=#concept-dnd-rw title=concept-dnd-rw>read/write mode</a> and the new value is
  one of "<code title="">none</code>", "<code title="">copy</code>",
  "<code title="">copyLink</code>", "<code title="">copyMove</code>",
  "<code title="">link</code>", "<code title="">linkMove</code>",
  "<code title="">move</code>", "<code title="">all</code>", or "<code title="">uninitialized</code>", then the attribute's current value
  must be set to the new value. Otherwise it must be left
  unchanged.</p>

  <p>The <dfn id=dom-datatransfer-items title=dom-DataTransfer-items><code>items</code></dfn>
  attribute must return a <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object
  associated with the <code><a href=#datatransfer>DataTransfer</a></code> object. The same
  object must be returned each time.</p>

  <p>The <dfn id=dom-datatransfer-setdragimage title=dom-DataTransfer-setDragImage><code>setDragImage(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method must run the following
  steps:</p>

  <ol><li><p>If the <code><a href=#datatransfer>DataTransfer</a></code> object is no longer
   associated with a <a href=#drag-data-store>drag data store</a>, abort these steps.
   Nothing happens.</li>

   <li><p>If the <a href=#drag-data-store>drag data store</a>'s <a href=#drag-data-store-mode title="drag data
   store mode">mode</a> is not the <a href=#concept-dnd-rw title=concept-dnd-rw>read/write mode</a>, abort these steps.
   Nothing happens.</li>

   <li><p>If the <var title="">element</var> argument is an
   <code><a href=#the-img-element>img</a></code> element, then set the <a href=#drag-data-store-bitmap>drag data store
   bitmap</a> to the element's image (at its intrinsic size);
   otherwise, set the <a href=#drag-data-store-bitmap>drag data store bitmap</a> to an image
   generated from the given element (the exact mechanism for doing so
   is not currently specified).</li>

   <li><p>Set the <a href=#drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate</a> to
   the given <var title="">x</var>, <var title="">y</var>
   coordinate.</li>

  </ol><p>The <dfn id=dom-datatransfer-types title=dom-DataTransfer-types><code>types</code></dfn>
  attribute must return a <a href=#live>live</a> <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array giving the
  strings that the following steps would produce. The same object must
  be returned each time.</p>

  <ol><li><p>Start with an empty list <var title="">L</var>.</li>

   <li><p>If the <code><a href=#datatransfer>DataTransfer</a></code> object is no longer
   associated with a <a href=#drag-data-store>drag data store</a>, the array is empty.
   Abort these steps; return the empty list <var title="">L</var>.</li>

   <li><p>For each item in the <a href=#drag-data-store-item-list>drag data store item list</a>
   <!-- in some order...? --> whose <a href=#the-drag-data-item-kind title="the drag data item
   kind">kind</a> is <i>Plain Unicode string</i>, add an entry to
   the list <var title="">L</var> consisting of the item's <a href=#the-drag-data-item-type-string title="the drag data item type string">type string</a>.</li>

   <li><p>If there are any items in the <a href=#drag-data-store-item-list>drag data store item
   list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a>
   is <i><a href=#file>File</a></i>, then add an entry to the list <var title="">L</var>
   consisting of the string "<code title="">Files</code>". (This value
   can be distinguished from the other values because it is not
   lowercase.)</li>

   <!-- <li><p>Sort the list...?</p></li> -->

   <li><p>The strings produced by these steps are those in the list
   <var title="">L</var>.</li>

  </ol><p>The <dfn id=dom-datatransfer-getdata title=dom-DataTransfer-getData><code>getData(<var title="">format</var>)</code></dfn> method
  must run the following steps:</p>

  <ol><li><p>If the <code><a href=#datatransfer>DataTransfer</a></code> object is no longer
   associated with a <a href=#drag-data-store>drag data store</a>, return the empty
   string and abort these steps.</li>

   <li><p>If the <a href=#drag-data-store>drag data store</a>'s <a href=#drag-data-store-mode title="drag data
   store mode">mode</a> is the <a href=#concept-dnd-p title=concept-dnd-p>protected mode</a>, return the empty
   string and abort these steps.</li>

   <li><p>Let <var title="">format</var> be the first argument,
   <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>

   <li><p>Let <var title="">convert-to-URL</var> be false.</li>

   <li><p>If <var title="">format</var> equals "<code title="">text</code>", change it to "<code title="">text/plain</code>".</li>

   <li><p>If <var title="">format</var> equals "<code title="">url</code>", change it to "<code title="">text/uri-list</code>" and set <var title="">convert-to-URL</var> to true.</li>

   <li><p>If there is no item in the <a href=#drag-data-store-item-list>drag data store item
   list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a>
   is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string title="the drag data
   item type string">type string</a> is equal to <var title="">format</var>, return the empty string and abort these
   steps.</li>

   <li><p>Let <var title="">result</var> be the data of the item
   in the <a href=#drag-data-store-item-list>drag data store item list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a> is <i>Plain Unicode
   string</i> and whose <a href=#the-drag-data-item-type-string title="the drag data item type
   string">type string</a> is equal to <var title="">format</var>.</li>

   <li><p>If <var title="">convert-to-URL</var> is true, then parse
   <var title="">result</var> as appropriate for <code title="">text/uri-list</code> data, and then set <var title="">result</var> to the first URL from the list, if any, or
   the empty string otherwise. <a href=#refsRFC2483>[RFC2483]</a></li>

   <li><p>Return <var title="">result</var>.</li>

  </ol><p>The <dfn id=dom-datatransfer-setdata title=dom-DataTransfer-setData><code>setData(<var title="">format</var>, <var title="">data</var>)</code></dfn> method
  must run the following steps:</p>

  <ol><li><p>If the <code><a href=#datatransfer>DataTransfer</a></code> object is no longer
   associated with a <a href=#drag-data-store>drag data store</a>, abort these steps.
   Nothing happens.</li>

   <li><p>If the <a href=#drag-data-store>drag data store</a>'s <a href=#drag-data-store-mode title="drag data
   store mode">mode</a> is not the <a href=#concept-dnd-rw title=concept-dnd-rw>read/write mode</a>, abort these steps.
   Nothing happens.</li>

   <li><p>Let <var title="">format</var> be the first argument,
   <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>

   <li>

    <p>If <var title="">format</var> equals "<code title="">text</code>", change it to "<code title="">text/plain</code>".</p>

    <p>If <var title="">format</var> equals "<code title="">url</code>", change it to "<code title="">text/uri-list</code>".</p>

   </li>

   <li><p>Remove the item in the <a href=#drag-data-store-item-list>drag data store item
   list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a>
   is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string title="the drag data
   item type string">type string</a> is equal to <var title="">format</var>, if there is one.</li>

   <li><p>Add an item to the <a href=#drag-data-store-item-list>drag data store item list</a>
   whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a> is <i>Plain
   Unicode string</i>, whose <a href=#the-drag-data-item-type-string title="the drag data item type
   string">type string</a> is equal to <var title="">format</var>,
   and whose data is the string given by the method's second
   argument.</li>

  </ol><p>The <dfn id=dom-datatransfer-cleardata title=dom-DataTransfer-clearData><code>clearData()</code></dfn>
  method must run the following steps:</p>

  <ol><li><p>If the <code><a href=#datatransfer>DataTransfer</a></code> object is no longer
   associated with a <a href=#drag-data-store>drag data store</a>, abort these steps.
   Nothing happens.</li>

   <li><p>If the <a href=#drag-data-store>drag data store</a>'s <a href=#drag-data-store-mode title="drag data
   store mode">mode</a> is not the <a href=#concept-dnd-rw title=concept-dnd-rw>read/write mode</a>, abort these steps.
   Nothing happens.</li>

   <li><p>If the method was called with no arguments, remove each item
   in the <a href=#drag-data-store-item-list>drag data store item list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a> is <i>Plain Unicode
   string</i>, and abort these steps.</li>

   <li><p>Let <var title="">format</var> be the first argument,
   <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</li>

   <li>

    <p>If <var title="">format</var> equals "<code title="">text</code>", change it to "<code title="">text/plain</code>".</p>

    <p>If <var title="">format</var> equals "<code title="">url</code>", change it to "<code title="">text/uri-list</code>".</p>

   </li>

   <li><p>Remove the item in the <a href=#drag-data-store-item-list>drag data store item
   list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a>
   is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string title="the drag data
   item type string">type string</a> is equal to <var title="">format</var>, if there is one.</li>

  </ol><p class=note>The <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData()</a></code> method does
  not affect whether any files were included in the drag, so the <code title=dom-DataTransfer-types><a href=#dom-datatransfer-types>types</a></code> attribute's list might
  still not be empty after calling <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData()</a></code> (it would
  still contain the "<code title="">Files</code>" string if any files
  were included in the drag).</p>

  <p>The <dfn id=dom-datatransfer-files title=dom-DataTransfer-files><code>files</code></dfn>
  attribute must return a <a href=#live>live</a> <code><a href=#filelist>FileList</a></code>
  sequence consisting of <code><a href=#file>File</a></code> objects representing the
  files found by the following steps. The same object must be returned
  each time. Furthermore, for a given <code><a href=#filelist>FileList</a></code> object and
  a given underlying file, the same <code><a href=#file>File</a></code> object must be
  used each time.</p>

  <ol><li><p>Start with an empty list <var title="">L</var>.</li>

   <li><p>If the <code><a href=#datatransfer>DataTransfer</a></code> object is no longer
   associated with a <a href=#drag-data-store>drag data store</a>, the
   <code><a href=#filelist>FileList</a></code> is empty. Abort these steps; return the
   empty list <var title="">L</var>.</li>

   <li><p>If the <a href=#drag-data-store>drag data store</a>'s <a href=#drag-data-store-mode title="drag data
   store mode">mode</a> is the <a href=#concept-dnd-p title=concept-dnd-p>protected mode</a>, abort these steps;
   return the empty list <var title="">L</var>.</li>

   <li><p>For each item in the <a href=#drag-data-store-item-list>drag data store item list</a>
   <!-- in some order...? --> whose <a href=#the-drag-data-item-kind title="the drag data item
   kind">kind</a> is <i><a href=#file>File</a></i> <!-- DND-v3: (not <i>Blob</i>) -->,
   add the item's data (the file, in particular its name and contents,
   as well as its <a href=#the-drag-data-item-type-string title="the drag data item type
   string">type</a>) to the list <var title="">L</var>.</li>

   <!-- <li><p>Sort the list...?</p></li> -->

   <li><p>The files found by these steps are those in the list <var title="">L</var>.</li>

  </ol><p class=note>This version of the API does not expose the types of
  the files during the drag.</p>

  </div>


  <h5 id=the-datatransferitemlist-interface><span class=secno>8.7.3.1 </span>The <code><a href=#datatransferitemlist>DataTransferItemList</a></code> interface</h5>

  <p>Each <code><a href=#datatransfer>DataTransfer</a></code> object is associated with a
  <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object.</p>

  <pre class=idl>interface <dfn id=datatransferitemlist>DataTransferItemList</dfn> {
  readonly attribute unsigned long <a href=#dom-datatransferitemlist-length title=dom-DataTransferItemList-length>length</a>;
  <a href=#dom-datatransferitemlist-item title=dom-DataTransferItemList-item>getter</a> <a href=#datatransferitem>DataTransferItem</a> (unsigned long index);
  void <a href=#dom-datatransferitemlist-remove title=dom-DataTransferItemList-remove>remove</a>(unsigned long index);
  void <a href=#dom-datatransferitemlist-clear title=dom-DataTransferItemList-clear>clear</a>();

  <a href=#datatransferitem>DataTransferItem</a>? <a href=#dom-datatransferitemlist-add title=dom-DataTransferItemList-add>add</a>(DOMString data, DOMString type);<!--
DND-v3:  <span>DataTransferItem</span>? <span title="dom-DataTransferItemList-add">add</span>(<span>Blob</span> data);-->
  <a href=#datatransferitem>DataTransferItem</a>? <a href=#dom-datatransferitemlist-add title=dom-DataTransferItemList-add>add</a>(<a href=#file>File</a> data);<!--
DND-v4:  <span>DataTransferItem</span>? <span title="dom-DataTransferItemList-add">add</span>(any data, DOMString type);--><!--
DND-v5:  <span>DataTransferItem</span>? <span title="dom-DataTransferItemList-add">add</span>(<span>DataTransferPromise</span> data);-->
};</pre>

  <dl class=domintro><dt><var title="">items</var> . <code title=dom-DataTransferItemList-length><a href=#dom-datatransferitemlist-length>length</a></code></dt>

   <dd><p>Returns the number of items in the <a href=#drag-data-store>drag data store</a>.</dd>


   <dt><var title="">items</var>[<var title="">index</var>]</dt>

   <dd>

    <p>Returns the <code><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var title="">index</var>th entry in the <a href=#drag-data-store>drag data store</a>.</p>

   </dd>


   <dt><code title="">delete</code> <var title="">items</var>[<var title="">index</var>]</dt>

   <dd>

    <p>Removes the <var title="">index</var>th entry in the <a href=#drag-data-store>drag data store</a>.</p>

   </dd>


   <dt><var title="">items</var> . <code title=dom-DataTransferItemList-clear><a href=#dom-datatransferitemlist-clear>clear</a></code>()</dt>

   <dd>

    <p>Removes all the entries in the <a href=#drag-data-store>drag data store</a>.</p>

   </dd>


   <dt><var title="">items</var> . <code title=dom-DataTransferItemList-add><a href=#dom-datatransferitemlist-add>add</a></code>(<var title="">data</var>)</dt>
   <dt><var title="">items</var> . <code title=dom-DataTransferItemList-add><a href=#dom-datatransferitemlist-add>add</a></code>(<var title="">data</var>, <var title="">type</var>)</dt>

   <dd>

<!--CLEANUP-->

    <p>Adds a new entry for the given data to the <a href=#drag-data-store>drag data
    store</a>. If the data is plain text <!-- DND-v4: or an object -->
    then a <var title="">type</var> string has to be provided
    also.</p>

   </dd>

  </dl><div class=impl>

  <p>While the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object's
  <code><a href=#datatransfer>DataTransfer</a></code> object is associated with a <a href=#drag-data-store>drag
  data store</a>, the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object's
  <i>mode</i> is the same as the <a href=#drag-data-store-mode>drag data store mode</a>.
  When the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object's
  <code><a href=#datatransfer>DataTransfer</a></code> object is <em>not</em> associated with a
  <a href=#drag-data-store>drag data store</a>, the <code><a href=#datatransferitemlist>DataTransferItemList</a></code>
  object's <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store>drag
  data store</a> referenced in this section (which is used only
  when the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the
  <i>disabled mode</i>) is the <a href=#drag-data-store>drag data store</a> with which
  the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object's
  <code><a href=#datatransfer>DataTransfer</a></code> object is associated.</p>

  <p>The <dfn id=dom-datatransferitemlist-length title=dom-DataTransferItemList-length><code>length</code></dfn>
  attribute must return zero if the object is in the <i>disabled
  mode</i>; otherwise it must return the number of items in the
  <a href=#drag-data-store-item-list>drag data store item list</a>.</p>

  <p>When a <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the
  <i>disabled mode</i>, its <a href=#supported-property-indices>supported property indices</a>
  are the numbers in the range

    <span title="">0 .. <var title="">n</var>-1</span>,

  where <var title="">n</var> is the number of items in the <a href=#drag-data-store-item-list>drag
  data store item list</a>.</p>

  <p>To <dfn id=dom-datatransferitemlist-item title=dom-DataTransferItemList-item>determine the value of
  an indexed property</dfn> <var title="">i</var> of a
  <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object, the user agent must return a
  <code><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var title="">i</var>th item in the <a href=#drag-data-store>drag data store</a>. The
  same object must be returned each time a particular item is obtained
  from this <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object. The
  <code><a href=#datatransferitem>DataTransferItem</a></code> object must be associated with the
  same <code><a href=#datatransfer>DataTransfer</a></code> object as the
  <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object when it is first created.</p>

<!--CLEANUP--><!--MOVE this down below add() -->
  <p>The <dfn id=dom-datatransferitemlist-remove title=dom-DataTransferItemList-remove><code>remove()</code></dfn> method, when
  invoked with the argument <var title="">i</var>, must run these steps:</p>

  <ol><li><p>If the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the
   <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i>, throw an
   <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
   steps.</li>

   <li><p>Remove the <var title="">i</var>th item from the <a href=#drag-data-store>drag
   data store</a>.</li>

  </ol><p>The <dfn id=dom-datatransferitemlist-clear title=dom-DataTransferItemList-clear><code>clear</code></dfn> method,
  if the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object is in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i>, must remove all the
  items from the <a href=#drag-data-store>drag data store</a>. Otherwise, it must do
  nothing.</p>

  <p>The <dfn id=dom-datatransferitemlist-add title=dom-DataTransferItemList-add><code>add()</code></dfn> method
  must run the following steps:</p>

  <ol><li><p>If the <code><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the
   <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i>, return null and
   abort these steps.</li>

   <li>

    <p>Jump to the appropriate set of steps from the following list:</p>

    <dl class=switch><dt>If the first argument to the method is a string</dt>

     <dd>

      <p>If there is already an item in the <a href=#drag-data-store-item-list>drag data store item
      list</a> whose <a href=#the-drag-data-item-kind title="the drag data item
      kind">kind</a> is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string title="the drag data item type string">type string</a> is
      equal to the value of the method's second argument,
      <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, then throw a
      <code><a href=#notsupportederror>NotSupportedError</a></code> exception and abort these
      steps.</p>

      <p>Otherwise, add an item to the <a href=#drag-data-store-item-list>drag data store item
      list</a> whose <a href=#the-drag-data-item-kind title="the drag data item
      kind">kind</a> is <i>Plain Unicode string</i>, whose <a href=#the-drag-data-item-type-string title="the drag data item type string">type string</a> is
      equal to the value of the method's second argument,
      <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, and whose data is the
      string given by the method's first argument.</p>

     </dd>

<!--DND-v3:
     <dt>If the first argument to the method is a <code>Blob</code></dt>

     <dd>

      <p>Add an item to the <span>drag data store item list</span>
      whose <span title="the drag data item kind">kind</span> is
      <i>Blob</i>, whose <span title="the drag data item type
      string">type string</span> is the <code
      title="dom-Blob-type">type</code> of the <code>Blob</code>,
      <span>converted to ASCII lowercase</span>, and whose data is the
      same as the <code>Blob</code>'s data.</p>

     </dd>
-->

     <dt>If the first argument to the method is a <code><a href=#file>File</a></code></dt>

     <dd>

      <p>Add an item to the <a href=#drag-data-store-item-list>drag data store item list</a>
      whose <a href=#the-drag-data-item-kind title="the drag data item kind">kind</a> is
      <i><a href=#file>File</a></i>, whose <a href=#the-drag-data-item-type-string title="the drag data item type
      string">type string</a> is the <code title=dom-Blob-type>type</code> of the <code><a href=#file>File</a></code>,
      <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, and whose data is the
      same as the <code><a href=#file>File</a></code>'s data.</p>

     </dd>

<!--DND-v4: (might want to prevent duplicates like for strings; see above)
[make sure that the cloning happens before any side-effects can happen]
     <dt>Otherwise

     <dd>

      <p>Add an item to the <span>drag data store item list</span>
      whose <span title="the drag data item kind">kind</span> is
      <i>Object</i>, whose <span title="the drag data item type
      string">type string</span> is equal to the value of the method's
      second argument, <span>converted to ASCII lowercase</span>, and
      whose data is a <span>structured clone</span> of the method's
      first argument. If creating the clone throws an exception, then
      throw that exception and abort these steps.</p>

     </dd>
-->

    </dl></li>

   <li><p><a href=#dom-datatransferitemlist-item title=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><a href=#datatransferitem>DataTransferItem</a></code> object).</li>

  </ol></div>


  <h5 id=the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code><a href=#datatransferitem>DataTransferItem</a></code> interface</h5>

  <p>Each <code><a href=#datatransferitem>DataTransferItem</a></code> object is associated with a
  <code><a href=#datatransfer>DataTransfer</a></code> object.</p>

  <pre class=idl>interface <dfn id=datatransferitem>DataTransferItem</dfn> {
  readonly attribute DOMString <a href=#dom-datatransferitem-kind title=dom-DataTransferItem-kind>kind</a>;
  readonly attribute DOMString <a href=#dom-datatransferitem-type title=dom-DataTransferItem-type>type</a>;
  void <a href=#dom-datatransferitem-getasstring title=dom-DataTransferItem-getAsString>getAsString</a>(<a href=#functionstringcallback>FunctionStringCallback</a>? _callback);<!--
DND-v3:  <span>Blob</span> <span title="dom-DataTransferItem-getAsBlob">getAsBlob</span>();-->
  <a href=#file>File</a>? <a href=#dom-datatransferitem-getasfile title=dom-DataTransferItem-getAsFile>getAsFile</a>();<!--
DND-v4:  void <span title="dom-DataTransferItem-getAsObject">getAsObject</span>(<span>FunctionObjectCallback</span> _callback);-->
};

callback <dfn id=functionstringcallback>FunctionStringCallback</dfn> void (DOMString data);<!--

// DND-v4:
callback <dfn>FunctionObjectCallback</dfn> void (any data);--></pre>

  <dl class=domintro><dt><var title="">item</var> . <code title=dom-DataTransferItem-kind><a href=#dom-datatransferitem-kind>kind</a></code></dt>
   <dd>

    <p>Returns <a href=#the-drag-data-item-kind>the drag data item kind</a>, one of: "string",
    <!-- DND-v3: "blob", --> "file"<!-- DND-v4: , "object" -->.</p>

   </dd>

   <dt><var title="">item</var> . <code title=dom-DataTransferItem-type><a href=#dom-datatransferitem-type>type</a></code></dt>
   <dd>

    <p>Returns <a href=#the-drag-data-item-type-string>the drag data item type string</a>.</p>

   </dd>

   <dt><var title="">item</var> . <code title=dom-DataTransferItem-getAsString><a href=#dom-datatransferitem-getasstring>getAsString</a></code>(<var title="">callback</var>)</dt>
   <dd>

    <p>Invokes the callback with the string data as the argument, if <a href=#the-drag-data-item-kind>the drag data item kind</a> is <i>Plain Unicode string</i>.</p>

   </dd>

<!-- DND-v3:
   <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsBlob">getAsBlob</code>()</dt>
   <dd>

    <p>Returns a <code>Blob</code> object, if <span>the drag data item kind</span> is <i>Blob</i> or <i>File</i>.</p>

   </dd>
-->

   <dt><var title="">file</var> = <var title="">item</var> . <code title=dom-DataTransferItem-getAsFile><a href=#dom-datatransferitem-getasfile>getAsFile</a></code>()</dt>
   <dd>

    <p>Returns a <code><a href=#file>File</a></code> object, if <a href=#the-drag-data-item-kind>the drag data item kind</a> is <i><a href=#file>File</a></i>.</p>

   </dd>

<!-- DND-v4:
   <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsObject">getAsObject</code>()</dt>
   <dd>

    <p>Invokes the callback with the cloned object data as the argument, if <span>the drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>

   </dd>
-->

  </dl><div class=impl>

  <p>While the <code><a href=#datatransferitem>DataTransferItem</a></code> object's
  <code><a href=#datatransfer>DataTransfer</a></code> object is associated with a <a href=#drag-data-store>drag
  data store</a> and that <a href=#drag-data-store>drag data store</a>'s <a href=#drag-data-store-item-list>drag
  data store item list</a> still contains the item that the
  <code><a href=#datatransferitem>DataTransferItem</a></code> object represents, the
  <code><a href=#datatransferitem>DataTransferItem</a></code> object's <i>mode</i> is the same as
  the <a href=#drag-data-store-mode>drag data store mode</a>. When the
  <code><a href=#datatransferitem>DataTransferItem</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
  object is <em>not</em> associated with a <a href=#drag-data-store>drag data
  store</a>, or if the item that the <code><a href=#datatransferitem>DataTransferItem</a></code>
  object represents has been removed from the relevant <a href=#drag-data-store-item-list>drag data
  store item list</a>, the <code><a href=#datatransferitem>DataTransferItem</a></code> object's
  <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store>drag data
  store</a> referenced in this section (which is used only when the
  <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i>disabled
  mode</i>) is the <a href=#drag-data-store>drag data store</a> with which the
  <code><a href=#datatransferitem>DataTransferItem</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
  object is associated.</p>

  <p>The <dfn id=dom-datatransferitem-kind title=dom-DataTransferItem-kind><code>kind</code></dfn> attribute
  must return the empty string if the <code><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>the
  drag data item kind</a> of the item represented by the
  <code><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 title="">string</code>"
<!-- DND-v3:    <tr> <td> <i>Blob</i> <td> "<code title="">blob</code>"-->
    <tr><td> <i><a href=#file>File</a></i> <td> "<code title="">file</code>"
<!-- DND-v4:    <tr> <td> <i>Object</i> <td> "<code title="">object</code>"-->
  </table><p>The <dfn id=dom-datatransferitem-type title=dom-DataTransferItem-type><code>type</code></dfn> attribute
  must return the empty string if the <code><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>the drag data item type string</a> of the item represented
  by the <code><a href=#datatransferitem>DataTransferItem</a></code> object.</p>

  <p>The <dfn id=dom-datatransferitem-getasstring title=dom-DataTransferItem-getAsString><code>getAsString(<var title="">callback</var>)</code></dfn> method must run the following
  steps:</p>

  <ol><li><p>If the <var title="">callback</var> is null, abort these
   steps.</li>

   <li><p>If the <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i title=concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>, abort these steps. The
   callback is never invoked.</li>

   <li><p>If <a href=#the-drag-data-item-kind>the drag data item kind</a> is not <i>Plain
   Unicode string</i>, abort these steps. The callback is never
   invoked.</li>

   <li><p>Otherwise, <a href=#queue-a-task>queue a task</a> to invoke <var title="">callback</var>, passing the actual data of the item
   represented by the <code><a href=#datatransferitem>DataTransferItem</a></code> object as the
   argument.</li>

  </ol><!--DND-v3:
  <p>The <dfn
  title="dom-DataTransferItem-getAsBlob"><code>getAsBlob()</code></dfn>
  method must run the following steps:</p>

  <ol>

   <li><p>If the <code>DataTransferItem</code> object is not in the <i
   title="concept-dnd-rw">read/write mode</i> or the <i
   title="concept-dnd-ro">read-only mode</i>, return null and abort
   these steps.</p></li>

   <li>

--><!--DND-v4:
    <p>If <span>the drag data item kind</span> is <i>Object</i>,
    return null.</p></li>
--><!--DND-v3:

    <p>If <span>the drag data item kind</span> is <i>File</i>, then
    return a new <code>File</code> object representing the actual data
    of the item represented by the <code>DataTransferItem</code>
    object.</p>

    <p>If <span>the drag data item kind</span> is <i>Unicode Data
    string</i>, then return a new <code>Blob</code> object
    representing the actual data of the item represented by the
    <code>DataTransferItem</code> object, with the <code
    title="dom-Blob-type">type</code> of the <code>Blob</code> being
    <span>the drag data item type string</span> and with the binary
    data of the <code>Blob</code> object being the Unicode string
    encoded as UTF-8. <a href="#refsRFC3629">[RFC3629]</a></p>

    <p>Otherwise, <span>the drag data item kind</span> is <i>Blob</i>;
    return a new <code>Blob</code> object representing the actual data
    of the item represented by the <code>DataTransferItem</code>
    object.</p>

   </li>

  </ol>
--><p>The <dfn id=dom-datatransferitem-getasfile title=dom-DataTransferItem-getAsFile><code>getAsFile()</code></dfn>
  method must run the following steps:</p>

  <ol><li><p>If the <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i title=concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>, return null and abort
   these steps.</li>

   <li><p>If <a href=#the-drag-data-item-kind>the drag data item kind</a> is not <i><a href=#file>File</a></i>,
   then return null and abort these steps.</li>

   <li><p>Return a new <code><a href=#file>File</a></code> object representing the
   actual data of the item represented by the
   <code><a href=#datatransferitem>DataTransferItem</a></code> object.</p>

  </ol><!--DND-v4:
  <p>The <dfn
  title="dom-DataTransferItem-getAsObject"><code>getAsObject(<var
  title="">callback</var>)</code></dfn> method must run the following
  steps:</p>

  <ol>

   <li><p>If the <code>DataTransferItem</code> object is not in the <i
   title="concept-dnd-rw">read/write mode</i> or the <i
   title="concept-dnd-ro">read-only mode</i>, return null and abort
   these steps.</p></li>

   <li>

    <p>Let <var title="">data</var> be the actual data of the item
    represented by the <code>DataTransferItem</code> object.</p>

    <p>If <span>the drag data item kind</span> is <i>Unicode Data
    string</i>, then <var title="">data</var> is a <code
    title="">DOMString</code> containing the actual data.</p>

    <p>If <span>the drag data item kind</span> is <i>Blob</i>, then
    <var title="">data</var> is a <code>Blob</code> representing the
    actual data.</p>

    <p>If <span>the drag data item kind</span> is <i>File</i>, then
    <var title="">data</var> is a <code>File</code> representing the
    actual data.</p>

    <p>If <span>the drag data item kind</span> is <i>Object</i>, then
    <var title="">data</var> is the object that is the actual
    data.</p>

   </li>

   <li><span>Queue a task</span> to invoke <var
   title="">callback</var>, passing a <span>structured clone</span> of
   <var title="">data</var> as the argument.</p></li>

  </ol>
--></div>



  <h4 id=the-dragevent-interface><span class=secno>8.7.4 </span>The <code><a href=#dragevent>DragEvent</a></code> interface</h4>

  <p>The drag-and-drop processing model involves several events. They
  all use the <code><a href=#dragevent>DragEvent</a></code> interface.</p>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#drageventinit>DragEventInit</a> eventInitDict)]
interface <dfn id=dragevent>DragEvent</dfn> : <a href=#mouseevent>MouseEvent</a> {
  readonly attribute <a href=#datatransfer>DataTransfer</a>? <a href=#dom-dragevent-datatransfer title=dom-DragEvent-dataTransfer>dataTransfer</a>;
};

dictionary <dfn id=drageventinit>DragEventInit</dfn> : <a href=#mouseeventinit>MouseEventInit</a> {
  <a href=#datatransfer>DataTransfer</a>? dataTransfer;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#datatransfer>DataTransfer</a></code> object for the event.</p>

   </dd>

  </dl><p class=note>Although, for consistency with other event interfaces, the <code><a href=#dragevent>DragEvent</a></code>
  interface has a constructor, it is not particularly useful. In particular, there's no way to
  create a useful <code><a href=#datatransfer>DataTransfer</a></code> object from script, as <code><a href=#datatransfer>DataTransfer</a></code> objects
  have a processing and security model that is coordinated by the browser during drag-and-drops.</p>

  <div class=impl>

  <p>The <dfn id=dom-dragevent-datatransfer title=dom-DragEvent-dataTransfer><code>dataTransfer</code></dfn> attribute of the
  <code><a href=#dragevent>DragEvent</a></code> interface must return the value it was initialized to. When the object is
  created, this attribute must be initialized to null. It represents the context information for the
  event.</p>

  </div>

  <div class=impl>

  <p>When a user agent is required to <dfn id=fire-a-dnd-event>fire a DND event</dfn> named <var title="">e</var> at an
  element, using a particular <a href=#drag-data-store>drag data store</a>, the user agent must run the following
  steps:</p>

  <ol><li>

    <p>If <var title="">e</var> is <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code>, set the
    <a href=#drag-data-store-mode>drag data store mode</a> to the <a href=#concept-dnd-rw title=concept-dnd-rw>read/write
    mode</a>.</p>

    <p>If <var title="">e</var> is <code title=event-drop><a href=#event-drop>drop</a></code>, set the <a href=#drag-data-store-mode>drag data
    store mode</a> to the <a href=#concept-dnd-ro title=concept-dnd-ro>read-only mode</a>.</p>

   </li>

   <li><p>Let <var title="">dataTransfer</var> be a newly created <code><a href=#datatransfer>DataTransfer</a></code> object
   associated with the given <a href=#drag-data-store>drag data store</a>.</li>

   <li><p id=effectAllowed-initialization>Set the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute to the <a href=#drag-data-store>drag data
   store</a>'s <a href=#drag-data-store-allowed-effects-state>drag data store allowed effects state</a>.</li>

   <li>

    <p id=dropEffect-initialization>Set the <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute to "<code title="">none</code>"
    if <var title="">e</var> is <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code>, <code title=event-drag><a href=#event-drag>drag</a></code>, <code title=event-dragexit><a href=#event-dragexit>dragexit</a></code>, or <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code>; to the value corresponding to the <a href=#current-drag-operation>current drag
    operation</a> if <var title="">e</var> is <code title=event-drop><a href=#event-drop>drop</a></code> or <code title=event-dragend><a href=#event-dragend>dragend</a></code>; and to a value based on the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute's value and the
    drag-and-drop source, as given by the following table, otherwise (i.e. if <var title="">e</var>
    is <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> or <code title=event-dragover><a href=#event-dragover>dragover</a></code>):</p>

    <table><thead><tr><th><code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code></th>
       <th><code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code></th>
      </thead><tr><td>"<code title="">none</code>"</td>
      <td>"<code title="">none</code>"</td>
     <tr><td>"<code title="">copy</code>"</td>
      <td>"<code title="">copy</code>"</td>
     <tr><td>"<code title="">copyLink</code>"</td>
      <td>"<code title="">copy</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, "<code title="">link</code>"</td>
     <tr><td>"<code title="">copyMove</code>"</td>
      <td>"<code title="">copy</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, "<code title="">move</code>"</td>
     <tr><td>"<code title="">all</code>"</td>
      <td>"<code title="">copy</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, either "<code title="">link</code>" or "<code title="">move</code>"</td>
     <tr><td>"<code title="">link</code>"</td>
      <td>"<code title="">link</code>"</td>
     <tr><td>"<code title="">linkMove</code>"</td>
      <td>"<code title="">link</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, "<code title="">move</code>"</td>
     <tr><td>"<code title="">move</code>"</td>
      <td>"<code title="">move</code>"</td>
     <tr><td>"<code title="">uninitialized</code>" when what is being dragged is a selection from a text field</td>
      <td>"<code title="">move</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, either "<code title="">copy</code>" or "<code title="">link</code>"</td>
     <tr><td>"<code title="">uninitialized</code>" when what is being dragged is a selection</td>
      <td>"<code title="">copy</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, either "<code title="">link</code>" or "<code title="">move</code>"</td>
     <tr><td>"<code title="">uninitialized</code>" when what is being dragged is an <code><a href=#the-a-element>a</a></code> element with an <code>href</code> attribute</td>
      <td>"<code title="">link</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, either "<code title="">copy</code>" or "<code title="">move</code>"</td>
     <tr><td>Any other case</td>
      <td>"<code title="">copy</code>", or, <a href=#concept-platform-dropeffect-override title=concept-platform-dropEffect-override>if appropriate</a>, either "<code title="">link</code>" or "<code title="">move</code>"</td>
     </table><p>Where the table above provides <dfn id=concept-platform-dropeffect-override title=concept-platform-dropEffect-override>possibly
    appropriate alternatives</dfn>, user agents may instead use the listed alternative values if
    platform conventions dictate that the user has requested those alternate effects.</p>

    <p class=example>For example, Windows platform conventions are such that dragging while
    holding the "alt" key indicates a preference for linking the data, rather than moving or copying
    it. Therefore, on a Windows system, if "<code title="">link</code>" is an option according to
    the table above while the "alt" key is depressed, the user agent could select that instead of
    "<code title="">copy</code>" or "<code title="">move</code>".</p>

   </li>

   <li>

    <p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code><a href=#dragevent>DragEvent</a></code> object
    and initialize it to have the given name <var title="">e</var>, to bubble, to be cancelable
    unless <var title="">e</var> is <code title=event-dragexit><a href=#event-dragexit>dragexit</a></code>, <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code>, or <code title=event-dragend><a href=#event-dragend>dragend</a></code>, and to
    have the <code title=dom-UIEvent-detail><a href=#dom-uievent-detail>detail</a></code> attribute initialized to zero, the mouse
    and key attributes initialized according to the state of the input devices as they would be for
    user interaction events, the <code title="">relatedTarget</code> attribute initialized to null,
    and the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> attribute initialized to
    <var title="">dataTransfer</var>, the <code><a href=#datatransfer>DataTransfer</a></code> object created above.</p>

    <!-- interaction event spec point -->

    <p>If there is no relevant pointing device, the object must have its <code title="">screenX</code>, <code title="">screenY</code>, <code title="">clientX</code>, <code title="">clientY</code>, and <code title="">button</code> attributes set to 0.</p>

   </li>

   <li><p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> the newly created
   <code><a href=#dragevent>DragEvent</a></code> object at the specified target element.</li>

   <li><p>Set the <a href=#drag-data-store-allowed-effects-state>drag data store allowed effects state</a> to the current value of <var title="">dataTransfer</var>'s <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
   attribute. (It can only have changed value if <var title="">e</var> is <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code>.)</li>

   <li><p>Set the <a href=#drag-data-store-mode>drag data store mode</a> back to the <a href=#concept-dnd-p title=concept-dnd-p>protected mode</a> if it was changed in the first step.</li>

   <li><p>Break the association between <var title="">dataTransfer</var> and the <a href=#drag-data-store>drag data
   store</a>.</li>

  </ol></div>


  <div class=impl>

  <h4 id=drag-and-drop-processing-model><span class=secno>8.7.5 </span>Drag-and-drop processing model</h4>

  <p>When the user attempts to begin a drag operation, the user agent must run the following steps.
  User agents must act as if these steps were run even if the drag actually started in another
  document or application and the user agent was not aware that the drag was occurring until it
  intersected with a document under the user agent's purview.</p>

  <ol><li>

    <p>Determine what is being dragged, as follows:</p>

    <p>If the drag operation was invoked on a selection, then it is the selection that is being
    dragged.</p>

    <p>Otherwise, if the drag operation was invoked on a <code><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 title=dom-draggable><a href=#dom-draggable>draggable</a></code> set to true. If there is no such
    element, then nothing is being dragged; abort these steps, the drag-and-drop operation is never
    started.</p>

    <p>Otherwise, the drag operation was invoked outside the user agent's purview. What is being
    dragged is defined by the document or application where the drag was started.</p>

    <p class=note><code><a href=#the-img-element>img</a></code> elements and <code><a href=#the-a-element>a</a></code> elements with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute have their <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> attribute set to true by default.</p>

   </li>

   <li><p><a href=#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>drag data store</a>.</li>

   <li>

    <p>Establish which DOM node is the <dfn id=source-node>source node</dfn>, as follows:</p>

    <p>If it is a selection that is being dragged, then the <a href=#source-node>source node</a> is the
    <code><a href=#text>Text</a></code> node that the user started the drag on (typically the <code><a href=#text>Text</a></code> node
    that the user originally clicked). If the user did not specify a particular node, for example if
    the user just told the user agent to begin a drag of "the selection", then the <a href=#source-node>source
    node</a> is the first <code><a href=#text>Text</a></code> node containing a part of the selection.</p>

    <p>Otherwise, if it is an element that is being dragged, then the <a href=#source-node>source node</a> is
    the element that is being dragged.</p>

    <p>Otherwise, the <a href=#source-node>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>source node</a> in this case,
    the user agent must instead follow the platform-specific conventions relevant to that
    situation.</p>

    <p class=note>Multiple events are fired on the <a href=#source-node>source node</a> during the course of
    the drag-and-drop operation.</p>

   </li>

   <li>

    <p>Determine the <dfn id=list-of-dragged-nodes>list of dragged nodes</dfn>, as follows:</p>

    <p>If it is a selection that is being dragged, then the <a href=#list-of-dragged-nodes>list of dragged nodes</a>
    contains, in <a href=#tree-order>tree order</a>, every node that is partially or completely included in the
    selection (including all their ancestors).</p>

    <p>Otherwise, the <a href=#list-of-dragged-nodes>list of dragged nodes</a> contains only the <a href=#source-node>source node</a>,
    if any.</p>

   </li>

   <li>

    <p>If it is a selection that is being dragged, then add an item to the <a href=#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>The drag data item type string</a>
     <dd>"<code>text/plain</code>"</dd>

     <dt><a href=#the-drag-data-item-kind>The drag data item kind</a>
     <dd><i>Plain Unicode string</i></dd>

     <dt>The actual data</dt>
     <dd>The text of the selection</dd>

    </dl><p>Otherwise, if any files are being dragged, then add one item per file to the <a href=#drag-data-store-item-list>drag data
    store item list</a>, with their properties set as follows:</p>

    <dl><dt><a href=#the-drag-data-item-type-string>The drag data item type string</a>
     <dd>The MIME type of the file, if known, or "<code>application/octet-stream</code>" otherwise.</dd>

     <dt><a href=#the-drag-data-item-kind>The drag data item kind</a>
     <dd><i><a href=#file>File</a></i></dd>

     <dt>The actual data</dt>
     <dd>The file's contents and name.</dd>

    </dl><p class=note>Dragging files can currently only happen from outside a <a href=#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>drag data store item list</a> as appropriate for the data being dragged, honoring
    platform conventions where appropriate; however, if the platform conventions do not use <a href=#mime-type title="MIME type">MIME types</a> to label dragged data, the user agent must make a
    best-effort attempt to map the types to MIME types, and, in any case, all the <a href=#the-drag-data-item-type-string title="the
    drag data item type string">drag data item type strings</a> must be <a href=#converted-to-ascii-lowercase>converted to ASCII
    lowercase</a>.</p>

    <p>User agents may also add one or more items representing the selection or dragged element(s)
    in other forms, e.g. as HTML.</p>

   </li>

   <!-- DND-v2: text/html as an export format -->

   <li>

    <p>If the <a href=#list-of-dragged-nodes>list of dragged nodes</a> is not empty, then <a href=#extracting-json title="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>drag data store item list</a>, with its properties set as follows:</p>

    <dl><dt><a href=#the-drag-data-item-type-string>The drag data item type string</a>
     <dd><code><a href=#application/microdata+json>application/microdata+json</a></code></dd>

     <dt><a href=#the-drag-data-item-kind>The drag data item kind</a>
     <dd><i>Plain Unicode string</i></dd>

     <dt>The actual data</dt>
     <dd>The resulting JSON string.</dd>

    </dl></li>

   <li>

    <p>Run the following substeps:</p>

    <ol><li><p>Let <var title="">urls</var> be an empty list of <a href=#absolute-url title="absolute URL">absolute
     URLs</a>.</li>

     <li>

      <p>For each <var title="">node</var> in the <a href=#list-of-dragged-nodes>list of dragged nodes</a>:</p>

      <dl><dt>If the node is an <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</dt>

       <dd>Add to <var title="">urls</var> the result of <a href=#resolve-a-url title="resolve a
       url">resolving</a> the element's <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content
       attribute relative to the element.</dd>

       <dt>If the node is an <code><a href=#the-img-element>img</a></code> element with a <code title=attr-img-src><a href=#attr-img-src>src</a></code>
       attribute</dt>

       <dd>Add to <var title="">urls</var> the result of <a href=#resolve-a-url title="resolve a
       url">resolving</a> the element's <code title=attr-img-src><a href=#attr-img-src>src</a></code> content attribute
       relative to the element.</dd>

       <!-- DND-v2: more -->

      </dl></li>

     <li><p>If <var title="">urls</var> is still empty, abort these substeps.</li>

     <li><p>Let <var title="">url string</var> be the result of concatenating the strings in <var title="">urls</var>, in the order they were added, separated by a U+000D CARRIAGE RETURN U+000A
     LINE FEED character pair (CRLF).</li>

     <li><p>Add one item to the <a href=#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>The drag data item type string</a>
       <dd><code>text/uri-list</code></dd>

       <dt><a href=#the-drag-data-item-kind>The drag data item kind</a>
       <dd><i>Plain Unicode string</i></dd>

       <dt>The actual data</dt>
       <dd><var title="">url string</var></dd>

      </dl></li>

    </ol></li>

   <li>

    <p>Update the <a href=#drag-data-store-default-feedback>drag data store default feedback</a> as appropriate for the user agent
    (if the user is dragging the selection, then the selection would likely be the basis for this
    feedback; if the user is dragging an element, then that element's rendering would be used; if
    the drag began outside the user agent, then the platform conventions for determining the drag
    feedback should be used).</p>

   </li>

   <li>

    <p><a href=#fire-a-dnd-event>Fire a DND event</a> named <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> at the
    <a href=#source-node>source node</a>.</p>

    <p>If the event is canceled, then the drag-and-drop operation should not occur; abort these
    steps.</p> <!-- only a should because the UA can always allow the user to drag without the page
    knowing -->

    <p class=note>Since events with no event listeners registered are, almost by definition, never
    canceled, drag-and-drop is always available to the user if the author does not specifically
    prevent it.</p>

   </li>

   <li>

    <p><a href=#initiate-the-drag-and-drop-operation>Initiate the drag-and-drop operation</a> in a manner consistent with platform
    conventions, and as described below.</p>

    <p id=base-dnd-feedback>The drag-and-drop feedback must be generated from the first of the
    following sources that is available:</p>

    <ol><li>The <a href=#drag-data-store-bitmap>drag data store bitmap</a>, if any. In this case, the <a href=#drag-data-store-hot-spot-coordinate>drag data store
     hot spot coordinate</a> should be used as hints for where to put the cursor relative to the
     resulting image. The values are expressed as distances in CSS pixels from the left side and
     from the top side of the image respectively. <a href=#refsCSS>[CSS]</a></li>

     <li>The <a href=#drag-data-store-default-feedback>drag data store default feedback</a>.</li>

    </ol></li>

  </ol><p>From the moment that the user agent is to <dfn id=initiate-the-drag-and-drop-operation>initiate the drag-and-drop operation</dfn>,
  until the end of the drag-and-drop operation, device input events (e.g. mouse and keyboard events)
  must be suppressed.</p>

  <p>During the drag operation, the element directly indicated by the user as the drop target is
  called the <dfn id=immediate-user-selection>immediate user selection</dfn>. (Only elements can be selected by the user; other
  nodes must not be made available as drop targets.) However, the <a href=#immediate-user-selection>immediate user
  selection</a> is not necessarily the <dfn id=current-target-element>current target element</dfn>, which is the element
  currently selected for the drop part of the drag-and-drop operation.</p>

  <p>The <a href=#immediate-user-selection>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>current target element</a> changes when the <a href=#immediate-user-selection>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>current target element</a> and the <a href=#immediate-user-selection>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>current target element</a> is initially null.</p>

  <p>In addition, there is also a <dfn id=current-drag-operation>current drag operation</dfn>, which can take on the values
  "<code title="">none</code>", "<code title="">copy</code>", "<code title="">link</code>", and
  "<code title="">move</code>". Initially, it has the value "<code title="">none</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 title="initiate the drag-and-drop
  operation">initiated</a> and every 350ms (&plusmn;200ms) thereafter for as long as the drag
  operation is ongoing, <a href=#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>

   <li>

    <p><a href=#fire-a-dnd-event>Fire a DND event</a> named <code title=event-drag><a href=#event-drag>drag</a></code> at the
    <a href=#source-node>source node</a>. If this event is canceled, the user agent must set the <a href=#current-drag-operation>current
    drag operation</a> to "<code title="">none</code>" (no drag operation).</p>

   </li>

   <li>

    <p>If the <code title=event-drag><a href=#event-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>immediate user selection</a> than during the
      last iteration (or if this is the first iteration), and if this <a href=#immediate-user-selection>immediate user
      selection</a> is not the same as the <a href=#current-target-element>current target element</a>, then <a href=#fire-a-dnd-event>fire a
      DND event</a> named <code title=event-dragexit><a href=#event-dragexit>dragexit</a></code> at the <a href=#current-target-element>current
      target element</a>, and then update the <a href=#current-target-element>current target element</a> as follows:</p>

      <dl class=switch><dt>If the new <a href=#immediate-user-selection>immediate user selection</a> is null</dt>

       <dd><p>Set the <a href=#current-target-element>current target element</a> to null also.</dd>

       <dt>If the new <a href=#immediate-user-selection>immediate user selection</a> is in a non-DOM document or
       application</dt>

       <dd><p>Set the <a href=#current-target-element>current target element</a> to the <a href=#immediate-user-selection>immediate user
       selection</a>.</dd>

       <dt>Otherwise</dt>

       <dd>

        <p><a href=#fire-a-dnd-event>Fire a DND event</a> named <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> at the
        <a href=#immediate-user-selection>immediate user selection</a>.</p>

        <p>If the event is canceled, then set the <a href=#current-target-element>current target element</a> to the
        <a href=#immediate-user-selection>immediate user selection</a>.</p>

        <p>Otherwise, run the appropriate step from the following list:</p>

        <dl class=switch><dt>If the <a href=#immediate-user-selection>immediate user selection</a> is a text field (e.g.
         <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state) or an <a href=#editing-host>editing host</a> or
         <a href=#editable>editable</a> element, and the <a href=#drag-data-store-item-list>drag data store item list</a> has an item
         with <a href=#the-drag-data-item-type-string>the drag data item type string</a> "<code>text/plain</code>" and <a href=#the-drag-data-item-kind>the
         drag data item kind</a> <i>Plain Unicode string</i></dt>

         <dd><p>Set the <a href=#current-target-element>current target element</a> to the <a href=#immediate-user-selection>immediate user
         selection</a> anyway.</dd>


         <dt>If the <a href=#immediate-user-selection>immediate user selection</a> is an element with a <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match title=concept-dropzone-match>matches</a> the <a href=#drag-data-store>drag data store</a></dt>

         <dd><p>Set the <a href=#current-target-element>current target element</a> to the <a href=#immediate-user-selection>immediate user
         selection</a> anyway.</dd>


         <dt>If the <a href=#immediate-user-selection>immediate user selection</a> is an element that itself has an ancestor
         element with a <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match title=concept-dropzone-match>matches</a> the <a href=#drag-data-store>drag data store</a></dt>

         <dd>

          <p>Let <var title="">new target</var> be the nearest (deepest) such ancestor element.</p>

          <p>If the <a href=#immediate-user-selection>immediate user selection</a> is <var title="">new target</var>, then
          leave the <a href=#current-target-element>current target element</a> unchanged.</p>

          <p>Otherwise, <a href=#fire-a-dnd-event>fire a DND event</a> named <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> at <var title="">new target</var>. Then, set the
          <a href=#current-target-element>current target element</a> to <var title="">new target</var>, regardless of
          whether that event was canceled or not.</p>

         </dd>


         <dt>If the <a href=#immediate-user-selection>immediate user selection</a> is <a href=#the-body-element-0>the body element</a></dt>

         <dd><p>Leave the <a href=#current-target-element>current target element</a> unchanged.</dd>


         <dt>Otherwise</dt>

         <dd>

          <p><a href=#fire-a-dnd-event>Fire a DND event</a> named <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> at
          <a href=#the-body-element-0>the body element</a>, if there is one, or at the <code><a href=#document>Document</a></code> object, if
          not. Then, set the <a href=#current-target-element>current target element</a> to <a href=#the-body-element-0>the body element</a>,
          regardless of whether that event was canceled or not.</p>

         </dd>

        </dl></dd>

      </dl></li>

     <li>

      <p>If the previous step caused the <a href=#current-target-element>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>fire a DND
      event</a> named <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> at the previous target
      element.</p>

     </li>

     <li>

      <p>If the <a href=#current-target-element>current target element</a> is a DOM element, then <a href=#fire-a-dnd-event>fire a DND
      event</a> named <code title=event-dragover><a href=#event-dragover>dragover</a></code> at this <a href=#current-target-element>current target
      element</a>.</p>

      <p>If the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event is not canceled, run the
      appropriate step from the following list:</p>

      <dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field (e.g. <code><a href=#the-textarea-element>textarea</a></code>,
       or an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is
       in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state) or an <a href=#editing-host>editing host</a>
       or <a href=#editable>editable</a> element, and the <a href=#drag-data-store-item-list>drag data store item list</a> has an item
       with <a href=#the-drag-data-item-type-string>the drag data item type string</a> "<code>text/plain</code>" and <a href=#the-drag-data-item-kind>the drag
       data item kind</a> <i>Plain Unicode string</i></dt>

       <dd><p>Set the <a href=#current-drag-operation>current drag operation</a> to either "<code title="">copy</code>" or
       "<code title="">move</code>", as appropriate given the platform conventions.</dd>


       <dt>If the <a href=#current-target-element>current target element</a> is an element with a <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match title=concept-dropzone-match>matches</a> the <a href=#drag-data-store>drag data store</a> and <a href=#concept-dropzone-operation title=concept-dropzone-operation>specifies an operation</a></dt>

       <dd><p>Set the <a href=#current-drag-operation>current drag operation</a> to the operation <a href=#concept-dropzone-operation title=concept-dropzone-operation>specified</a> by the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute of the <a href=#current-target-element>current target
       element</a>.</p>


       <dt>If the <a href=#current-target-element>current target element</a> is an element with a <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match title=concept-dropzone-match>matches</a> the <a href=#drag-data-store>drag data store</a> and does not
       <a href=#concept-dropzone-operation title=concept-dropzone-operation>specify an operation</a></dt>

       <dd><p>Set the <a href=#current-drag-operation>current drag operation</a> to "<code title="">copy</code>".</p>


       <dt>Otherwise</dt>

       <dd><p>Reset the <a href=#current-drag-operation>current drag operation</a> to "<code title="">none</code>".</dd>

      </dl><p>Otherwise (if the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event <em>is</em> canceled),
      set the <a href=#current-drag-operation>current drag operation</a> based on the values of the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attributes of the <code><a href=#dragevent>DragEvent</a></code>
      object's <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object as they stood
      after the event <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> finished, as per the
      following table:</p>

      <table><thead><tr><th><code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code></th>
         <th><code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code></th>
         <th>Drag operation</th>
        </thead><tr><td>"<code title="">uninitialized</code>", "<code title="">copy</code>", "<code title="">copyLink</code>", "<code title="">copyMove</code>", or "<code title="">all</code>"</td>
        <td>"<code title="">copy</code>"</td>
        <td>"<code title="">copy</code>"</td>
       <tr><td>"<code title="">uninitialized</code>", "<code title="">link</code>", "<code title="">copyLink</code>", "<code title="">linkMove</code>", or "<code title="">all</code>"</td>
        <td>"<code title="">link</code>"</td>
        <td>"<code title="">link</code>"</td>
       <tr><td>"<code title="">uninitialized</code>", "<code title="">move</code>", "<code title="">copyMove</code>", "<code title="">linkMove</code>", or "<code title="">all</code>"</td>
        <td>"<code title="">move</code>"</td>
        <td>"<code title="">move</code>"</td>
       <tr><td colspan=2>Any other case</td>
        <td>"<code title="">none</code>"</td>
       </table></li>

     <li>

      <p>Otherwise, if the <a href=#current-target-element>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 <i><a href=#current-drag-operation>current drag operation</a></i> accordingly.</p>

     </li>

     <li>

      <p>Update the drag feedback (e.g. the mouse cursor) to match the <a href=#current-drag-operation>current drag
      operation</a>, as follows:</p>

      <table><thead><tr><th>Drag operation</th>
         <th>Feedback</th>
        </thead><tr><td>"<code title="">copy</code>"</td>
        <td>Data will be copied if dropped here.</td>
       <tr><td>"<code title="">link</code>"</td>
        <td>Data will be linked if dropped here.</td>
       <tr><td>"<code title="">move</code>"</td>
        <td>Data will be moved if dropped here.</td>
       <tr><td>"<code title="">none</code>"</td>
        <td>No operation allowed, dropping here will cancel the drag-and-drop operation.</td>
       </table></li>

    </ol></li>

   <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 title=event-drag><a href=#event-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>current drag operation</a> is "<code title="">none</code>" (no drag
      operation), or, if the user ended the drag-and-drop operation by canceling it (e.g. by hitting
      the <kbd>Escape</kbd> key), or if the <a href=#current-target-element>current target element</a> is null, then the
      drag operation failed. Run these substeps:</p>

      <ol><li><p>Let <var title="">dropped</var> be false.</li>

       <li><p>If the <a href=#current-target-element>current target element</a> is a DOM element, <a href=#fire-a-dnd-event>fire a DND
       event</a> named <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> at it; otherwise, if it is
       not null, use platform-specific conventions for drag cancellation.</li>

       <li><p>Set the <a href=#current-drag-operation>current drag operation</a> to "<code title="">none</code>".</li>

      </ol><p>Otherwise, the drag operation might be a success; run these substeps:</p>

      <ol><li><p>Let <var title="">dropped</var> be true.</li>

       <li><p>If the <a href=#current-target-element>current target element</a> is a DOM element, <a href=#fire-a-dnd-event>fire a DND
       event</a> named <code title=event-drop><a href=#event-drop>drop</a></code> at it; otherwise, use
       platform-specific conventions for indicating a drop.</li>

       <li>

        <p>If the event is canceled, set the <a href=#current-drag-operation>current drag operation</a> to the value of the
        <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute of the
        <code><a href=#dragevent>DragEvent</a></code> object's <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
        object as it stood after the event <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a>
        finished.</p>

        <p>Otherwise, the event is not canceled; perform the event's default action, which depends
        on the exact target as follows:</p>

        <dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field (e.g. <code><a href=#the-textarea-element>textarea</a></code>,
         or an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
         is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a> state) or an <a href=#editing-host>editing
         host</a> or <a href=#editable>editable</a> element, and the <a href=#drag-data-store-item-list>drag data store item
         list</a> has an item with <a href=#the-drag-data-item-type-string>the drag data item type string</a>
         "<code>text/plain</code>" and <a href=#the-drag-data-item-kind>the drag data item kind</a> <i>Plain Unicode
         string</i></dt>

         <dd><p>Insert the actual data of the first item in the <a href=#drag-data-store-item-list>drag data store item
         list</a> to have <a href=#the-drag-data-item-type-string title="the drag data item type string">a drag data item type
         string</a> of "<code>text/plain</code>" and <a href=#the-drag-data-item-kind title="the drag data item kind">a drag
         data item kind</a> that is <i>Plain Unicode string</i> into the text field or
         <a href=#editing-host>editing host</a> or <a href=#editable>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).</dd>

         <dt>Otherwise</dt>

         <dd><p>Reset the <a href=#current-drag-operation>current drag operation</a> to "<code title="">none</code>".</dd>

        </dl></li>

      </ol></li>

     <li>

      <p><a href=#fire-a-dnd-event>Fire a DND event</a> named <code title=event-dragend><a href=#event-dragend>dragend</a></code> at the
      <a href=#source-node>source node</a>.</p>

     </li>

     <li>

      <p>Run the appropriate steps from the following list as the default action of the <code title=event-dragend><a href=#event-dragend>dragend</a></code> event:</p>

      <dl class=switch><dt>If <var title="">dropped</var> is true, the <a href=#current-target-element>current target element</a> is a
       <i>text field</i> (see below), the <a href=#current-drag-operation>current drag operation</a> is "<code title="">move</code>", and the source of the drag-and-drop operation is a selection in the
       DOM that is entirely contained within an <a href=#editing-host>editing host</a></dt>

       <dd><p><a href=#delete-the-selection>Delete the selection</a>.</dd>

       <dt>If <var title="">dropped</var> is true, the <a href=#current-target-element>current target element</a> is a
       <i>text field</i> (see below), the <a href=#current-drag-operation>current drag operation</a> is "<code title="">move</code>", and the source of the drag-and-drop operation is a selection in a text
       field</dt>

       <dd><p>The user agent should delete the dragged selection from the relevant text
       field.</dd>

       <dt>If <var title="">dropped</var> is false or if the <a href=#current-drag-operation>current drag operation</a> is
       "<code title="">none</code>"</dt>

       <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.</dd>

       <dt>Otherwise</dt>

       <dd><p>The event has no default action.</dd>

      </dl><p>For the purposes of this step, a <i>text field</i> is a <code><a href=#the-textarea-element>textarea</a></code> element or an
      <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one
      of the
      <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>,
      <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>,
      <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Tel</a>,
      <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>,
      <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a>,
      <a href="#password-state-(type=password)" title=attr-input-type-password>Password</a>, or
      <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a>
      states.</p>


     </li>

    </ol></li>

  </ol><p class=note>User agents are encouraged to consider how to react to drags near the edge of
  scrollable regions. For example, if a user drags a link to the bottom of the viewport on a long
  page, it might make sense to scroll the page so that the user can drop the link lower on the
  page.</p>

  <p class=note>This model is independent of which <code><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>

  </div>


  <h4 id=dndevents><span class=secno>8.7.6 </span>Events summary</h4>

  <p><i>This section is non-normative.</i></p>

  <p>The following events are involved in the drag-and-drop
  model.</p>

  <table><thead><tr><th> Event Name </th>
     <th> Target </th>
     <!-- <th> Bubbles? </th> -->
     <th> Cancelable? </th>
     <th> <a href=#drag-data-store-mode>Drag data store mode</a> </th>
     <!-- <th> <code title="dom-DataTransfer-effectAllowed">effectAllowed</code> </th> -->
     <th> <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> </th>
     <th> Default Action </th>
    <tbody><tr><td><dfn id=event-dragstart title=event-dragstart><code>dragstart</code></dfn></td>
     <td><a href=#source-node>Source node</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&check; Cancelable</td>
     <td><a href=#concept-dnd-rw title=concept-dnd-rw>Read/write mode</a>
     <!-- <td>"<code title="">uninitialized</code>"</td> -->
     <td>"<code title="">none</code>"</td>
     <td>Initiate the drag-and-drop operation</td>
    <tr><td><dfn id=event-drag title=event-drag><code>drag</code></dfn></td>
     <td><a href=#source-node>Source node</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&check; Cancelable</td>
     <td><a href=#concept-dnd-p title=concept-dnd-p>Protected mode</a>
     <!-- <td>Same as last event</td> -->
     <td>"<code title="">none</code>"</td>
     <td>Continue the drag-and-drop operation</td>
    <tr><td><dfn id=event-dragenter title=event-dragenter><code>dragenter</code></dfn></td>
     <td><a href=#immediate-user-selection>Immediate user selection</a> or <a href=#the-body-element-0>the body element</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&check; Cancelable</td>
     <td><a href=#concept-dnd-p title=concept-dnd-p>Protected mode</a>
     <!-- <td>Same as last event</td> -->
     <td><a href=#dropEffect-initialization>Based on <code>effectAllowed</code> value</a></td>
     <td>Reject <a href=#immediate-user-selection>immediate user selection</a> as potential <a href=#current-target-element title="current target element">target element</a></td>
    <tr><td><dfn id=event-dragexit title=event-dragexit><code>dragexit</code></dfn></td>
     <td><a href=#current-target-element title="current target element">Previous target element</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&mdash;</td>
     <td><a href=#concept-dnd-p title=concept-dnd-p>Protected mode</a>
     <!-- <td>Same as last event</td> -->
     <td>"<code title="">none</code>"</td>
     <td>None</td>
    <tr><td><dfn id=event-dragleave title=event-dragleave><code>dragleave</code></dfn></td>
     <td><a href=#current-target-element title="current target element">Previous target element</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&mdash;</td>
     <td><a href=#concept-dnd-p title=concept-dnd-p>Protected mode</a>
     <!-- <td>Same as last event</td> -->
     <td>"<code title="">none</code>"</td>
     <td>None</td>
    <tr><td><dfn id=event-dragover title=event-dragover><code>dragover</code></dfn></td>
     <td><a href=#current-target-element>Current target element</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&check; Cancelable</td>
     <td><a href=#concept-dnd-p title=concept-dnd-p>Protected mode</a>
     <!-- <td>Same as last event</td> -->
     <td><a href=#dropEffect-initialization>Based on <code>effectAllowed</code> value</a></td>
     <td>Reset the <a href=#current-drag-operation>current drag operation</a> to "none"</td>
    <tr><td><dfn id=event-drop title=event-drop><code>drop</code></dfn></td>
     <td><a href=#current-target-element>Current target element</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&check; Cancelable</td>
     <td><a href=#concept-dnd-ro title=concept-dnd-ro>Read-only mode</a>
     <!-- <td>Same as last event</td> -->
     <td><a href=#current-drag-operation>Current drag operation</a></td>
     <td>Varies</td>
    <tr><td><dfn id=event-dragend title=event-dragend><code>dragend</code></dfn></td>
     <td><a href=#source-node>Source node</a></td>
     <!-- <td>&#x2713; Bubbles</td> -->
     <td>&mdash;</td>
     <td><a href=#concept-dnd-p title=concept-dnd-p>Protected mode</a>
     <!-- <td>Same as last event</td> -->
     <td><a href=#current-drag-operation>Current drag operation</a></td>
     <td>Varies</td>
    </table><p>Not shown in the above table: all these events bubble, and the
  <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
  attribute always has the value it had after the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event, defaulting to "<code title="">uninitialized</code>" in the <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event.</p>



  <h4 id=the-draggable-attribute><span class=secno>8.7.7 </span>The <dfn title=attr-draggable><code>draggable</code></dfn> attribute</h4>

  <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute set. The
  <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> attribute is an
  <a href=#enumerated-attribute>enumerated attribute</a>. It has three states. The first
  state is <i>true</i> and it has the keyword <code title="">true</code>. The second state is <i>false</i> and it has
  the keyword <code title="">false</code>. The third state is
  <i>auto</i>; it has no keywords but it is the <i>missing value
  default</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 title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
  attribute should also have a <code title=attr-title><a href=#attr-title>title</a></code>
  attribute that names the element for the purpose of non-visual
  interactions. <!-- "should", not "must", only because this is a
  relatively new attribute and its design implications are not
  entirely obvious yet. For example, what happens if you use an
  element with text as a drag source? Is that sufficiently clear for
  ATs? Indeed, shouldn't the element generally be distinguishable
  anyway for it to be useful to drag? See also the dropzone attribute.
  --></p>

  <dl class=domintro><dt><var title="">element</var> . <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> [ = <var title="">value</var> ]</dt>

   <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 title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-draggable title=dom-draggable><code>draggable</code></dfn> IDL
  attribute, whose value depends on the content attribute's in the way
  described below, controls whether or not the element is
  draggable. Generally, only text selections are draggable, but
  elements whose <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL
  attribute is true become draggable as well.</p>

  <p>If an element's <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
  content attribute has the state <i>true</i>, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute must return
  true.</p>

  <p>Otherwise, if the element's <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute has the
  state <i>false</i>, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute must return
  false.</p>

  <p>Otherwise, the element's <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute has the
  state <i>auto</i>. If the element is an <code><a href=#the-img-element>img</a></code> element,
  or, if the element is an <code><a href=#the-a-element>a</a></code> element with an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute must return
  true; otherwise, the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute
  must return false.</p>

  <p>If the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute
  is set to the value false, the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute must be
  set to the literal value <code title="">false</code>. If the <code title=dom-draggable><a href=#dom-draggable>draggable</a></code> IDL attribute is set to the
  value true, the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code>
  content attribute must be set to the literal value <code title="">true</code>.</p>

  </div>


  <h4 id=the-dropzone-attribute><span class=secno>8.7.8 </span>The <dfn title=attr-dropzone><code>dropzone</code></dfn> attribute</h4>

  <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> content attribute set. When
  specified, its value must be an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique
  space-separated tokens</a> that are <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a>. The allowed values are the following:</p>

  <dl><dt><dfn id=attr-dropzone-copy title=attr-dropzone-copy><code>copy</code></dfn></dt>

   <dd><p>Indicates that dropping an accepted item on the element will
   result in a copy of the dragged data.</p>


   <dt><dfn id=attr-dropzone-move title=attr-dropzone-move><code>move</code></dfn></dt>

   <dd><p>Indicates that dropping an accepted item on the element will
   result in the dragged data being moved to the new location.</p>


   <dt><dfn id=attr-dropzone-link title=attr-dropzone-link><code>link</code></dfn></dt>

   <dd><p>Indicates that dropping an accepted item on the element will
   result in a link to the original data.</p>


   <dt>Any keyword with eight characters or more, beginning with the
   an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">string:</code>"</dt>

   <dd><p>Indicates that items with <a href=#the-drag-data-item-kind>the drag data item
   kind</a> <i>Plain Unicode string</i> and <a href=#the-drag-data-item-type-string>the drag data
   item type string</a> set to a value that matches the remainder
   of the keyword are accepted.</dd>

<!--DND-v3:
   <dt>Any keyword with six characters or more, beginning with an
   <span>ASCII case-insensitive</span> match for the string "<code
   title="">blob:</code>"</dt>

   <dd><p>Indicates that items with <span>the drag data item
   kind</span> <i>Blob</i>, <i>File</i>, or <i>Plain Unicode
   string</i> and <span>the drag data item type string</span> set to a
   value that matches the remainder of the keyword are
   accepted.</p></dd>
-->

   <dt>Any keyword with six characters or more, beginning with an
   <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">file:</code>"</dt>

   <dd><p>Indicates that items with <a href=#the-drag-data-item-kind>the drag data item
   kind</a> <i><a href=#file>File</a></i> and <a href=#the-drag-data-item-type-string>the drag data item type
   string</a> set to a value that matches the remainder of the
   keyword are accepted.</dd>

<!--DND-v4:
   <dt>Any keyword with eight characters or more, beginning with an
   <span>ASCII case-insensitive</span> match for the string "<code
   title="">object:</code>"</dt>

   <dd><p>Indicates that items with <span>the drag data item type
   string</span> set to a value that matches the remainder of the
   keyword are accepted.</p></dd>
-->

  </dl><p>The <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> content
  attribute's values must not have more than one of the three feedback
  values (<code title=attr-dropzone-copy><a href=#attr-dropzone-copy>copy</a></code>, <code title=attr-dropzone-move><a href=#attr-dropzone-move>move</a></code>, and <code title=attr-dropzone-link><a href=#attr-dropzone-link>link</a></code>) specified. If none are
  specified, the <code title=attr-dropzone-copy><a href=#attr-dropzone-copy>copy</a></code> value is
  implied.</p>

  <p>An element with a <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code>
  attribute should also have a <code title=attr-title><a href=#attr-title>title</a></code>
  attribute that names the element for the purpose of non-visual
  interactions. <!-- "should", not "must", only because this is a
  relatively new attribute and its design implications are not
  entirely obvious yet. For example, what happens if you use an
  element with text as a drop zone? Is that sufficiently clear for
  ATs? See also the draggable attribute. --></p>

  <div class=impl>

  <p>A <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute <dfn id=concept-dropzone-match title=concept-dropzone-match>matches a drag data store</dfn> if
  the <a href=#dropzone-processing-steps><code title=attr-dropzone>dropzone</code> processing
  steps</a> result in a match.</p>

  <p>A <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute <dfn id=concept-dropzone-operation title=concept-dropzone-operation>specifies an operation</dfn> if
  the <a href=#dropzone-processing-steps><code title=attr-dropzone>dropzone</code> processing
  steps</a> result in a specified operation. The specified
  operation is as given by those steps.</p>

  <p>The <dfn id=dropzone-processing-steps><code title=attr-dropzone>dropzone</code> processing
  steps</dfn> are as follows. They either result in a match or not,
  and separate from this result either in a specified operation or
  not, as defined below.</p>

  <ol><li><p>Let <var title="">value</var> be the value of the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute.</li>

   <li><p>Let <var title="">keywords</var> be the result of <a href=#split-a-string-on-spaces title="split a string on spaces">splitting <var title="">value</var> on spaces</a>.</li>

   <li><p>Let <var title="">matched</var> be false.</li>

   <li><p>Let <var title="">operation</var> be unspecified.</li>

   <li>

    <p>For each value in <var title="">keywords</var>, if any, in the
    order that they were found in <var title="">value</var>, run the
    following steps.</p>

    <ol><li><p>Let <var title="">keyword</var> be the keyword.</li>

     <li>

      <p>If <var title="">keyword</var> is one of "<code title=attr-dropzone-copy><a href=#attr-dropzone-copy>copy</a></code>", "<code title=attr-dropzone-move><a href=#attr-dropzone-move>move</a></code>", or "<code title=attr-dropzone-link><a href=#attr-dropzone-link>link</a></code>", then: run the following
      substeps:</p>

      <ol><li><p>If <var title="">operation</var> is still unspecified,
       then let <var title="">operation</var> be the string given by
       <var title="">keyword</var>.</li>

       <li><p>Skip to the step labeled <i>end of keyword</i>
       below.</li>

      </ol></li>

     <li><p>If <var title="">keyword</var> does not contain a U+003A
     COLON character (:), or if the first such character in <var title="">keyword</var> is either the first character or the last
     character in the string, then skip to the step labeled <i>end of
     keyword</i> below.</li>

     <li><p>Let <var title="">kind code</var> be the substring
     of <var title="">keyword</var> from the first character in the
     string to the last character in the string that is before the
     first U+003A COLON character (:) in the string, <a href=#converted-to-ascii-lowercase>converted
     to ASCII lowercase</a>.</p>

     <li>

      <p>Jump to the appropriate step from the list below, based on
      the value of <var title="">kind code</var>:</p>

      <dl class=switch><dt>If <var title="">kind code</var> is the string "<code title="">string</code>"</dt>
       <dd>

        <p>Let <var title="">kind<!--DND-v3:/DND-v4: s--></var> be
        <i>Plain Unicode string</i>.</p>

       </dd>

<!--DND-v3:
       <dt>If <var title="">kind code</var> is the string "<code title="">blob</code>"</dt>
       <dd>

        <p>Let <var title="">kinds</var> be <i>Plain Unicode
        string</i>, <i>Blob</i>, and <i>File</i>.</p>

       </dd>
-->

       <dt>If <var title="">kind code</var> is the string "<code title="">file</code>"</dt>
       <dd>

        <p>Let <var title="">kind<!--DND-v3:/DND-v4: s--></var> be
        <i><a href=#file>File</a></i>.</p>

       </dd>

<!--DND-v4:
       <dt>If <var title="">kind code</var> is the string "<code title="">object</code>"</dt>
       <dd>

        <p>Let <var title="">kinds</var> be <i>Plain Unicode
        string</i>, <i>Blob</i>, <i>File</i>, and <i>Object</i>.</p>

       </dd>
-->

       <dt>Otherwise</dt>
       <dd>

        <p>Skip to the step labeled <i>end of keyword</i> below.</p>

       </dd>

      </dl></li>

     <li><p>Let <var title="">type</var> be the substring of <var title="">keyword</var> from the first character after the first
     U+003A COLON character (:) in the string, to the last character
     in the string, <a href=#converted-to-ascii-lowercase>converted to ASCII
     lowercase</a>.</li>

     <li><p>If there exist any items in the <a href=#drag-data-store-item-list>drag data store item
     list</a> whose <a href=#the-drag-data-item-kind title="the drag data item kind">drag data
     item kind</a> is <!--DND-v3:/DND-v4: one of--> the
     kind<!--DND-v3:/DND-v4: s--> given in <var title="">kind<!--DND-v3:/DND-v4: s--></var> and whose <span title="the drag data item type">drag data item type</span> is
     <var title="">type</var>, then let <var title="">matched</var> be
     true.</li>

     <li><p><i>End of keyword</i>: Go on to the next keyword, if any,
     or the next step in the overall algorithm, if there are no
     more.</li>

    </ol></li>

   <li>

    <p>The algorithm results in a match if <var title="">matched</var>
    is true, and does not otherwise.</p>

    <p>The algorithm results in a specified operation if <var title="">operation</var> is not unspecified. The specified
    operation, if one is specified, is the one given by <var title="">operation</var>.</p>

   </li>

  </ol><p>The <dfn id=dom-dropzone title=dom-dropzone><code>dropzone</code></dfn> IDL
  attribute must <a href=#reflect>reflect</a> the content attribute of the
  same name.</p>

  </div>

  <div class=example>

   <p>In this example, a <code><a href=#the-div-element>div</a></code> element is made into a drop
   target for image files using the <code title=attr-dropzone><a href=#the-dropzone-attribute>dropzone</a></code> attribute. Images dropped
   into the target are then displayed.</p>

   <pre>&lt;div dropzone="copy file:image/png file:image/gif file:image/jpeg" ondrop="receive(event, this)"&gt;
 &lt;p&gt;Drop an image here to have it displayed.&lt;/p&gt;
&lt;/div&gt;
&lt;script&gt;
 function receive(event, element) {
   var data = event.dataTransfer.items;
   for (var i = 0; i &lt; data.length; i += 1) {
     if ((data[i].kind == 'file') &amp;&amp; (data[i].type.match('^image/'))) {
       var img = new Image();
       img.src = window.createObjectURL(data[i].getAsFile());
       element.appendChild(img);
     }
   }
 }
&lt;/script&gt;</pre>

  </div>


<!--
  <h4>Copy and paste</h4>

  <p>Copy-and-paste is a form of drag-and-drop: the "copy" part is
  equivalent to dragging content to another application (the
  "clipboard"), and the "paste" part is equivalent to dragging content
  <em>from</em> another application.</p>

  <p>Select-and-paste (a model used by mouse operations in the X
  Window System) is equivalent to a drag-and-drop operation where the
  source is the selection.</p>


  <div class="impl">

  <h5>Copy to clipboard</h5>

  <p>When the user invokes a copy operation, the user agent must act
  as if the user had invoked a drag on the current selection. If the
  drag-and-drop operation initiates, then the user agent must act as
  if the user had indicated (as the <span>immediate user
  selection</span>) a hypothetical application representing the
  clipboard. Then, the user agent must act as if the user had ended
  the drag-and-drop operation without canceling it. If the
  drag-and-drop operation didn't get canceled, the user agent should
  then follow the relevant platform-specific conventions for copy
  operations (e.g. updating the clipboard).</p>

  <p>The events involved in this process are the <code
  title="event-dragstart">dragstart</code>, <code
  title="event-drag">drag</code>, and <code
  title="event-dragend">dragend</code> events.</p>


  <h5>Cut to clipboard</h5>

  <p>When the user invokes a cut operation, the user agent must act as
  if the user had invoked a copy operation (see the previous section),
  followed, if the copy was completed successfully, by <a
  href="#contenteditable-delete">a selection delete operation</a>.</p>

  <p>The events involved in this process are the <code
  title="event-dragstart">dragstart</code>, <code
  title="event-drag">drag</code>, and <code
  title="event-dragend">dragend</code> events.</p>


  <h5>Paste from clipboard</h5>

  <p>When the user invokes a clipboard paste operation, the user agent
  must act as if the user had invoked a drag on a hypothetical
  application representing the clipboard, setting the data associated
  with the drag as the content on the clipboard (in whatever formats
  are available).</p>

  <p>Then, the user agent must act as if the user had indicated (as
  the <span>immediate user selection</span>) the element with the
  keyboard focus, and then ended the drag-and-drop operation without
  canceling it.</p>

  <p>The events involved in this process are the <code
  title="event-dragenter">dragenter</code>, <code
  title="event-dragover">dragover</code>, <code
  title="event-dragexit">dragexit</code>, <code
  title="event-dragleave">dragleave</code>, and <code
  title="event-drop">drop</code> events.</p>


  <h5>Paste from selection</h5>

  <p>When the user invokes a selection paste operation, the user agent
  must act as if the user had invoked a drag on the current selection,
  then indicated (as the <span>immediate user selection</span>) the
  element with the keyboard focus, and then ended the drag-and-drop
  operation without canceling it.</p>

  <p>All the drag-and-drop events can be involved in this process.</p>

  </div>
-->


<!--ADD-TOPIC:Security-->
  <div class=impl>

  <h4 id=security-risks-in-the-drag-and-drop-model><span class=secno>8.7.9 </span>Security risks in the drag-and-drop model</h4>

  <p>User agents must not make the data added to the <code><a href=#datatransfer>DataTransfer</a></code> object during the
  <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event available to scripts until the <code title=event-drop><a href=#event-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 &mdash; if any scripts end the drag operation, it must be
  considered unsuccessful (canceled) and the <code title=event-drop><a href=#event-drop>drop</a></code> event must not be
  fired.</p>

  <p>User agents should take care to not start drag-and-drop operations in response to script
  actions. For example, in a mouse-and-window environment, if a script moves a window while the user
  has his mouse button depressed, the UA would not consider that to start a drag. This is important
  because otherwise UAs could cause data to be dragged from sensitive sources and dropped into
  hostile documents without the user's consent.</p>

  <p>User agents should filter potentially active (scripted) content (e.g. HTML) when it is dragged
  and when it is dropped, using a whitelist of known-safe features. Similarly, <a href=#relative-url title="relative
  URL">relative URLs</a> should be turned into absolute URLs to avoid references changing in
  unexpected ways. This specification does not specify how this is performed.</p>

  <div class=example>

   <p>Consider a hostile page providing some content and getting the user to select and drag and
   drop (or indeed, copy and paste) that content to a victim page's <code title=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>

  </div>
<!--REMOVE-TOPIC:Security-->





<!--ADD-TOPIC:Workers-->

  <h2 id=workers><span class=secno>9 </span>Web workers</h2>



  <h3 id=introduction-9><span class=secno>9.1 </span>Introduction</h3>

  <h4 id=scope-0><span class=secno>9.1.1 </span>Scope</h4>

  <p><i>This section is non-normative.</i></p>

  <p>This specification defines an API for running scripts in the
  background independently of any user interface scripts.</p>

  <p>This allows for long-running scripts that are not interrupted by
  scripts that respond to clicks or other user interactions, and
  allows long tasks to be executed without yielding to keep the page
  responsive.</p>

  <p>Workers (as these background scripts are called herein) are
  relatively heavy-weight, and are not intended to be used in large
  numbers. For example, it would be inappropriate to launch one worker
  for each pixel of a four megapixel image. The examples below show
  some appropriate uses of workers.</p>

  <p>Generally, workers are expected to be long-lived, have a high
  start-up performance cost, and a high per-instance memory cost.</p>


  <h4 id=examples-4><span class=secno>9.1.2 </span>Examples</h4>

  <p><i>This section is non-normative.</i></p>

  <p>There are a variety of uses that workers can be put to. The
  following subsections show various examples of this use.</p>

  <h5 id=a-background-number-crunching-worker><span class=secno>9.1.2.1 </span>A background number-crunching worker</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The simplest use of workers is for performing a computationally
  expensive task without interrupting the user interface.</p>

  <p>In this example, the main document spawns a worker to
  (na&iuml;vely) compute prime numbers, and progressively displays the
  most recently found prime number.</p>

  <p>The main page is as follows:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Worker example: One-core computation&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;The highest prime number discovered so far is: &lt;output id="result"&gt;&lt;/output&gt;&lt;/p&gt;
  &lt;script&gt;
   var worker = new Worker('worker.js');
   worker.onmessage = function (event) {
     document.getElementById('result').textContent = event.data;
   };
  &lt;/script&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  <p>The <code title=dom-Worker><a href=#dom-worker>Worker()</a></code> constructor call
  creates a worker and returns a <code><a href=#worker>Worker</a></code> object
  representing that worker, which is used to communicate with the
  worker. That object's <code title=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 &lt;= 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 title=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=http://www.whatwg.org/demos/workers/primes/page.html>View this example online</a>.</p>




  <h5 id=worker-used-for-background-i/o><span class=secno>9.1.2.2 </span>Worker used for background I/O</h5>

  <p><i>This section is non-normative.</i></p>

  <p>In this example, the main document uses two workers, one for fetching stock updates at regular
  intervals, and one for performing search queries that the user requests.</p>

  <p>The main page is as follows:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Worker example: Stock ticker&lt;/title&gt;
  &lt;script&gt;
   // 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);
   }
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body onload="search('')"&gt;
  &lt;p&gt;&lt;output id="symbol"&gt;&lt;/output&gt; &lt;output id="value"&gt;&lt;/output&gt;&lt;/p&gt;
  &lt;script&gt;
   ticker.onmessage = function (event) {
     var data = event.data.split(' ');
     document.getElementById('symbol').textContent = data[0];
     document.getElementById('value').textContent = data[1];
   };
   ticker.postMessage(symbol);
  &lt;/script&gt;
  &lt;p&gt;&lt;label&gt;Search: &lt;input type="text" autofocus oninput="search(this.value)"&gt;&lt;/label&gt;&lt;/p&gt;
  &lt;ul id="results"&gt;&lt;/ul&gt;
  &lt;script&gt;
   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 &lt; data.length; i += 1) {
       // add a list item with a button for each result
       var li = document.createElement('li');
       var button = document.createElement('button');
       button.value = data[i];
       button.type = 'button';
       button.onclick = function () { select(this.value); };
       button.textContent = data[i];
       li.appendChild(button);
       results.appendChild(li);
     }
   };
  &lt;/script&gt;
  &lt;p&gt;(The data in this example is not real. Try searching for "Google" or "Apple".)&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</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=http://www.whatwg.org/demos/workers/stocks/page.html>View this example online</a>.</p>


  <h5 id=shared-workers-introduction><span class=secno>9.1.2.3 </span>Shared workers introduction</h5>

  <p><i>This section is non-normative.</i></p>

  <p>This section introduces shared workers using a Hello World
  example. Shared workers use slightly different APIs, since each
  worker can have multiple connections.</p>

  <p>This first example shows how you connect to a worker and how a
  worker can send a message back to the page when it connects to
  it. Received messages are displayed in a log.</p>

  <p>Here is the HTML page:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Shared workers: demo 1&lt;/title&gt;
&lt;pre id="log"&gt;Log:&lt;/pre&gt;
&lt;script&gt;
  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;
  }
&lt;/script&gt;
</pre>

  <p>Here is the JavaScript worker:</p>

  <pre>onconnect = function(e) {
  var port = e.ports[0];
  port.postMessage('Hello World!');
}
</pre>

  <p><a href=http://www.whatwg.org/demos/workers/shared/001/test.html>View this example online</a>.</p>

  <hr><p>This second example extends the first one by changing two things:
  first, messages are received using <code title="">addEventListener()</code> instead of an <a href=#event-handler-idl-attributes title="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>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Shared workers: demo 2&lt;/title&gt;
&lt;pre id="log"&gt;Log:&lt;/pre&gt;
&lt;script&gt;
  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');
&lt;/script&gt;
</pre>

  <p>Here is the JavaScript worker:</p>

  <pre>onconnect = function(e) {
  var port = e.ports[0];
  port.postMessage('Hello World!');
  port.onmessage = function(e) {
    port.postMessage('pong'); // not e.ports[0].postMessage!
    // e.target.postMessage('pong'); would work also
  }
}
</pre>

  <p><a href=http://www.whatwg.org/demos/workers/shared/002/test.html>View this example online</a>.</p>

  <hr><p>Finally, the example is extended to show how two pages can
  connect to the same worker; in this case, the second page is merely
  in an <code><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>top-level browsing context</a>.</p>

  <p>Here is the outer HTML page:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Shared workers: demo 3&lt;/title&gt;
&lt;pre id="log"&gt;Log:&lt;/pre&gt;
&lt;script&gt;
  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');
&lt;/script&gt;
&lt;iframe src="inner.html"&gt;&lt;/iframe&gt;
</pre>

  <p>Here is the inner HTML page:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Shared workers: demo 3 inner frame&lt;/title&gt;
&lt;pre id=log&gt;Inner log:&lt;/pre&gt;
&lt;script&gt;
  var worker = new SharedWorker('test.js');
  var log = document.getElementById('log');
  worker.port.onmessage = function(e) {
   log.textContent += '\n' + e.data;
  }
&lt;/script&gt;
</pre>

  <p>Here is the JavaScript worker:</p>

  <pre>var count = 0;
onconnect = function(e) {
  count += 1;
  var port = e.ports[0];
  port.postMessage('Hello World! You are connection #' + count);
  port.onmessage = function(e) {
    port.postMessage('pong');
  }
}
</pre>

  <p><a href=http://www.whatwg.org/demos/workers/shared/003/test.html>View this example online</a>.</p>


  <h5 id=shared-state-using-a-shared-worker><span class=secno>9.1.2.4 </span>Shared state using a shared worker</h5>

  <p><i>This section is non-normative.</i></p>

  <p>In this example, multiple windows (viewers) can be opened that
  are all viewing the same map. All the windows share the same map
  information, with a single worker coordinating all the viewers. Each
  viewer can move around independently, but if they set any data on
  the map, all the viewers are updated.</p>

  <p>The main page isn't interesting, it merely provides a way to open
  the viewers:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Workers example: Multiviewer&lt;/title&gt;
  &lt;script&gt;
   function openViewer() {
     window.open('viewer.html');
   }
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;&lt;button type=button onclick="openViewer()"&gt;Open a new
  viewer&lt;/button&gt;&lt;/p&gt;
  &lt;p&gt;Each viewer opens in a new window. You can have as many viewers
  as you like, they all view the same data.&lt;/p&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  <p>The viewer is more involved:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Workers example: Multiviewer viewer&lt;/title&gt;
  &lt;script&gt;
   var worker = new SharedWorker('worker.js', 'core');

   // CONFIGURATION
   function configure(event) {
     if (event.data.substr(0, 4) != 'cfg ') return;
     var name = event.data.substr(4).split(' ', 1)[0];
     // update display to mention our name is name
     document.getElementsByTagName('h1')[0].textContent += ' ' + name;
     // no longer need this listener
     worker.port.removeEventListener('message', configure, false);
   }
   worker.port.addEventListener('message', configure, false);

   // MAP
   function paintMap(event) {
     if (event.data.substr(0, 4) != 'map ') return;
     var data = event.data.substr(4).split(',');
     // display tiles data[0] .. data[8]
     var canvas = document.getElementById('map');
     var context = canvas.getContext('2d');
     for (var y = 0; y &lt; 3; y += 1) {
       for (var x = 0; x &lt; 3; x += 1) {
         var tile = data[y * 3 + x];
         if (tile == '0')
           context.fillStyle = 'green';
         else 
           context.fillStyle = 'maroon';
         context.fillRect(x * 50, y * 50, 50, 50);
       }
     }
   }
   worker.port.addEventListener('message', paintMap, false);

   // PUBLIC CHAT
   function updatePublicChat(event) {
     if (event.data.substr(0, 4) != 'txt ') return;
     var name = event.data.substr(4).split(' ', 1)[0];
     var message = event.data.substr(4 + name.length + 1);
     // display "&lt;name&gt; message" in public chat
     var public = document.getElementById('public');
     var p = document.createElement('p');
     var n = document.createElement('button');
     n.textContent = '&lt;' + name + '&gt; ';
     n.onclick = function () { worker.port.postMessage('msg ' + name); };
     p.appendChild(n);
     var m = document.createElement('span');
     m.textContent = message;
     p.appendChild(m);
     public.appendChild(p);
   }
   worker.port.addEventListener('message', updatePublicChat, false);

   // PRIVATE CHAT
   function startPrivateChat(event) {
     if (event.data.substr(0, 4) != 'msg ') return;
     var name = event.data.substr(4).split(' ', 1)[0];
     var port = event.ports[0];
     // display a private chat UI
     var ul = document.getElementById('private');
     var li = document.createElement('li');
     var h3 = document.createElement('h3');
     h3.textContent = 'Private chat with ' + name;
     li.appendChild(h3);
     var div = document.createElement('div');
     var addMessage = function(name, message) {
       var p = document.createElement('p');
       var n = document.createElement('strong');
       n.textContent = '&lt;' + name + '&gt; ';
       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();
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;Viewer&lt;/h1&gt;
  &lt;h2&gt;Map&lt;/h2&gt;
  &lt;p&gt;&lt;canvas id="map" height=150 width=150&gt;&lt;/canvas&gt;&lt;/p&gt;
  &lt;p&gt;
   &lt;button type=button onclick="worker.port.postMessage('mov left')"&gt;Left&lt;/button&gt;
   &lt;button type=button onclick="worker.port.postMessage('mov up')"&gt;Up&lt;/button&gt;
   &lt;button type=button onclick="worker.port.postMessage('mov down')"&gt;Down&lt;/button&gt;
   &lt;button type=button onclick="worker.port.postMessage('mov right')"&gt;Right&lt;/button&gt;
   &lt;button type=button onclick="worker.port.postMessage('set 0')"&gt;Set 0&lt;/button&gt;
   &lt;button type=button onclick="worker.port.postMessage('set 1')"&gt;Set 1&lt;/button&gt;
  &lt;/p&gt;
  &lt;h2&gt;Public Chat&lt;/h2&gt;
  &lt;div id="public"&gt;&lt;/div&gt;
  &lt;form onsubmit="worker.port.postMessage('txt ' + message.value); message.value = ''; return false;"&gt;
   &lt;p&gt;
    &lt;input type="text" name="message" size="50"&gt;
    &lt;button&gt;Post&lt;/button&gt;
   &lt;/p&gt;
  &lt;/form&gt;
  &lt;h2&gt;Private Chat&lt;/h2&gt;
  &lt;ul id="private"&gt;&lt;/ul&gt;
 &lt;/body&gt;
&lt;/html&gt;
</pre>

  <p>There are several key things worth noting about the way the
  viewer is written.</p>

  <p><strong>Multiple listeners</strong>. Instead of a single message
  processing function, the code here attaches multiple event
  listeners, each one performing a quick check to see if it is
  relevant for the message. In this example it doesn't make much
  difference, but if multiple authors wanted to collaborate using a
  single port to communicate with a worker, it would allow for
  independent code instead of changes having to all be made to a
  single event handling function.</p>

  <p>Registering event listeners in this way also allows you to
  unregister specific listeners when you are done with them, as is
  done with the <code title="">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 &lt; 0) return wrapX(x + map[0].length);
  if (x &gt;= map[0].length) return wrapX(x - map[0].length);
  return x;
}

function wrapY(y) {
  if (y &lt; 0) return wrapY(y + map.length);
  if (y &gt;= map[0].length) return wrapY(y - map.length);
  return y;
}

function wrap(val, min, max) {
  if (val &lt; min)
    return val + (max-min)+1;
  if (val &gt; max)
    return val - (max-min)-1;
  return val;
}

function sendMapData(viewer) {
  var data = '';
  for (var y = viewer.y-1; y &lt;= viewer.y+1; y += 1) {
    for (var x = viewer.x-1; x &lt;= viewer.x+1; x += 1) {
      if (data != '')
        data += ',';
      data += map[wrap(y, 0, map[0].length-1)][wrap(x, 0, map.length-1)];
    }
  }
  viewer.port.postMessage('map ' + data);
}

var viewers = {};
onconnect = function (event) {
  var name = getNextName();
  event.ports[0]._data = { port: event.ports[0], name: name, x: 0, y: 0, };
  viewers[name] = event.ports[0]._data;
  event.ports[0].postMessage('cfg ' + name);
  event.ports[0].onmessage = getMessage;
  sendMapData(event.ports[0]._data);
};

function getMessage(event) {
  switch (event.data.substr(0, 4)) {
    case 'mov ':
      var direction = event.data.substr(4);
      var dx = 0;
      var dy = 0;
      switch (direction) {
        case 'up': dy = -1; break;
        case 'down': dy = 1; break;
        case 'left': dx = -1; break;
        case 'right': dx = 1; break;
      }
      event.target._data.x = wrapX(event.target._data.x + dx);
      event.target._data.y = wrapY(event.target._data.y + dy);
      sendMapData(event.target._data);
      break;
    case 'set ':
      var value = event.data.substr(4);
      map[event.target._data.y][event.target._data.x] = value;
      for (var viewer in viewers)
        sendMapData(viewers[viewer]._data);
      break;
    case 'txt ':
      var name = event.target._data.name;
      var message = event.data.substr(4);
      for (var viewer in viewers)
        viewers[viewer].port.postMessage('txt ' + name + ' ' + message);
      break;
    case 'msg ':
      var party1 = event.target._data;
      var party2 = viewers[event.data.substr(4).split(' ', 1)[0]];
      if (party2) {
        var channel = new MessageChannel();
        party1.port.postMessage('msg ' + party2.name, [channel.port1]);
        party2.port.postMessage('msg ' + party1.name, [channel.port2]);
      }
      break;
  }
}</pre>

  <p><strong>Connecting to multiple pages</strong>. The script uses
  the <code title=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=http://www.whatwg.org/demos/workers/multiviewer/page.html>View this example online</a>.</p>


  <h5 id=delegation><span class=secno>9.1.2.5 </span>Delegation</h5>

  <p><i>This section is non-normative.</i></p>

  <p>With multicore CPUs becoming prevalent, one way to obtain better
  performance is to split computationally expensive tasks amongst
  multiple workers. In this example, a computationally expensive task
  that is to be performed for every number from 1 to 10,000,000 is
  farmed out to ten subworkers.</p>

  <p>The main page is as follows, it just reports the result:</p>

  <pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Worker example: Multicore computation&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;p&gt;Result: &lt;output id="result"&gt;&lt;/output&gt;&lt;/p&gt;
  &lt;script&gt;
   var worker = new Worker('worker.js');
   worker.onmessage = function (event) {
     document.getElementById('result').textContent = event.data;
   };
  &lt;/script&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>

  <p>The worker itself is as follows:</p>

  <pre>// settings
var num_workers = 10;
var items_per_worker = 1000000;

// start the workers
var result = 0;
var pending_workers = num_workers;
for (var i = 0; i &lt; num_workers; i += 1) {
  var worker = new Worker('core.js');
  worker.postMessage(i * items_per_worker);
  worker.postMessage((i+1) * items_per_worker);
  worker.onmessage = storeResult;
}

// handle the results
function storeResult(event) {
  result += 1*event.data;
  pending_workers -= 1;
  if (pending_workers &lt;= 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 &lt; 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=http://www.whatwg.org/demos/workers/multicore/page.html>View this example online</a>.</p>

<!--(this uses startConversation, which is currently commented out)

  <h5>Providing libraries</h5>

  <!- -END dev-html- -><p><i>This section is non-normative.</i></p><!- -START dev-html- ->

  <p>Suppose that a cryptography library is made available that
  provides three tasks:</p>

  <dl>

   <dt>Generate a public/private key pair</dt>

   <dd>Takes a port, on which it will send two messages, first the
   public key and then the private key.</dd>

   <dt>Given a plaintext and a public key, return the corresponding cyphertext</dt>

   <dd>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.</dd>

   <dt>Given a cyphertext and a private key, return the corresponding plaintext</dt>

   <dd>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.</dd>

  </dl>

  <p>The library itself is as follows:</p>

  <pre>function handleMessage(e) {
  if (e.data == "genkeys")
    genkeys(e.ports[0]);
  else if (e.data == "encrypt")
    encrypt(e.ports[0]);
  else if (e.data == "decrypt")
    decrypt(e.ports[0]);
}

function genkeys(p) {
  var keys = _generateKeyPair();
  p.postMessage(keys[0]);
  p.postMessage(keys[1]);
}

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 worker
if ('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 don't do
  real cryptography.</p>

  <p>This library could be used as follows:</p>

  <pre>&lt;!DOCTYPE HTML>
&lt;html>
 &lt;head>
  &lt;title>Worker example: Crypto library&lt;/title>
  &lt;script>
   var cryptoLib = new Worker('libcrypto-v1.js'); // or could use 'libcrypto-v2.js'
   function getKeys() {
     var state = 0;
     cryptoLib.startConversation("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() {
     var port = cryptoLib.startConversation("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() {
     var port = cryptoLib.startConversation("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();
     };
   }
  &lt;/script>
  &lt;style>
   textarea { display: block; }
  &lt;/style>
 &lt;/head>
 &lt;body onload="getKeys()">
  &lt;fieldset>
   &lt;legend>Keys&lt;/legend>
   &lt;p>&lt;label>Public Key: &lt;textarea id="public">&lt;/textarea>&lt;/label>&lt;/p>
   &lt;p>&lt;label>Private Key: &lt;textarea id="private">&lt;/textarea>&lt;/label>&lt;/p>
  &lt;/fieldset>
  &lt;p>&lt;label>Input: &lt;textarea id="input">&lt;/textarea>&lt;/label>&lt;/p>
  &lt;p>&lt;button onclick="enc()">Encrypt&lt;/button> &lt;button onclick="dec()">Decrypt&lt;/button>&lt;/p>
 &lt;/body>
&lt;/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.ports[0]);
  else if (e.data == "encrypt")
    encrypt(e.ports[0]);
  else if (e.data == "decrypt")
    decrypt(e.ports[0]);
}

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 worker
if ('onmessage' in this) // dedicated worker
  onmessage = handleMessage;
else // shared worker
  onconnect = function (e) { e.ports[0].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.ports[0].postMessage(k[0]);
  e.ports[0].postMessage(k[1]);
  close();
}

function _generateKeyPair() {
  return [Math.random(), Math.random()];
}</pre>

  <p>For encrypting:</p>

  <pre>onmessage = function (e) {
  var key = e.data;
  e.ports[0].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.ports[0].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 don't have to even know that this
  is happening &mdash; the API hasn't changed; the library can
  delegate to subworkers without changing its API, even though it is
  accepting data using message channels.</p>

  <p><a href="http://www.whatwg.org/demos/workers/crypto/page.html">View this example online</a>.</p>

(end startConversation block) (beware nested comments)-->


  <h4 id=tutorials><span class=secno>9.1.3 </span>Tutorials</h4>

  <h5 id=creating-a-dedicated-worker><span class=secno>9.1.3.1 </span>Creating a dedicated worker</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Creating a worker requires a URL to a JavaScript file. The <code title=dom-Worker><a href=#dom-worker>Worker()</a></code> constructor is invoked with the
  URL to that file as its only argument; a worker is then created and
  returned:</p>

  <pre>var worker = new Worker('helper.js');</pre>


  <h5 id=communicating-with-a-dedicated-worker><span class=secno>9.1.3.2 </span>Communicating with a dedicated worker</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Dedicated workers use <code><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 title=handler-worker-onmessage><a href=#handler-worker-onmessage>onmessage</a></code> <a href=#event-handler-idl-attributes title="event
  handler IDL attributes">event handler IDL attribute</a> on the
  <code><a href=#worker>Worker</a></code> object:</p>

  <pre>worker.onmessage = function (event) { ... };</pre>

  <p>You can also use the <code title=dom-EventTarget-addEventListener>addEventListener()</code> method.</p>

  <p class=note>The implicit <code><a href=#messageport>MessagePort</a></code> used by
  dedicated workers has its <a href=#port-message-queue>port message queue</a> implicitly
  enabled when it is created, so there is no equivalent to the
  <code><a href=#messageport>MessagePort</a></code> interface's <code title=dom-MessagePort-start><a href=#dom-messageport-start>start()</a></code> method on the
  <code><a href=#worker>Worker</a></code> interface.</p>

  <p>To <em>send</em> data to a worker, use the <code title=dom-Worker-postMessage><a href=#dom-worker-postmessage>postMessage()</a></code> method.
  Structured data can be sent over this communication channel. To send
  <code><a href=#arraybuffer>ArrayBuffer</a></code> objects efficiently (by transferring them
  rather than cloning them), list them in an array in the second
  argument.</p>

  <pre>worker.postMessage({
  operation: 'find-edges',
  input: buffer, // an ArrayBuffer object
  threshold: 0.6,
}, [buffer]);</pre>

  <p>To receive a message inside the worker, the <code title=handler-DedicatedWorkerGlobalScope-onmessage><a href=#handler-dedicatedworkerglobalscope-onmessage>onmessage</a></code>
  <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler IDL
  attribute</a> is used.</p>

  <pre>onmessage = function (event) { ... };</pre>

  <p>You can again also use the <code title=dom-EventTarget-addEventListener>addEventListener()</code>
  method.</p>

  <p>In either case, the data is provided in the event object's <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute.</p>

  <p>To send messages back, you again use <code title=dom-DedicatedWorkerGlobalScope-postMessage><a href=#dom-dedicatedworkerglobalscope-postmessage>postMessage()</a></code>.
  It supports the structured data in the same manner.</p>

  <pre>postMessage(event.data.input, [event.data.input]); // transfer the buffer back</pre>


  <h5 id=shared-workers><span class=secno>9.1.3.3 </span>Shared workers</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Shared workers are identified by the URL of the script used to create it, optionally with an
  explicit name. The name allows multiple instances of a particular shared worker to be started.</p>

  <p>Shared workers are scoped by <a href=#origin>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 title=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><a href=#messageport>MessagePort</a></code> objects. The object returned by the <code title=dom-SharedWorker><a href=#dom-sharedworker>SharedWorker()</a></code> constructor holds a
  reference to the port on its <code title=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 title=event-connect>connect</code> event. The port
  for the new client is given by the event object's <code title=dom-messageevent-source><a href=#dom-messageevent-source>source</a></code> attribute.</p>

  <pre>onconnect = function (event) {
  var newPort = event.source;
  // set up a listener
  newPort.onmessage = function (event) { ... };
  // send a message back to the port
  newPort.postMessage('ready!'); // can also send structured data, of course
};</pre>




  <h3 id=infrastructure-0><span class=secno>9.2 </span>Infrastructure</h3>

  <p>There are two kinds of workers; dedicated workers, and shared
  workers. Dedicated workers, once created, and are linked to their
  creator; but message ports can be used to communicate from a
  dedicated worker to multiple other browsing contexts or
  workers. Shared workers, on the other hand, are named, and once
  created any script running in the same <a href=#origin>origin</a> can
  obtain a reference to that worker and communicate with it.</p>



  <h4 id=the-global-scope><span class=secno>9.2.1 </span>The global scope</h4>

  <p>The global scope is the "inside" of a worker.</p>

  <h5 id=the-workerglobalscope-common-interface><span class=secno>9.2.1.1 </span>The <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> common interface</h5>

  <pre class=idl>interface <dfn id=workerglobalscope>WorkerGlobalScope</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute <a href=#workerglobalscope>WorkerGlobalScope</a> <a href=#dom-workerglobalscope-self title=dom-WorkerGlobalScope-self>self</a>;
  readonly attribute <a href=#workerlocation>WorkerLocation</a> <a href=#dom-workerglobalscope-location title=dom-WorkerGlobalScope-location>location</a>;

  void <a href=#dom-workerglobalscope-close title=dom-WorkerGlobalScope-close>close</a>();
<!-- v2-onclose           attribute <span>EventHandler</span> <span title="handler-WorkerGlobalScope-onclose">onclose</span>;
-->           attribute <a href=#onerroreventhandler>OnErrorEventHandler</a> <a href=#handler-workerglobalscope-onerror title=handler-WorkerGlobalScope-onerror>onerror</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-workerglobalscope-onoffline title=handler-WorkerGlobalScope-onoffline>onoffline</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-workerglobalscope-ononline title=handler-WorkerGlobalScope-ononline>ononline</a>;

  // <a href="#WorkerGlobalScope-partial">also has additional members in a partial interface</a>
};</pre>

  <p>The <dfn id=dom-workerglobalscope-self title=dom-WorkerGlobalScope-self><code>self</code></dfn> attribute must return the
  <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object itself.</p>

  <p>The <dfn id=dom-workerglobalscope-location title=dom-WorkerGlobalScope-location><code>location</code></dfn> attribute must
  return the <code><a href=#workerlocation>WorkerLocation</a></code> object created for the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>
  object when the worker was created. It represents the <a href=#absolute-url>absolute URL</a> of the script that
  was used to initialize the worker, after any redirects.</p>

  <hr><p>When a script invokes the <dfn id=dom-workerglobalscope-close title=dom-WorkerGlobalScope-close><code>close()</code></dfn>
  method on a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, the user agent must run the following steps
  (atomically):</p>

  <ol><li><p>Discard any <a href=#concept-task title=concept-task>tasks</a> that have been added to the
   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
   queues</a>.</p>

<!-- v2-onclose (remember to specify the task source, too)
   <li><p><span>Queue a task</span> to <span>fire a simple event</span> named <code
   title="event-worker-close">close</code> at the <code>WorkerGlobalScope</code> object.</p></li>
-->

   <li><p>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to true. (This prevents any further
   tasks from being queued.)</li>

  </ol><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>,
  by objects implementing the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><!-- v2-onclose    <tr><td><dfn title="handler-WorkerGlobalScope-onclose"><code>onclose</code></dfn> <td> <code title="event-worker-close">close</code> --><tr><td><dfn id=handler-workerglobalscope-onerror title=handler-WorkerGlobalScope-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
    <tr><td><dfn id=handler-workerglobalscope-onoffline title=handler-WorkerGlobalScope-onoffline><code>onoffline</code></dfn> <td> <code title=event-offline><a href=#event-offline>offline</a></code> <!-- new -->
    <tr><td><dfn id=handler-workerglobalscope-ononline title=handler-WorkerGlobalScope-ononline><code>ononline</code></dfn> <td> <code title=event-online><a href=#event-online>online</a></code> <!-- new -->
  </table><hr><p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a <dfn id=worker-origin>worker
  origin</dfn> that is set when the object is created.</p>

  <p class=note>For <a href=#data-protocol title="data protocol"><code title="">data:</code> URLs</a>, this is the <a href=#origin>origin</a>
  of the <a href=#entry-script>entry script</a> when the constructor was called. For
  other <a href=#url title=URL>URLs</a>, this is the <a href=#origin>origin</a>
  of the value of the <a href=#absolute-url>absolute URL</a> given in the worker's
  <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location></a></code> attribute.</p>


  <h5 id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface><span class=secno>9.2.1.2 </span>Dedicated workers and the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> interface</h5>

  <pre class=idl>[Global]
/*sealed*/ interface <dfn id=dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</dfn> : <a href=#workerglobalscope>WorkerGlobalScope</a> {
  void <a href=#dom-dedicatedworkerglobalscope-postmessage title=dom-DedicatedWorkerGlobalScope-postMessage>postMessage</a>(any message, optional sequence&lt;<a href=#transferable>Transferable</a>&gt; transfer);<!--
  <span>MessagePort</span> <span title="dom-DedicatedWorkerGlobalScope-startConversation">startConversation</span>(any message);-->
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-dedicatedworkerglobalscope-onmessage title=handler-DedicatedWorkerGlobalScope-onmessage>onmessage</a>;
};</pre>

  <p>The <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> interface must only
  be <a href=#exposed-to-javascript>exposed to JavaScript</a> if the <a href=#javascript-global-environment>JavaScript
  global environment</a> is a <a href=#dedicated-worker-environment>dedicated worker
  environment</a>.</p>

  <p><code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> objects act as if they
  had an implicit <code><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><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</p>

  <p>All messages received by that port must immediately be retargeted
  at the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</p>

  <p>The <dfn id=dom-dedicatedworkerglobalscope-postmessage title=dom-DedicatedWorkerGlobalScope-postMessage><code>postMessage()</code></dfn>
  method on <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> objects must act as if, when invoked, it
  immediately invoked <a href=#dom-messageport-postmessage title=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>Similarly, the <dfn
  title="dom-DedicatedWorkerGlobalScope-startConversation"><code>startConversation()</code></dfn>
  method on <code>DedicatedWorkerGlobalScope</code> objects must act as if, when invoked, it
  immediately invoked <span title="dom-MessagePort-startConversation">the method of the same
  name</span> on the port, with the same arguments, and returned the same return value.</p>
-->

  <p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>, by
  objects implementing the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
  interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-dedicatedworkerglobalscope-onmessage title=handler-DedicatedWorkerGlobalScope-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
  </table><p>For the purposes of the <a href=#application-cache>application cache</a> networking
  model, a dedicated worker is an extension of the <a href=#cache-host>cache
  host</a> from which it was created.</p>



  <h5 id=shared-workers-and-the-sharedworkerglobalscope-interface><span class=secno>9.2.1.3 </span>Shared workers and the <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> interface</h5>

  <pre class=idl>[Global]
/*sealed*/ interface <dfn id=sharedworkerglobalscope>SharedWorkerGlobalScope</dfn> : <a href=#workerglobalscope>WorkerGlobalScope</a> {
  readonly attribute DOMString <a href=#dom-sharedworkerglobalscope-name title=dom-SharedWorkerGlobalScope-name>name</a>;
  readonly attribute <a href=#applicationcache>ApplicationCache</a> <a href=#dom-sharedworkerglobalscope-applicationcache title=dom-SharedWorkerGlobalScope-applicationCache>applicationCache</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-sharedworkerglobalscope-onconnect title=handler-SharedWorkerGlobalScope-onconnect>onconnect</a>;
};</pre>

  <p>The <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> interface must only be
  <a href=#exposed-to-javascript>exposed to JavaScript</a> if the <a href=#javascript-global-environment>JavaScript global
  environment</a> is a <a href=#shared-worker-environment>shared worker environment</a>.</p>

  <p>Shared workers receive message ports through <code title=event-WorkerGlobalScope-connect>connect</code> events on
  their global object for each connection.</p>

  <p>The <dfn id=dom-sharedworkerglobalscope-name title=dom-SharedWorkerGlobalScope-name><code>name</code></dfn>
  attribute must return the value it was assigned when the
  <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object was created by the
  "<a href=#run-a-worker>run a worker</a>" algorithm. Its value represents the name
  that can be used to obtain a reference to the worker using the
  <code><a href=#sharedworker>SharedWorker</a></code> constructor.</p>

  <p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>, by
  objects implementing the <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
  interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-sharedworkerglobalscope-onconnect title=handler-SharedWorkerGlobalScope-onconnect><code>onconnect</code></dfn> <td> <code title=event-connect>connect</code>
  </table><p>For the purposes of the <a href=#application-cache>application cache</a> networking
  model, a shared worker is its own <a href=#cache-host>cache host</a>. The
  <a href=#run-a-worker>run a worker</a> algorithm takes care of associating the
  worker with an <a href=#application-cache>application cache</a>.</p>

  <p class=note>The <code title=dom-SharedWorkerGlobalScope-applicationCache><a href=#dom-sharedworkerglobalscope-applicationcache>applicationCache</a></code>
  attribute returns the <code><a href=#applicationcache>ApplicationCache</a></code> object for the
  worker.</p><!-- normative conf criteria is in the appcache section
  -->



  <h4 id=the-event-loop><span class=secno>9.2.2 </span>The event loop</h4>

  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a distinct <a href=#event-loop>event loop</a>, separate
  from those used by <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
  similar-origin browsing contexts</a>. This <a href=#event-loop>event loop</a> has no associated
  <a href=#browsing-context>browsing context</a>, and its <a href=#task-queue title="task queue">task queues</a> only have
  events, callbacks, and networking activity as <a href=#concept-task title=concept-task>tasks</a>. These <a href=#event-loop title="event loop">event loops</a> are created by the <a href=#run-a-worker>run a worker</a> algorithm.</p>

  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object also has a <dfn id=dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</dfn> flag, which must initially be false, but which
  can get set to true by the algorithms in the processing model section below.</p>

  <p>Once the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true, the <a href=#event-loop>event
  loop</a>'s <a href=#task-queue title="task queue">task queues</a> must discard any further <a href=#concept-task title=concept-task>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 title=dom-WorkerGlobalScope-closing>closing</a> flag is true, timers stop firing,
  notifications for all pending asynchronous operations are dropped, etc.</p>



  <h4 id="the-worker's-lifetime"><span class=secno>9.2.3 </span>The worker's lifetime</h4>

  <p>Workers communicate with other workers and with <a href=#browsing-context title="browsing context">browsing
  contexts</a> through <a href=#channel-messaging title="channel messaging">message channels</a> and their
  <code><a href=#messageport>MessagePort</a></code> objects.</p>

  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> <var title="">worker global scope</var> has a list of
  <dfn id="the-worker's-ports">the worker's ports</dfn>, which consists of all the <code><a href=#messageport>MessagePort</a></code> objects that are
  entangled with another port and that have one (but only one) port owned by <var title="">worker
  global scope</var>. This list includes <!--all the <code>MessagePort</code> objects that are in
  events pending in the <code>WorkerGlobalScope</code> object's <span>event loop</span>, as well as
  (commented out because in practice it makes no difference either way as far as I can tell, and it
  would be hard to strictly implement since these ports might not yet be across the thread
  boundary)--> the implicit <code><a href=#messageport>MessagePort</a></code> in the case of <a href=#dedicatedworkerglobalscope title=DedicatedWorkerGlobalScope>dedicated workers</a>.</p>

  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-workers">the worker's workers</dfn>.
  Initially this list is empty; it is populated when the worker creates or obtains further
  workers.</p>

  <p>Finally, each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-documents">the worker's
  <code>Document</code>s</dfn>. Initially this list is empty; it is populated when the worker is
  created.</p>

  <p>Whenever a <code><a href=#document>Document</a></code> <var title="">d</var> is <dfn id="add-a-document-to-the-worker's-documents" title="add a document to the
  worker's documents">added to the worker's <code>Document</code>s</dfn>, the user agent must, for
  each worker <var title="">q</var> in the list of <a href="#the-worker's-workers">the worker's workers</a> whose list of
  <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> does not contain <var title="">d</var>, <a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">add <var title="">d</var> to <var title="">q</var>'s <code>WorkerGlobalScope</code> owner's list of <span>the worker's
  <code>Document</code>s</span></a>.</p> <!-- suggestions welcome on making this sentence into
  understandable English -->

  <p>Whenever a <code><a href=#document>Document</a></code> object is <a href=#discard-a-document title="discard a Document">discarded</a>,
  it must be removed from the list of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> of each
  worker whose list contains that <code><a href=#document>Document</a></code>.</p>

  <p>Given a <a href="#script's-global-object">script's global object</a> <var title="">o</var> when creating or obtaining a
  worker, the <dfn id=list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to add</dfn> depends on the type
  of <var title="">o</var>. If <var title="">o</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object
  (i.e. if we are creating a nested worker), then the relevant <code><a href=#document>Document</a></code>s are the
  <code><a href=#document>Document</a></code>s that are in <var title="">o</var>'s own list of <a href="#the-worker's-documents">the worker's
  <code>Document</code>s</a>. Otherwise, <var title="">o</var> is a <code><a href=#window>Window</a></code> object,
  and the relevant <code><a href=#document>Document</a></code> is just the <code><a href=#document>Document</a></code> that is the <a href=#active-document>active
  document</a> of the <code><a href=#window>Window</a></code> object <var title="">o</var>.</p>

  <hr><p>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its list of <a href="#the-worker's-documents">the worker's
  <code>Document</code>s</a> is not empty.</p>

  <p>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is a <a href=#permissible-worker>permissible worker</a>
  and either it has outstanding timers, database transactions, or network connections, or its list
  of <a href="#the-worker's-ports">the worker's ports</a> is not empty, or its <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> is actually
  a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared worker).</p>

  <p>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any of the <code><a href=#document>Document</a></code>
  objects in <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> are <a href=#fully-active>fully active</a>.</p>

  <p>A worker is said to be a <dfn id=suspendable-worker>suspendable worker</dfn> if it is not an <a href=#active-needed-worker>active needed
  worker</a> but it is a <a href=#permissible-worker>permissible worker</a>.</p>


  <h4 id=processing-model-6><span class=secno>9.2.4 </span>Processing model</h4>

  <p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with <a href=#url>URL</a> <var title="">url</var>, a <a href=#browsing-context>browsing context</a> <var title="">owner browsing context</var>, a
  <code><a href=#document>Document</a></code> <var title="">owner document</var>, an <a href=#origin>origin</a> <var title="">owner origin</var>, and with global scope <var title="">worker global scope</var>, it
  must run the following steps:</p>

  <ol><li id=worker-processing-model-top>

    <p>Create a separate parallel execution environment (i.e. a separate thread or process or
    equivalent construct), and run the rest of these steps asynchronously in that context.</p>

    <p>For the purposes of timing APIs, this is the <dfn id=official-moment-of-creation>official moment of creation</dfn> of the
    worker.</p>

   </li>

   <li><p>If <var title="">worker global scope</var> is actually a
   <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared worker), and there are
   any <a href=#relevant-application-cache title="relevant application cache">relevant application caches</a> that are
   identified by a manifest URL with the <a href=#same-origin>same origin</a> as <var title="">url</var> and
   that have <var title="">url</var> as one of their entries, <em>not</em> excluding entries marked
   as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then associate the <var title="">worker
   global scope</var> with the <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application
   cache</a> of those that match.</li>

   <li>

    <p>Attempt to <a href=#fetch>fetch</a><!--FETCH--> the resource identified by <var title="">url</var>,
    from the <var title="">owner origin</var>, using <var title="">owner document</var> as the
    <a href=#referrer-source>referrer source</a>, with the <i>synchronous flag</i> set and the <i>force same-origin
    flag</i> set.</p> <!-- not http-origin privacy sensitive (looking forward to CORS) -->

    <p>If the attempt fails, then for each <code><a href=#worker>Worker</a></code> or <code><a href=#sharedworker>SharedWorker</a></code> object
    associated with <var title="">worker global scope</var>, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
    a simple event</a> named <code title=event-error>error</code> at that object. Abort these
    steps.</p>

    <p>If the attempt succeeds, then let <var title="">source</var> be the result of running the
    <a href=#utf-8-decode>UTF-8 decode</a> algorithm on the script resource.</p>

    <p>Let <var title="">language</var> be JavaScript.</p>

    <p class=note>As with <code><a href=#the-script-element>script</a></code> elements, the MIME type of the script is ignored.
    Unlike with <code><a href=#the-script-element>script</a></code> elements, there is no way to override the type. It's always
    assumed to be JavaScript.</p>

   </li>

   <li><p>In the newly created execution environment, create a <a href=#javascript-global-environment>JavaScript global
   environment</a> whose <i>global object</i> is <var title="">worker global scope</var>. If <var title="">worker global scope</var> is a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this
   is a <a href=#dedicated-worker-environment>dedicated worker environment</a>. Otherwise, <var title="">worker global
   scope</var> is a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object, and this is a <a href=#shared-worker-environment>shared worker
   environment</a>. (In either case, by definition, it is a <a href=#worker-environment>worker
   environment</a>.)</li>

   <li><!-- SCRIPT EXEC -->

    <p>A new <a href=#concept-script title=concept-script>script</a> is now created, as follows.</p>

    <p>Create a new <a href=#script-execution-environment>script execution environment</a> set up as appropriate for the
    scripting language <var title="">language</var>.</p>

    <p>Parse/compile/initialize <var title="">source</var> using that <a href=#script-execution-environment>script execution
    environment</a>, as appropriate for <var title="">language</var>, and thus obtain a
    <a href=#code-entry-point>code entry-point</a>.</p>

    <p>Set the <a href="#script's-global-object">script's global object</a> to <var title="">worker global scope</var>.</p>

    <p>Set the <a href="#script's-browsing-context">script's browsing context</a> to <var title="">owner browsing
    context</var>.</p>

    <p>Set the <a href="#script's-document">script's document</a> to <var title="">owner document</var>.</p>

    <p>Set the <a href="#script's-referrer-source">script's referrer source</a> to <var title="">url</var>.</p>

    <p>Set the <a href="#script's-url-character-encoding">script's URL character encoding</a> to UTF-8. (This is just used for
    encoding non-ASCII characters in the query component of URLs.)</p>

    <p>Set the <a href="#script's-base-url">script's base URL</a> to <var title="">url</var>.</p>

   </li>

   <li>

    <p><strong>Closing orphan workers</strong>: Start monitoring the worker such that no sooner than
    it stops being either a <a href=#protected-worker>protected worker</a> or a <a href=#suspendable-worker>suspendable worker</a>, and
    no later than it stops being a <a href=#permissible-worker>permissible worker</a>, <var title="">worker global
    scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true<!--
    v2-onclose and <span title="queue a task">a task is queued</span> to <span>fire a simple
    event</span> named <code title="event-worker-close">close</code> at <var title="">worker global
    scope</var>-->.</p>

   </li>

   <li>

    <p><strong>Suspending workers</strong>: Start monitoring the worker, such that whenever <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a>
    flag is false and the worker is a <a href=#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 title=dom-WorkerGlobalScope-closing>closing</a> flag switches to true or the worker stops
    being a <a href=#suspendable-worker>suspendable worker</a>.</p>

   </li>

   <li>

    <p><a href=#jump-to-a-code-entry-point title="jump to a code entry-point">Jump</a> to the <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code entry-point</a>, and let that run until
    it either returns, fails to catch an exception, or gets prematurely aborted by the "<a href=#kill-a-worker>kill a
    worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms defined below.</p>

<!-- v2-onclose
    <p class="note">If the script gets aborted by the "<span>kill a worker</span>" algorithm, then
    that same algorithm will cause there to only be a single <span title="concept-task">task</span>
    in the <code>WorkerGlobalScope</code> object's <span>event loop</span> at the next step, namely
    the task for the <code title="message-close">close</code> event. The "<span>terminate a
    worker</span>" algorithm removes all the events.</p>
-->

   </li>

   <li><p>If <var title="">worker global scope</var> is actually a
   <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object (i.e. the worker is a dedicated worker), then
   enable the <a href=#port-message-queue>port message queue</a> of the worker's implicit port.</li>

   <li>

    <p><strong><a href=#event-loop>Event loop<!-- labeled for ease of discussion --></a></strong>: Create a new <a href=#event-loop>event
    loop</a>, and run it until it is destroyed.</p>

    <p class=note>The handling of events or the execution of callbacks by <a href=#concept-task title=concept-task>tasks</a> run by the <a href=#event-loop>event loop</a> might get prematurely
    aborted by the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms
    defined below.</p>

    <p class=note>The worker processing model remains on this step until the event loop is
    destroyed, which happens after the <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a>
    flag is set to true, as described in the <a href=#event-loop>event loop</a> processing model.</p>

   </li>

   <li>

    <p>Empty the <var title="">worker global scope</var>'s <a href=#list-of-active-timers>list of active timers</a>.</p>

   </li>

   <li>

    <p>Disentangle all the ports in the list of <a href="#the-worker's-ports">the worker's ports</a>.</p>

   </li>

<!-- v2-onclose
   <li>

    <p>For each <code>Worker</code> or <code>SharedWorker</code> object associated with <var
    title="">worker global scope</var>, <span>queue a task</span> to <span>fire a simple
    event</span> named <code title="event-worker-close">close</code> at that object.</p>

   </li>
-->
  </ol><hr><p>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it must run the following steps in parallel
  with the worker's main loop (the "<a href=#run-a-worker>run a worker</a>" processing model defined above):</p>

  <ol><!-- v2-onclose
   <li><p>If the worker's <code>WorkerGlobalScope</code> object's <span
   title="dom-WorkerGlobalScope-closing">closing</span> flag is false, <span>queue a task</span> to
   <span>fire a simple event</span> named <code title="event-worker-close">close</code> at the
   worker's <code>WorkerGlobalScope</code> object.</p></li>
--><li><p>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to true.</li>

<!-- v2-onclose
   <li><p>Wait a user-agent-defined amount of time. If the "<span>run a worker</span>" processing
   model defined above immediately starts running event listeners registered for the <code
   title="event-worker-close">close</code> event, this time should not be zero &mdash; the idea is
   that the <code title="event-worker-close">close</code> event can be used to clean up when
   shutting down unexpectedly.</p></li>
-->

   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the
   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
   queues</a><!-- v2-onclose other than the <code title="event-worker-close">close</code> event
   that this algorithm just added-->, discard them without processing them.</li>

<!-- v2-onclose
   <li><p>If the <code title="event-worker-close">close</code> event that this algorithm just queued
   hasn't yet been dispatched, then abort the script currently running in the worker.</p></li>
-->

   <li><p>Wait a user-agent-defined amount of time.</li>

   <li><p>Abort the script currently running in the worker<!-- v2-onclose (if any script is running,
   then it will be a handler for the <code title="event-worker-close">close</code>
   event)-->.</li>

  </ol><p>User agents may invoke the "<a href=#kill-a-worker>kill a worker</a>" processing model on a worker at any
  time, e.g. in response to user requests, in response to CPU quota management, or when a worker
  stops being an <a href=#active-needed-worker>active needed worker</a> if the worker continues executing even after its
  <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag was set to true.</p>

  <hr><p>When a user agent is to <dfn id=terminate-a-worker>terminate a worker</dfn> it must run the following steps in
  parallel with the worker's main loop (the "<a href=#run-a-worker>run a worker</a>" processing model defined
  above):</p>

  <ol><li><p>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to true.</li>

   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the
   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
   queues</a>, discard them without processing them.</li>

   <li><p>Abort the script currently running in the worker.</li>

   <li><p>If the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object is actually a
   <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object (i.e. the worker is a dedicated worker), then
   empty the <a href=#port-message-queue>port message queue</a> of the port that the worker's implicit port is
   entangled with.</li>

  </ol><hr><p>The <a href=#task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>


  <h4 id=runtime-script-errors-0><span class=secno>9.2.5 </span>Runtime script errors</h4>

  <p>Whenever an uncaught runtime script error occurs in one of the worker's scripts, if the error
  did not occur while handling a previous script error, the user agent must <a href=#report-the-error>report the
  error</a> for that <a href=#concept-script title=concept-script>script</a>, with the position (line number
  and column number) where the error occurred, using the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object as the target.
  </p>

  <p>For shared workers, if the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>
  afterwards, the error may be reported to the user.
  </p>

  <p>For dedicated workers, if the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not
  handled</a></i> afterwards, the user
  agent must <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the <code><a href=#errorevent>ErrorEvent</a></code>
  interface, with the name <code title=event-error>error</code>, that doesn't bubble and is
  cancelable, with its <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code>, <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code>, <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>, <code title=dom-ErrorEvent-colno><a href=#dom-errorevent-colno>colno</a></code>,
  attributes initialized appropriately,
  and with the <code title=dom-ErrorEvent-error><a href=#dom-errorevent-error>error</a></code> attribute initialized to null,
  at the <code><a href=#worker>Worker</a></code> object associated with the
  worker. If the event is not canceled, the user agent must act as if the uncaught runtime script
  error had occurred in the global scope that the <code><a href=#worker>Worker</a></code> object is in, thus repeating
  the entire runtime script error reporting process one level up.</p>

  <p>If the implicit port connecting the worker to its <code><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><a href=#worker>Worker</a></code> object had no <code title=event-error>error</code> event handler and as
  if that worker's <code title=handler-WorkerGlobalScope-onerror><a href=#handler-workerglobalscope-onerror>onerror</a></code> attribute was
  null, but must otherwise act as described above.</p>

  <p class=note>Thus, error reports propagate up to the chain of dedicated workers up to the
  original <code><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>task source</a> for the task mentioned above is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>


  <h4 id=creating-workers><span class=secno>9.2.6 </span>Creating workers</h4>

  <h5 id=the-abstractworker-abstract-interface><span class=secno>9.2.6.1 </span>The <code><a href=#abstractworker>AbstractWorker</a></code> abstract interface</h5>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=abstractworker>AbstractWorker</dfn> {
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-abstractworker-onerror title=handler-AbstractWorker-onerror>onerror</a>;
<!-- v2-onclose           attribute <span>EventHandler</span> <span title="handler-AbstractWorker-onclose">onclose</span>; -->
};</pre>

  <p>The following are the <a href=#event-handlers>event handlers</a> (and their
  corresponding <a href=#event-handler-event-type title="event handler event type">event handler
  event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>, by
  objects implementing the <code><a href=#abstractworker>AbstractWorker</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-abstractworker-onerror title=handler-AbstractWorker-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
<!-- v2-onclose    <tr><td><dfn title="handler-AbstractWorker-onclose"><code>onclose</code></dfn> <td> <code title="event-worker-close">close</code> -->
  </table><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>9.2.6.2 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>

  <pre class=idl>[<a href=#dom-worker title=dom-Worker>Constructor</a>(DOMString scriptURL)]
interface <dfn id=worker>Worker</dfn> : <a href=#eventtarget>EventTarget</a> {
  void <a href=#dom-worker-terminate title=dom-Worker-terminate>terminate</a>();

  void <a href=#dom-worker-postmessage title=dom-Worker-postMessage>postMessage</a>(any message, optional sequence&lt;<a href=#transferable>Transferable</a>&gt; transfer);<!--
  <span>MessagePort</span> <span title="dom-Worker-startConversation">startConversation</span>(any message);-->
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-worker-onmessage title=handler-Worker-onmessage>onmessage</a>;
};
<a href=#worker>Worker</a> implements <a href=#abstractworker>AbstractWorker</a>;</pre>

  <p>The <dfn id=dom-worker-terminate title=dom-Worker-terminate><code>terminate()</code></dfn> method, when invoked, must
  cause the "<a href=#terminate-a-worker>terminate a worker</a>" algorithm to be run on the worker with which the object
  is associated.</p>

  <p><code><a href=#worker>Worker</a></code> objects act as if they had an implicit <code><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><a href=#worker>Worker</a></code> object.</p>

  <p>All messages received by that port must immediately be retargeted at the <code><a href=#worker>Worker</a></code>
  object.</p>

  <p>The <dfn id=dom-worker-postmessage title=dom-Worker-postMessage><code>postMessage()</code></dfn> method on
  <code><a href=#worker>Worker</a></code> objects must act as if, when invoked, it immediately invoked <a href=#dom-messageport-postmessage title=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>Similarly, the <dfn title="dom-Worker-startConversation"><code>startConversation()</code></dfn>
  method on <code>Worker</code> objects must act as if, when invoked, it immediately invoked <span
  title="dom-MessagePort-startConversation">the method of the same name</span> on the port, with the
  same arguments, and returned the same return value.</p>
-->

  <div class=example>

   <p>The <code title=dom-Worker-postMessage><a href=#dom-worker-postmessage>postMessage()</a></code>
   method's first argument can be structured data:</p>

   <pre>worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});</pre>

  </div>

  <p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>,
  by objects implementing the <code><a href=#worker>Worker</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-worker-onmessage title=handler-Worker-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
  </table><hr><p>When the <dfn id=dom-worker title=dom-Worker><code>Worker(<var title="">scriptURL</var>)</code></dfn> constructor is invoked, the
  user agent must run the following steps:</p>

  <ol><li><p>The user agent may throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps if
   the request violates a policy decision (e.g. if the user agent is configured to not allow the
   page to start dedicated workers).</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var> argument
   relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, when
   the method is invoked.</li>

   <li><p>If this fails, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>

   <li>

    <p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of the resulting <a href=#parsed-url>parsed
    URL</a> is not "<code title=data-protocol>data</code>", and the <a href=#origin>origin</a> of the
    resulting <a href=#absolute-url>absolute URL</a> is not the <a href=#same-origin title="same origin">same</a> as the
    origin of the <a href=#entry-script>entry script</a>, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and
    abort these steps.</p>

    <p class=note>Thus, scripts must either be external files with the same scheme, host, and port
    as the original page, or <a href=#data-protocol title="data protocol"><code title="">data:</code> URLs</a>.
    For example, you can't load a script from a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a>, and an <code>https:</code> page couldn't start workers
    using scripts with <code>http:</code> URLs.</p>

   </li>

   <li><p>Create a new <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object whose <a href=#worker-origin>worker
   origin</a> is the origin of the <a href=#entry-script>entry script</a>. Let <var title="">worker global
   scope</var> be this new object.</li>

   <li><p>Create a new <code><a href=#worker>Worker</a></code> object, associated with <var title="">worker global
   scope</var>. Let <var title="">worker</var> be this new object.</li>

   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
   this be the <var title="">outside port</var>.</li>

   <li><p>Associate the <var title="">outside port</var> with <var title="">worker</var>.</li>

   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker
   global scope</var>. Let <var title="">inside port</var> be this new object.</li>

   <li><p>Associate <var title="">inside port</var> with <var title="">worker global
   scope</var>.</li>

   <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var> and <var title="">inside
   port</var>.</li>

   <li><p>Return <var title="">worker</var>, and run the following steps asynchronously.</li>

<!-- (this is done by the "run a worker" algorithm)
   <li><p>Enable <var title="">inside port</var>'s <span>port message queue</span>.</p></li>
-->

   <li><p>Enable <var title="">outside port</var>'s <a href=#port-message-queue>port message queue</a>.</li>

   <li>

    <p>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
    add</a> given the <a href="#script's-global-object" title="script's global object">global object</a> of the
    <a href=#incumbent-script>incumbent script</a>.</p>

   </li>

   <li>

    <p><a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">Add to <var title="">worker global
    scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
    <code><a href=#document>Document</a></code> objects in <var title="">docs</var>.</p>

   </li>

   <li>

    <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
    script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we are creating a nested worker),
    add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of
    the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global
    object">global object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>

   </li>

   <li>

    <p><a href=#run-a-worker>Run a worker</a> for the resulting <a href=#absolute-url>absolute URL</a>, with the
    <a href="#script's-browsing-context">script's browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <var title="">owner browsing context</var>, with the <a href="#script's-document">script's document</a> of the
    <a href=#incumbent-script>incumbent script</a> as the <var title="">owner document</var>, with the
    <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner origin</var>,
    and with <var title="">worker global scope</var> as the global scope.</p>

   </li>

  </ol><h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>9.2.6.3 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>

  <pre class=idl>[<a href=#dom-sharedworker title=dom-SharedWorker>Constructor</a>(DOMString scriptURL, optional DOMString name)]
interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute <a href=#messageport>MessagePort</a> <a href=#dom-sharedworker-port title=dom-SharedWorker-port>port</a>;
};
<a href=#sharedworker>SharedWorker</a> implements <a href=#abstractworker>AbstractWorker</a>;</pre>

  <p>The <dfn id=dom-sharedworker-port title=dom-SharedWorker-port><code>port</code></dfn> attribute must return the value
  it was assigned by the object's constructor. It represents the <code><a href=#messageport>MessagePort</a></code> for
  communicating with the shared worker.</p>

  <p>When the <dfn id=dom-sharedworker title=dom-SharedWorker><code>SharedWorker(<var title="">scriptURL</var>, <var title="">name</var>)</code></dfn> constructor is invoked, the user agent must run the following
  steps:</p>

  <ol><li><p>The user agent may throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps if
   the request violates a policy decision (e.g. if the user agent is configured to not allow the
   page to start shared workers).</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var>
   argument.</li>

   <li><p>If this fails, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>

   <li><p>Let <var title="">scriptURL</var> be the resulting <a href=#absolute-url>absolute URL</a> and <var title="">parsed scriptURL</var> be the resulting <a href=#parsed-url>parsed URL</a>.</li>

   <li><p>Let <var title="">name</var> be the value of the second argument, or the empty string if
   the second argument was omitted.</li>

   <li>

    <p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of <var title="">parsed
    scriptURL</var> is not "<code title=data-protocol>data</code>", and the <a href=#origin>origin</a> of
    <var title="">scriptURL</var> is not the <a href=#same-origin title="same origin">same</a> as the origin of
    the <a href=#entry-script>entry script</a>, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these
    steps.</p>

    <p class=note>Thus, scripts must either be external files with the same scheme, host, and port
    as the original page, or <a href=#data-protocol title="data protocol"><code title="">data:</code> URLs</a>.
    For example, you can't load a script from a <a href=#javascript-protocol title="javascript protocol"><code title="">javascript:</code> URL</a>, and an <code>https:</code> page couldn't start workers
    using scripts with <code>http:</code> URLs.</p>

   </li>

   <li>

    <p>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
    add</a> given the <a href="#script's-global-object" title="script's global object">global object</a> of the
    <a href=#incumbent-script>incumbent script</a>.</p>

   </li>

   <li>

    <p>Execute the following substeps atomically:</p>

    <ol><li><p>Create a new <code><a href=#sharedworker>SharedWorker</a></code> object, which will shortly be associated with a
     <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object. Let this <code><a href=#sharedworker>SharedWorker</a></code> object be <var title="">worker</var>.</li>

     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
     this be the <var title="">outside port</var>.</li>

     <li><p>Assign <var title="">outside port</var> to the <code title=dom-SharedWorker-port><a href=#dom-sharedworker-port>port</a></code> attribute of <var title="">worker</var>.</li>

     <li><p>Let <var title="">worker global scope</var> be null.</li>

     <li>

      <p>If <var title="">name</var> is not the empty string and there exists a
      <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is false, whose <code title=dom-WorkerGlobalScope-name>name</code> attribute is exactly equal to <var title="">name</var>, and whose <a href=#worker-origin>worker origin</a> is the <a href=#same-origin>same origin</a> as
      <var title="">scriptURL</var>, then let <var title="">worker global scope</var> be that
      <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</p>

      <p>Otherwise, if <var title="">name</var> is the empty string and there exists a
      <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is false, whose <code title=dom-WorkerGlobalScope-name>name</code> attribute is the empty string, and whose <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute represents an <a href=#absolute-url>absolute
      URL</a> that is exactly equal to <var title="">scriptURL</var>, then let <var title="">worker global scope</var> be that <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</p>

     </li>

     <li>

      <p>If <var title="">worker global scope</var> is not null, but the user agent has been
      configured to disallow communication between the <a href=#incumbent-script>incumbent script</a> and the worker
      represented by the <var title="">worker global scope</var>, then set <var title="">worker
      global scope</var> to null.</p>

      <p class=note>For example, a user agent could have a development mode that isolates a
      particular <a href=#top-level-browsing-context>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>

     <li>

      <p>If <var title="">worker global scope</var> is not null, then run these steps:</p>

      <ol><li><p>If <var title="">worker global scope</var>'s <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute represents an <a href=#absolute-url>absolute
       URL</a> that is not exactly equal to <var title="">scriptURL</var>, then throw a
       <code><a href=#urlmismatcherror>URLMismatchError</a></code> exception and abort all these steps.</li>

       <li><p>Associate <var title="">worker</var> with <var title="">worker global
       scope</var>.</li>

       <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker global scope</var>. Let this be the <var title="">inside port</var>.</li>

       <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var>
       and <var title="">inside port</var>.</li>

       <li><p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the
       <code><a href=#messageevent>MessageEvent</a></code> interface, with the name <code title=event-connect>connect</code>, which does not bubble, is not cancelable, has no
       default action, has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value
       is initialized to the empty string, has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
       attribute whose value is initialized to a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a>
       array containing only the newly created port, and has a <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute whose value is initialized to the
       newly created port, and <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> the event at <var title="">worker global
       scope</var>.</li>

       <li>

        <p><a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">Add to <var title="">worker global
        scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
        <code><a href=#document>Document</a></code> objects in <var title="">docs</var>.</p>

       </li>

       <li>

        <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
        script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global
        scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
        <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global
        object">global object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>

       </li>

       <li><p>Return <var title="">worker</var> and abort all these steps.</li>

      </ol></li>

     <li><p>Create a new <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#worker-origin>worker
     origin</a> is the origin of the <a href=#entry-script>entry script</a>. Let <var title="">worker global
     scope</var> be this new object.</li>

     <li><p>Associate <var title="">worker</var> with <var title="">worker global
     scope</var>.</li>

     <li><p>Set the <code title=dom-SharedWorkerGlobalScope-name><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute of <var title="">worker global scope</var> to <var title="">name</var>.</li>

     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker
     global scope</var>. Let <var title="">inside port</var> be this new object.</li>

     <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var> and <var title="">inside
     port</var>.</li>

    </ol></li>

   <li><p>Return <var title="">worker</var> and perform the remaining steps asynchronously.</li>

   <li><p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the
   <code><a href=#messageevent>MessageEvent</a></code> interface, with the name <code title=event-connect>connect</code>,
   which does not bubble, is not cancelable, has no default action, has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value is initialized to the empty
   string, has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose value is
   initialized to a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array containing only the
   newly created port, and has a <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute whose
   value is initialized to the newly created port, and <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> the event at <var title="">worker global
   scope</var>.</li>

   <li>

    <p><a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">Add to <var title="">worker global
    scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
    <code><a href=#document>Document</a></code> objects in <var title="">docs</var>.</p>

   </li>

   <li>

    <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
    script</a> that invoked the constructor is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global object">global
    object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>

   </li>

   <li>

    <p><a href=#run-a-worker>Run a worker</a> for <var title="">scriptURL</var>, with the <a href="#script's-browsing-context">script's browsing
    context</a> of the <a href=#incumbent-script>incumbent script</a> as the <var title="">owner browsing
    context</var>, with the <a href="#script's-document">script's document</a> of the <a href=#incumbent-script>incumbent script</a> the
    <var title="">owner document</var>, with the <a href=#origin>origin</a> of the <a href=#entry-script>entry
    script</a> as the <var title="">owner origin</var>, and with <var title="">worker global
    scope</var> as the global scope.</p>

   </li>

  </ol><p>The <a href=#task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>



  <h3 id=apis-available-to-workers><span class=secno>9.3 </span>APIs available to workers</h3>

  <pre class=idl>[NoInterfaceObject]
partial interface <a href=#workerglobalscope id=WorkerGlobalScope-partial>WorkerGlobalScope</a> {<!-- not obsolete -->
  void <a href=#dom-workerglobalscope-importscripts title=dom-WorkerGlobalScope-importScripts>importScripts</a>(DOMString... urls);
  readonly attribute <a href=#workernavigator>WorkerNavigator</a> <a href=#dom-worker-navigator title=dom-worker-navigator>navigator</a>;
};
<a href=#workerglobalscope>WorkerGlobalScope</a> implements <a href=#windowtimers>WindowTimers</a>;
<a href=#workerglobalscope>WorkerGlobalScope</a> implements <a href=#windowbase64>WindowBase64</a>;</pre>


  <p>The DOM APIs &mdash; specifically, all the interfaces defind in the DOM specification other
  than exceptions &mdash; must not be <a href=#exposed-to-javascript>exposed to JavaScript</a> if the <a href=#javascript-global-environment>JavaScript
  global environment</a> is a <a href=#worker-environment>worker environment</a>. <a href=#refsDOM>[DOM]</a></p>


  <h4 id=importing-scripts-and-libraries><span class=secno>9.3.1 </span>Importing scripts and libraries</h4>

  <p>When a script invokes the <dfn id=dom-workerglobalscope-importscripts title=dom-WorkerGlobalScope-importScripts><code>importScripts(<var title="">urls</var>)</code></dfn> method on a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, the user
  agent must run the following steps:</p>

  <ol><li><p>If there are no arguments, return without doing anything. Abort these steps.</li>

   <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> each argument.</li>

   <li><p>If any fail, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>

   <li>

    <p>Attempt to <a href=#fetch>fetch</a><!--FETCH--> each resource identified by the resulting <a href=#absolute-url title="absolute URL">absolute URLs</a>, from the <a href=#entry-script>entry script</a>'s
    <a href=#origin>origin</a>, using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's referrer
    source">referrer source</a>, and with the <i>synchronous flag</i> set.</p> <!-- not
    http-origin privacy sensitive -->

   </li>

   <li>

    <p>For each argument in turn, in the order given, starting with the first one, run these
    substeps:</p>

    <ol><li>

      <p>Wait for the fetching attempt for the corresponding resource to complete.</p>

      <p>If the fetching attempt failed, throw a <code><a href=#networkerror>NetworkError</a></code> exception and abort all
      these steps.</p>

      <p>If the attempt succeeds, then let <var title="">source</var> be the result of running the
      <a href=#utf-8-decode>UTF-8 decode</a> algorithm on the script resource.</p>

      <p>Let <var title="">language</var> be JavaScript.</p>

      <p class=note>As with the worker's script, the script here is always assumed to be
      JavaScript, regardless of the MIME type.</p>

     </li>

     <li>

      <p><a href=#create-a-script>Create a script</a>, using <var title="">source</var> as the script source, the
      <a href=#url>URL</a> from which <var title="">source</var> was obtained, and <var title="">language</var> as the scripting language, using the same global object, browsing
      context, document, referrer source, URL character encoding, and base URL as the <a href=#concept-script title=concept-script>script</a> that was created by the worker's <a href=#run-a-worker>run a
      worker</a> algorithm.</p>

      <p>If the script came from a resource whose <a href=#url>URL</a> does not have the <a href=#same-origin>same
      origin</a> as the <a href=#worker-origin>worker origin</a>, then pass the <var title="">muted
      errors</var> flag to the <a href=#create-a-script-from-a-node>create a script from a node</a> algorithm.</p>

      <p>Let the newly created <a href=#concept-script title=concept-script>script</a> run until it either
      returns, fails to parse, fails to catch an exception, or gets prematurely aborted by the
      "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms defined
      above.</p>

      <p>If it failed to parse, then throw an ECMAScript <code title=js-SyntaxError><a href=#js-syntaxerror>SyntaxError</a></code> exception and abort all these steps. <a href=#refsECMA262>[ECMA262]</a></p>

      <p>If an exception was thrown or if the script was prematurely aborted, then abort all these
      steps, letting the exception or aborting continue to be processed by the <a href=#incumbent-script>incumbent
      script</a>.</p>

      <p>If the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms abort
      the script then abort all these steps.</p>

     </li>

    </ol></li>

  </ol><h4 id=the-workernavigator-object><span class=secno>9.3.2 </span>The <code><a href=#workernavigator>WorkerNavigator</a></code> object</h4>

  <p>The <dfn id=dom-worker-navigator title=dom-worker-navigator><code>navigator</code></dfn> attribute
  of the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface must return an instance of
  the <code><a href=#workernavigator>WorkerNavigator</a></code> interface, which represents the
  identity and state of the user agent (the client):</p>

  <pre class=idl>interface <dfn id=workernavigator>WorkerNavigator</dfn> {};
<a href=#workernavigator>WorkerNavigator</a> implements <a href=#navigatorid>NavigatorID</a>;
<a href=#workernavigator>WorkerNavigator</a> implements <a href=#navigatorlanguage>NavigatorLanguage</a>;
<a href=#workernavigator>WorkerNavigator</a> implements <a href=#navigatoronline>NavigatorOnLine</a>;</pre>

  <p>The <code><a href=#workernavigator>WorkerNavigator</a></code> interface must only be <a href=#exposed-to-javascript>exposed
  to JavaScript</a> if the <a href=#javascript-global-environment>JavaScript global
  environment</a> is a <a href=#worker-environment>worker environment</a>.</p>




  <h4 id=interface-objects-and-constructors><span class=secno>9.3.3 </span>Interface objects and constructors</h4>

  <p>Nothing must be <a href=#exposed-to-javascript>exposed to JavaScript</a> when the <a href=#javascript-global-environment>JavaScript global
  environment</a> is a <a href=#worker-environment>worker environment</a> except for the following:</p>

  <ul><li><p>Any interfaces and exceptions defined by a specification that explicitly specifies that
   they are <a href=#exposed-to-javascript>exposed to JavaScript</a> when the <a href=#javascript-global-environment>JavaScript global environment</a>
   is a <a href=#worker-environment>worker environment</a>.</li>

   <li><p>The interfaces of any objects made accessible through, and the exceptions thrown by any,
   interfaces or objects of interfaces that are themselves
   <a href=#exposed-to-javascript>exposed to JavaScript</a> (i.e. this requirement is transitive).</li>

  </ul><p class=note>These requirements do not override the requirements defined by the Web IDL
  specification, in particular concerning the visibility of interfaces annotated with the <code title="">[NoInterfaceObject]</code> extended attribute.</p>


  <h4 id=worker-locations><span class=secno>9.3.4 </span>Worker locations</h4>

  <pre class=idl>interface <dfn id=workerlocation>WorkerLocation</dfn> { };
<a href=#workerlocation>WorkerLocation</a> implements <a href=#urlutilsreadonly>URLUtilsReadOnly</a>;</pre>

  <p>A <code><a href=#workerlocation>WorkerLocation</a></code> object represents an <a href=#absolute-url>absolute URL</a> set at its
  creation.</p>

  <p>The <code><a href=#workerlocation>WorkerLocation</a></code> interface supports the <code><a href=#urlutilsreadonly>URLUtilsReadOnly</a></code>
  interface. <a href=#refsURL>[URL]</a></p>

  <p>When the object is created, the user agent must invoke the element's
  <code><a href=#urlutilsreadonly>URLUtilsReadOnly</a></code> interface's <a href=#concept-uu-set-the-input title=concept-uu-set-the-input>set the
  input</a> algorithm with the <a href=#absolute-url>absolute URL</a> that the <code><a href=#workerlocation>WorkerLocation</a></code>
  object represents as the given value.</p>

  <p>The element's <code><a href=#urlutilsreadonly>URLUtilsReadOnly</a></code> interface's <a href=#concept-uu-get-the-base title=concept-uu-get-the-base>get the base</a> algorithm must return null.</p>

  <p>The <code><a href=#workerlocation>WorkerLocation</a></code> interface must only be <a href=#exposed-to-javascript>exposed to JavaScript</a> if
  the <a href=#javascript-global-environment>JavaScript global environment</a> is a <a href=#worker-environment>worker environment</a>.</p>



<!--REMOVE-TOPIC:Workers-->



  <h2 id=comms><span class=secno>10 </span>Communication</h2>



  <h3 id=event-definitions-2><span class=secno>10.1 </span>Event definitions</h3>

  <p>Messages in <a href=#server-sent-events>server-sent events</a>, <a href=#network>Web sockets</a>, <a href=#web-messaging>cross-document
  messaging</a>, and <a href=#channel-messaging>channel messaging</a> use the <dfn id=event-message title=event-message><code>message</code></dfn> event. </p>

  <p>The following interface is defined for this event:</p>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#messageeventinit>MessageEventInit</a> eventInitDict)]
interface <dfn id=messageevent>MessageEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute any <a href=#dom-messageevent-data title=dom-MessageEvent-data>data</a>;
  readonly attribute DOMString <a href=#dom-messageevent-origin title=dom-MessageEvent-origin>origin</a>;
  readonly attribute DOMString <a href=#dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId>lastEventId</a>;
  readonly attribute (<a href=#windowproxy>WindowProxy</a> or <a href=#messageport>MessagePort</a>)? <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
  readonly attribute <a href=#messageport>MessagePort</a>[]? <a href=#dom-messageevent-ports title=dom-MessageEvent-ports>ports</a>;
};

dictionary <dfn id=messageeventinit>MessageEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  any data;
  DOMString origin;
  DOMString lastEventId;
  <a href=#windowproxy>WindowProxy</a>? source;
  <a href=#messageport>MessagePort</a>[]? ports;
};</pre>

  <dl class=domintro><dt><var title="">event</var> . <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code></dt>

   <dd>

    <p>Returns the data of the message.</p>

   </dd>

   <dt><var title="">event</var> . <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code></dt>

   <dd>

    <p>Returns the origin of the message, for <a href=#server-sent-events>server-sent events</a> and
    <a href=#web-messaging>cross-document messaging</a>.</p>

   </dd>

   <dt><var title="">event</var> . <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code></dt>

   <dd>

    <p>Returns the <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</a>, for
    <a href=#server-sent-events>server-sent events</a>.</p>

   </dd>

   <dt><var title="">event</var> . <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> of the source window, for <a href=#web-messaging>cross-document
    messaging</a>, and the <code><a href=#messageport>MessagePort</a></code> being attached, in the <code title=event-connect>connect</code> event fired at <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
    objects.</p>

   </dd>

   <dt><var title="">event</var> . <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code></dt>

   <dd>

    <p>Returns the <code><a href=#messageport>MessagePort</a></code> array sent with the message, for <a href=#web-messaging>cross-document
    messaging</a> and <a href=#channel-messaging>channel messaging</a>.</p>

   </dd>

  </dl><div class=impl>

  <p>The <dfn id=dom-messageevent-data title=dom-MessageEvent-data><code>data</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to null. It
  represents the message being sent.</p>

  <p>The <dfn id=dom-messageevent-origin title=dom-MessageEvent-origin><code>origin</code></dfn> attribute
  must return the value it was initialized to. When the object is
  created, this attribute must be initialized to the empty string. It
  represents, in <a href=#server-sent-events>server-sent events</a> and
  <a href=#web-messaging>cross-document messaging</a>, the <a href=#origin>origin</a> of
  the document that sent the message (typically the scheme, hostname,
  and port of the document, but not its path or fragment
  identifier).</p>

  <p>The <dfn id=dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId><code>lastEventId</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to the empty
  string. It represents, in <a href=#server-sent-events>server-sent events</a>, the <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID
  string</a> of the event source.</p>

  <p>The <dfn id=dom-messageevent-source title=dom-MessageEvent-source><code>source</code></dfn> attribute
  must return the value it was initialized to. When the object is
  created, this attribute must be initialized to null. It represents,
  in <a href=#web-messaging>cross-document messaging</a>, the
  <code><a href=#windowproxy>WindowProxy</a></code> of the <a href=#browsing-context>browsing context</a> of the
  <code><a href=#window>Window</a></code> object from which the message came; and in the
  <code title=event-connect>connect</code> events used by <a href=#sharedworkerglobalscope title=SharedWorkerGlobalScope>shared workers</a>, the newly
  connecting <code><a href=#messageport>MessagePort</a></code>.</p>

  <p>The <dfn id=dom-messageevent-ports title=dom-MessageEvent-ports><code>ports</code></dfn>
  attribute must return the value it was initialized to. When the
  object is created, this attribute must be initialized to null<!-- a
  <span title="dfn-read-only-array">read only</span> empty array-->.
  It represents, in <a href=#web-messaging>cross-document messaging</a> and
  <a href=#channel-messaging>channel messaging</a> the <code><a href=#messageport>MessagePort</a></code> array
  being sent, if any.</p>

  </div>

  




  <h3 id=server-sent-events><span class=secno>10.2 </span><dfn>Server-sent events</dfn></h3>

  

  <h4 id=server-sent-events-intro><span class=secno>10.2.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>To enable servers to push data to Web pages over HTTP or using
  dedicated server-push protocols, this specification introduces the
  <code><a href=#eventsource>EventSource</a></code> interface.</p>

  <p>Using this API consists of creating an <code><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 title="">updates.cgi</code>" in this case) sends messages in the
  following form, with the <code><a href=#text/event-stream>text/event-stream</a></code> MIME
  type:</p>

  <pre>data: This is the first message.

data: This is the second message, it
data: has two lines.

data: This is the third message.</pre>

  <hr><p>Authors can separate events by using different event types. Here
  is a stream that has two event types, "add" and "remove":</p>

  <pre>event: add
data: 73857293

event: remove
data: 2153

event: add
data: 113411</pre>

  <p>The script to handle such a stream would look like this (where
  <code title="">addHandler</code> and <code title="">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>

  <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>XMLHttpRequest</code> or an
  <code><a href=#the-iframe-element>iframe</a></code> allows the user agent to make better use of network resources in cases where
  the user agent implementor and the network operator are able to coordinate in advance. Amongst
  other benefits, this can result in significant savings in battery life on portable devices. This
  is discussed further in the section below on <a href=#eventsource-push>connectionless
  push</a>.</p>



  <h4 id=the-eventsource-interface><span class=secno>10.2.2 </span>The <code><a href=#eventsource>EventSource</a></code> interface</h4>

  <pre class=idl>[<a href=#dom-eventsource title=dom-EventSource>Constructor</a>(DOMString url, optional <a href=#eventsourceinit>EventSourceInit</a> eventSourceInitDict)]
interface <dfn id=eventsource>EventSource</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute DOMString <a href=#dom-eventsource-url title=dom-EventSource-url>url</a>;
  readonly attribute boolean <a href=#dom-eventsource-withcredentials title=dom-EventSource-withCredentials>withCredentials</a>;

  // ready state
  const unsigned short <a href=#dom-eventsource-connecting title=dom-EventSource-CONNECTING>CONNECTING</a> = 0;
  const unsigned short <a href=#dom-eventsource-open title=dom-EventSource-OPEN>OPEN</a> = 1;
  const unsigned short <a href=#dom-eventsource-closed title=dom-EventSource-CLOSED>CLOSED</a> = 2;
  readonly attribute unsigned short <a href=#dom-eventsource-readystate title=dom-EventSource-readyState>readyState</a>;

  // networking
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-eventsource-onopen title=handler-EventSource-onopen>onopen</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-eventsource-onmessage title=handler-EventSource-onmessage>onmessage</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-eventsource-onerror title=handler-EventSource-onerror>onerror</a>;
  void <a href=#dom-eventsource-close title=dom-EventSource-close>close</a>();
};

dictionary <dfn id=eventsourceinit>EventSourceInit</dfn> {
  boolean <dfn id=dom-eventsourceinit-withcredentials title=dom-EventSourceInit-withCredentials>withCredentials</dfn> = false;
};</pre>

  <p>The <dfn id=dom-eventsource title=dom-EventSource><code>EventSource()</code></dfn> constructor takes one or two
  arguments. The first specifies the <a href=#url>URL</a> to which to connect. The second specifies the
  settings, if any, in the form of an <code><a href=#eventsourceinit>EventSourceInit</a></code> dictionary. When the
  <code>EventSource()</code> constructor is invoked, the UA must run these steps:</p>

  <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> specified in the first
   argument, relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
   URL</a>.
   </li>

   <li><p>If the previous step failed, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort
   these steps.</li>

   <li><p>Create a new <code><a href=#eventsource>EventSource</a></code> object.</li>

   <li><p>Let <var title="">CORS mode</var> be <a href=#attr-crossorigin-anonymous title=attr-crossorigin-anonymous>Anonymous</a>.</li>

   <li><p>If the second argument is present, and the <code title=dom-EventSourceInit-withCredentials><a href=#dom-eventsourceinit-withcredentials>withCredentials</a></code> dictionary member has the
   value true, then set <var title="">CORS mode</var> to <a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use Credentials</a> and initialize the new
   <code><a href=#eventsource>EventSource</a></code> object's <code title=dom-EventSource-withCredentials><a href=#dom-eventsource-withcredentials>withCredentials</a></code> attribute to true.</li>

   <li><p>Return the new <code><a href=#eventsource>EventSource</a></code> object, but continue these steps
   asynchronously.</li>

   <li><!-- if you change this, don't forget to update the
            reconnecting fetch lower down as well! -->

    <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the resulting <a href=#absolute-url>absolute
    URL</a> using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's referrer source">referrer
    source</a>, with the <i>mode</i> being <var title="">CORS mode</var>, and the <i title="">origin</i> being the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a><!--, and the
    <i>default origin behaviour</i> set to <i>fail</i> (though it has no effect in the "Anonymous"
    and "Use Credentials" modes)-->, and process the resource obtained in this fashion, if any, as
    described below.</p>

    <p class=note>The definition of the <a href=#fetch title=fetch>fetching</a> algorithm (which is
    used by CORS) is such that if the browser is already fetching the resource identified by the
    given <a href=#absolute-url>absolute URL</a>, that connection can be reused, instead of a new connection
    being established. All messages received up to this point are dispatched immediately, in this
    case.</p>

   </li>

  </ol><hr><p>The <dfn id=dom-eventsource-url title=dom-EventSource-url><code>url</code></dfn> attribute must return the
  <a href=#absolute-url>absolute URL</a> that resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the
  value that was passed to the constructor.</p> <!-- not the result of redirects, since that would
  introduce race conditions -->

  <p>The <dfn id=dom-eventsource-withcredentials title=dom-EventSource-withCredentials><code>withCredentials</code></dfn> attribute
  must return the value to which it was last initialized. When the object is created, it must be
  initialized to false.</p>

  <p>The <dfn id=dom-eventsource-readystate title=dom-EventSource-readyState><code>readyState</code></dfn> attribute represents
  the state of the connection. It can have the following values:</p>

  <dl><dt><dfn id=dom-eventsource-connecting title=dom-EventSource-CONNECTING><code>CONNECTING</code></dfn> (numeric value 0)</dt>

   <dd>The connection has not yet been established, or it was closed and the user agent is
   reconnecting.</dd>

   <dt><dfn id=dom-eventsource-open title=dom-EventSource-OPEN><code>OPEN</code></dfn> (numeric value 1)</dt>

   <dd>The user agent has an open connection and is dispatching events as it receives them.</dd>

   <dt><dfn id=dom-eventsource-closed title=dom-EventSource-CLOSED><code>CLOSED</code></dfn> (numeric value 2)</dt>

   <dd>The connection is not open, and the user agent is not trying to reconnect. Either there was a
   fatal error or the <code title=dom-EventSource-close><a href=#dom-eventsource-close>close()</a></code> method was invoked.</dd>

  </dl><p>When the object is created its <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> must
  be set to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code> (0). The rules given below
  for handling the connection define when the value changes.</p>

  <p>The <dfn id=dom-eventsource-close title=dom-EventSource-close><code>close()</code></dfn> method must abort any
  instances of the <a href=#fetch>fetch</a> algorithm started for this <code><a href=#eventsource>EventSource</a></code> object,
  and must set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>.</p> <!-- this also causes all the message events to
  stop firing, even if they were queued before close() was called -->

  <p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event
  handler IDL attributes</a>, by all objects implementing the <code><a href=#eventsource>EventSource</a></code>
  interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-eventsource-onopen title=handler-EventSource-onopen><code>onopen</code></dfn> <td> <code title=event-open>open</code>
    <tr><td><dfn id=handler-eventsource-onmessage title=handler-EventSource-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
    <tr><td><dfn id=handler-eventsource-onerror title=handler-EventSource-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
  </table><hr><p>In addition to the above, each <code><a href=#eventsource>EventSource</a></code> object has the following associated
  with it:</p>

  <ul><li>A <dfn id=concept-event-stream-reconnection-time title=concept-event-stream-reconnection-time>reconnection time</dfn>, in
   milliseconds. This must initially be a user-agent-defined value, probably in the region of a few
   seconds.</li>

   <li>A <dfn id=concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</dfn>. This must
   initially be the empty string.</li>

  </ul><p>These values are not currently exposed on the interface.</p>


  <h4 id=processing-model-7><span class=secno>10.2.3 </span>Processing model</h4>

  <p>The resource indicated in the argument to the <code title=dom-EventSource><a href=#dom-eventsource>EventSource</a></code>
  constructor is <a href=#fetch title=fetch>fetched</a> when the constructor is run.</p>

  <p>For HTTP connections, the <code title="">Accept</code> header may be included; if included, it
  must contain only formats of event framing that are supported by the user agent (one of which must
  be <code><a href=#text/event-stream>text/event-stream</a></code>, as described below).</p>

  <p>If the event source's <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID
  string</a> is not the empty string, then a <code title=http-last-event-id><a href=#last-event-id>Last-Event-ID</a></code> HTTP header must be included with the request,
  whose value is the value of the event source's <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</a>, encoded as UTF-8.</p>

  <p>User agents should use the <code>Cache-Control: no-cache</code> header in requests to bypass
  any caches for requests of event sources. (This header is not a <a href=#custom-request-headers title="custom request
  headers">custom request header</a>, so the user agent will still use the CORS <a href=#simple-cross-origin-request>simple
  cross-origin request</a> mechanism.) User agents should ignore HTTP cache headers in the
  response, never caching event sources.</p>

  <hr><!--CLEANUP--><p>As data is received, the <a href=#concept-task title=concept-task>tasks</a> queued by the <a href=#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>Content-Type</a> header specifying the type
  <code><a href=#text/event-stream>text/event-stream</a></code>, ignoring any <a href=#mime-type>MIME type</a> parameters, must be processed
  line by line <a href=#event-stream-interpretation>as described below</a>.</p>

  <p>When a successful response with a supported <a href=#mime-type>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>announce the
  connection</a>.</p>

  <p>The <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a> places
  on the <a href=#task-queue>task queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a> for such a
  resource (with the correct <a href=#mime-type>MIME type</a>) has completed must cause the user agent to
  asynchronously <a href=#reestablish-the-connection>reestablish the connection</a>. This applies whether the connection is
  closed gracefully or unexpectedly (but does not apply when the <a href=#fetch>fetch</a> algorithm is
  canceled by the user agent, e.g. in response to <code title=dom-window-stop><a href=#dom-window-stop>window.stop()</a></code>,
  since in those cases the final <a href=#concept-task title=concept-task>task</a> is actually discarded).
  It doesn't apply for the error conditions listed below except
  where explicitly specified.</p>

  <p>HTTP 200 OK responses that have a <a href=#content-type>Content-Type</a> specifying an unsupported type, or
  that have no <a href=#content-type>Content-Type</a> at all, must cause the user agent to <a href=#fail-the-connection>fail the
  connection</a>.</p> <!-- about:blank is defined as having no MIME type; javascript: as having
  the type text/html -->

  <p>HTTP 305 Use Proxy, 401 Unauthorized, and 407 Proxy Authentication Required should be treated
  transparently as for any other subresource.</p>

  <p>HTTP 301 Moved Permanently, 302 Found, 303 See Other, and 307 Temporary Redirect responses are
  handled by the <a href=#fetch title=fetch>fetching</a> and CORS algorithms. In the case of 301
  redirects, the user agent must also remember the new URL so that subsequent requests for this
  resource for this <code><a href=#eventsource>EventSource</a></code> object start with the URL given for the last 301 seen
  for requests for this object.</p>

  <p id=event-source-network-errors-reconnect>Network errors that prevents the connection from
  being established in the first place (e.g. DNS errors), must cause the user agent to
  asynchronously <a href=#reestablish-the-connection>reestablish the connection</a>.</p>

  <p id=event-source-fail-reasons>Any other HTTP response code not listed here, as well as the
  cancelation of the <a href=#fetch>fetch</a> algorithm by the user agent (e.g. in response to
  <code title=dom-window-stop><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>fail the connection</a>.</p> <!-- including: HTTP 201 Created, 202 Accepted, 203
  Non-Authoritative Information, 204 No Content, 205 Reset Content, 206 Partial Content, 300
  Multiple Choices, 304 Not Modified, 400 Bad Request, 403 Forbidden, 404 Not Found, 405 Method Not
  Allowed, 406 Not Acceptable, 408 Request Timeout, 409 Conflict, 410 Gone, 411 Length Required, 412
  Precondition Failed, 413 Request Entity Too Large, 414 Request-URI Too Long, 415 Unsupported Media
  Type, 416 Requested Range Not Satisfiable, 417 Expectation Failed, HTTP 500 Internal Server Error,
  501 Not Implemented, 502 Bad Gateway, 503 Service Unavailable, and 504 Gateway Timeout responses,
  and 505 HTTP Version Not Supported responses --> <!-- mailto: is defined as equivalent to HTTP 204
  -->

  <p>For non-HTTP protocols, UAs should act in equivalent ways.</p>

  <hr><p>When a user agent is to <dfn id=announce-the-connection>announce the connection</dfn>, the user agent must <a href=#queue-a-task>queue a
  task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
  set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#fire-a-simple-event title="fire a simple event">fires a simple
  event</a> named <code title=event-open>open</code> at the <code><a href=#eventsource>EventSource</a></code>
  object.</p>

  <p>When a user agent is to <dfn id=reestablish-the-connection>reestablish the connection</dfn>, the user agent must run the
  following steps. These steps are run asynchronously, not as part of a <a href=#concept-task title=concept-task>task</a>. (The tasks that it queues, of course, are run like normal tasks
  and not asynchronously.)</p>

  <ol><li>

    <p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

    <ol><li><p>If the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is set to
     <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, abort the task.</li>

     <li><p>Set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>.</li>

     <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-error>error</code> at the
     <code><a href=#eventsource>EventSource</a></code> object.</li>

    </ol></li>

   <li><p>Wait a delay equal to the reconnection time of the event source.</li>

   <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>

   <li><p>Wait until the aforementioned task has run, if it has not yet run.</li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

    <ol><li><p>If the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is not set
     to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, abort these steps.</li>

     <li><p>Perform a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the <a href=#absolute-url>absolute
     URL</a> of the event source resource, using the same <i><a href=#referrer-source>referrer source</a></i>, and with the
     same <i>mode</i><!--, <i>default origin behaviour</i>,--> and <i title="">origin</i>, as those
     used in the original request triggered by the <code title=dom-EventSource><a href=#dom-eventsource>EventSource()</a></code> constructor, and process the resource obtained in
     this fashion, if any, as described earlier in this section.</li>

    </ol></li>

  </ol><p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user agent must <a href=#queue-a-task>queue a
  task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
  set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#fire-a-simple-event title="fire a simple event">fires a simple
  event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code> object.
  <strong>Once the user agent has <a href=#fail-the-connection title="fail the connection">failed the connection</a>, it
  does <em>not</em> attempt to reconnect!</strong></p>

  <hr><p>The <a href=#task-source>task source</a> for any <a href=#concept-task title=concept-task>tasks</a> that are <a href=#queue-a-task title="queue a task">queued</a> by <code><a href=#eventsource>EventSource</a></code> objects is the <dfn id=remote-event-task-source>remote event
  task source</dfn>.</p>


  <h4 id=parsing-an-event-stream><span class=secno>10.2.4 </span>Parsing an event stream</h4>

  <p>This event stream format's <a href=#mime-type>MIME type</a> is <code><a href=#text/event-stream>text/event-stream</a></code>.</p>

  <p>The event stream format is as described by the <code title="">stream</code> production of the
  following ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

  <pre>stream        = [ bom ] *event
event         = *( comment / field ) end-of-line
comment       = colon *any-char end-of-line
field         = 1*name-char [ colon [ space ] *any-char ] end-of-line
end-of-line   = ( cr lf / cr / lf )

; characters
lf            = %x000A ; U+000A LINE FEED (LF)
cr            = %x000D ; U+000D CARRIAGE RETURN (CR)
space         = %x0020 ; U+0020 SPACE
colon         = %x003A ; U+003A COLON (:)
bom           = %xFEFF ; U+FEFF BYTE ORDER MARK
name-char     = %x0000-0009 / %x000B-000C / %x000E-0039 / %x003B-10FFFF
                ; a <a href=#unicode-character>Unicode character</a> other than U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), or U+003A COLON (:)
any-char      = %x0000-0009 / %x000B-000C / %x000E-10FFFF
                ; a <a href=#unicode-character>Unicode character</a> other than U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)</pre>

  <p>Event streams in this format must always be encoded as UTF-8. <a href=#refsRFC3629>[RFC3629]</a></p>

  <p>Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character
  pair, a single U+000A LINE FEED (LF) character, or a single U+000D CARRIAGE RETURN (CR)
  character.</p>

  <p>Since connections established to remote servers for such resources are expected to be
  long-lived, UAs should ensure that appropriate buffering is used. In particular, while line
  buffering with lines are defined to end with a single U+000A LINE FEED (LF) character is safe,
  block buffering or line buffering with different expected line endings can cause delays in event
  dispatch.</p>


  <h4 id=event-stream-interpretation><span class=secno>10.2.5 </span>Interpreting an event stream</h4>

  <p>Streams must be decoded using the <a href=#utf-8-decode>UTF-8 decode</a> algorithm.</p>

  <p class=note>The <a href=#utf-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 title="">data</var> buffer, an <var title="">event type</var>
  buffer, and a <var title="">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 class=switch><dt>If the line is empty (a blank line)</dt>

   <dd><p><a href=#dispatchMessage>Dispatch the event</a>, as defined below.</dd>


   <dt>If the line starts with a U+003A COLON character (:)</dt>

   <dd><p>Ignore the line.</dd>


   <dt>If the line contains a U+003A COLON character (:)</dt>

   <dd>

    <p>Collect the characters on the line before the first U+003A COLON character (:), and let <var title="">field</var> be that string.</p>

    <p>Collect the characters on the line after the first U+003A COLON character (:), and let <var title="">value</var> be that string. If <var title="">value</var> starts with a U+0020 SPACE
    character, remove it from <var title="">value</var>.</p>

    <p><a href=#processField>Process the field</a> using the steps described below, using <var title="">field</var> as the field name and <var title="">value</var> as the field value.</p>

   </dd>


   <dt>Otherwise, the string is not empty but does not contain a U+003A COLON character (:)</dt>

   <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>

   </dd>

  </dl><p>Once the end of the file is reached, any pending data must be discarded. (If the file ends in
  the middle of an event, before the final empty line, the incomplete event is not dispatched.)</p>

  <hr><p id=processField>The steps to <dfn title="">process the field</dfn> given a field name and a
  field value depend on the field name, as given in the following list. Field names must be compared
  literally, with no case folding performed.</p>

  <dl class=switch><dt>If the field name is "event"</dt>

   <dd><p>Set the <var title="">event type</var> buffer to field value.</dd>


   <dt>If the field name is "data"</dt>

   <dd><p>Append the field value to the <var title="">data</var> buffer, then append a single U+000A
   LINE FEED (LF) character to the <var title="">data</var> buffer.</dd>


   <dt>If the field name is "id"</dt>

   <dd><p>Set the <var title="">last event ID</var> buffer to the field value.</dd>


   <dt>If the field name is "retry"</dt>

   <dd><p>If the field value consists of only <a href=#ascii-digits>ASCII digits</a>, then interpret the field
   value as an integer in base ten, and set the event stream's <a href=#concept-event-stream-reconnection-time title=concept-event-stream-reconnection-time>reconnection time</a> to that integer.
   Otherwise, ignore the field.</dd>

   <!-- v2 feature request from Per-Erik Brodin:
      > > > Finally, it could be useful to be able to reset the reconnection
      > > > time to the user agent default value by sending the retry field only
      > > > and leave out the value similar to how you reset the last event id.
      > >
      > > What's the use case?
      >
      > Take the stock ticker as an example. When the stock market closes the
      > server logic knows that there won't be any new events for a number of
      > hours and so it can send the corresponding reconnection time and close
      > the connection. If the client is still running by the time the market
      > opens, it will reconnect, and the server can now reset the reconnection
      > time to a time that is convenient for the user agent (which is the user
      > agent default value, unknown to the server).
    -->

<!-- v2 feature request from John Fallows - http://www.w3.org/mid/c5b3a7130810271238h11e40a4fybfcd5983ed5dc08d@mail.gmail.com

   <dt>If the field name is "reconnect"</dt>

   <dd><p>If the field value is the empty string, then: <a href="#dispatchMessage">dispatch the
   event</a> as defined below, and then drop the connection and immediately reconnect as if the
   <span title="concept-event-stream-reconnection-time">reconnection time</span> was zero for this
   one time.</p></dd>

  -->

   <dt>Otherwise</dt>

   <dd><p>The field is ignored.</dd>

  </dl><p id=dispatchMessage>When the user agent is required to <dfn title="">dispatch the event</dfn>,
  then the user agent must act as follows:

  <ol><li><p>Set the <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</a> of
   the event source to the value of the <var title="">last event ID</var> buffer. The buffer does
   not get reset, so the <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>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>

   <li><p>If the <var title="">data</var> buffer is an empty string, set the <var title="">data</var> buffer and the <var title="">event type</var> buffer to the empty string and
   abort these steps.</li>

   <li><p>If the <var title="">data</var> buffer's last character is a U+000A LINE FEED (LF)
   character, then remove the last character from the <var title="">data</var> buffer.</li>

   <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code> interface, with the event type
   <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
   default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be initialized
   to the value of the <var title="">data</var> buffer, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialized to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an origin">Unicode serialization</a> of the
   <a href=#origin>origin</a> of the event stream's final URL (i.e. the URL after redirects), and the <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code> attribute must be initialized to the
   <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</a> of the event source.
   This event is not <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>.</li>

   <li><p>If the <var title="">event type</var> buffer has a value other than the empty string,
   change the <a href=#concept-event-type title=concept-event-type>type</a> of the newly created event to equal the
   value of the <var title="">event type</var> buffer.</li>

   <li><p>Set the <var title="">data</var> buffer and the <var title="">event type</var> buffer to
   the empty string.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, <a href=#concept-event-dispatch title=concept-event-dispatch>dispatches</a> the newly created event at the
   <code><a href=#eventsource>EventSource</a></code> object.</li> <!-- so calling close() drops the messages immediately.
   The connection dying doesn't interfere with already-sent messages since it sets us to CLOSED via
   a task, not synchronously -->

  </ol><p class=note>If an event doesn't have an "id" field, but an earlier event did set the event
  source's <a href=#concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</a>, then the
  event's <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code> field will be set to the
  value of whatever the last seen "id" field was.</p>


  <div class=example>

   <p>The following event stream, once followed by a blank line:</p>
   <pre>data: YHOO
data: +2
data: 10</pre>

   <p>...would cause an event <code title=event-message><a href=#event-message>message</a></code> with the interface
   <code><a href=#messageevent>MessageEvent</a></code> to be dispatched on the <code><a href=#eventsource>EventSource</a></code> object. The event's
   <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute would contain the string
   <code>YHOO\n+2\n10</code> (where <code>\n</code> represents a newline).</p>

   <p>This could be used as follows:
   <pre>var stocks = new EventSource("http://stocks.example.com/ticker.php");
stocks.onmessage = function (event) {
  var data = event.data.split('\n');
  updateStocks(data[0], data[1], data[2]);
};</pre>

   <p>...where <code title="">updateStocks()</code> is a function defined as:</p>

   <pre>function updateStocks(symbol, delta, value) { ... }</pre>

   <p>...or some such.</p>

  </div>

  <div class=example>

   <p>The following stream contains four blocks. The first block has just a comment, and will fire
   nothing. The second block has two fields with names "data" and "id" respectively; an event will
   be fired for this block, with the data "first event", and will then set the last event ID to "1"
   so that if the connection died between this block and the next, the server would be sent a <code title=http-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 title=http-last-event-id><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
   "&nbsp;third&nbsp;event" (with a single leading space character). Note that the last still has to
   end with a blank line, the end of the stream is not enough to trigger the dispatch of the last
   event.</p>

   <pre>: test stream

data: first event
id: 1

data:second event
id

data:&nbsp;&nbsp;third event
</pre>
  </div>

  <div class=example>

   <p>The following stream fires two events:</p>

   <pre>data

data
data

data:</pre>

   <p>The first block fires events with the data set to the empty string, as would the last block if
   it was followed by a blank line. The middle block fires an event with the data set to a single
   newline character. The last block is discarded because it is not followed by a blank line.</p>

  </div>

  <div class=example>

   <p>The following stream fires two identical events:</p>

   <pre>data:test

data:&nbsp;test
</pre>

   <p>This is because the space after the colon is ignored if present.</p>

  </div>


  <h4 id=authoring-notes><span class=secno>10.2.6 </span>Authoring notes</h4>

  <p>Legacy proxy servers are known to, in certain cases, drop HTTP connections after a short
  timeout. To protect against such proxy servers, authors can include a comment line (one starting
  with a ':' character) every 15 seconds or so.</p>

  <p>Authors wishing to relate event source connections to each other or to specific documents
  previously served might find that relying on IP addresses doesn't work, as individual clients can
  have multiple IP addresses (due to having multiple proxy servers) and individual IP addresses can
  have multiple clients (due to sharing a proxy server). It is better to include a unique identifier
  in the document when it is served and then pass that identifier as part of the URL when the
  connection is established.</p>

  <p>Authors are also cautioned that HTTP chunking can have unexpected negative effects on the
  reliability of this protocol. Where possible, chunking should be disabled for serving event
  streams unless the rate of messages is high enough for this not to matter.</p> <!-- v2 can we get
  a better solution? -->

  <p>Clients that support HTTP's per-server connection limitation might run into trouble when
  opening multiple pages from a site if each page has an <code><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><a href=#eventsource>EventSource</a></code>
  functionality on a per-page basis, or by sharing a single <code><a href=#eventsource>EventSource</a></code> object using a
  <a href=#sharedworkerglobalscope title=SharedWorkerGlobalScope>shared worker</a>.
  </p>


  <h4 id=eventsource-push><span class=secno>10.2.7 </span>Connectionless push and other features</h4>

  <p>User agents running in controlled environments, e.g. browsers on mobile handsets tied to
  specific carriers, may offload the management of the connection to a proxy on the network. In such
  a situation, the user agent for the purposes of conformance is considered to include both the
  handset software and the network proxy.</p>

  <div class=example>

   <p>For example, a browser on a mobile device, after having established a connection, might detect
   that it is on a supporting network and request that a proxy server on the network take over the
   management of the connection. The timeline for such a situation might be as follows:</p>

   <ol><li>Browser connects to a remote HTTP server and requests the resource specified by the author
    in the <code title=dom-EventSource><a href=#dom-eventsource>EventSource</a></code> constructor.</li>

    <li>The server sends occasional messages.</li>

    <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>

    <li>The browser disconnects from the server.</li>

    <li>The browser contacts a service on the network, and requests that that service, a "push
    proxy", maintain the connection instead.</li>

    <li>The "push proxy" service contacts the remote HTTP server and requests the resource specified
    by the author in the <code title=dom-EventSource><a href=#dom-eventsource>EventSource</a></code> constructor (possibly
    including a <code title=http-last-event-id><a href=#last-event-id>Last-Event-ID</a></code> HTTP header, etc).</li>

    <li>The browser allows the mobile device to go to sleep.</li>

    <li>The server sends another message.</li>

    <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.</li>

   </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><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>other applicable specifications</a> may be supported. This
  specification does not define how they are to be parsed or processed.</p>


  <h4 id=garbage-collection-0><span class=secno>10.2.8 </span>Garbage collection</h4>

  <p>While an <code><a href=#eventsource>EventSource</a></code> object's <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> is <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, and the object has one or more event
  listeners registered for <code title=event-open>open</code>, <code title=event-message><a href=#event-message>message</a></code> or <code title=event-error>error</code> events, there must
  be a strong reference from the <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that
  the <code><a href=#eventsource>EventSource</a></code> object's constructor was invoked from to the <code><a href=#eventsource>EventSource</a></code>
  object itself.</p>

  <p>While an <code><a href=#eventsource>EventSource</a></code> object's <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> is <code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code>, and the object has one or more event listeners
  registered for <code title=event-message><a href=#event-message>message</a></code> or <code title=event-error>error</code> events, there must be a strong reference from the
  <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that the <code><a href=#eventsource>EventSource</a></code>
  object's constructor was invoked from to the <code><a href=#eventsource>EventSource</a></code> object itself.</p>

  <p>While there is a task queued by an <code><a href=#eventsource>EventSource</a></code> object on the <a href=#remote-event-task-source>remote event
  task source</a>, there must be a strong reference from the <code><a href=#window>Window</a></code> or
  <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that the <code><a href=#eventsource>EventSource</a></code> object's constructor was
  invoked from to that <code><a href=#eventsource>EventSource</a></code> object.</p>

  <p>If a user agent is to <dfn id=concept-eventsource-forcibly-close title=concept-EventSource-forcibly-close>forcibly close</dfn> an
  <code><a href=#eventsource>EventSource</a></code> object (this happens when a <code><a href=#document>Document</a></code> object goes away
  permanently), the user agent must abort any instances of the <a href=#fetch>fetch</a> algorithm started
  for this <code><a href=#eventsource>EventSource</a></code> object, and must set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>.</p> <!-- same as calling close() -->

  <p>If an <code><a href=#eventsource>EventSource</a></code> object is garbage collected while its connection is still open,
  the user agent must abort any instance of the <a href=#fetch title=fetch>fetch</a> algorithm opened by
  this <code><a href=#eventsource>EventSource</a></code>.</p> <!-- no need to throw tasks away or anything; for it to get
  garbage collected, there can't be anything that would be able to receive those events -->

  <p class=note>It's possible for one active network connection to be shared by multiple
  <code><a href=#eventsource>EventSource</a></code> objects and their <a href=#fetch>fetch</a> algorithms, which is why the above
  is phrased in terms of aborting the <a href=#fetch>fetch</a> algorithm and not the actual underlying
  download.</p>


  <h4 id=implementation-advice><span class=secno>10.2.9 </span>Implementation advice</h4>

  <p><i>This section is non-normative.</i></p>

  <p>User agents are strongly urged to provide detailed diagnostic information about
  <code><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><a href=#eventsource>EventSource</a></code>
  objects a page has created, each listing the constructor's arguments, whether there was a network
  error, what the CORS status of the connection is and what headers were sent by the client and
  received from the server to lead to that status, the messages that were received and how they were
  parsed, and so forth.</p>

  <p>Implementations are especially encouraged to report detailed information to their development
  consoles whenever an <code title=event-error>error</code> event is fired, since little to no
  information can be made available in the events themselves.</p>


  <h4 id=iana-considerations><span class=secno>10.2.10 </span>IANA considerations</h4>

  <h5 id=text/event-stream><span class=secno>10.2.10.1 </span><dfn><code>text/event-stream</code></dfn></h5>

  <p>This registration is for community review and will be submitted to the IESG for review,
  approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type text/event-stream
  -->

  <dl><dt>Type name:</dt>
   <dd>text</dd>
   <dt>Subtype name:</dt>
   <dd>event-stream</dd>
   <dt>Required parameters:</dt>
   <dd>No parameters</dd>
   <dt>Optional parameters:</dt>
   <dd>
    <dl><dt><code title="">charset</code></dt>
     <dd>

      <p>The <code title="">charset</code> parameter may be provided. The parameter's value must be
      "<code title="">utf-8</code>". This parameter serves no purpose; it is only allowed for
      compatibility with legacy servers.</p>

     </dd>
    </dl></dd>
   <dt>Encoding considerations:</dt>
   <dd>8bit (always UTF-8)</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <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=#refsCORS>[CORS]</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>

   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>
    Rules for processing both conforming and non-conforming content
    are defined in this specification.
   </dd>
   <dt>Published specification:</dt>
   <dd>
    This document is the relevant specification.
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    Web browsers and tools using Web services.
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>No sequence of bytes can uniquely identify an event stream.</dd>
     <dt>File extension(s):</dt>
     <dd>No specific file extensions are recommended for this type.</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd>No specific Macintosh file type codes are recommended for this type.</dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <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.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers have no meaning with
  <code><a href=#text/event-stream>text/event-stream</a></code> resources.</p>


  <h5 id=last-event-id><span class=secno>10.2.10.2 </span><dfn title=http-last-event-id><code>Last-Event-ID</code></dfn></h5>

  <p>This section describes a header field for registration in the
  Permanent Message Header Field Registry.  <a href=#refsRFC3864>[RFC3864]</a></p>

  <dl><dt>Header field name:</dt>
   <dd>Last-Event-ID</dd>
   <dt>Applicable protocol:</dt>
   <dd>http</dd>
   <dt>Status:</dt>
   <dd>standard</dd>
   <dt>Author/Change controller:</dt>
   <dd>W3C</dd>
   <dt>Specification document(s):</dt>
   <dd>
    This document is the relevant specification.
   </dd>
   <dt>Related information:</dt>
   <dd>None.</dd>
  </dl><h3 id=network><span class=secno>10.3 </span><dfn>Web sockets</dfn></h3>



  <h4 id=network-intro><span class=secno>10.3.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>To enable Web applications to maintain bidirectional
  communications with server-side processes, this specification
  introduces the <code><a href=#websocket>WebSocket</a></code> interface.</p>

  <p class=note>This interface does not allow for raw access to the
  underlying network. For example, this interface could not be used to
  implement an IRC client without proxying messages through a custom
  server.</p>


  <h4 id=the-websocket-interface><span class=secno>10.3.2 </span>The <code><a href=#websocket>WebSocket</a></code> interface</h4>

  <pre class=idl>enum <dfn id=binarytype>BinaryType</dfn> { "<span title=dom-BinaryType-blob>blob</span>", "<span title=dom-BinaryType-arraybuffer>arraybuffer</span>" };
[<a href=#dom-websocket title=dom-WebSocket>Constructor</a>(DOMString url, optional (DOMString or DOMString[]) protocols)]
interface <dfn id=websocket>WebSocket</dfn> : <a href=#eventtarget>EventTarget</a> {
  readonly attribute DOMString <a href=#dom-websocket-url title=dom-WebSocket-url>url</a>;

  // ready state
  const unsigned short <a href=#dom-websocket-connecting title=dom-WebSocket-CONNECTING>CONNECTING</a> = 0;
  const unsigned short <a href=#dom-websocket-open title=dom-WebSocket-OPEN>OPEN</a> = 1;
  const unsigned short <a href=#dom-websocket-closing title=dom-WebSocket-CLOSING>CLOSING</a> = 2;
  const unsigned short <a href=#dom-websocket-closed title=dom-WebSocket-CLOSED>CLOSED</a> = 3;
  readonly attribute unsigned short <a href=#dom-websocket-readystate title=dom-WebSocket-readyState>readyState</a>;
  readonly attribute unsigned long <a href=#dom-websocket-bufferedamount title=dom-WebSocket-bufferedAmount>bufferedAmount</a>;

  // networking
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-websocket-onopen title=handler-WebSocket-onopen>onopen</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-websocket-onerror title=handler-WebSocket-onerror>onerror</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-websocket-onclose title=handler-WebSocket-onclose>onclose</a>;
  readonly attribute DOMString <a href=#dom-websocket-extensions title=dom-WebSocket-extensions>extensions</a>;
  readonly attribute DOMString <a href=#dom-websocket-protocol title=dom-WebSocket-protocol>protocol</a>;
  void <a href=#dom-websocket-close title=dom-WebSocket-close>close</a>([Clamp] optional unsigned short code, optional DOMString reason);

  // messaging
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-websocket-onmessage title=handler-WebSocket-onmessage>onmessage</a>;
           attribute <a href=#binarytype>BinaryType</a> <a href=#dom-websocket-binarytype title=dom-WebSocket-binaryType>binaryType</a>;
  void <a href=#dom-websocket-send title=dom-WebSocket-send>send</a>(DOMString data);
  void <a href=#dom-websocket-send title=dom-WebSocket-send>send</a>(<a href=#blob>Blob</a> data);
  void <a href=#dom-websocket-send title=dom-WebSocket-send>send</a>(<a href=#arraybuffer>ArrayBuffer</a> data);
  void <a href=#dom-websocket-send title=dom-WebSocket-send>send</a>(<a href=#arraybufferview>ArrayBufferView</a> data);
};</pre>

  <p>The <dfn id=dom-websocket title=dom-WebSocket><code>WebSocket(<var title="">url</var>, <var title="">protocols</var>)</code></dfn> constructor takes one or two arguments. The first argument,
  <var title="">url</var>, specifies the <a href=#url>URL</a> to which to connect. The second, <var title="">protocols</var>, if present, is either a string or an array of strings. If it is a
  string, it is equivalent to an array consisting of just that string; if it is omitted, it is
  equivalent to the empty array. Each string in the array is a subprotocol name. The connection will
  only be established if the server reports that it has selected one of these subprotocols. The
  subprotocol names must all be strings that match the requirements for elements that comprise the
  value of <code title=http-sec-websocket-protocol>Sec-WebSocket-Protocol</code> header fields as
  defined by the WebSocket protocol specification. <a href=#refsWSP>[WSP]</a></p>

  <p>When the <code>WebSocket()</code> constructor is invoked, the UA must run these steps:</p>

  <ol><li><p><i><a href="#parse-a-websocket-url's-components">Parse a WebSocket URL's components</a></i> from the <var title="">url</var> argument, to
   obtain <var title="">host</var>, <var title="">port</var>, <var title="">resource name</var>, and
   <var title="">secure</var>. If this fails, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort
   these steps. <a href=#refsWSP>[WSP]</a></li>

   <li><p>If <var title="">secure</var> is false but the <a href=#origin>origin</a> of the <a href=#entry-script>entry
   script</a> has a scheme component that is itself a secure protocol, e.g. HTTPS, then throw a
   <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>

   <li>

    <p>If <var title="">port</var> is a port to which the user agent is configured to block access,
    then throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps. (User agents typically
    block access to well-known ports like SMTP.)</p>
    <!-- e.g. http://www.mozilla.org/projects/netlib/PortBanning.html -->

    <p>Access to ports 80 and 443 should not be blocked, including the unlikely cases when <var title="">secure</var> is false but <var title="">port</var> is 443 or <var title="">secure</var>
    is true but <var title="">port</var> is 80.</p>
    <!-- paragraph requested by zcorpan -->

   </li>

   <li>

    <p>If <var title="">protocols</var> is absent, let <var title="">protocols</var> be an empty
    array.</p>

    <p>Otherwise, if <var title="">protocols</var> is present and a string, let <var title="">protocols</var> instead be an array consisting of just that string.</p>

   </li>

   <li><p>If any of the values in <var title="">protocols</var> occur more than once or otherwise
   fail to match the requirements for elements that comprise the value of <code title=http-sec-websocket-protocol>Sec-WebSocket-Protocol</code> header fields as defined by the
   WebSocket protocol specification, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
   steps. <a href=#refsWSP>[WSP]</a></li>

   <li><p>Let <var title="">origin</var> be the <a href=#ascii-serialization-of-an-origin title="ASCII serialization of an origin">ASCII
   serialization</a> of the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a>, <a href=#converted-to-ascii-lowercase>converted
   to ASCII lowercase</a>.</li>

   <li><p>Return a new <code><a href=#websocket>WebSocket</a></code> object, but continue these steps
   asynchronously.</li>

   <li>

    <p><i><a href=#establish-a-websocket-connection>Establish a WebSocket connection</a></i> given the set (<var title="">host</var>, <var title="">port</var>, <var title="">resource name</var>, <var title="">secure</var>), along with
    the <var title="">protocols</var> list, an empty list for the extensions, and <var title="">origin</var>. The <i><a href=#headers-to-send-appropriate-cookies>headers to send appropriate cookies</a></i> must be a <code title=http-Cookie>Cookie</code> header whose value is the <i><a href=#cookie-string>cookie-string</a></i> computed from
    the user's cookie store and the URL <var title="">url</var>; for these purposes this is
    <em>not</em> a "non-HTTP" API. <a href=#refsWSP>[WSP]</a> <a href=#refsCOOKIES>[COOKIES]</a></p>

    <p>When the user agent <i title="validate the server's response"><a href="#validate-the-server's-response">validates the server's
    response</a></i> during the "<i><a href=#establish-a-websocket-connection>establish a WebSocket connection</a></i>" algorithm, if the status code
    received from the server is not 101 (e.g. it is a redirect), the user agent must <i><a href=#fail-the-websocket-connection>fail the
    WebSocket connection</a></i>.</p>

    <p class=warning>Following HTTP procedures here could introduce serious security problems in a
    Web browser context. For example, consider a host with a WebSocket server at one path and an
    open HTTP redirector at another. Suddenly, any script that can be given a particular WebSocket
    URL can be tricked into communicating to (and potentially sharing secrets with) any host on the
    Internet, even if the script checks that the URL has the right hostname.</p>
    <!-- http://www.ietf.org/mail-archive/web/hybi/current/msg06951.html -->

    <p class=note>If the <i><a href=#establish-a-websocket-connection>establish a WebSocket connection</a></i> algorithm fails, it triggers the
    <i><a href=#fail-the-websocket-connection>fail the WebSocket connection</a></i> algorithm, which then invokes the <i><a href=#close-the-websocket-connection>close the WebSocket
    connection</a></i> algorithm, which then establishes that <i><a href=#the-websocket-connection-is-closed>the WebSocket connection is closed</a></i>,
    which fires the <code title=event-socket-close>close</code> event <a href=#closeWebSocket>as
    described below</a>.</p>

   </li>

  </ol><hr><p>The <dfn id=dom-websocket-url title=dom-WebSocket-url><code>url</code></dfn> attribute must return the result of
  <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a> that was passed to the
  constructor. (It doesn't matter what it is resolved relative to, since we already know it is an
  <a href=#absolute-url>absolute URL</a>.)</p>

  <p>The <dfn id=dom-websocket-readystate title=dom-WebSocket-readyState><code>readyState</code></dfn> attribute represents
  the state of the connection. It can have the following values:</p>

  <dl><dt><dfn id=dom-websocket-connecting title=dom-WebSocket-CONNECTING><code>CONNECTING</code></dfn> (numeric value 0)</dt>

   <dd>The connection has not yet been established.</dd>

   <dt><dfn id=dom-websocket-open title=dom-WebSocket-OPEN><code>OPEN</code></dfn> (numeric value 1)</dt>

   <dd><i><a href=#the-websocket-connection-is-established>The WebSocket connection is established</a></i> and communication is possible.</dd>

   <dt><dfn id=dom-websocket-closing title=dom-WebSocket-CLOSING><code>CLOSING</code></dfn> (numeric value 2)</dt>

   <dd>The connection is going through the closing handshake, or the <code title=dom-WebSocket-close><a href=#dom-websocket-close>close()</a></code> method has been invoked.</dd>

   <dt><dfn id=dom-websocket-closed title=dom-WebSocket-CLOSED><code>CLOSED</code></dfn> (numeric value 3)</dt>

   <dd>The connection has been closed or could not be opened.</dd>

  </dl><p>When the object is created its <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> must be
  set to <code title=dom-WebSocket-CONNECTING><a href=#dom-websocket-connecting>CONNECTING</a></code> (0).</p>

  <p>The <dfn id=dom-websocket-extensions title=dom-WebSocket-extensions><code>extensions</code></dfn> attribute must
  initially return the empty string. After <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, its value
  might change, as defined below.</p>

  <p class=note>The <code title=dom-WebSocket-extensions><a href=#dom-websocket-extensions>extensions</a></code> attribute returns the
  extensions selected by the server, if any. (Currently this will only ever be the empty
  string.)</p>

  <p>The <dfn id=dom-websocket-protocol title=dom-WebSocket-protocol><code>protocol</code></dfn> attribute must initially
  return the empty string. After <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, its value might
  change, as defined below.</p>

  <p class=note>The <code title=dom-WebSocket-protocol><a href=#dom-websocket-protocol>protocol</a></code> attribute returns the
  subprotocol selected by the server, if any. It can be used in conjunction with the array form of
  the constructor's second argument to perform subprotocol negotiation.</p>

  <p>The <dfn id=dom-websocket-close title=dom-WebSocket-close><code>close()</code></dfn> method must run the following
  steps:</p>

  <ol><li><p>If the method's first argument is present but is neither an integer equal to 1000 nor an
   integer in the range 3000 to 4999, throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort
   these steps.</li>

   <li>

    <p>If the method's second argument is present, then run these substeps:</p>

    <ol><li><p>Let <var title="">raw reason</var> be the method's second argument.</li>

     <li><p>Let <var title="">Unicode reason</var> be the result of <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters title="convert a DOMString
     to a sequence of Unicode characters">converting <var title="">raw reason</var> to a sequence of
     Unicode characters</a>.</li>

     <li><p>Let <var title="">reason</var> be the result of encoding <var title="">Unicode
     reason</var> as UTF-8.</li>

     <li><p>If <var title="">reason</var> is longer than 123 bytes, then throw a
     <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. <a href=#refsRFC3629>[RFC3629]</a></li>

    </ol></li>

   <li><p>Run the first matching steps from the following list:</p>

    <dl class=switch><dt>If the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute is in the <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2) or <code title=dom-WebSocket-CLOSED><a href=#dom-websocket-closed>CLOSED</a></code> (3) state</dt>

     <dd>

      <p>Do nothing.</p>

      <p class=note>The connection is already closing or is already closed. If it has not already,
      a <code title=event-socket-close>close</code> event will eventually fire <a href=#closeWebSocket>as described below</a>.</p>

     </dd>


     <dt>If the WebSocket connection is not yet <i title="the WebSocket connection is
     established"><a href=#the-websocket-connection-is-established>established</a></i> <a href=#refsWSP>[WSP]</a></dt>

     <dd>

      <p><i><a href=#fail-the-websocket-connection>Fail the WebSocket connection</a></i> and set the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2). <a href=#refsWSP>[WSP]</a></p>

      <p class=note>The <i><a href=#fail-the-websocket-connection>fail the WebSocket connection</a></i> algorithm invokes the <i><a href=#close-the-websocket-connection>close the
      WebSocket connection</a></i> algorithm, which then establishes that <i><a href=#the-websocket-connection-is-closed>the WebSocket connection is
      closed</a></i>, which fires the <code title=event-socket-close>close</code> event <a href=#closeWebSocket>as described below</a>.</p>

     </dd>


     <dt>If the WebSocket closing handshake has not yet been <i title="the WebSocket closing
     handshake is started"><a href=#the-websocket-closing-handshake-is-started>started</a></i> <a href=#refsWSP>[WSP]</a></dt>

     <dd>

      <p><i><a href=#start-the-websocket-closing-handshake>Start the WebSocket closing handshake</a></i> and set the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2). <a href=#refsWSP>[WSP]</a></p>

      <p>If the first argument is present, then the status code<!--CLOSE CODE--> to use in the
      WebSocket Close message must be the integer given by the first argument. <a href=#refsWSP>[WSP]</a></p>

      <p>If the second argument is also present, then <var title="">reason</var> must be provided in
      the Close message after the status code<!--CLOSE CODE-->. <a href=#refsRFC3629>[RFC3629]</a>
      <a href=#refsWSP>[WSP]</a></p>

      <p class=note>The <i><a href=#start-the-websocket-closing-handshake>start the WebSocket closing handshake</a></i> algorithm eventually invokes
      the <i><a href=#close-the-websocket-connection>close the WebSocket connection</a></i> algorithm, which then establishes that <i><a href=#the-websocket-connection-is-closed>the
      WebSocket connection is closed</a></i>, which fires the <code title=event-socket-close>close</code> event <a href=#closeWebSocket>as described
      below</a>.</p>

     </dd>


     <dt>Otherwise</dt>

     <dd>

      <p>Set the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2).</p>

      <p class=note><i><a href=#the-websocket-closing-handshake-is-started>The WebSocket closing handshake is started</a></i>, and will eventually invoke
      the <i><a href=#close-the-websocket-connection>close the WebSocket connection</a></i> algorithm, which will establish that <i><a href=#the-websocket-connection-is-closed>the
      WebSocket connection is closed</a></i>, and thus the <code title=event-socket-close>close</code>
      event will fire, <a href=#closeWebSocket>as described below</a>.</p>

     </dd>

    </dl></li>

  </ol><hr><p>The <dfn id=dom-websocket-bufferedamount title=dom-WebSocket-bufferedAmount><code>bufferedAmount</code></dfn> attribute must
  return the number of bytes of application data (UTF-8 text and binary data) that have been queued
  using <code title=dom-WebSocket-send><a href=#dom-websocket-send>send()</a></code> but that, as of the last time the <a href=#event-loop>event
  loop</a> started executing a <a href=#concept-task title=concept-task>task</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 asynchronously with script
  execution.) This does not include framing overhead incurred by the protocol, or buffering done by
  the operating system or network hardware. If the connection is closed, this attribute's value will
  only increase with each call to the <code title=dom-WebSocket-send><a href=#dom-websocket-send>send()</a></code> method (the
  number does not reset to zero once the connection closes).</p>

  <div class=example>

   <p>In this simple example, the <code title=dom-WebSocket-bufferedAmount><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 title=dom-WebSocket-bufferedAmount><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><a href=#websocket>WebSocket</a></code> object is created, its <dfn id=dom-websocket-binarytype title=dom-WebSocket-binaryType><code>binaryType</code></dfn> IDL attribute must be set to the
  string "<code title="">blob</code>". On getting, it must return the last value it was set to. On
  setting, the user agent must set the IDL attribute to the new value.</p>

  <p class=note>This attribute allows authors to control how binary data is exposed to scripts. By
  setting the attribute to "<code title="">blob</code>", binary data is returned in
  <code><a href=#blob>Blob</a></code> form; by setting it to "<code title="">arraybuffer</code>", it is returned in
  <code><a href=#arraybuffer>ArrayBuffer</a></code> form. User agents can use this as a hint for how to handle incoming
  binary data: if the attribute is set to "<code title="">blob</code>", it is safe to spool it to
  disk, and if it is set to "<code title="">arraybuffer</code>", it is likely more efficient to keep
  the data in memory. Naturally, user agents are encouraged to use more subtle heuristics to decide
  whether to keep incoming data in memory or not, e.g. based on how big the data is or how common it
  is for a script to change the attribute at the last minute. This latter aspect is important in
  particular because it is quite possible for the attribute to be changed after the user agent has
  received the data but before the user agent has fired the event for it.</p>

  <p>The <dfn id=dom-websocket-send title=dom-WebSocket-send><code>send(<var title="">data</var>)</code></dfn> method
  transmits data using the connection. If the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute is <code title=dom-WebSocket-CONNECTING><a href=#dom-websocket-connecting>CONNECTING</a></code>, it must throw an
  <code><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, the user agent must run the appropriate set
  of steps from the following list:</p>

  <dl><dt>If the argument is a string</dt>

   <dd>

    <p>Let <var title="">data</var> be the result of <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters title="convert a DOMString to a sequence
    of Unicode characters">converting the <var title="">data</var> argument to a sequence of Unicode
    characters</a>. If <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i> and <i title="the WebSocket
    closing handshake is started"><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake has not yet started</a></i>, then the
    user agent must <i>send a WebSocket Message</i> comprised of <var title="">data</var> using a
    text frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but the
    buffer is full, the user agent must <i><a href=#close-the-websocket-connection>close the WebSocket connection</a></i> <a href=#concept-websocket-close-fail title=concept-websocket-close-fail>with prejudice</a>. Any invocation of this method with a
    string argument that does not throw an exception must increase the <code title=dom-WebSocket-bufferedAmount><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=#refsRFC3629>[RFC3629]</a> <a href=#refsWSP>[WSP]</a></p>

   </dd>


   <dt>If the argument is a <code><a href=#blob>Blob</a></code> object</dt>

   <dd>

    <p>If <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, and <i title="the WebSocket closing
    handshake is started"><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake has not yet started</a></i>, then the user
    agent must <i>send a WebSocket Message</i> comprised of <var title="">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 <i><a href=#close-the-websocket-connection>close the WebSocket connection</a></i> <a href=#concept-websocket-close-fail title=concept-websocket-close-fail>with prejudice</a>. The data to be sent is the raw data
    represented by the <code><a href=#blob>Blob</a></code> object. <!-- that sentence is meant to invoke "This
    interface represents immutable raw data." --> Any invocation of this method with a
    <code><a href=#blob>Blob</a></code> argument that does not throw an exception must increase the <code title=dom-WebSocket-bufferedAmount><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute by the size of the
    <code><a href=#blob>Blob</a></code> object's raw data, in bytes. <!-- that sentence is meant to invoke the same as
    Blob.size --> <a href=#refsWSP>[WSP]</a> <a href=#refsFILEAPI>[FILEAPI]</a></p>

   </dd>


   <dt>If the argument is an <code><a href=#arraybuffer>ArrayBuffer</a></code> object</dt>

   <dd>

    <p>If <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, and <i title="the WebSocket closing
    handshake is started"><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake has not yet started</a></i>, then the user
    agent must <i>send a WebSocket Message</i> comprised of <var title="">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 <i><a href=#close-the-websocket-connection>close the WebSocket connection</a></i> <a href=#concept-websocket-close-fail title=concept-websocket-close-fail>with prejudice</a>. The data to be sent is the data
    stored in the buffer described by the <code><a href=#arraybuffer>ArrayBuffer</a></code> object. <!-- that sentence is
    meant to invoke "The ArrayBuffer type describes a buffer used to store data for the array buffer
    views." at the top of the Typed Array spec, and "Optional byteOffset and length can be used to
    limit the section of the buffer referenced" in the definition of the TypedArray constructor -->
    Any invocation of this method with an <code><a href=#arraybuffer>ArrayBuffer</a></code> argument that does not throw an
    exception must increase the <code title=dom-WebSocket-bufferedAmount><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code>
    attribute by the length of the <code><a href=#arraybuffer>ArrayBuffer</a></code> in bytes. <!-- that sentence is meant to
    invoke the same as ArrayBuffer.byteLength --> <a href=#refsWSP>[WSP]</a> <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

   </dd>


   <dt>If the argument is an <code><a href=#arraybufferview>ArrayBufferView</a></code> object</dt>

   <dd>

    <p>If <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, and <i title="the WebSocket closing
    handshake is started"><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake has not yet started</a></i>, then the user
    agent must <i>send a WebSocket Message</i> comprised of <var title="">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 <i><a href=#close-the-websocket-connection>close the WebSocket connection</a></i> <a href=#concept-websocket-close-fail title=concept-websocket-close-fail>with prejudice</a>. The data to be sent is the data
    stored in the section of the buffer described by the <code><a href=#arraybuffer>ArrayBuffer</a></code> object that the
    <code><a href=#arraybufferview>ArrayBufferView</a></code> object references. <!-- that sentence is meant to invoke "The
    ArrayBuffer type describes a buffer used to store data for the array buffer views." at the top
    of the Typed Array spec, and "Optional byteOffset and length can be used to limit the section of
    the buffer referenced" in the definition of the TypedArray constructor --> Any invocation of
    this method with an <code><a href=#arraybufferview>ArrayBufferView</a></code> argument that does not throw an exception must
    increase the <code title=dom-WebSocket-bufferedAmount><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute by the
    length of the <code><a href=#arraybufferview>ArrayBufferView</a></code> in bytes. <!-- that sentence is meant to invoke the
    same as ArrayBufferView.byteLength --> <a href=#refsWSP>[WSP]</a> <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

   </dd>

  </dl><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>,
  by all objects implementing the <code><a href=#websocket>WebSocket</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-websocket-onopen title=handler-WebSocket-onopen><code>onopen</code></dfn> <td> <code title=event-open>open</code>
    <tr><td><dfn id=handler-websocket-onmessage title=handler-WebSocket-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
    <tr><td><dfn id=handler-websocket-onerror title=handler-WebSocket-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
    <tr><td><dfn id=handler-websocket-onclose title=handler-WebSocket-onclose><code>onclose</code></dfn> <td> <code title=event-socket-close>close</code>
  </table><h4 id=feedback-from-the-protocol><span class=secno>10.3.3 </span>Feedback from the protocol</h4>

  <p>When <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, the user agent must <a href=#queue-a-task>queue a
  task</a> to run these steps:</p>

  <ol><li><p>Change the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to
   <code title=dom-WebSocket-OPEN><a href=#dom-websocket-open>OPEN</a></code> (1).</li>

   <li><p>Change the <code title=dom-WebSocket-extensions><a href=#dom-websocket-extensions>extensions</a></code> attribute's value to
   the <i><a href=#extensions-in-use>extensions in use</a></i>, if is not the null value. <a href=#refsWSP>[WSP]</a></li>

   <li><p>Change the <code title=dom-WebSocket-protocol><a href=#dom-websocket-protocol>protocol</a></code> attribute's value to the
   <i><a href=#subprotocol-in-use>subprotocol in use</a></i>, if is not the null value. <a href=#refsWSP>[WSP]</a></li>

   <li><p>Act as if the user agent had <a href=#receives-a-set-cookie-string title="receives a set-cookie-string">received a
   set-cookie-string</a> consisting of the <i><a href="#cookies-set-during-the-server's-opening-handshake">cookies set during the server's opening
   handshake</a></i>, for the URL <var title="">url</var> given to the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsRFC3629>[RFC3629]</a> <a href=#refsWSP>[WSP]</a></li>

   <li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-open>open</code> at the
   <code><a href=#websocket>WebSocket</a></code> object.</p>

  </ol><hr><p>When <i><a href=#a-websocket-message-has-been-received>a WebSocket message has been received</a></i> with type <var title="">type</var> and data
  <var title="">data</var>, the user agent must <a href=#queue-a-task>queue a task</a> to follow these steps: <a href=#refsWSP>[WSP]</a></p>

  <ol><li>

    <p>If the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value is not
    <code title=dom-WebSocket-OPEN><a href=#dom-websocket-open>OPEN</a></code> (1), then abort these steps.</p>

   </li>

   <li>

    <p>Let <var title="">event</var> be a newly created <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the <code><a href=#messageevent>MessageEvent</a></code>
    interface, with the event type <code title=event-message><a href=#event-message>message</a></code>, which does not
    bubble, is not cancelable, and has no default action.
    </p>

   </li>

   <li><p>Initialize <var title="">event</var>'s <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code>
   attribute to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an origin">Unicode serialization</a> of
   the <a href=#origin>origin</a> of the <a href=#url>URL</a> that was passed to the <code><a href=#websocket>WebSocket</a></code>
   object's constructor.</li>

   <li>

    <p>If <var title="">type</var> indicates that the data is Text, then initialize <var title="">event</var>'s <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute to <var title="">data</var>.

    <p>If <var title="">type</var> indicates that the data is Binary, and <code title=dom-WebSocket-binaryType><a href=#dom-websocket-binarytype>binaryType</a></code> is set to "<code title="">blob</code>", then
    initialize <var title="">event</var>'s <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute
    to a new <code><a href=#blob>Blob</a></code> object that represents <var title="">data</var> as its raw data. <a href=#refsFILEAPI>[FILEAPI]</a></p>

    <p>If <var title="">type</var> indicates that the data is Binary, and <code title=dom-WebSocket-binaryType><a href=#dom-websocket-binarytype>binaryType</a></code> is set to "<code title="">arraybuffer</code>", then initialize <var title="">event</var>'s <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute to a new read-only <code><a href=#arraybuffer>ArrayBuffer</a></code>
    object whose contents are <var title="">data</var>. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

   </li>

   <li>

    <p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> <var title="">event</var> at the
    <code><a href=#websocket>WebSocket</a></code> object.</p>

   </li>

  </ol><p class=note>User agents are encouraged to check if they can perform the above steps
  efficiently before they run the task, picking tasks from other <a href=#task-queue title="task queue">task
  queues</a> while they prepare the buffers if not. For example, if the <code title=dom-WebSocket-binaryType><a href=#dom-websocket-binarytype>binaryType</a></code> attribute was set to "<code title="">blob</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 title=concept-task>task</a> for this particular message
  the script switched <code title=dom-WebSocket-binaryType><a href=#dom-websocket-binarytype>binaryType</a></code> to "<code title="">arraybuffer</code>", the user agent would want to page the data back to RAM before
  running this <a href=#concept-task title=concept-task>task</a> so as to avoid stalling the main thread while
  it created the <code><a href=#arraybuffer>ArrayBuffer</a></code> object.</p>

  <div class=example>

   <p>Here is an example of how to define a handler for the <code title=event-message><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><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake is started</a></i>, the user agent must <a href=#queue-a-task>queue a
  task</a> to change the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's
  value to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2). (If the <code title=dom-WebSocket-close><a href=#dom-websocket-close>close()</a></code> method was called, the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value will already be set to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2) when this task runs.) <a href=#refsWSP>[WSP]</a></p>

  <hr><p id=closeWebSocket>When <i><a href=#the-websocket-connection-is-closed>the WebSocket connection is closed</a></i>, possibly <i title="">cleanly</i>, the user agent must <a href=#queue-a-task>queue a task</a> to run the following
  substeps:</p>

  <ol><li><p>Change the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to
   <code title=dom-WebSocket-CLOSED><a href=#dom-websocket-closed>CLOSED</a></code> (3).</li>

   <li><p>If the user agent was required to <i><a href=#fail-the-websocket-connection>fail the WebSocket connection</a></i> or <i><a href=#the-websocket-connection-is-closed>the WebSocket
   connection is closed</a></i> <dfn id=concept-websocket-close-fail title=concept-websocket-close-fail>with prejudice</dfn>,
   <a href=#fire-a-simple-event>fire a simple event</a> named <code title="">error</code> at the <code><a href=#websocket>WebSocket</a></code>
   object. <a href=#refsWSP>[WSP]</a></li>

   <li><p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the
   <code><a href=#closeevent>CloseEvent</a></code> interface, with the event type <code title=event-socket-close>close</code>, which does not bubble, is not cancelable, has no default
   action, whose <code title=dom-CloseEvent-wasClean><a href=#dom-closeevent-wasclean>wasClean</a></code> attribute is initialized to
   true if the connection closed <i title="">cleanly</i> and false otherwise, whose <code title=dom-CloseEvent-code><a href=#dom-closeevent-code>code</a></code> attribute is initialized to <i><a href=#the-websocket-connection-close-code>the WebSocket connection
   close code</a></i>, and whose <code title=dom-CloseEvent-reason><a href=#dom-closeevent-reason>reason</a></code> attribute is
   initialized to the result of applying the <a href=#utf-8-decoder>UTF-8 decoder</a> to <i><a href=#the-websocket-connection-close-reason>the WebSocket
   connection close reason</a></i>, and <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> the event
   at the <code><a href=#websocket>WebSocket</a></code> object. <a href=#refsWSP>[WSP]</a></li>

  </ol><div class=warning>

   <p>User agents must not convey any failure information to scripts in a way that would allow a
   script to distinguish the following situations:</p>

   <ul><li>A server whose host name could not be resolved.

    <li>A server to which packets could not successfully be routed.

    <li>A server that refused the connection on the specified port.

    <li>A server that failed to correctly perform a TLS handshake (e.g., the server certificate
    can't be verified).

    <li>A server that did not complete the opening handshake (e.g. because it was not a WebSocket
    server).

    <li>A WebSocket server that sent a correct opening handshake, but that specified options that
    caused the client to drop the connection (e.g. the server specified a subprotocol that the
    client did not offer).

    <li>A WebSocket server that abruptly closed the connection after successfully completing the
    opening handshake.

   </ul><p>In all of these cases, the <i><a href=#the-websocket-connection-close-code>the WebSocket connection close code</a></i> would be 1006, as
   required by the WebSocket Protocol specification. <a href=#refsWSP>[WSP]</a></p>

   <p>Allowing a script to distinguish these cases would allow a script to probe the user's local
   network in preparation for an attack.</p>

   <p class=note>In particular, this means the code 1015 is not used by the user agent (unless the
   server erroneously uses it in its close frame, of course).</p>

  </div>

  <hr><p>The <a href=#task-source>task source</a> for all <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue
  a task">queued</a> in this section is the <dfn id=websocket-task-source>WebSocket task source</dfn>.</p>


  <h4 id=ping-and-pong-frames><span class=secno>10.3.4 </span>Ping and Pong frames</h4>

  <p>The WebSocket protocol specification defines Ping and Pong frames that can be used for
  keep-alive, heart-beats, network status probing, latency instrumentation, and so forth. These are
  not currently exposed in the API.</p>

  <p>User agents may send ping and unsolicited pong frames as desired, for example in an attempt to
  maintain local network NAT mappings, to detect failed connections, or to display latency metrics
  to the user. User agents must not use pings or unsolicited pongs to aid the server; it is assumed
  that servers will solicit pongs whenever appropriate for the server's needs.</p>

  <!-- v2: we'll probably add a way to make the client send pings and automatically terminate the
  connection if they don't get a pong within an author-provided timeout; see
  https://www.w3.org/Bugs/Public/show_bug.cgi?id=17264 -->


  <h4 id=parsing-websocket-urls><span class=secno>10.3.5 </span>Parsing WebSocket URLs</h4>

  <p>The steps to <dfn id="parse-a-websocket-url's-components">parse a WebSocket URL's components</dfn> from a string <var title="">url</var> are as follows. These steps return either a <var title="">host</var>, a <var title="">port</var>, a <var title="">resource name</var>, and a <var title="">secure</var> flag,
  or they fail.</p>

  <ol><li><p>If the <var title="">url</var> string is not an <a href=#absolute-url>absolute URL</a>, then fail this
   algorithm.</li>

   <li>

    <p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">url</var> string, with the URL
    character encoding set to UTF-8. <a href=#refsRFC3629>[RFC3629]</a></p> <!-- the URL character
    encoding is used to escape the query component -->

    <p class=note>It doesn't matter what it is resolved relative to, since we already know it is
    an <a href=#absolute-url>absolute URL</a> at this point.</p>

   </li>

   <li><p>If the resulting <a href=#parsed-url>parsed URL</a> does not have a <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component whose value is either "<code title="">ws</code>" or "<code title="">wss</code>", then fail this algorithm.</li>

   <li><p>If the resulting <a href=#parsed-url>parsed URL</a> has a non-null <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> component, then fail this algorithm.</li>

   <li><p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of the resulting
   <a href=#parsed-url>parsed URL</a> is "<code title="">ws</code>", set <var title="">secure</var> to false;
   otherwise, the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component is "<code title="">wss</code>", set <var title="">secure</var> to true.</li>

   <li><p>Let <var title="">host</var> be the value of the resulting <a href=#parsed-url>parsed URL</a>'s <a href=#concept-url-host title=concept-url-host>host</a> component.</li> <!-- at this point this is
   Punycode-encoded and lowercased already -->

   <li><p>If the resulting <a href=#parsed-url>parsed URL</a> has a <a href=#concept-url-port title=concept-url-port>port</a>
   component that is not the empty string, then let <var title="">port</var> be that component's
   value; otherwise, there is no explicit <var title="">port</var>.</li>

   <li><p>If there is no explicit <var title="">port</var>, then: if <var title="">secure</var> is
   false, let <var title="">port</var> be 80, otherwise let <var title="">port</var> be
   443.</li>

   <li><p>Let <var title="">resource name</var> be the value of the resulting <a href=#parsed-url>parsed
   URL</a>'s <a href=#concept-url-path title=concept-url-path>path</a> component (which might be
   empty).</li> <!-- at this point this is UTF-8 encoded and percent encoded -->

   <li><p>If <var title="">resource name</var> is the empty string, set it to a single character
   U+002F SOLIDUS (/).</li>

   <li><p>If the resulting <a href=#parsed-url>parsed URL</a> has a non-null <a href=#concept-url-query title=concept-url-query>query</a> component, then append a single U+003F QUESTION MARK
   character (?) to <var title="">resource name</var>, followed by the value of the <a href=#concept-url-query title=concept-url-query>query</a> component.</li> <!-- at this point this is UTF-8
   encoded and percent encoded -->

   <li><p>Return <var title="">host</var>, <var title="">port</var>, <var title="">resource
   name</var>, and <var title="">secure</var>.</li>

  </ol><h4 id=event-definitions-3><span class=secno>10.3.6 </span>Event definitions</h4>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#closeeventinit>CloseEventInit</a> eventInitDict)]
interface <dfn id=closeevent>CloseEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute boolean <a href=#dom-closeevent-wasclean title=dom-CloseEvent-wasClean>wasClean</a>;
  readonly attribute unsigned short <a href=#dom-closeevent-code title=dom-CloseEvent-code>code</a>;
  readonly attribute DOMString <a href=#dom-closeevent-reason title=dom-CloseEvent-reason>reason</a>;
};

dictionary <dfn id=closeeventinit>CloseEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  boolean wasClean;
  unsigned short code;
  DOMString reason;
};</pre>

  <p>The <dfn id=dom-closeevent-wasclean title=dom-CloseEvent-wasClean><code>wasClean</code></dfn> attribute must return the
  value it was initialized to. When the object is created, this attribute must be initialized to
  false. It represents whether the connection closed cleanly or not.</p>

  <p>The <dfn id=dom-closeevent-code title=dom-CloseEvent-code><code>code</code></dfn> attribute must return the value it
  was initialized to. When the object is created, this attribute must be initialized to zero. It
  represents the WebSocket connection close code provided by the server.</p>

  <p>The <dfn id=dom-closeevent-reason title=dom-CloseEvent-reason><code>reason</code></dfn> attribute must return the
  value it was initialized to. When the object is created, this attribute must be initialized to
  empty string. It represents the WebSocket connection close reason provided by the server.</p>



  <h4 id=garbage-collection-1><span class=secno>10.3.7 </span>Garbage collection</h4>

  <p>A <code><a href=#websocket>WebSocket</a></code> object whose <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code>
  attribute's value was set to <code title=dom-WebSocket-CONNECTING><a href=#dom-websocket-connecting>CONNECTING</a></code> (0) as of
  the last time the <a href=#event-loop>event loop</a> started executing a <a href=#concept-task title=concept-task>task</a> must not be garbage collected if there are any event listeners
  registered for <code title=event-open>open</code> events, <code title=event-message><a href=#event-message>message</a></code> events, <code title=event-error>error</code> events, or
  <code title=event-socket-close>close</code> events.</p>

  <p>A <code><a href=#websocket>WebSocket</a></code> object whose <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code>
  attribute's value was set to <code title=dom-WebSocket-OPEN><a href=#dom-websocket-open>OPEN</a></code> (1) as of the last time
  the <a href=#event-loop>event loop</a> started executing a <a href=#concept-task title=concept-task>task</a> must not be
  garbage collected if there are any event listeners registered for <code title=event-message><a href=#event-message>message</a></code> events, <code title=event-error>error</code>, or <code title=event-socket-close>close</code> events.</p>

  <p>A <code><a href=#websocket>WebSocket</a></code> object whose <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code>
  attribute's value was set to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2) as of the last
  time the <a href=#event-loop>event loop</a> started executing a <a href=#concept-task title=concept-task>task</a> must
  not be garbage collected if there are any event listeners registered for <code title=event-error>error</code> or <code title=event-socket-close>close</code> events.</p>

  <p>A <code><a href=#websocket>WebSocket</a></code> object with <i title="the WebSocket connection is established"><a href=#the-websocket-connection-is-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><a href=#websocket>WebSocket</a></code> object is garbage collected while its connection is still open, the
  user agent must <i><a href=#start-the-websocket-closing-handshake>start the WebSocket closing handshake</a></i>, with no status code<!--CLOSE CODE-->
  for the Close message. <a href=#refsWSP>[WSP]</a></p>

  <hr><p>If a user agent is to <dfn id=make-disappear>make disappear</dfn> a <code><a href=#websocket>WebSocket</a></code> object (this happens
  when a <code><a href=#document>Document</a></code> object goes away), the user agent must follow the first appropriate
  set of steps from the following list:</p>

  <dl class=switch><dt>If the WebSocket connection is not yet <i title="the WebSocket
   connection is established"><a href=#the-websocket-connection-is-established>established</a></i> <a href=#refsWSP>[WSP]</a></dt>

   <dd>

    <p><i><a href=#fail-the-websocket-connection>Fail the WebSocket connection</a></i>. <a href=#refsWSP>[WSP]</a></p>

   </dd>


   <dt>If the WebSocket closing handshake has not yet been <i title="the WebSocket closing handshake is started"><a href=#the-websocket-closing-handshake-is-started>started</a></i>
   <a href=#refsWSP>[WSP]</a></dt>

   <dd>

    <p><i><a href=#start-the-websocket-closing-handshake>Start the WebSocket closing handshake</a></i>, with the
    status code<!--CLOSE CODE--> to use in the WebSocket Close message
    being 1001. <a href=#refsWSP>[WSP]</a></p>

   </dd>


   <dt>Otherwise</dt>

   <dd>

    <p>Do nothing.</p>

   </dd>

  </dl><!--TOPIC:DOM APIs--><!--POSTMSG--><h3 id=web-messaging><span class=secno>10.4 </span><dfn id=crossDocumentMessages>Cross-document messaging</dfn></h3>

  <p>Web browsers, for security and privacy reasons, prevent documents
  in different domains from affecting each other; that is, cross-site
  scripting is disallowed.</p>

  <p>While this is an important security feature, it prevents pages
  from different domains from communicating even when those pages are
  not hostile. This section introduces a messaging system that allows
  documents to communicate with each other regardless of their source
  domain, in a way designed to not enable cross-site scripting
  attacks.</p>

  <div class=impl>

  <p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> in <a href=#web-messaging>cross-document
  messaging</a> is the <dfn id=posted-message-task-source>posted message task source</dfn>.</p>

  </div>


  <h4 id=introduction-10><span class=secno>10.4.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

   <p>For example, if document A contains an <code><a href=#the-iframe-element>iframe</a></code>
   element that contains document B, and script in document A calls
   <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> on the
   <code><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><a href=#window>Window</a></code> of document A. The script in document A might
   look like:</p>

   <pre>var o = document.getElementsByTagName('iframe')[0];
o.contentWindow.postMessage('Hello world', 'http://b.example.org/');</pre>

   <p>To register an event handler for incoming events, the script
   would use <code title="">addEventListener()</code> (or similar
   mechanisms). For example, the script in document B might look
   like:</p>

   <pre>window.addEventListener('message', receiver, false);
function receiver(e) {
  if (e.origin == 'http://example.com') {
    if (e.data == 'Hello world') {
      e.source.postMessage('Hello', e.origin);
    } else {
      alert(e.data);
    }
  }
}</pre>

   <p>This script first checks the domain is the expected domain, and
   then looks at the message, which it either displays to the user, or
   responds to by sending a message back to the document which sent
   the message in the first place.</p>

  </div>


<!--ADD-TOPIC:Security-->
  <h4 id=security-postmsg><span class=secno>10.4.2 </span>Security</h4>

  <div class=impl>

  <h5 id=authors><span class=secno>10.4.2.1 </span>Authors</h5>

  </div>

  <p id=security-4 class=warning>Use of this API requires extra
  care to protect users from hostile entities abusing a site for their
  own purposes.</p>

  <p>Authors should check the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute to ensure
  that messages are only accepted from domains that they expect to
  receive messages from. Otherwise, bugs in the author's message
  handling code could be exploited by hostile sites.</p>

  <p>Furthermore, even after checking the <code title=dom-MessageEvent-origin><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 title=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 title="">targetOrigin</var> argument in messages that contain any
  confidential information, as otherwise there is no way to guarantee
  that the message is only delivered to the recipient to which it was
  intended.</p>

  <hr><p>Authors who accept messages from any origin are encouraged to
  consider the risks of a denial-of-service attack. An attacker could
  send a high volume of messages; if the receiving page performs
  expensive computation or causes network traffic to be sent for each
  such message, the attacker's message could be multplied into a
  denial-of-service attack. Authors are encouraged to employ rate
  limiting (only accepting a certain number of messages per minute) to
  make such attacks impractical.</p>


  <div class=impl>

  <h5 id=user-agents><span class=secno>10.4.2.2 </span>User agents</h5>

  <p>The integrity of this API is based on the inability for scripts
  of one <a href=#origin>origin</a> to post arbitrary events (using <code title="">dispatchEvent()</code> or otherwise) to objects in other
  origins (those that are not the <a href=#same-origin title="same
  origin">same</a>).</p>

  <p class=note>Implementors are urged to take extra care in the
  implementation of this feature. It allows authors to transmit
  information from one domain to another domain, which is normally
  disallowed for security reasons. It also requires that UAs be
  careful to allow access to certain properties but not others.</p>

  <hr><p>User agents are also encouraged to consider rate-limiting message
  traffic between different <a href=#origin title=origin>origins</a>, to
  protect na&iuml;ve sites from denial-of-service attacks.</p>

  </div>
<!--REMOVE-TOPIC:Security-->


  <h4 id=posting-messages><span class=secno>10.4.3 </span>Posting messages</h4>

  <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">transfer</var> ])</dt>

   <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>Date</code>s, etc), and can
    contain certain data objects such as <code><a href=#file>File</a></code>
    <code><a href=#blob>Blob</a></code>, <code><a href=#filelist>FileList</a></code>, and
    <code><a href=#arraybuffer>ArrayBuffer</a></code> objects.</p>

    <p>Objects listed in <var title="">transfer</var> are transferred,
    not just cloned, meaning that they are no longer usable on the
    sending side.</p>

    <p>If the origin of the target window doesn't match the given
    origin, the message is discarded, to avoid information leakage. To
    send the message to the target regardless of origin, set the
    target origin to "<code title="">*</code>". To restrict the
    message to same-origin targets only, without needing to explicitly
    state the origin, set the target origin to "<code title="">/</code>".</p>

    <p>Throws a <code><a href=#datacloneerror>DataCloneError</a></code> exception if <var title="">transfer</var> array contains
    duplicate objects or if <var title="">message</var> could not be cloned.</p>

   </dd>

  </dl><p class=note>When posting a message to a <code><a href=#window>Window</a></code> of a
  <a href=#browsing-context>browsing context</a> that has just been navigated to a new
  <code><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>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><a href=#window>Window</a></code> of newly created
  child <code><a href=#the-iframe-element>iframe</a></code>, authors are advised to have the child
  <code><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>

  <div class=impl>

  <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">transfer</var>)</code></dfn> method (with two or three
  arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
  follow these steps:</p>

  <ol><!-- a lot of this is similar or identical to port.postMessage --><li>

    <p>If the value of the <var title="">targetOrigin</var> argument
    is neither a single U+002A ASTERISK character (*), a single U+002F
    SOLIDUS character (/), nor an <a href=#absolute-url>absolute URL</a>, then
    throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort the overall
    set of steps.</p>

   </li>

   <li>

    <p>Let <var title="">new ports</var> be an empty array.</p>

   </li>

   <li>

    <p>Let <var title="">transfer map</var> be an empty association
    list of <code><a href=#transferable>Transferable</a></code> objects to placeholder
    objects.</p>

   </li>

   <li>

    <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>

    <ol><li>

      <p>If any object is listed in <var title="">transfer</var> more
      than once, or any of the <code><a href=#transferable>Transferable</a></code> objects
      listed in <var title="">transfer</var> are marked as <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, then
      throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort these
      steps.</p>

     </li>

     <li>

      <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, add a mapping from <var title="">x</var> to a new unique placeholder object created for
      <var title="">x</var> to <var title="">transfer map</var>, and
      if <var title="">x</var> is a <code><a href=#messageport>MessagePort</a></code> object,
      also append the placeholder object to the <var title="">new
      ports</var> array.</p>

     </li>

    </ol></li>

   <li>

    <p>Let <var title="">message clone</var> be the result of
    obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument, with <var title="">transfer
    map</var> as the <i>transfer map</i>. If this throws an exception,
    then throw that exception and abort these steps.</p>

   </li>

   <li>

    <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>

    <ol><li>

      <p>Let <var title="">new owner</var> be the <code><a href=#window>Window</a></code>
      object on which the method was invoked.</p>

     </li>

     <li>

      <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, obtain a new object <var title="">y</var> by <a href=#transfer-a-transferable-object title="transfer a Transferable
      object">transferring</a> the object <var title="">x</var> to
      <var title="">new owner</var>, and replace the placeholder
      object that was created for the object <var title="">x</var> by
      the new object <var title="">y</var> wherever the placeholder
      exists (i.e. in <var title="">message clone</var> and in <var title="">new ports</var>).</p>

     </li>

    </ol></li>

   <li>

    <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>

   </li>

   <li>

    <p>Return from the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, but
    asynchronously continue running these steps.</p>

   </li>

   <li>

    <p>If the <var title="">targetOrigin</var> argument is a single
    literal U+002F SOLIDUS character (/), and the
    <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which
    the method was invoked does not have the <a href=#same-origin>same origin</a>
    as the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
    document">document</a>, then abort these steps silently.</p>

    <p>Otherwise, if the <var title="">targetOrigin</var> argument is
    an <a href=#absolute-url>absolute URL</a>, and the <code><a href=#document>Document</a></code> of the
    <code><a href=#window>Window</a></code> object on which the method was invoked does
    not have the <a href=#same-origin>same origin</a> as <var title="">targetOrigin</var>, then abort these steps silently.</p>

    <p>Otherwise, the <var title="">targetOrigin</var> argument is a
    single literal U+002A ASTERISK character (*), and no origin check
    is made.</p>

   </li>

   <li>

    <p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the
    <code><a href=#messageevent>MessageEvent</a></code> interface, with the event type <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
    default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
    initialized to the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialized to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an origin">Unicode serialization</a> of the
    <a href=#origin>origin</a> of the <a href=#incumbent-script>incumbent script</a>, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be initialized to the
    <a href="#script's-global-object">script's global object</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialized to the <var title="">new ports</var> array.
    </p>
    <!-- invariant: the global object is always a Window if the script can see this method -->

   </li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> to <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> the event
    created in the previous step at the <code><a href=#window>Window</a></code> object on which the method was invoked.
    The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#posted-message-task-source>posted
    message task source</a>.</p>

   </li>

  </ol></div>




  <h3 id=channel-messaging><span class=secno>10.5 </span><dfn>Channel messaging</dfn></h3>

  <h4 id=introduction-11><span class=secno>10.5.1 </span>Introduction</h4>

  <p><i>This section is non-normative.</i></p>

  <p>To enable independent pieces of code (e.g. running in different
  <a href=#browsing-context title="browsing context">browsing contexts</a>) to
  communicate directly, authors can use <a href=#channel-messaging>channel
  messaging</a>.</p>

  <p>Communication channels in this mechanism are implemented as
  two-ways pipes, with a port at each end. Messages sent in one port
  are delivered at the other port, and vice-versa. Messages are
  asynchronous, and delivered as DOM events.</p>

  <p>To create a connection (two "entangled" ports), the <code title="">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 title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code>:</p>

  <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>

  <p>To send messages, the <code title=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 title=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><a href=#messageport>MessagePort</a></code>:</p>

  <pre>port1.postMessage(['hello', 'world']);</pre>


  <h5 id=examples-5><span class=secno>10.5.1.1 </span>Examples</h5>

  <p><i>This section is non-normative.</i></p>

  <div class=example>

   <p>In this example, two JavaScript libraries are connected to each
   other using <code><a href=#messageport>MessagePort</a></code>s. This allows the libraries to
   later be hosted in different frames, or in <code><a href=#worker>Worker</a></code>
   objects, without any change to the APIs.</p>

   <pre>&lt;script src="contacts.js"&gt;&lt;/script&gt; &lt;!-- exposes a contacts object --&gt;
&lt;script src="compose-mail.js"&gt;&lt;/script&gt; &lt;!-- exposes a composer object --&gt;
&lt;script&gt;
 var channel = new MessageChannel();
 composer.addContactsProvider(channel.port1);
 contacts.registerConsumer(channel.port2);
&lt;/script&gt;</pre>

   <p>Here's what the "addContactsProvider()" function's
   implementation could look like:</p>

   <pre>function addContactsProvider(port) {
  port.onmessage = function (event) {
    switch (event.data.messageType) {
      'search-result': handleSearchResult(event.data.results); break;
      'search-done': handleSearchDone(); break;
      'search-error': handleSearchError(event.data.message); break;
      // ...
    }
  };
};</pre>

   <p>Alternatively, it could be implemented as follows:</p>

   <pre>function addContactsProvider(port) {
  port.addEventListener('message', function (event) {
    if (event.data.messageType == 'search-result')
      handleSearchResult(event.data.results);
  });
  port.addEventListener('message', function (event) {
    if (event.data.messageType == 'search-done')
      handleSearchDone();
  });
  port.addEventListener('message', function (event) {
    if (event.data.messageType == 'search-error')
      handleSearchError(event.data.message);
  });
  // ...
  port.start();
};</pre>

   <p>The key difference is that when using <code title=dom-EventTarget-addEventListener>addEventListener()</code>,
   the <code title=dom-MessagePort-start><a href=#dom-messageport-start>start()</a></code> method must
   also be invoked. When using <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code>, the call to
   <code title=dom-MessagePort-start><a href=#dom-messageport-start>start()</a></code> is implied.</p>

   <p>The <code title=dom-MessagePort-start><a href=#dom-messageport-start>start()</a></code> method,
   whether called explicitly or implicitly (by setting <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code>), starts the
   flow of messages: messages posted on message ports are initially
   paused, so that they don't get dropped on the floor before the
   script has had a chance to set up its handlers.</p>

  </div>


  <h5 id=ports-as-the-basis-of-an-object-capability-model-on-the-web><span class=secno>10.5.1.2 </span>Ports as the basis of an object-capability model on the Web</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Ports can be viewed as a way to expose limited capabilities (in
  the object-capability model sense) to other actors in the system.
  This can either be a weak capability system, where the ports are
  merely used as a convenient model within a particular origin, or as
  a strong capability model, where they are provided by one origin
  <var title="">provider</var> as the only mechanism by which another
  origin <var title="">consumer</var> can effect change in or obtain
  information from <var title="">provider</var>.</p>

  <p>For example, consider a situation in which a social Web site
  embeds in one <code><a href=#the-iframe-element>iframe</a></code> the user's e-mail contacts
  provider (an address book site, from a second origin), and in a
  second <code><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><a href=#the-iframe-element>iframe</a></code> cannot
  access anything inside the first <code><a href=#the-iframe-element>iframe</a></code>; together they
  can only:</p>

  <ul class=brief><li><a href=#navigate>Navigate</a> the <code><a href=#the-iframe-element>iframe</a></code> to a new
   <a href=#url>URL</a>, such as the same <a href=#url>URL</a> but with a
   different fragment identifier, causing the <code><a href=#window>Window</a></code> in
   the <code><a href=#the-iframe-element>iframe</a></code> to receive a <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> event.</li>

   <li>Resize the <code><a href=#the-iframe-element>iframe</a></code>, causing the <code><a href=#window>Window</a></code>
   in the <code><a href=#the-iframe-element>iframe</a></code> to receive a <code title=event-resize>resize</code> event.</li>

   <!-- anything else? -->

   <li>Send a <code title=event-message><a href=#event-message>message</a></code> event to 
   the <code><a href=#window>Window</a></code> in the <code><a href=#the-iframe-element>iframe</a></code> using the <code title=dom-window-postMessage><a href=#dom-window-postmessage>window.postMessage()</a></code>
   API.</li>

  </ul><p>The contacts provider can use these methods, most particularly
  the third one, to provide an API that can be accessed by other
  origins to manipulate the user's address book. For example, it could
  respond to a message "<code title="">add-contact Guillaume Tell
  &lt;tell@pomme.example.net&gt;</code>" by adding the given person and
  e-mail address to the user's address book.</p>

  <p>To avoid any site on the Web being able to manipulate the user's
  contacts, the contacts provider might only allow certain trusted
  sites, such as the social site, to do this.</p>

  <p>Now suppose the game wanted to add a contact to the user's
  address book, and that the social site was willing to allow it to do
  so on its behalf, essentially "sharing" the trust that the contacts
  provider had with the social site. There are several ways it could
  do this; most simply, it could just proxy messages between the game
  site and the contacts site. However, this solution has a number of
  difficulties: it requires the social site to either completely trust
  the game site not to abuse the privilege, or it requires that the
  social site verify each request to make sure it's not a request that
  it doesn't want to allow (such as adding multiple contacts, reading
  the contacts, or deleting them); it also requires some additional
  complexity if there's ever the possibility of multiple games
  simultaneously trying to interact with the contacts provider.</p>

  <p>Using message channels and <code><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><a href=#messageport>MessagePort</a></code> objects, and sends
  one of them back to the social site, who forwards it on to the game.
  The game and the contacts provider then have a direct connection,
  and the contacts provider knows to only honor a single "add contact"
  request, nothing else. In other words, the game has been granted the
  capability to add a single contact.</p>


  <h5 id=ports-as-the-basis-of-abstracting-out-service-implementations><span class=secno>10.5.1.3 </span>Ports as the basis of abstracting out service implementations</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Continuing the example from the previous section, consider the
  contacts provider in particular. While an initial implementation
  might have simply used <code>XMLHttpRequest</code> objects in the
  service's <code><a href=#the-iframe-element>iframe</a></code>, an evolution of the service might
  instead want to use a <a href=#sharedworker title=SharedWorker>shared
  worker</a> with a single <code><a href=#websocket>WebSocket</a></code> connection.</p>

  <p>If the initial design used <code><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>XMLHttpRequest</code>s-in-each-<code><a href=#the-iframe-element>iframe</a></code> model to
  the shared-<code><a href=#websocket>WebSocket</a></code> model without changing the API at
  all: the ports on the service provider side can all be forwarded to
  the shared worker without it affecting the users of the API in the
  slightest.</p>



  <h4 id=message-channels><span class=secno>10.5.2 </span>Message channels</h4>

  <pre class=idl>[<a href=#dom-messagechannel title=dom-MessageChannel>Constructor</a>]
interface <dfn id=messagechannel>MessageChannel</dfn> {
  readonly attribute <a href=#messageport>MessagePort</a> <a href=#dom-channel-port1 title=dom-channel-port1>port1</a>;
  readonly attribute <a href=#messageport>MessagePort</a> <a href=#dom-channel-port2 title=dom-channel-port2>port2</a>;
};</pre>

  <dl class=domintro><dt><var title="">channel</var> = new <code title=dom-MessageChannel><a href=#dom-messagechannel>MessageChannel</a></code>()</dt>

   <dd>

    <p>Returns a new <code><a href=#messagechannel>MessageChannel</a></code> object with two new <code><a href=#messageport>MessagePort</a></code> objects.</p>

   </dd>

   <dt><var title="">channel</var> . <code title=dom-MessageChannel-port1>port1</code></dt>

   <dd>

    <p>Returns the first <code><a href=#messageport>MessagePort</a></code> object.</p>

   </dd>

   <dt><var title="">channel</var> . <code title=dom-MessageChannel-port2>port2</code></dt>

   <dd>

    <p>Returns the second <code><a href=#messageport>MessagePort</a></code> object.</p>

   </dd>

  </dl><div class=impl>

  <p>When the <dfn id=dom-messagechannel title=dom-MessageChannel><code>MessageChannel()</code></dfn>
  constructor is called, it must run the following algorithm:</p>

  <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
   owned by the <a href="#script's-global-object">script's global object</a>, and let <var title="">port1</var> be that object.</li>

   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
   owned by the <a href="#script's-global-object">script's global object</a>, and let <var title="">port2</var> be that object.</li>

   <li><p><a href=#entangle>Entangle</a> the <var title="">port1</var> and <var title="">port2</var> objects.</li>

   <li><p>Instantiate a new <code><a href=#messagechannel>MessageChannel</a></code> object, and
   let <var title="">channel</var> be that object.</li>

   <li><p>Let the <code title=dom-channel-port1><a href=#dom-channel-port1>port1</a></code>
   attribute of the <var title="">channel</var> object be <var title="">port1</var>.</p>

   <li><p>Let the <code title=dom-channel-port2><a href=#dom-channel-port2>port2</a></code>
   attribute of the <var title="">channel</var> object be <var title="">port2</var>.</p>

   <li><p>Return <var title="">channel</var>.</li>

  </ol><p>The <dfn id=dom-channel-port1 title=dom-channel-port1><code>port1</code></dfn> and
  <dfn id=dom-channel-port2 title=dom-channel-port2><code>port2</code></dfn> attributes
  must return the values they were assigned when the
  <code><a href=#messagechannel>MessageChannel</a></code> object was created.</p>

  </div>



  <h4 id=message-ports><span class=secno>10.5.3 </span>Message ports</h4>

  <p>Each channel has two message ports. Data sent through one port is
  received by the other port, and vice versa.</p>

  <pre class=idl>interface <dfn id=messageport>MessagePort</dfn> : <a href=#eventtarget>EventTarget</a> {
<!-- v2-onclose  readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
-->  void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(any message, optional sequence&lt;<a href=#transferable>Transferable</a>&gt; transfer);<!--
  <span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(any message);-->
  void <a href=#dom-messageport-start title=dom-MessagePort-start>start</a>();
  void <a href=#dom-messageport-close title=dom-MessagePort-close>close</a>();

  // event handlers
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-messageport-onmessage title=handler-MessagePort-onmessage>onmessage</a>;
};
// <a href=#messageport>MessagePort</a> implements <a href=#transferable>Transferable</a>;</pre>

  <dl class=domintro><!-- v2-onclose
   <dt><var title="">port</var> . <code title="dom-MessagePort-active">active</code></dt>

   <dd>

    <p>Returns true if the port is still active; otherwise, returns false.</p>

   </dd>
--><dt><var title="">port</var> . <code title=dom-MessagePort-postMessage><a href=#dom-messageport-postmessage>postMessage</a></code>(<var title="">message</var> [, <var title="">transfer</var>] )</dt>

   <dd>

    <p>Posts a message through the channel. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
    that they are no longer usable on the sending side.</p>

    <p>Throws a <code><a href=#datacloneerror>DataCloneError</a></code> exception if <var title="">transfer</var> array contains
    duplicate objects or the source or target ports, or if <var title="">message</var> could not be
    cloned.</p>

   </dd>

   <dt><var title="">port</var> . <code title=dom-MessagePort-start><a href=#dom-messageport-start>start</a></code>()</dt>

   <dd>

    <p>Begins dispatching messages received on the port.</p>

   </dd>

   <dt><var title="">port</var> . <code title=dom-MessagePort-close><a href=#dom-messageport-close>close</a></code>()</dt>

   <dd>

    <p>Disconnects the port, so that it is no longer active.</p>

   </dd>

  </dl><div class=impl>

  <p>Each <code><a href=#messageport>MessagePort</a></code> object can be entangled with another (a symmetric relationship).
  Each <code><a href=#messageport>MessagePort</a></code> object also has a <a href=#task-source>task source</a> called the <dfn id=port-message-queue>port
  message queue</dfn>, initially empty. A <a href=#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><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag. It must
  initially be false.</p>

  <p>Each <a href=#event-loop>event loop</a> has a <a href=#task-source>task source</a> called the <dfn id=unshipped-port-message-queue>unshipped port
  message queue</dfn>. This is a virtual <a href=#task-source>task source</a>: it must act as if it contained
  the <a href=#concept-task title=concept-task>tasks</a> of each <a href=#port-message-queue>port message queue</a> of each
  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false, in the order in which
  they were added to their respective <a href=#task-source>task source</a>. When a <a href=#concept-task title=concept-task>task</a> would be removed from the <a href=#unshipped-port-message-queue>unshipped port message
  queue</a>, it must instead be removed from its <a href=#port-message-queue>port message queue</a>.</p>

  <p>When a <code><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped>has been shipped</a> flag is false, its <a href=#port-message-queue>port
  message queue</a> must be ignored for the purposes of the <a href=#event-loop>event loop</a>. (The
  <a href=#unshipped-port-message-queue>unshipped port message queue</a> is used instead.)</p>

  <p class=note>The <a href=#has-been-shipped>has been shipped</a> flag is set to true when a port, its twin, or
  the object it was cloned from, is or has been <a href=#transfer-a-transferable-object title="transfer a transferable
  object">transferred</a>. When a <code><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped>has been shipped</a> flag
  is true, its <a href=#port-message-queue>port message queue</a> acts as a first-class <a href=#task-source>task source</a>,
  unaffected to any <a href=#unshipped-port-message-queue>unshipped port message queue</a>.</p>

  <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> owned by a
  <a href="#script's-global-object">script's global object</a> object <var title="">owner</var>, it must instantiate a new
  <code><a href=#messageport>MessagePort</a></code> object, and let its owner be <var title="">owner</var>.</p>

  <p>When the user agent is to <dfn id=entangle>entangle</dfn> two <code><a href=#messageport>MessagePort</a></code> objects, it must run
  the following steps:</p>

  <ol><li>

    <p>If one of the ports is already entangled, then disentangle it
    and the port that it was entangled with.</p>

    <p class=note>If those two previously entangled ports were the
    two ports of a <code><a href=#messagechannel>MessageChannel</a></code> object, then that
    <code><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>

   <li>

    <p>Associate the two ports to be entangled, so that they form the two parts of a new channel.
    (There is no <code><a href=#messagechannel>MessageChannel</a></code> object that represents this channel.)</p>

    <p>Two ports <var title="">A</var> and <var title="">B</var> that have gone through this step
    are now said to be entangled; one is entangled to the other, and vice versa.</p>

    <p class=note>While this specification describes this process as instantaneous,
    implementations are more likely to implement it via message passing. As with all algorithms, the
    key is "merely" that the end result be indistinguishable, in a black-box sense, from the
    specification.</p>

   </li>

  </ol><p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var title="">original port</var>, with the clone being owned by <var title="">owner</var>, it must run the following steps, which return
  a new <code><a href=#messageport>MessagePort</a></code> object. These steps must be run
  atomically.</p>

  <ol><li><p>Set <var title="">original port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
   true.</li>

   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
   owned by <var title="">owner</var>, and let <var title="">new
   port</var> be that object.</li>

   <li><p>Set <var title="">new port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to true.</li>

   <li><p>Move all the events in the <a href=#port-message-queue>port message queue</a>
   of <var title="">original port</var> to the <a href=#port-message-queue>port message
   queue</a> of <var title="">new port</var>, if any, leaving the
   <var title="">new port</var>'s <a href=#port-message-queue>port message queue</a> in
   its initial disabled state.</li>

   <li>

    <p>If the <var title="">original port</var> is entangled with
    another port, then run these substeps:</p>

    <ol><li><p>Let the <var title="">remote port</var> be the port with
     which the <var title="">original port</var> is entangled.</li>

     <li><p>Set <var title="">remote port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
     true.</li>

     <li><p><a href=#entangle>Entangle</a> the <var title="">remote port</var>
     and <var title="">new port</var> objects. The <var title="">original port</var> object will be disentangled by this
     process.</li>

    </ol></li>

   <li><p>Return <var title="">new port</var>. It is the
   clone.</li>

  </ol><p id=transferMessagePort>To <a href=#transfer-a-transferable-object title="transfer a Transferable
  object">transfer</a> a <code><a href=#messageport>MessagePort</a></code> object <var title="">old</var> to a new owner <var title="">owner</var>, a user
  agent must <a href=#clone-a-port title="clone a port">clone</a> the <var title="">old</var> object with the clone being owned by <var title="">owner</var>, thus obtaining <var title="">new</var>, must
  <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neuter</a> the <var title="">old</var> port, and must finally return <var title="">new</var>.</p>

  <hr><!-- v2-onclose
  <p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
  attribute must return true if the port is entangled, and false
  otherwise.</p>

  <hr>
--><p>The <dfn id=dom-messageport-postmessage title=dom-MessagePort-postMessage><code>postMessage()</code></dfn>
  method, when called on a port <var title="">source port</var>, must
  cause the user agent to run the following steps:</p>

  <ol><!-- a lot of this is similar or identical to window.postMessage --><li><p>Let <var title="">target port</var> be the port with which
   <var title="">source port</var> is entangled, if any.</li>

   <li>

    <p>Let <var title="">new ports</var> be an empty array.</p>

   </li>

   <li>

    <p>Let <var title="">transfer map</var> be an empty association
    list of <code><a href=#transferable>Transferable</a></code> objects to placeholder
    objects.</p>

   </li>

   <li>

    <p>If the method was invoked with a second argument <var title="">transfer</var>, run these substeps:</p>

    <ol><li>

      <p>If any object is listed in <var title="">transfer</var> more
      than once, or any of the <code><a href=#transferable>Transferable</a></code> objects
      listed in <var title="">transfer</var> are marked as <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, then
      throw a <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort these
      steps.</p>

     </li>

     <li>

      <p>If any of the objects in <var title="">transfer</var> are
      either the <var title="">source port</var> or the <var title="">target port</var> (if any), then throw a
      <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort these
      steps.</p>

     </li>

     <li>

      <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, add a mapping from <var title="">x</var> to a new unique placeholder object created for
      <var title="">x</var> to <var title="">transfer map</var>, and
      if <var title="">x</var> is a <code><a href=#messageport>MessagePort</a></code> object,
      also append the placeholder object to the <var title="">new
      ports</var> array.</p>

     </li>

    </ol></li>

   <li>

    <p>Let <var title="">message clone</var> be the result of
    obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument, with <var title="">transfer
    map</var> as the <i>transfer map</i>. If this throws an exception,
    then throw that exception and abort these steps.</p>

   </li>

   <li>

    <p>If the method was invoked with a second argument <var title="">transfer</var>, run these substeps:</p>

    <ol><li>

      <p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there is a <var title="">target
      port</var>, or else some arbitrary owner. (This <var title="">new owner</var> is used when transferring objects below.
      If there is no <var title="">target port</var>, the
      <code><a href=#transferable>Transferable</a></code> objects given in the second argument,
      if any, are still <a href=#transfer-a-transferable-object title="transfer a Transferable
      object">transferred</a>, but since they are then discarded, it
      doesn't matter where they are transferred to.)</p>

     </li>


     <li>

      <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, obtain a new object <var title="">y</var> by <a href=#transfer-a-transferable-object title="transfer a Transferable
      object">transferring</a> the object <var title="">x</var> to
      <var title="">new owner</var>, and replace the placeholder
      object that was created for the object <var title="">x</var> by
      the new object <var title="">y</var> wherever the placeholder
      exists (i.e. in <var title="">message clone</var> and in <var title="">new ports</var>).</p>

     </li>

    </ol></li>

   <li>

    <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>

   </li>

   <li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
   steps.</li> <!-- we don't throw an exception if there is no
   target port because this can happen at a moment's notice. we don't
   return false because if the port is _about_ to be closed, the
   message might not be listened for anyway. we don't do this before
   the steps above because otherwise you can tell the difference (in
   whether the ports have become useless, or in when the structured
   clone algorithm runs scripts -->

   <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
   interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
   cancelable, and has no default action.
   </li>

   <li><p>Let the <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code>
   attribute of the event be initialized to the value of <var title="">message clone</var>.</li>

   <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
   attribute of the event be initialized to the <var title="">new
   ports</var> array.</li>

   <li><p>Add the event to the <a href=#port-message-queue>port message queue</a> of <var title="">target port</var>.</li>

  </ol><!--
  <hr>

  <p>The <dfn
  title="dom-MessagePort-startConversation"><code>startConversation(<var
  title="">message</var>)</code></dfn> method is a convenience method
  that simplifies create a new <code>MessageChannel</code> and
  invoking <code
  title="dom-MessagePort-postMessage">postMessage()</code> with one of
  the new ports. When invoked on a port <var title="">source
  port</var>, it must run the following steps:</p>

  <ol>

   <li><p>Let <var title="">message</var> be the method's first
   argument.</p></li>

   <li><p><span>Create a new <code>MessagePort</code> object</span>
   owned by the <span>script's global object</span>, and let <var
   title="">port1</var> be that object.</p></li>

   <li><p>If the <var title="">source port</var> is not entangled with
   another port, then return <var title="">port1</var> and abort these
   steps.</p></li>
   <!- - we don't throw an exception because this can happen moment's
   notice. we don't return null because then we'd end up with
   null derefs. better to just let the likely next postMessage call
   fall on the floor. - ->

   <li><p>Let <var title="">target port</var> be the port with which
   <var title="">source port</var> is entangled.</p></li>

   <li><p><span>Create a new <code>MessagePort</code> object</span>
   owned by the owner of the <var title="">target port</var>, and let
   <var title="">port2</var> be that object.</p></li>

   <li><p><span>Entangle</span> the <var title="">port1</var> and <var
   title="">port2</var> objects.</p></li>

   <li><p>Create an event that uses the <code>MessageEvent</code>
   interface, with the name <code
   title="event-message">message</code>, which does not bubble, is not
   cancelable, and has no default action.
   </p></li>

   <li><p>Let the <code title="dom-MessageEvent-data">data</code>
   attribute of the event be initialized to the value of <var
   title="">message</var>, the method's first argument.</p></li>

   <li><p>Let the <code title="dom-MessageEvent-ports">ports</code>
   attribute of the event be initialized to a <span
   title="dfn-read-only-array">read only</span> array containing only
   <var title="">port2</var>.</p></li>

   <li><p>Return <var title="">port1</var> from the method, but
   continue with these steps.</p></li>

   <li><p>Add the event to the <span>port message queue</span> of <var
   title="">target port</var>.</p></li>

  </ol>
--><hr><p>The <dfn id=dom-messageport-start title=dom-MessagePort-start><code>start()</code></dfn> method must enable its port's
  <a href=#port-message-queue>port message queue</a>, if it is not already enabled.</p>

  <p>When a port's <a href=#port-message-queue>port message queue</a> is enabled, the <a href=#event-loop>event loop</a> must use
  it as one of its <a href=#task-source title="task source">task sources</a>.</p>

  <p class=note>If the <code><a href=#document>Document</a></code> of the port's event listeners' <a href="#script's-global-object" title="script's
  global object">global object</a> is not <a href=#fully-active>fully active</a>, then the messages are
  lost.</p> <!-- because of the jump-to-entry-point algorithm first step -->

  <hr><p>The <dfn id=dom-messageport-close title=dom-MessagePort-close><code>close()</code></dfn> method, when called on a port
  <var title="">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>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event handler IDL attributes</a>,
  by all objects implementing the <code><a href=#messageport>MessagePort</a></code> interface:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-messageport-onmessage title=handler-MessagePort-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
  </table><p>The first time a <code><a href=#messageport>MessagePort</a></code> object's <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> IDL attribute
  is set, the port's <a href=#port-message-queue>port message queue</a> must be enabled,
  as if the <code title=dom-MessagePort-start><a href=#dom-messageport-start>start()</a></code> method
  had been called.</p>

  </div>


  <h4 id=broadcasting-to-many-ports><span class=secno>10.5.4 </span>Broadcasting to many ports</h4>

  <p>Broadcasting to many ports is in principle relatively simple: keep an array of
  <code><a href=#messageport>MessagePort</a></code> objects to send messages to, and iterate through the array to send a
  message. However, this has one rather unfortunate effect: it prevents the ports from being garbage
  collected, even if the other side has gone away.</p>

  <p>To avoid this problem, the <code><a href=#portcollection>PortCollection</a></code> object can be used. It acts as an opaque
  array of <code><a href=#messageport>MessagePort</a></code> objects, thus allowing the objects to be garbage collected when
  they stop being relevant, while still allowing scripts to iterate over the
  <code><a href=#messageport>MessagePort</a></code> objects.</p>

  <pre class=idl>[<a href=#dom-portcollection title=dom-PortCollection>Constructor</a>] interface <dfn id=portcollection>PortCollection</dfn> {
  void <a href=#dom-portcollection-add title=dom-PortCollection-add>add</a>(<a href=#messageport>MessagePort</a> port);
  void <a href=#dom-portcollection-remove title=dom-PortCollection-remove>remove</a>(<a href=#messageport>MessagePort</a> port);
  void <a href=#dom-portcollection-clear title=dom-PortCollection-clear>clear</a>();
  void <a href=#dom-portcollection-iterate title=dom-PortCollection-iterate>iterate</a>(<a href=#portcollectioncallback>PortCollectionCallback</a> callback);
};

callback <dfn id=portcollectioncallback>PortCollectionCallback</dfn> = void (<a href=#messageport>MessagePort</a> port);</pre>

  <dl class=domintro><dt><var title="">portCollection</var> = new <code title=dom-PortCollection><a href=#dom-portcollection>PortCollection</a></code>()</dt>

   <dd>

    <p>Returns a new empty <code><a href=#portcollection>PortCollection</a></code> object.</p>

   </dd>

   <dt><var title="">portCollection</var> . <code title=dom-PortCollection-add><a href=#dom-portcollection-add>add</a></code>(<var title="">port</var>)</dt>

   <dd>

    <p>Adds <var title="">port</var> to the collection, if it isn't already present.</p>

   </dd>

   <dt><var title="">portCollection</var> . <code title=dom-PortCollection-remove><a href=#dom-portcollection-remove>remove</a></code>(<var title="">port</var>)</dt>

   <dd>

    <p>Removes <var title="">port</var> from the collection, if it is present.</p>

   </dd>

   <dt><var title="">portCollection</var> . <code title=dom-PortCollection-clear><a href=#dom-portcollection-clear>clear</a></code>()</dt>

   <dd>

    <p>Removes all ports from the collection.</p>

   </dd>

   <dt><var title="">portCollection</var> . <code title=dom-PortCollection-iterate><a href=#dom-portcollection-iterate>iterate</a></code>(<var title="">callback</var>)</dt>

   <dd>

    <p>Calls <var title="">callback</var> for each port in the collection.</p>

   </dd>

  </dl><div class=impl>

  <p>A <code><a href=#portcollection>PortCollection</a></code> object has an initially empty <dfn id=concept-portcollection-list title=concept-PortCollection-list>list of ports</dfn>. When a <code><a href=#messageport>MessagePort</a></code> object in
  a <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a> is garbage collected, it must be
  silently removed from that <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>. Objects
  in a <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a> are ordered chronologically by
  the time at which they were most recently added; the least-recently added <code><a href=#messageport>MessagePort</a></code>
  object is the first in the list, and the most-recently added <code><a href=#messageport>MessagePort</a></code> is the last
  in the list.</p>

  <p>The <dfn id=dom-portcollection title=dom-PortCollection><code>PortCollection()</code></dfn> constructor must return
  a new <code><a href=#portcollection>PortCollection</a></code> object (with an empty <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>).</p>

  <p>The <dfn id=dom-portcollection-add title=dom-PortCollection-add><code>add()</code></dfn> method must add the
  <code><a href=#messageport>MessagePort</a></code> given by the argument to the <code><a href=#portcollection>PortCollection</a></code> object's <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>, unless the <code><a href=#messageport>MessagePort</a></code> is
  already in the <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>, in which case the
  method does nothing. (Calling this method with a port already in the list does not move the port
  to the end of the list.)</p>

  <p>The <dfn id=dom-portcollection-remove title=dom-PortCollection-remove><code>remove()</code></dfn> method must remove the
  <code><a href=#messageport>MessagePort</a></code> given by the argument from the <code><a href=#portcollection>PortCollection</a></code> object's <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>, unless the <code><a href=#messageport>MessagePort</a></code> is
  not in the <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>, in which case the
  method does nothing.</p>

  <p>The <dfn id=dom-portcollection-clear title=dom-PortCollection-clear><code>clear()</code></dfn> method must remove all
  <code><a href=#messageport>MessagePort</a></code> objects from the <code><a href=#portcollection>PortCollection</a></code> object's <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>, returning it to the initial empty state.
  If the <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a> is already empty, the method
  does nothing.</p>

  <p>The <dfn id=dom-portcollection-iterate title=dom-PortCollection-iterate><code>iterate()</code></dfn> method must invoke its
  <code><a href=#portcollectioncallback>PortCollectionCallback</a></code> argument once for each <code><a href=#messageport>MessagePort</a></code> object in the
  object's <a href=#concept-portcollection-list title=concept-PortCollection-list>list of ports</a>, in the order defined
  above, with each invocation being passed the corresponding <code><a href=#messageport>MessagePort</a></code> object as the
  callback's sole argument.</p>

  </div>


  <h4 id=ports-and-garbage-collection><span class=secno>10.5.5 </span>Ports and garbage collection</h4>

  <div class=impl>

  <p>When a <code><a href=#messageport>MessagePort</a></code> object <var title="">o</var> is
  entangled, user agents must either act as if <var title="">o</var>'s
  entangled <code><a href=#messageport>MessagePort</a></code> object has a strong reference to
  <var title="">o</var>, or as if <var title="">o</var>'s owner has a
  strong reference to <var title="">o</var>.</p>

  <div class=note>

   <p>Thus, a message port can be received, given an event listener,
   and then forgotten, and so long as that event listener could
   receive a message, the channel will be maintained.</p>

   <p>Of course, if this was to occur on both sides of the channel,
   then both ports could be garbage collected, since they would not be
   reachable from live code, despite having a strong reference to each
   other.</p>

  </div>

  <p>Furthermore, a <code><a href=#messageport>MessagePort</a></code> object must not be
  garbage collected while there exists a message in a <a href=#task-queue>task
  queue</a> that is to be dispatched on that
  <code><a href=#messageport>MessagePort</a></code> object, or while the
  <code><a href=#messageport>MessagePort</a></code> object's <a href=#port-message-queue>port message queue</a> is
  open and there exists a <code title=event-message><a href=#event-message>message</a></code>
  event in that queue.</p>
  <!-- we might not need to explicitly say the first part if DOM
  Events is fixed to say that events on a task queue prevent GC -->

  <!-- ports in the ports attribute of a MessageEvent that isn't
  dispatched yet are safe because the MessageEvent is safe -->

  <p>There are no strong references from a <code><a href=#portcollection>PortCollection</a></code> object to its
  <code><a href=#messageport>MessagePort</a></code> objects. (That is in fact the whole point of <code><a href=#portcollection>PortCollection</a></code>
  objects: they allow for <code><a href=#messageport>MessagePort</a></code> objects to be referenced without preventing them
  from being garbage collected.)</p>

  </div>

  <p class=note>Authors are strongly encouraged to explicitly close <code><a href=#messageport>MessagePort</a></code>
  objects to disentangle them, so that their resources can be recollected. Creating many
  <code><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.</p>

<!--POSTMSG-->






  <h2 id=webstorage><span class=secno>11 </span>Web storage</h2>



  <h3 id=introduction-12><span class=secno>11.1 </span>Introduction</h3>

  <p><i>This section is non-normative.</i></p>

  <p>This specification introduces two related mechanisms, similar to HTTP session cookies, for
  storing name-value pairs on the client side. <a href=#refsCOOKIES>[COOKIES]</a></p>

  <p>The first is designed for scenarios where the user is carrying
  out a single transaction, but could be carrying out multiple
  transactions in different windows at the same time.</p>

  <p>Cookies don't really handle this case well. For example, a user
  could be buying plane tickets in two different windows, using the
  same site. If the site used cookies to keep track of which ticket
  the user was buying, then as the user clicked from page to page in
  both windows, the ticket currently being purchased would "leak" from
  one window to the other, potentially causing the user to buy two
  tickets for the same flight without really noticing.</p>

  <p>To address this, this specification introduces the <code title=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> <!-- we're
  not using xrefs here because this is just an intro -->

  <div class=example>

   <p>For example, a page could have a checkbox that the user ticks to
   indicate that he wants insurance:</p>

   <pre>&lt;label&gt;
 &lt;input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''"&gt;
 I want insurance on this trip.
&lt;/label&gt;</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>

  <!--

   sessionStorage.flightDeparture = 'OSL';
   sessionStorage.flightArrival = 'NYC';

   for (var i in forms[0].elements)
      sessionStorage["data_" + i.name] = i.value;

   // if we add storage of non-strings
   if (!sessionStorage[documents])
     sessionStorage[documents] = {};
   sessionStorage[documents][filename] = <document/>;

  -->

  <p>The second storage mechanism is designed for storage that spans
  multiple windows, and lasts beyond the current session. In
  particular, Web applications may wish to store megabytes of user
  data, such as entire user-authored documents or a user's mailbox, on
  the client side for performance reasons.</p>

  <p>Again, cookies do not handle this case well, because they are
  transmitted with every request.</p>

  <p>The <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> IDL
  attribute is used to access a page's local storage area.</p>

  <div class=example>

   <p>The site at example.com can display a count of how many times
   the user has loaded its page by putting the following at the bottom
   of its page:</p>

   <pre>&lt;p&gt;
  You have viewed this page
  &lt;span id="count"&gt;an untold number of&lt;/span&gt;
  time(s).
&lt;/p&gt;
&lt;script&gt;
  if (!localStorage.pageLoadCount)
    localStorage.pageLoadCount = 0;
  localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
  document.getElementById('count').textContent = localStorage.pageLoadCount;
&lt;/script&gt;</pre>

  </div>

  <p>Each site has its own separate storage area.</p>




  <h3 id=storage><span class=secno>11.2 </span>The API</h3>

  <h4 id=the-storage-interface><span class=secno>11.2.1 </span>The <code><a href=#storage-0>Storage</a></code> interface</h4>

  <pre class=idl>interface <dfn id=storage-0>Storage</dfn> {
  readonly attribute unsigned long <a href=#dom-storage-length title=dom-Storage-length>length</a>;
  DOMString? <a href=#dom-storage-key title=dom-Storage-key>key</a>(unsigned long index);
  getter DOMString? <a href=#dom-storage-getitem title=dom-Storage-getItem>getItem</a>(DOMString key);
  setter creator void <a href=#dom-storage-setitem title=dom-Storage-setItem>setItem</a>(DOMString key, DOMString value);
  deleter void <a href=#dom-storage-removeitem title=dom-Storage-removeItem>removeItem</a>(DOMString key);
  void <a href=#dom-storage-clear title=dom-Storage-clear>clear</a>();
};</pre>

  <!-- v2 ideas:
    a getInfo() method that returns an object that tells you:
       - when the key was added
       - when the key was last modified
       - which page was the last to modify the key
    [-Mihai Sucan]

    support non-string values
  -->

  <p>Each <code><a href=#storage-0>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><a href=#storage-0>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 title=dom-sessionStorage><a href=#dom-sessionstorage>sessionStorage</a></code>
  and <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attributes. Multiple separate objects
  implementing the <code><a href=#storage-0>Storage</a></code> interface can all be associated with the same list of
  key/value pairs simultaneously.</p>

  <p>The <dfn id=dom-storage-length title=dom-Storage-length><code>length</code></dfn> attribute must return the number
  of key/value pairs currently present in the list associated with the object.</p>

  <p>The <dfn id=dom-storage-key title=dom-Storage-key><code>key(<var title="">n</var>)</code></dfn> method must
  return the name of the <var title="">n</var>th key in the list. The order of keys is user-agent
  defined, but must be consistent within an object so long as the number of keys doesn't change.
  (Thus, <a href=#dom-storage-setitem title=dom-Storage-setItem>adding</a> or <a href=#dom-storage-removeitem title=dom-Storage-removeItem>removing</a> a key may change the order of the keys, but merely
  changing the value of an existing key must not.) <!--The order of keys may differ between
  instances of the <code>Storage</code> interface accessing the same list. [removed for now for
  clarity, but if people ask, put it back. this is part of the spec.]--> If <var title="">n</var> is
  <!--less than zero or [can't, unsigned]--> greater than or equal to the number of key/value pairs
  in the object, then this method must return null.</p>

  <p>The <a href=#supported-property-names>supported property names</a> on a <code><a href=#storage-0>Storage</a></code> object are the keys of each
  key/value pair currently present in the list associated with the object, in the order that the
  keys were last added to the storage area.</p>

  <p>The <dfn id=dom-storage-getitem title=dom-Storage-getItem><code>getItem(<var title="">key</var>)</code></dfn> method
  must return the current value associated with the given <var title="">key</var>. If the given <var title="">key</var> does not exist in the list associated with the object then this method must
  return null. </p>

  <p>The <dfn id=dom-storage-setitem title=dom-Storage-setItem><code>setItem(<var title="">key</var>, <var title="">value</var>)</code></dfn> method must first check if a key/value pair with the given <var title="">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 title="">key</var> and with its value set to <var title="">value</var>.</p>

  <p>If the given <var title="">key</var> <em>does</em> exist in the list, and its value is not
  equal to <var title="">value</var>, then it must have its value updated to <var title="">value</var>. If its previous value <em>is</em> equal to <var title="">value</var>, then
  the method must do nothing.</p>

  <p>If it couldn't set the new value, the method must throw a <code><a href=#quotaexceedederror>QuotaExceededError</a></code>
  exception. (Setting could fail if, e.g., the user has disabled storage for the site, or if the
  quota has been exceeded.)</p>

  <p>The <dfn id=dom-storage-removeitem title=dom-Storage-removeItem><code>removeItem(<var title="">key</var>)</code></dfn>
  method must cause the key/value pair with the given <var title="">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 title=dom-Storage-setItem><a href=#dom-storage-setitem>setItem()</a></code> and <code title=dom-Storage-removeItem><a href=#dom-storage-removeitem>removeItem()</a></code> methods must be atomic with respect to failure.
  In the case of failure, the method does nothing. That is, changes to the data storage area must
  either be successful, or the data storage area must not be changed at all.</p>

  <p>The <dfn id=dom-storage-clear title=dom-Storage-clear><code>clear()</code></dfn> method must atomically cause the
  list associated with the object to be emptied of all key/value pairs, if there are any. If there
  are none, then the method must do nothing.</p>

  <p class=note>When the <code title=dom-Storage-setItem><a href=#dom-storage-setitem>setItem()</a></code>, <code title=dom-Storage-removeItem><a href=#dom-storage-removeitem>removeItem()</a></code>, and <code title=dom-Storage-clear><a href=#dom-storage-clear>clear()</a></code> methods are invoked, events are fired on the
  <code><a href=#window>Window</a></code> objects of other <code><a href=#document>Document</a></code>s that can access the newly stored or
  removed data, as defined in the sections on the <code title=dom-sessionStorage><a href=#dom-sessionstorage>sessionStorage</a></code> and <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attributes.</p> <!-- not normative, see the sections
  below for the normative statement -->

  <p class=note>This specification does not require that the above methods wait until the data has
  been physically written to disk. Only consistency in what different scripts accessing the same
  underlying list of key/value pairs see is required.</p>


  <h4 id=the-sessionstorage-attribute><span class=secno>11.2.2 </span>The <code title=dom-sessionStorage><a href=#dom-sessionstorage>sessionStorage</a></code> attribute</h4>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=windowsessionstorage>WindowSessionStorage</dfn> {
  readonly attribute <a href=#storage-0>Storage</a> <a href=#dom-sessionstorage title=dom-sessionStorage>sessionStorage</a>;
};
<a href=#window>Window</a> implements <a href=#windowsessionstorage>WindowSessionStorage</a>;</pre>

  <p>The <dfn id=dom-sessionstorage title=dom-sessionStorage><code>sessionStorage</code></dfn> attribute represents the
  set of storage areas specific to the current <a href=#top-level-browsing-context>top-level browsing context</a>.</p>

  <p>Each <a href=#top-level-browsing-context>top-level browsing context</a> has a unique set of session storage areas, one for
  each <a href=#origin>origin</a>.</p>

  <p>User agents should not expire data from a browsing context's session storage areas, but may do
  so when the user requests that such data be deleted, or when the UA detects that it has limited
  storage space, or for security reasons. User agents should always avoid deleting data while a
  script that could access that data is running. When a top-level browsing context is destroyed (and
  therefore permanently inaccessible to the user) the data stored in its session storage areas can
  be discarded with it, as the API described in this specification provides no way for that data to
  ever be subsequently retrieved.</p>

  <p class=note>The lifetime of a browsing context can be unrelated to the lifetime of the actual
  user agent process itself, as the user agent may support resuming sessions after a restart.</p>

  <p>When a new <code><a href=#document>Document</a></code> is created in a <a href=#browsing-context>browsing context</a> which has a
  <a href=#top-level-browsing-context>top-level browsing context</a>, the user agent must check to see if that <a href=#top-level-browsing-context>top-level
  browsing context</a> has a session storage area for that document's <a href=#origin>origin</a>. If it
  does, then that is the <code><a href=#document>Document</a></code>'s assigned session storage area. If it does not, a
  new storage area for that document's <a href=#origin>origin</a> must be created, and then <em>that</em>
  is the <code><a href=#document>Document</a></code>'s assigned session storage area. A <code><a href=#document>Document</a></code>'s assigned
  storage area does not change during the lifetime of a <code><a href=#document>Document</a></code>.</p>

  <p class=note>In the case of an <code><a href=#the-iframe-element>iframe</a></code> being moved to another
  <code><a href=#document>Document</a></code>, the nested browsing context is destroyed and a new one created.</p>

  <p>The <code title=dom-sessionStorage><a href=#dom-sessionstorage>sessionStorage</a></code> attribute must return a
  <code><a href=#storage-0>Storage</a></code> object associated with the <code><a href=#document>Document</a></code>'s assigned session storage
  area, if any, or null if there isn't one. Each <code><a href=#document>Document</a></code> object must have a separate
  object for its <code><a href=#window>Window</a></code>'s <code title=dom-sessionStorage><a href=#dom-sessionstorage>sessionStorage</a></code>
  attribute.</p>

  <p>When a new <a href=#top-level-browsing-context>top-level browsing context</a> is created by cloning an existing
  <a href=#browsing-context>browsing context</a>, the new browsing context must start with the same session storage
  areas as the original, but the two sets must from that point on be considered separate, not
  affecting each other in any way.</p>

  <p>When a new <a href=#top-level-browsing-context>top-level browsing context</a> is created by a <a href=#concept-script title=concept-script>script</a> in an existing <a href=#browsing-context>browsing context</a>, or by the user
  following a link in an existing browsing context, or in some other way related to a specific
  <code><a href=#document>Document</a></code>, and the creation is not <a href=#a-new-start-for-session-storage>a new start for session storage</a>, then
  the session storage area of the <a href=#origin>origin</a> of that <code><a href=#document>Document</a></code> must be copied
  into the new browsing context when it is created. From that point on, however, the two session
  storage areas must be considered separate, not affecting each other in any way.</p>

  <p id=sessionStorageEvent>When the <code title=dom-Storage-setItem><a href=#dom-storage-setitem>setItem()</a></code>, <code title=dom-Storage-removeItem><a href=#dom-storage-removeitem>removeItem()</a></code>, and <code title=dom-Storage-clear><a href=#dom-storage-clear>clear()</a></code> methods are called on a <code><a href=#storage-0>Storage</a></code> object <var title="">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><a href=#document>Document</a></code> object whose
  <code><a href=#window>Window</a></code> object's <code title=dom-sessionStorage><a href=#dom-sessionstorage>sessionStorage</a></code> attribute's
  <code><a href=#storage-0>Storage</a></code> object is associated with the same storage area, other than <var title="">x</var>, <a href=#send-a-storage-notification>send a storage notification</a>.</p>


  <h4 id=the-localstorage-attribute><span class=secno>11.2.3 </span>The <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attribute</h4>

  <pre class=idl>[NoInterfaceObject]
interface <dfn id=windowlocalstorage>WindowLocalStorage</dfn> {
  readonly attribute <a href=#storage-0>Storage</a> <a href=#dom-localstorage title=dom-localStorage>localStorage</a>;
};
<a href=#window>Window</a> implements <a href=#windowlocalstorage>WindowLocalStorage</a>;</pre>

  <p>The <dfn id=dom-localstorage title=dom-localStorage><code>localStorage</code></dfn> object provides a
  <code><a href=#storage-0>Storage</a></code> object for an <a href=#origin>origin</a>.
  <a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
  </p>

  <p>User agents must have a set of local storage areas, one for each <a href=#origin>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 title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attribute is accessed, the user
  agent must run the following steps, which are known as the <dfn id=storage-object-initialization-steps><code>Storage</code> object
  initialization steps</dfn>:</p> <!-- these steps are named because marcos uses them from another
  spec -->

  <ol><li><p>The user agent may throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps
   instead of returning a <code><a href=#storage-0>Storage</a></code> object if the request violates a policy decision
   (e.g. if the user agent is configured to not allow the page to persist data).</li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a> is not a scheme/host/port tuple, then
   throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>

   <li><p>Check to see if the user agent has allocated a local storage area for the
   <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which the
   attribute was accessed. If it has not, create a new storage area for that
   <a href=#origin>origin</a>.</li>

   <li><p>Return the <code><a href=#storage-0>Storage</a></code> object associated with that origin's local storage area.
   Each <code><a href=#document>Document</a></code> object must have a separate object for its <code><a href=#window>Window</a></code>'s <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attribute.</p>

  </ol><p id=localStorageEvent>When the <code title=dom-Storage-setItem><a href=#dom-storage-setitem>setItem()</a></code>, <code title=dom-Storage-removeItem><a href=#dom-storage-removeitem>removeItem()</a></code>, and <code title=dom-Storage-clear><a href=#dom-storage-clear>clear()</a></code> methods are called on a <code><a href=#storage-0>Storage</a></code> object <var title="">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><a href=#document>Document</a></code> object whose
  <code><a href=#window>Window</a></code> object's <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attribute's
  <code><a href=#storage-0>Storage</a></code> object is associated with the same storage area, other than <var title="">x</var>, <a href=#send-a-storage-notification>send a storage notification</a>.

  <p id=localStorageMutex>Whenever the properties of a <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code> attribute's <code><a href=#storage-0>Storage</a></code> object are to be
  examined, returned, set, or deleted, whether as part of a direct property access, when checking
  for the presence of a property, during property enumeration, when determining the number of
  properties present, or as part of the execution of any of the methods or attributes defined on the
  <code><a href=#storage-0>Storage</a></code> interface, the user agent must first <a href=#obtain-the-storage-mutex>obtain the storage
  mutex</a>.</p>


  <h4 id=the-storage-event><span class=secno>11.2.4 </span>The <code title=event-storage><a href=#event-storage>storage</a></code> event</h4>

  <p>The <dfn id=event-storage title=event-storage><code>storage</code></dfn> event is fired on a
  <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object when a storage area changes, as described in
  the previous two sections (<a href=#sessionStorageEvent>for session storage</a>, <a href=#localStorageEvent>for local storage</a>).</p>

  <p>When a user agent is to <dfn id=send-a-storage-notification>send a storage notification</dfn> for a <code><a href=#document>Document</a></code>, the
  user agent must <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code><a href=#storage-0>storage</a></code>, which does
  not bubble and is not cancelable, and which uses the <code><a href=#storageevent>StorageEvent</a></code> interface, at the
  <code><a href=#document>Document</a></code> object's <code><a href=#window>Window</a></code> object.</p>

  <p class=note>Such a <code><a href=#document>Document</a></code> object is not necessarily <a href=#fully-active>fully active</a>,
  but events fired on such objects are ignored by the <a href=#event-loop>event loop</a> until the
  <code><a href=#document>Document</a></code> becomes <a href=#fully-active>fully active</a> again.</p>

  <p>The <a href=#task-source>task source</a> for these tasks is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>

  <p>If the event is being fired due to an invocation of the <code title=dom-Storage-setItem><a href=#dom-storage-setitem>setItem()</a></code> or <code title=dom-Storage-removeItem><a href=#dom-storage-removeitem>removeItem()</a></code> methods, the event must have its <code title=dom-StorageEvent-key><a href=#dom-storageevent-key>key</a></code> attribute initialized to the name of the key in question,
  its <code title=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 title=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 title=dom-Storage-clear><a href=#dom-storage-clear>clear()</a></code> method, the event must have its <code title=dom-StorageEvent-key><a href=#dom-storageevent-key>key</a></code>, <code title=dom-StorageEvent-oldValue><a href=#dom-storageevent-oldvalue>oldValue</a></code>,
  and <code title=dom-StorageEvent-newValue><a href=#dom-storageevent-newvalue>newValue</a></code> attributes initialized to null.</p>

  <p>In addition, the event must have its <code title=dom-StorageEvent-url><a href=#dom-storageevent-url>url</a></code> attribute
  initialized to <a href="#the-document's-address" title="the document's address">the address of the document</a> whose
  <code><a href=#storage-0>Storage</a></code> object was affected; and its <code title=dom-StorageEvent-storageArea><a href=#dom-storageevent-storagearea>storageArea</a></code> attribute initialized to the
  <code><a href=#storage-0>Storage</a></code> object from the <code><a href=#window>Window</a></code> object of the target
  <code><a href=#document>Document</a></code> that represents the same kind of <code><a href=#storage-0>Storage</a></code> area as was affected
  (i.e. session or local).</p>


  <h5 id=event-definition-0><span class=secno>11.2.4.1 </span>Event definition</h5>

  <pre class=idl>[Constructor(DOMString type, optional <a href=#storageeventinit>StorageEventInit</a> eventInitDict)]
interface <dfn id=storageevent>StorageEvent</dfn> : <a href=#event>Event</a> {
  readonly attribute DOMString? <a href=#dom-storageevent-key title=dom-StorageEvent-key>key</a>;
  readonly attribute DOMString? <a href=#dom-storageevent-oldvalue title=dom-StorageEvent-oldValue>oldValue</a>;
  readonly attribute DOMString? <a href=#dom-storageevent-newvalue title=dom-StorageEvent-newValue>newValue</a>;
  readonly attribute DOMString <a href=#dom-storageevent-url title=dom-StorageEvent-url>url</a>;
  readonly attribute <a href=#storage-0>Storage</a>? <a href=#dom-storageevent-storagearea title=dom-StorageEvent-storageArea>storageArea</a>;
};

dictionary <dfn id=storageeventinit>StorageEventInit</dfn> : <a href=#eventinit>EventInit</a> {
  DOMString? key;
  DOMString? oldValue;
  DOMString? newValue;
  DOMString url;
  <a href=#storage-0>Storage</a>? storageArea;
};</pre>

  <p>The <dfn id=dom-storageevent-key title=dom-StorageEvent-key><code>key</code></dfn> attribute must return the value it
  was initialized to. When the object is created, this attribute must be initialized to null. It
  represents the key being changed.</p>

  <p>The <dfn id=dom-storageevent-oldvalue title=dom-StorageEvent-oldValue><code>oldValue</code></dfn> attribute must return
  the value it was initialized to. When the object is created, this attribute must be initialized to
  null. It represents the old value of the key being changed.</p>

  <p>The <dfn id=dom-storageevent-newvalue title=dom-StorageEvent-newValue><code>newValue</code></dfn> attribute must return
  the value it was initialized to. When the object is created, this attribute must be initialized to
  null. It represents the new value of the key being changed.</p>

  <p>The <dfn id=dom-storageevent-url title=dom-StorageEvent-url><code>url</code></dfn> attribute must return the value it
  was initialized to. When the object is created, this attribute must be initialized to the empty
  string. It represents the address of the document whose key changed.</p>

  <p>The <dfn id=dom-storageevent-storagearea title=dom-StorageEvent-storageArea><code>storageArea</code></dfn> attribute must
  return the value it was initialized to. When the object is created, this attribute must be
  initialized to null. It represents the <code><a href=#storage-0>Storage</a></code> object that was affected.</p>



  <h4 id=threads><span class=secno>11.2.5 </span>Threads</h4>

  <p>Because of <a href=#localStorageMutex>the use</a> of the <a href=#storage-mutex>storage mutex</a>, multiple
  browsing contexts will be able to access the local storage areas simultaneously in such a manner
  that scripts cannot detect any concurrent script execution.</p>

  <p>Thus, the <code title=dom-Storage-length><a href=#dom-storage-length>length</a></code> attribute of a <code><a href=#storage-0>Storage</a></code>
  object, and the value of the various properties of that object, cannot change while a script is
  executing, other than in a way that is predictable by the script itself.</p>


  <h3 id=disk-space-0><span class=secno>11.3 </span>Disk space</h3>

  <p>User agents should limit the total amount of space allowed for storage areas, because hostile
  authors could otherwise use this feature to exhaust the user's available disk space.</p>

  <p>User agents should guard against sites storing data under their origin's other affiliated
  sites, e.g. storing up to the limit in a1.example.com, a2.example.com, a3.example.com, etc,
  circumventing the main example.com storage limit.</p>

  <p>User agents may prompt the user when quotas are reached, allowing the user to grant a site more
  space. This enables sites to store many user-created documents on the user's computer, for
  instance.</p>

  <p>User agents should allow users to see how much space each domain is using.</p>

  <!--<p>If the storage area space limit is reached during a <code
  title="dom-Storage-setItem">setItem()</code> call, the method will throw an exception.</p>-->

  <p>A mostly arbitrary limit of five megabytes per <a href=#origin>origin</a> is suggested. Implementation
  feedback is welcome and will be used to update this suggestion in the future.</p>


  <h3 id=privacy><span class=secno>11.4 </span>Privacy</h3>

  <h4 id=user-tracking><span class=secno>11.4.1 </span>User tracking</h4>

  <p>A third-party advertiser (or any entity capable of getting content distributed to multiple
  sites) could use a unique identifier stored in its local storage area to track a user across
  multiple sessions, building a profile of the user's interests to allow for highly targeted
  advertising. In conjunction with a site that is aware of the user's real identity (for example an
  e-commerce site that requires authenticated credentials), this could allow oppressive groups to
  target individuals with greater accuracy than in a world with purely anonymous Web usage.</p>

  <p>There are a number of techniques that can be used to mitigate the risk of user tracking:</p>

  <dl><dt>Blocking third-party storage</dt>
   <dd>

    <p>User agents may restrict access to the <code title=dom-localStorage><a href=#dom-localstorage>localStorage</a></code>
    objects to scripts originating at the domain of the top-level document of the <a href=#browsing-context>browsing
    context</a>, for instance denying access to the API for pages from other domains running in
    <code><a href=#the-iframe-element>iframe</a></code>s.</p>

   </dd>

   <dt>Expiring stored data</dt>
   <dd>

    <p>User agents may, possibly in a manner configured by the user, automatically delete stored
    data after a period of time.</p>

    <p>For example, a user agent could be configured to treat third-party local storage areas as
    session-only storage, deleting the data once the user had closed all the <a href=#browsing-context title="browsing
    context">browsing contexts</a> that could access it.</p>

    <p>This can restrict the ability of a site to track a user, as the site would then only be able
    to track the user across multiple sessions when he authenticates with the site itself (e.g. by
    making a purchase or logging in to a service).</p>

    <p>However, this also reduces the usefulness of the API as a long-term storage mechanism. It can
    also put the user's data at risk, if the user does not fully understand the implications of data
    expiration.</p>

    <!--v2 consider adding an explicit way for sites to state when data should expire, as in
    localStorage.expireData(365); -->

   </dd>

   <dt>Treating persistent storage as cookies</dt>
   <dd>

    <p>If users attempt to protect their privacy by clearing cookies without also clearing data
    stored in the local storage area, sites can defeat those attempts by using the two features as
    redundant backup for each other. User agents should present the interfaces for clearing these in
    a way that helps users to understand this possibility and enables them to delete data in all
    persistent storage features simultaneously. <a href=#refsCOOKIES>[COOKIES]</a></p>

   </dd>

   <dt>Site-specific white-listing of access to local storage areas</dt> <dd>

    <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>

   </dd>

   <dt>Origin-tracking of stored data</dt>
   <dd>

    <p>User agents may record the <a href=#origin title=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 blacklist ("delete this data and prevent this domain from ever storing
    data again"), the user can restrict the use of persistent storage to sites that he trusts.</p>

   </dd>

   <dt>Shared blacklists</dt>
   <dd>

    <p>User agents may allow users to share their persistent storage domain blacklists.</p>

    <p>This would allow communities to act together to protect their privacy.</p>

   </dd>

  </dl><p>While these suggestions prevent trivial use of this API for user tracking, they do not block it
  altogether. Within a single domain, a site can continue to track the user during a session, and
  can then pass all this information to the third party along with any identifying information
  (names, credit card numbers, addresses) obtained by the site. If a third party cooperates with
  multiple sites to obtain such information, a profile can still be created.</p>

  <p>However, user tracking is to some extent possible even with no cooperation from the user agent
  whatsoever, for instance by using session identifiers in URLs, a technique already commonly used
  for innocuous purposes but easily repurposed for user tracking (even retroactively). This
  information can then be shared with other sites, using visitors' IP addresses and other
  user-specific data (e.g. user-agent headers and configuration settings) to combine separate
  sessions into coherent user profiles.</p>


  <h4 id=sensitivity-of-data><span class=secno>11.4.2 </span>Sensitivity of data</h4>

  <p>User agents should treat persistently stored data as potentially sensitive; it's quite possible
  for e-mails, calendar appointments, health records, or other confidential documents to be stored
  in this mechanism.</p>

  <p>To this end, user agents should ensure that when deleting data, it is promptly deleted from the
  underlying storage.</p>


<!--ADD-TOPIC:Security-->
  <h3 id=security-storage><span class=secno>11.5 </span>Security</h3>

  <h4 id=dns-spoofing-attacks><span class=secno>11.5.1 </span>DNS spoofing attacks</h4>

  <p>Because of the potential for DNS spoofing attacks, one cannot guarantee that a host claiming to
  be in a certain domain really is from that domain. To mitigate this, pages can use TLS. Pages
  using TLS can be sure that only the user, software working on behalf of the user, and other pages
  using TLS that have certificates identifying them as being from the same domain, can access their
  storage areas.</p>


  <h4 id=cross-directory-attacks><span class=secno>11.5.2 </span>Cross-directory attacks</h4>

  <p>Different authors sharing one host name, for example users hosting content on
  <code>geocities.com</code>, all share one local storage object. There is no feature to restrict
  the access by pathname. Authors on shared hosts are therefore urged to avoid using these features,
  as it would be trivial for other authors to read the data and overwrite it.</p>

  <p class=note>Even if a path-restriction feature was made available, the usual DOM scripting
  security model would make it trivial to bypass this protection and access the data from any
  path.</p>


  <h4 id=implementation-risks><span class=secno>11.5.3 </span>Implementation risks</h4>

  <p>The two primary risks when implementing these persistent storage features are letting hostile
  sites read information from other domains, and letting hostile sites write information that is
  then read from other domains.</p>

  <p>Letting third-party sites read data that is not supposed to be read from their domain causes
  <em>information leakage</em>, For example, a user's shopping wishlist on one domain could be used
  by another domain for targeted advertising; or a user's work-in-progress confidential documents
  stored by a word-processing site could be examined by the site of a competing company.</p>

  <p>Letting third-party sites write data to the persistent storage of other domains can result in
  <em>information spoofing</em>, which is equally dangerous. For example, a hostile site could add
  items to a user's wishlist; or a hostile site could set a user's session identifier to a known ID
  that the hostile site can then use to track the user's actions on the victim site.</p>

  <p>Thus, strictly following the <a href=#origin>origin</a> model described in this specification is
  important for user security.</p>
<!--REMOVE-TOPIC:Security-->





<!--TOPIC:HTML Syntax and Parsing-->

  <h2 id=syntax><span class=secno>12 </span><dfn>The HTML syntax</dfn></h2>

  <p class=note>This section only describes the rules for resources labeled with an <a href=#html-mime-type>HTML
  MIME type</a>. Rules for XML resources are discussed in the section below entitled "<a href=#the-xhtml-syntax>The
  XHTML syntax</a>".</p>


  <h3 id=writing><span class=secno>12.1 </span>Writing HTML documents</h3>

  <div class=impl>

  <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>

  </div>

  <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>

   <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and <a href=#space-character title="space
   character">space characters</a>.</li>

   <li>A <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>.

   <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and <a href=#space-character title="space
   character">space characters</a>.</li>

   <li>The root element, in the form of an <code><a href=#the-html-element>html</a></code> <a href=#syntax-elements title=syntax-elements>element</a>.</li>

   <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and <a href=#space-character title="space
   character">space characters</a>.</li>

  </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 title="character encoding
  declaration">character encoding declarations</a> are to be serialized, as discussed in the
  section on that topic.</p>

  <div class=note>

   <p>Space characters before the root <code><a href=#the-html-element>html</a></code> element, and space characters at the start
   of the <code><a href=#the-html-element>html</a></code> element and before the <code><a href=#the-head-element>head</a></code> element, will be dropped when
   the document is parsed; space characters <em>after</em> the root <code><a href=#the-html-element>html</a></code> element will
   be parsed as if they were at the end of the <code><a href=#the-body-element>body</a></code> element. Thus, space characters
   around the root element do not round-trip.</p>

   <p>It is suggested that newlines be inserted after the DOCTYPE, after any comments that are
   before the root element, after the <code><a href=#the-html-element>html</a></code> element's start tag (if it is not <a href=#syntax-tag-omission title=syntax-tag-omission>omitted</a>), and after any comments that are inside the
   <code><a href=#the-html-element>html</a></code> element but before the <code><a href=#the-head-element>head</a></code> element.</p>

  </div>

  <p>Many strings in the HTML syntax (e.g. the names of elements and their attributes) are
  case-insensitive, but only for <a href=#uppercase-ascii-letters>uppercase ASCII letters</a> and <a href=#lowercase-ascii-letters>lowercase ASCII
  letters</a>. For convenience, in this section this is just referred to as
  "case-insensitive".</p>


  <h4 id=the-doctype><span class=secno>12.1.1 </span>The DOCTYPE</h4>

  <p>A <dfn id=syntax-doctype title=syntax-doctype>DOCTYPE</dfn> is a <!-- mostly useless but nonetheless -->
  required preamble.</p>

  <p class=note>DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a
  different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a
  document ensures that the browser makes a best-effort attempt at following the relevant
  specifications.</p>

  <p>A DOCTYPE must consist of the following components, in this order:</p>

  <ol class=brief><li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">&lt;!DOCTYPE</code>".</li>
   <li>One or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">html</code>".</li>
   <li>Optionally, a <a href=#doctype-legacy-string>DOCTYPE legacy string</a> or an <a href=#obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a> (defined below).</li>
   <li>Zero or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>A U+003E GREATER-THAN SIGN character (&gt;).</li>
  </ol><p class=note>In other words, <code>&lt;!DOCTYPE html&gt;</code>, case-insensitively.</p>

  <hr><p>For the purposes of HTML generators that cannot output HTML
  markup with the short DOCTYPE "<code title="">&lt;!DOCTYPE
  html&gt;</code>", a <dfn id=doctype-legacy-string>DOCTYPE legacy string</dfn> may be inserted
  into the DOCTYPE (in the position defined above). This string must
  consist of:</p>

  <ol class=brief><li>One or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">SYSTEM</code>".</li>
   <li>One or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>quote mark</i>).</li>
   <li>The literal string "<code><a href=#about:legacy-compat>about:legacy-compat</a></code>".</li>
   <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>).</li>
  </ol><p class=note>In other words, <code>&lt;!DOCTYPE html SYSTEM
  "about:legacy-compat"&gt;</code> or <code>&lt;!DOCTYPE html SYSTEM
  'about:legacy-compat'&gt;</code>, case-insensitively except for the
  part in single or double quotes.</p>

  <p>The <a href=#doctype-legacy-string>DOCTYPE legacy string</a> should not be used unless
  the document is generated from a system that cannot output the
  shorter string.</p>

  <hr><!-- see the parser section before changing this bit --><p>To help authors transition from HTML4 and XHTML1, an
  <dfn id=obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</dfn> can be inserted into
  the DOCTYPE (in the position defined above). This string must
  consist of:</p>

  <ol class=brief><li>One or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>A string that is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">PUBLIC</code>".</li>
   <li>One or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>first quote mark</i>).</li>
   <li>The string from one of the cells in the first column of the table below. The row to which this cell belongs is the <i>selected row</i>.</li>
   <li>A matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>first quote mark</i>).</li>
   <li>If the cell in the second column of the <i>selected row</i> is not blank, one or more <a href=#space-character title="space character">space characters</a>.</li>
   <li>If the cell in the second column of the <i>selected row</i> is not blank, a U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>third quote mark</i>).</li>
   <li>If the cell in the second column of the <i>selected row</i> is not blank, the string from the cell in the second column of the <i>selected row</i>.</li>
   <li>If the cell in the second column of the <i>selected row</i> is not blank, a matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>third quote mark</i>).</li>
  </ol><table><caption>
    Allowed values for public and system identifiers in an <a href=#obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a>.
   </caption>
   <thead><tr><th> Public identifier
     <th> System identifier
   <tbody><tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.0//EN</code>
     <td>
    <tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.0//EN</code>
     <td> <code title="">http://www.w3.org/TR/REC-html40/strict.dtd</code>
    <tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN</code>
     <td>
    <tr><td> <code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN</code>
     <td> <code title="">http://www.w3.org/TR/html4/strict.dtd</code>
    <tr><td> <code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN</code>
     <td> <code title="">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>
    <tr><td> <code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1//EN</code>
     <td> <code title="">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>
  </table><p>A <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a> containing an
  <a href=#obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a> is an <dfn id=obsolete-permitted-doctype>obsolete
  permitted DOCTYPE</dfn>. Authors should not use <a href=#obsolete-permitted-doctype title="obsolete permitted DOCTYPE">obsolete permitted
  DOCTYPEs</a>, as they are unnecessarily long.</p>




  <h4 id=elements-0><span class=secno>12.1.2 </span>Elements</h4>

  <p>There are five different kinds of <dfn id=syntax-elements title=syntax-elements>elements</dfn>: <a href=#void-elements>void elements</a>,
  <a href=#raw-text-elements>raw text elements</a>, <a href=#escapable-raw-text-elements>escapable raw text elements</a>,
  <a href=#foreign-elements>foreign elements</a>, and <a href=#normal-elements>normal elements</a>.</p>

  <dl><dt><dfn id=void-elements>Void elements</dfn></dt>

   <dd><code><a href=#the-area-element>area</a></code>, <code><a href=#the-base-element>base</a></code>, <code><a href=#the-br-element>br</a></code>, <code><a href=#the-col-element>col</a></code>, <code><a href=#the-embed-element>embed</a></code>,
   <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-keygen-element>keygen</a></code>, <code><a href=#the-link-element>link</a></code>,
   <code><a href=#the-menuitem-element>menuitem</a></code>, <code><a href=#the-meta-element>meta</a></code>, <code><a href=#the-param-element>param</a></code>, <code><a href=#the-source-element>source</a></code>,
   <code><a href=#the-track-element>track</a></code>, <code><a href=#the-wbr-element>wbr</a></code></dd>
   <!-- see also other places that say VOIDLIST -->

   <dt><dfn id=raw-text-elements>Raw text elements</dfn></dt>

   <dd><code><a href=#the-script-element>script</a></code>, <code><a href=#the-style-element>style</a></code></dd> <!-- iframe and
   noscript don't count as raw text for syntax purposes -->

   <dt><dfn id=escapable-raw-text-elements>escapable raw text elements</dfn></dt>

   <dd><code><a href=#the-textarea-element>textarea</a></code>, <code><a href=#the-title-element>title</a></code></dd>

   <dt><dfn id=foreign-elements>Foreign elements</dfn></dt>

   <dd>Elements from the <a href=#mathml-namespace>MathML namespace</a>
   and the <a href=#svg-namespace>SVG namespace</a>.</dd>

   <dt><dfn id=normal-elements>Normal elements</dfn></dt>

   <dd>All other allowed <a href=#html-elements>HTML elements</a> are normal
   elements.</dd>

  </dl><p><dfn id=syntax-tags title=syntax-tags>Tags</dfn> are used to delimit the start and end of elements in the
  markup. <a href=#raw-text-elements title="raw text elements">Raw text</a>, <a href=#escapable-raw-text-elements title="escapable raw text
  elements">escapable raw text</a>, and <a href=#normal-elements title="normal elements">normal</a> elements have
  a <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> to indicate where they begin, and an <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> to indicate where they end. The start and end tags of
  certain <a href=#normal-elements>normal elements</a> can be <a href=#syntax-tag-omission title=syntax-tag-omission>omitted</a>, as
  described below in the section on <a href=#syntax-tag-omission title=syntax-tag-omission>optional tags</a>. Those
  that cannot be omitted must not be omitted. <a href=#void-elements>Void elements</a> only have a start tag; end
  tags must not be specified for <a href=#void-elements>void elements</a>. <a href=#foreign-elements>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 title=concept-html-contents>contents</a> of the element must be placed between
  just after the start tag (which <a href=#syntax-tag-omission title=syntax-tag-omission>might be implied, in certain
  cases</a>) and just before the end tag (which again, <a href=#syntax-tag-omission title=syntax-tag-omission>might be
  implied in certain cases</a>). The exact allowed contents of each individual element depend on
  the <a href=#content-models title="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>Void elements</a> can't have any contents (since there's no end tag, no content can be
  put between the start tag and the end tag).</p>

  <p><a href=#raw-text-elements>Raw text elements</a> can have <a href=#syntax-text title=syntax-text>text</a>, though it has <a href=#cdata-rcdata-restrictions>restrictions</a> described below.</p>

  <p><a href=#escapable-raw-text-elements>Escapable raw text elements</a> can have <a href=#syntax-text title=syntax-text>text</a> and
  <a href=#syntax-charref title=syntax-charref>character references</a>, but the text must not contain an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>. There are also <a href=#cdata-rcdata-restrictions>further restrictions</a> described below.</p>

  <p><a href=#foreign-elements>Foreign elements</a> whose start tag is marked as self-closing can't have any contents
  (since, again, as there's no end tag, no content can be put between the start tag and the end
  tag). <a href=#foreign-elements>Foreign elements</a> whose start tag is <em>not</em> marked as self-closing can
  have <a href=#syntax-text title=syntax-text>text</a>, <a href=#syntax-charref title=syntax-charref>character
  references</a>, <a href=#syntax-cdata title=syntax-cdata>CDATA sections</a>, other <a href=#syntax-elements title=syntax-elements>elements</a>, and <a href=#syntax-comments title=syntax-comments>comments</a>, but
  the text must not contain the character U+003C LESS-THAN SIGN (&lt;) or an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>.</p>

  <div class=note>

   <p>The HTML syntax does not support namespace declarations, even in <a href=#foreign-elements>foreign
   elements</a>.</p>

   <p>For instance, consider the following HTML fragment:</p>

   <pre>&lt;p&gt;
 &lt;svg&gt;
  &lt;metadata&gt;
   &lt;!-- this is invalid --&gt;
   &lt;cdr:license xmlns:cdr="http://www.example.com/cdr/metadata" name="MIT"/&gt;
  &lt;/metadata&gt;
 &lt;/svg&gt;
&lt;/p&gt;</pre>

   <p>The innermost element, <code title="">cdr:license</code>, is actually in the SVG namespace, as
   the "<code title="">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 title="">cdr:license</code>" in the
   SVG namespace.</p>

  </div>

  <p><a href=#normal-elements>Normal elements</a> can have <a href=#syntax-text title=syntax-text>text</a>, <a href=#syntax-charref title=syntax-charref>character references</a>, other <a href=#syntax-elements title=syntax-elements>elements</a>, and <a href=#syntax-comments title=syntax-comments>comments</a>, but
  the text must not contain the character U+003C LESS-THAN SIGN (&lt;) or an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>. Some <a href=#normal-elements>normal elements</a>
  also have <a href=#element-restrictions>yet more restrictions</a> on what content they are
  allowed to hold, beyond the restrictions imposed by the content model and those described in this
  paragraph. Those restrictions are described below.</p>

  <p>Tags contain a <dfn id=syntax-tag-name title=syntax-tag-name>tag name</dfn>, giving the element's name. HTML
  elements all have names that only use <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>. In the HTML
  syntax, tag names, even those for <a href=#foreign-elements>foreign elements</a>, may be written with any mix of
  lower- and uppercase letters that, when converted to all-lowercase, matches the element's tag
  name; tag names are case-insensitive.</p>


  <h5 id=start-tags><span class=secno>12.1.2.1 </span>Start tags</h5>

  <p><dfn id=syntax-start-tag title=syntax-start-tag>Start tags</dfn> must have the following format:</p>

  <ol><li>The first character of a start tag must be a U+003C LESS-THAN SIGN character (&lt;).</li>

   <li>The next few characters of a start tag must be the element's <a href=#syntax-tag-name title=syntax-tag-name>tag name</a>.</li>

   <li>If there are to be any attributes in the next step, there must first be one or more <a href=#space-character title="space character">space characters</a>.</li>

   <li>Then, the start tag may have a number of attributes, the <a href=#syntax-attributes title=syntax-attributes>syntax for which</a> is described below. Attributes must be
   separated from each other by one or more <a href=#space-character title="space character">space
   characters</a>.</li>

   <li>After the attributes, or after the <a href=#syntax-tag-name title=syntax-tag-name>tag name</a> if there are
   no attributes, there may be one or more <a href=#space-character title="space character">space characters</a>.
   (Some attributes are required to be followed by a space. See the <a href=#syntax-attributes title=syntax-attributes>attributes section</a> below.)</li>

   <li>Then, if the element is one of the <a href=#void-elements>void elements</a>, or if the element is a <a href=#foreign-elements title="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>void elements</a>, but on <a href=#foreign-elements>foreign
   elements</a> it marks the start tag as self-closing.</li>

   <li>Finally, start tags must be closed by a U+003E GREATER-THAN SIGN character (&gt;).</li>

  </ol><h5 id=end-tags><span class=secno>12.1.2.2 </span>End tags</h5>

  <p><dfn id=syntax-end-tag title=syntax-end-tag>End tags</dfn> must have the following format:</p>

  <ol><li>The first character of an end tag must be a U+003C LESS-THAN SIGN character (&lt;).</li>

   <li>The second character of an end tag must be a U+002F SOLIDUS character (/).</li>

   <li>The next few characters of an end tag must be the element's <a href=#syntax-tag-name title=syntax-tag-name>tag
   name</a>.</li>

   <li>After the tag name, there may be one or more <a href=#space-character title="space character">space
   characters</a>.</li>

   <li>Finally, end tags must be closed by a U+003E GREATER-THAN SIGN character (&gt;).</li>

  </ol><h5 id=attributes-0><span class=secno>12.1.2.3 </span>Attributes</h5>

  <p><dfn id=syntax-attributes title=syntax-attributes>Attributes</dfn> for an element are expressed inside the
  element's start tag.</p>

  <p>Attributes have a name and a value. <dfn id=syntax-attribute-name title=syntax-attribute-name>Attribute names</dfn>
  must consist of one or more characters other than the <a href=#space-character title="space character">space
  characters</a>, U+0000 NULL, U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+003E
  GREATER-THAN SIGN (&gt;), U+002F SOLIDUS (/), and U+003D EQUALS SIGN (=) characters, the control
  characters, and any characters that are not defined by Unicode. In the HTML syntax, attribute
  names, even those for <a href=#foreign-elements>foreign elements</a>, may be written with any mix of lower- and
  uppercase letters that are an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the attribute's
  name.</p>

  <p><dfn id=syntax-attribute-value title=syntax-attribute-value>Attribute values</dfn> are a mixture of <a href=#syntax-text title=syntax-text>text</a> and <a href=#syntax-charref title=syntax-charref>character references</a>,
  except with the additional restriction that the text cannot contain an <a href=#syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</a>.</p>

  <p>Attributes can be specified in four different ways:</p>

  <dl><dt>Empty attribute syntax</dt>

   <dd>

    <p>Just the <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>. The value is implicitly
    the empty string.</p>

    <div class=example>

     <p>In the following example, the <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is
     given with the empty attribute syntax:</p>

     <pre>&lt;input <em>disabled</em>&gt;</pre>

    </div>

    <p>If an attribute using the empty attribute syntax is to be followed by another attribute, then
    there must be a <a href=#space-character>space character</a> separating the two.</p>

   </dd>

   <dt id=unquoted>Unquoted attribute value syntax</dt>

   <dd>

    <p>The <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>, followed by zero or more <a href=#space-character title="space character">space characters</a>, followed by a single U+003D EQUALS SIGN
    character, followed by zero or more <a href=#space-character title="space character">space characters</a>,
    followed by the <a href=#syntax-attribute-value title=syntax-attribute-value>attribute value</a>, which, in addition
    to the requirements given above for attribute values, must not contain any literal <a href=#space-character title="space character">space characters</a>, any U+0022 QUOTATION MARK characters ("),
    U+0027 APOSTROPHE characters ('), U+003D EQUALS SIGN characters (=), U+003C LESS-THAN SIGN
    characters (&lt;), U+003E GREATER-THAN SIGN characters (&gt;), or U+0060 GRAVE ACCENT characters
    (`), and must not be the empty string.</p>

    <!-- The ` character is in this list on a temporary basis, waiting for IE to fix its parsing bug
         whereby it treats ` as an attribute value delimiter. Otherwise, escaping software that
         tries to be clever and not use quotes when it doesn't need to could be tricked by an
         attacker.

         Posit a site that allows the user to input text that is used verbatim in two attributes,
         such that the user can set the first attribute's value to:

            `

         ...and the second to:

            ` onload='...payload...' end=x

         ...with the assumption that the site is going to not quote the first one, and quote the
         second one with double quotes:

            <body title=` class="` onload='...payload...' end=x">

         In IE, this is treated as:

            <body title=' class="'
                  onload='...payload...'
                  end='x"'>

    -->


    <div class=example>

     <p>In the following example, the <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute is given
     with the unquoted attribute value syntax:</p>

     <pre>&lt;input <em>value=yes</em>&gt;</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 title=syntax-start-tag>start tag</a> syntax above, then there must be a <a href=#space-character>space
    character</a> separating the two.</p>

   </dd>

   <dt>Single-quoted attribute value syntax</dt>

   <dd>

    <p>The <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>, followed by zero or more <a href=#space-character title="space character">space characters</a>, followed by a single U+003D EQUALS SIGN
    character, followed by zero or more <a href=#space-character title="space character">space characters</a>,
    followed by a single U+0027 APOSTROPHE character ('), followed by the <a href=#syntax-attribute-value title=syntax-attribute-value>attribute value</a>, which, in addition to the requirements
    given above for attribute values, must not contain any literal U+0027 APOSTROPHE characters ('),
    and finally followed by a second single U+0027 APOSTROPHE character (').</p>

    <div class=example>

     <p>In the following example, the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is given
     with the single-quoted attribute value syntax:</p>

     <pre>&lt;input <em>type='checkbox'</em>&gt;</pre>

    </div>

    <p>If an attribute using the single-quoted attribute syntax is to be followed by another
    attribute, then there must be a <a href=#space-character>space character</a> separating the two.</p>

   </dd>

   <dt>Double-quoted attribute value syntax</dt>

   <dd>

    <p>The <a href=#syntax-attribute-name title=syntax-attribute-name>attribute name</a>, followed by zero or more <a href=#space-character title="space character">space characters</a>, followed by a single U+003D EQUALS SIGN
    character, followed by zero or more <a href=#space-character title="space character">space characters</a>,
    followed by a single U+0022 QUOTATION MARK character ("), followed by the <a href=#syntax-attribute-value title=syntax-attribute-value>attribute value</a>, which, in addition to the requirements
    given above for attribute values, must not contain any literal U+0022 QUOTATION MARK characters
    ("), and finally followed by a second single U+0022 QUOTATION MARK character (").</p>

    <div class=example>

     <p>In the following example, the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is given with
     the double-quoted attribute value syntax:</p>

     <pre>&lt;input <em>name="be evil"</em>&gt;</pre>

    </div>

    <p>If an attribute using the double-quoted attribute syntax is to be followed by another
    attribute, then there must be a <a href=#space-character>space character</a> separating the two.</p>

   </dd>

  </dl><p>There must never be two or more attributes on the same start tag whose names are an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> match for each other.</p>

  <hr><p>When a <a href=#foreign-elements title="foreign elements">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 title="">actuate</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:actuate</code>
    <tr><td> <code title="">arcrole</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:arcrole</code>
    <tr><td> <code title="">href</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:href</code>
    <tr><td> <code title="">role</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:role</code>
    <tr><td> <code title="">show</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:show</code>
    <tr><td> <code title="">title</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:title</code>
    <tr><td> <code title="">type</code> <td> <a href=#xlink-namespace>XLink namespace</a> <td> <code title="">xlink:type</code>
    <tr><td> <code title="">base</code> <td> <a href=#xml-namespace>XML namespace</a> <!-- attr-xml-base --> <td> <code title="">xml:base</code>
    <tr><td> <code title="">lang</code> <td> <a href=#xml-namespace>XML namespace</a> <td> <code title="">xml:lang</code>
    <tr><td> <code title="">space</code> <td> <a href=#xml-namespace>XML namespace</a> <td> <code title="">xml:space</code>
    <tr><td> <code title="">xmlns</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a> <td> <code title="">xmlns</code>
    <tr><td> <code title="">xlink</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a> <td> <code title="">xmlns:xlink</code>
  </table><p>No other namespaced attribute can be expressed in <a href=#syntax>the HTML syntax</a>.</p>

  <p class=note>Whether the attributes in the table above are conforming or not is defined by
  other specifications (e.g. the SVG and MathML specifications); this section only describes the
  syntax rules if the attributes are serialized using the HTML syntax.</p>


  <h5 id=optional-tags><span class=secno>12.1.2.4 </span>Optional tags</h5>

  <p>Certain tags can be <dfn id=syntax-tag-omission title=syntax-tag-omission>omitted</dfn>.</p>

  <p class=note>Omitting an element's <a href=#syntax-start-tag title=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><a href=#the-html-element>html</a></code> element, even if
  the string <code title="">&lt;html&gt;</code> doesn't appear anywhere in the markup.</p>

  <!-- <html> -->
  <p>An <code><a href=#the-html-element>html</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted
  if the first thing inside the <code><a href=#the-html-element>html</a></code> element is not a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>

  <!-- </html> -->
  <p>An <code><a href=#the-html-element>html</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if
  the <code><a href=#the-html-element>html</a></code> element is not immediately followed by a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>

  <!-- <head> -->
  <p>A <code><a href=#the-head-element>head</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if
  the element is empty, or if the first thing inside the <code><a href=#the-head-element>head</a></code> element is an
  element.</p>

  <!-- </head> -->
  <p>A <code><a href=#the-head-element>head</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-head-element>head</a></code> element is not immediately followed by a <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>

  <!-- <body> -->
  <p>A <code><a href=#the-body-element>body</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted if
  the element is empty, or if the first thing inside the <code><a href=#the-body-element>body</a></code> element is not a
  <a href=#space-character>space character</a> or a <a href=#syntax-comments title=syntax-comments>comment</a>, except if the
  first thing inside the <code><a href=#the-body-element>body</a></code> element is a <code><a href=#the-script-element>script</a></code> or <code><a href=#the-style-element>style</a></code>
  element. <!-- Note that even if the </head> end tag is present, the parser makes <style> and
  <script> elements between </head> and <body> end up in the <head> instead of implying the <body>
  --></p>

  <!-- </body> -->
  <p>A <code><a href=#the-body-element>body</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-body-element>body</a></code> element is not immediately followed by a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>

  <!-- </li> -->
  <p>An <code><a href=#the-li-element>li</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-li-element>li</a></code> element is immediately followed by another <code><a href=#the-li-element>li</a></code> element or if there is
  no more content in the parent element.</p>

  <!-- </dt> -->
  <p>A <code><a href=#the-dt-element>dt</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-dt-element>dt</a></code> element is immediately followed by another <code><a href=#the-dt-element>dt</a></code> element or a
  <code><a href=#the-dd-element>dd</a></code> element.</p>

  <!-- </dd> -->
  <p>A <code><a href=#the-dd-element>dd</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-dd-element>dd</a></code> element is immediately followed by another <code><a href=#the-dd-element>dd</a></code> element or a
  <code><a href=#the-dt-element>dt</a></code> element, or if there is no more content in the parent element.</p>

  <!-- </p> -->
  <p>A <code><a href=#the-p-element>p</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-p-element>p</a></code> element is immediately followed by an <code><a href=#the-address-element>address</a></code>, <code><a href=#the-article-element>article</a></code>,
  <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#dir>dir</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-dl-element>dl</a></code>,
  <code><a href=#the-fieldset-element>fieldset</a></code>, <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>,
  <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code><a href=#the-header-element>header</a></code>,
  <code><a href=#the-hgroup-element>hgroup</a></code>, <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-main-element>main</a></code>, <code><a href=#the-menu-element>menu</a></code>, <code><a href=#the-nav-element>nav</a></code>,
  <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-p-element>p</a></code>, <code><a href=#the-pre-element>pre</a></code>, <code><a href=#the-section-element>section</a></code>, <code><a href=#the-table-element>table</a></code>, or
  <code><a href=#the-ul-element>ul</a></code>, element, or if there is no more content in the parent element and the parent
  element is not an <code><a href=#the-a-element>a</a></code> element.</p>

  <!-- </rt> -->
  <p>An <code><a href=#the-rt-element>rt</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-rt-element>rt</a></code> element is immediately followed by an <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code> element,
  or if there is no more content in the parent element.</p>

  <!-- </rp> -->
  <p>An <code><a href=#the-rp-element>rp</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-rp-element>rp</a></code> element is immediately followed by an <code><a href=#the-rt-element>rt</a></code> or <code><a href=#the-rp-element>rp</a></code> element,
  or if there is no more content in the parent element.</p>

  <!-- </optgroup> (the text assumes <optgroup> can only be inside a <select>; commented out text
  below can handle the non-<select> case if we ever allow it) -->
  <p>An <code><a href=#the-optgroup-element>optgroup</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted
  if the <code><a href=#the-optgroup-element>optgroup</a></code> element <!--has an ancestor <code>select</code> element and--> is
  immediately followed by another <code><a href=#the-optgroup-element>optgroup</a></code> element, or if <!--all of the elements that
  are ancestors of the <code>optgroup</code> element, up to and including the first ancestor element
  that is not an <code>optgroup</code> element, have no more content--> there is no more content in
  the parent element.</p>
  <!-- so e.g. the max number of </optgroup>s are omitted here:
   <select><optgroup></select>
   <p id=x><optgroup></optgroup>x</p>
   <p id=x><optgroup><optgroup></optgroup></optgroup>x</p>
   <p><optgroup id=x><optgroup></optgroup>x</p>
   <p><optgroup><optgroup id=x>x</p>
  -->

  <!-- </option> -->
  <p>An <code><a href=#the-option-element>option</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if
  the <code><a href=#the-option-element>option</a></code> element is immediately followed by another <code><a href=#the-option-element>option</a></code> element, or
  if it is immediately followed by an <code><a href=#the-optgroup-element>optgroup</a></code> element, or if there is no more content
  in the parent element.</p>

  <!-- <colgroup> -->
  <p>A <code><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be
  omitted if the first thing inside the <code><a href=#the-colgroup-element>colgroup</a></code> element is a <code><a href=#the-col-element>col</a></code> element,
  and if the element is not immediately preceded by another <code><a href=#the-colgroup-element>colgroup</a></code> element whose
  <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> has been omitted. (It can't be omitted if the element
  is empty.)</p>

  <!-- </colgroup> -->
  <p>A <code><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if
  the <code><a href=#the-colgroup-element>colgroup</a></code> element is not immediately followed by a <a href=#space-character>space character</a> or
  a <a href=#syntax-comments title=syntax-comments>comment</a>.</p>

  <!-- </thead> -->
  <p>A <code><a href=#the-thead-element>thead</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if
  the <code><a href=#the-thead-element>thead</a></code> element is immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> or
  <code><a href=#the-tfoot-element>tfoot</a></code> element.</p>

  <!-- <tbody> -->
  <p>A <code><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> may be omitted
  if the first thing inside the <code><a href=#the-tbody-element>tbody</a></code> element is a <code><a href=#the-tr-element>tr</a></code> element, and if the
  element is not immediately preceded by a <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, or
  <code><a href=#the-tfoot-element>tfoot</a></code> element whose <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> has been omitted. (It
  can't be omitted if the element is empty.)</p>

  <!-- </tbody> -->
  <p>A <code><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if
  the <code><a href=#the-tbody-element>tbody</a></code> element is immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> or
  <code><a href=#the-tfoot-element>tfoot</a></code> element, or if there is no more content in the parent element.</p>

  <!-- </tfoot> -->
  <p>A <code><a href=#the-tfoot-element>tfoot</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if
  the <code><a href=#the-tfoot-element>tfoot</a></code> element is immediately followed by a <code><a href=#the-tbody-element>tbody</a></code> element, or if
  there is no more content in the parent element.</p>

  <!-- </tr> -->
  <p>A <code><a href=#the-tr-element>tr</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-tr-element>tr</a></code> element is immediately followed by another <code><a href=#the-tr-element>tr</a></code> element, or if there is
  no more content in the parent element.</p>

  <!-- </td> -->
  <p>A <code><a href=#the-td-element>td</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-td-element>td</a></code> element is immediately followed by a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element,
  or if there is no more content in the parent element.</p>

  <!-- </th> -->
  <p>A <code><a href=#the-th-element>th</a></code> element's <a href=#syntax-end-tag title=syntax-end-tag>end tag</a> may be omitted if the
  <code><a href=#the-th-element>th</a></code> element is immediately followed by a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element,
  or if there is no more content in the parent element.</p>

  <p><strong>However</strong>, a <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> must never be
  omitted if it has any attributes.</p>


  <h5 id=element-restrictions><span class=secno>12.1.2.5 </span>Restrictions on content models</h5>

  <p>For historical reasons, certain elements have extra restrictions beyond even the restrictions
  given by their content model.</p>

  <p>A <code><a href=#the-table-element>table</a></code> element must not contain <code><a href=#the-tr-element>tr</a></code> elements, even though these
  elements are technically allowed inside <code><a href=#the-table-element>table</a></code> elements according to the content
  models described in this specification. (If a <code><a href=#the-tr-element>tr</a></code> element is put inside a
  <code><a href=#the-table-element>table</a></code> in the markup, it will in fact imply a <code><a href=#the-tbody-element>tbody</a></code> start tag before
  it.)</p>

  <p>A single <a href=#syntax-newlines title=syntax-newlines>newline</a> may be placed immediately after the <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> of <code><a href=#the-pre-element>pre</a></code> and <code><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 title=syntax-newlines>newline</a> <em>must</em> be included if the element's contents
  themselves start with a <a href=#syntax-newlines title=syntax-newlines>newline</a> (because otherwise the
  leading newline in the contents would be treated like the optional newline, and ignored).</p>

  <div class=example>
   <p>The following two <code><a href=#the-pre-element>pre</a></code> blocks are equivalent:</p>
   <pre>&lt;pre&gt;Hello&lt;/pre&gt;</pre>
   <pre>&lt;pre&gt;<br>Hello&lt;/pre&gt;</pre>
  </div>


  <h5 id=cdata-rcdata-restrictions><span class=secno>12.1.2.6 </span>Restrictions on the contents of raw text and escapable raw text elements</h5>

  <p>The text in <a href=#raw-text-elements title="raw text elements">raw text</a> and <a href=#escapable-raw-text-elements>escapable raw text
  elements</a> must not contain any occurrences of the string "<code title="">&lt;/</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
  (&gt;), or U+002F SOLIDUS (/).</p>


  <h4 id=text-0><span class=secno>12.1.3 </span>Text</h4>

  <p><dfn id=syntax-text title=syntax-text>Text</dfn> is allowed inside elements, attribute values, and comments.
  Extra constraints are placed on what is and what is not allowed in text based on where the text is
  to be put, as described in the other sections.</p>


  <h5 id=newlines><span class=secno>12.1.3.1 </span>Newlines</h5>

  <p><dfn id=syntax-newlines title=syntax-newlines>Newlines</dfn> in HTML may be represented either as U+000D
  CARRIAGE RETURN (CR) characters, U+000A LINE FEED (LF) characters, or pairs of U+000D CARRIAGE
  RETURN (CR), U+000A LINE FEED (LF) characters in that order.</p>

  <p>Where <a href=#syntax-charref title=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 title=syntax-newlines>newline</a>.</p>


  <h4 id=character-references><span class=secno>12.1.4 </span>Character references</h4>

  <p>In certain cases described in other sections, <a href=#syntax-text title=syntax-text>text</a> may be
  mixed with <dfn id=syntax-charref title=syntax-charref>character references</dfn>. These can be used to escape
  characters that couldn't otherwise legally be included in <a href=#syntax-text title=syntax-text>text</a>.</p>

  <p>Character references must start with a U+0026 AMPERSAND character (&amp;). Following this,
  there are three possible kinds of character references:</p>

  <dl><dt>Named character references</dt>

   <dd>The ampersand must be followed by one of the names given in the <a href=#named-character-references>named character
   references</a> section, using the same case. <span class=impl>The name must be one that is
   terminated by a U+003B SEMICOLON character (;).</span></dd>


   <dt>Decimal numeric character reference</dt>

   <dd>The ampersand must be followed by a U+0023 NUMBER SIGN character (#), followed by one or more
   <a href=#ascii-digits>ASCII digits</a>, representing a base-ten integer that corresponds to a Unicode code
   point that is allowed according to the definition below. The digits must then be followed by a
   U+003B SEMICOLON character (;).</dd>


   <dt>Hexadecimal numeric character reference</dt>

   <dd>The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which must be followed
   by either a U+0078 LATIN SMALL LETTER X character (x) or a U+0058 LATIN CAPITAL LETTER X
   character (X), which must then be followed by one or more <a href=#ascii-hex-digits>ASCII hex digits</a>,
   representing a base-sixteen integer that corresponds to a Unicode code point that is allowed
   according to the definition below. The digits must then be followed by a U+003B SEMICOLON
   character (;).</dd>

  </dl><p>The numeric character reference forms described above are allowed to reference any Unicode code
  point other than U+0000, U+000D, permanently undefined Unicode characters (noncharacters), and
  control characters other than <a href=#space-character title="space character">space characters</a>.</p>

  <p>An <dfn id=syntax-ambiguous-ampersand title=syntax-ambiguous-ampersand>ambiguous ampersand</dfn> is a U+0026 AMPERSAND
  character (&amp;) that is followed by one or more <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
  followed by a U+003B SEMICOLON character (;), where these characters do not match any of the names
  given in the <a href=#named-character-references>named character references</a> section.</p>


  <h4 id=cdata-sections><span class=secno>12.1.5 </span>CDATA sections</h4>

  <p><dfn id=syntax-cdata title=syntax-cdata>CDATA sections</dfn> must consist of the following components, in
  this order:</p>

  <ol><li>The string "<code title="">&lt;![CDATA[</code>".</li>

   <li>Optionally, <a href=#syntax-text title=syntax-text>text</a>, with the additional restriction that the
   text must not contain the string "<code title="">]]&gt;</code>".</li>

   <li>The string "<code title="">]]&gt;</code>".</li>

  </ol><div class=example>

   <p>CDATA sections can only be used in foreign content (MathML or SVG). In this example, a CDATA
   section is used to escape the contents of an <code>ms</code> element:</p>

   <pre>&lt;p&gt;You can add a string to a number, but this stringifies the number:&lt;/p&gt;
&lt;math&gt;
 &lt;ms&gt;&lt;![CDATA[x&lt;y]]&gt;&lt;/ms&gt;
 &lt;mo&gt;+&lt;/mo&gt;
 &lt;mn&gt;3&lt;/mn&gt;
 &lt;mo&gt;=&lt;/mo&gt;
 &lt;ms&gt;&lt;![CDATA[x&lt;y3]]&gt;&lt;/ms&gt;
&lt;/math&gt;</pre>

  </div>


  <h4 id=comments><span class=secno>12.1.6 </span>Comments</h4>

  <p><dfn id=syntax-comments title=syntax-comments>Comments</dfn> must start with the four character sequence U+003C
  LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS (<code title="">&lt;!--</code>). Following this sequence, the comment may have <a href=#syntax-text title=syntax-text>text</a>, with the additional restriction that the text must not start with
  a single U+003E GREATER-THAN SIGN character (&gt;), nor start with a U+002D HYPHEN-MINUS character
  (-) followed by a U+003E GREATER-THAN SIGN (&gt;) character, nor contain two consecutive U+002D
  HYPHEN-MINUS characters (<code title="">--</code>), nor end with a U+002D HYPHEN-MINUS character
  (-). Finally, the comment must be ended by the three character sequence U+002D HYPHEN-MINUS,
  U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN (<code title="">--&gt;</code>).</p>


<!--HTMLPARSER-->

  <div class=impl>

  <h3 id=parsing><span class=secno>12.2 </span>Parsing HTML documents</h3>

  <p><i>This section only applies to user agents, data mining tools, and conformance
  checkers.</i></p>

  <p class=note>The rules for parsing XML documents into DOM trees are covered by the next
  section, entitled "<a href=#the-xhtml-syntax>The XHTML syntax</a>".</p>

  <p>User agents must use the parsing rules described in this section to generate the DOM trees from
  <code><a href=#text/html>text/html</a></code> resources. Together, these rules define what is referred to as the
  <dfn id=html-parser>HTML parser</dfn>.</p>

  <div class=note>

   <p>While the HTML syntax described in this specification bears a close resemblance to SGML and
   XML, it is a separate language with its own parsing rules.</p>

   <p>Some earlier versions of HTML (in particular from HTML2 to HTML4) were based on SGML and used
   SGML parsing rules. However, few (if any) web browsers ever implemented true SGML parsing for
   HTML documents; the only user agents to strictly handle HTML as an SGML application have
   historically been validators. The resulting confusion &mdash; with validators claiming documents
   to have one representation while widely deployed Web browsers interoperably implemented a
   different representation &mdash; 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>This specification defines the parsing rules for HTML documents, whether they are syntactically
  correct or not. Certain points in the parsing algorithm are said to be <dfn id=parse-error title="parse
  error">parse errors</dfn>. The error handling for parse errors is well-defined (that's the
  processing rules described throughout this specification), but user agents, while parsing an HTML
  document, may <a href=#abort-a-parser title="abort a parser">abort the parser</a> at the first <a href=#parse-error>parse
  error</a> that they encounter for which they do not wish to apply the rules described in this
  specification.</p>

  <p>Conformance checkers must report at least one parse error condition to the user if one or more
  parse error conditions exist in the document and must not report parse error conditions if none
  exist in the document. Conformance checkers may report more than one parse error condition if more
  than one parse error condition exists in the document.</p>

  <p class=note>Parse errors are only errors with the <em>syntax</em> of HTML. In addition to
  checking for parse errors, conformance checkers will also verify that the document obeys all the
  other conformance requirements described in this specification.</p>

  <p>For the purposes of conformance checkers, if a resource is determined to be in <a href=#syntax>the HTML
  syntax</a>, then it is an <a href=#html-documents title="HTML documents">HTML document</a>.</p>

  </div>


  <div class=impl>

  <h4 id=overview-of-the-parsing-model><span class=secno>12.2.1 </span>Overview of the parsing model</h4>

  <p class=overview><object width=345 height=535 data=images/parsing-model-overview.svg><img src=http://images.whatwg.org/parsing-model-overview.png width=345 alt="" height=450></object></p>

  <p>The input to the HTML parsing process consists of a stream of <a href=#unicode-code-point title="Unicode code
  point">Unicode code points</a>, which is passed through a <a href=#tokenization>tokenization</a> stage
  followed by a <a href=#tree-construction>tree construction</a> stage. The output is a <code><a href=#document>Document</a></code>
  object.</p>

  <p class=note>Implementations that <a href=#non-scripted>do not support scripting</a> do not
  have to actually create a DOM <code><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 title="dynamic markup insertion">it can also come from script</a> running in the user
  agent, e.g. using the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> API.</p>

  <p id=nestedParsing>There is only one set of states for the tokenizer stage and the tree
  construction stage, but the tree construction stage is reentrant, meaning that while the tree
  construction stage is handling one token, the tokenizer might be resumed, causing further tokens
  to be emitted and processed before the first token's processing is complete.</p>

  <div class=example>

   <p>In the following example, the tree construction stage will be called upon to handle a "p"
   start tag token while handling the "script" end tag token:</p>

   <pre>...
&lt;script&gt;
 document.write('&lt;p&gt;');
&lt;/script&gt;
...</pre>

  </div>

  <p>To handle these cases, parsers have a <dfn id=script-nesting-level>script nesting level</dfn>, which must be initially
  set to zero, and a <dfn id=parser-pause-flag>parser pause flag</dfn>, which must be initially set to false.</p>

  </div>



  <div class=impl>

  <h4 id=the-input-byte-stream><span class=secno>12.2.2 </span>The <dfn>input byte stream</dfn></h4>

  <p>The stream of Unicode code points that comprises the input to the tokenization stage will be
  initially seen by the user agent as a stream of bytes (typically coming over the network or from
  the local file system). The bytes encode the actual characters according to a particular
  <i>character encoding</i>, which the user agent uses to decode the bytes into characters.</p>

  <p class=note>For XML documents, the algorithm user agents must 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>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>input byte stream</a> must be converted
  to Unicode code points for the tokenizer's <a href=#input-stream>input stream</a>, as described by the rules
  for that encoding's <a href=#decoder>decoder</a>.</p>

  <p class=note>Bytes or sequences of bytes in the original byte stream that did not conform to
  the encoding specification (e.g. invalid UTF-8 byte sequences in a UTF-8 input byte stream) are
  errors that conformance checkers are expected to report.</p>

  <p class=note>Leading Byte Order Marks (BOMs) are not stripped by the decoder algorithms, they
  are stripped by the algorithm below.</p>

  <p class=warning>The decoder algorithms describe how to handle invalid input; for security
  reasons, it is imperative that those rules be followed precisely. Differences in how invalid byte
  sequences are handled can result in, amongst other problems, script injection vulnerabilities
  ("XSS").</p>

  <p>When the HTML parser is decoding an input byte stream, it uses a character encoding and a <dfn id=concept-encoding-confidence title=concept-encoding-confidence>confidence</dfn>. The confidence is either <i>tentative</i>,
  <i>certain</i>, or <i>irrelevant</i>. The encoding used, and whether the confidence in that
  encoding is <i>tentative</i> or <i>certain</i>, is <a href=#meta-charset-during-parse>used
  during the parsing</a> to determine whether to <a href=#change-the-encoding>change the encoding</a>. If no encoding is
  necessary, e.g. because the parser is operating on a Unicode stream and doesn't have to use a
  character encoding at all, then the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
  <i>irrelevant</i>.</p>

  <p class=note>Some algorithms feed the parser by directly adding characters to the <a href=#input-stream>input
  stream</a> rather than adding bytes to the <a href=#the-input-byte-stream>input byte stream</a>.</p>


  <h5 id=parsing-with-a-known-character-encoding><span class=secno>12.2.2.1 </span>Parsing with a known character encoding</h5>

  <p>When the HTML parser is to operate on an input byte stream that has <dfn id=a-known-definite-encoding>a known definite
  encoding</dfn>, then the character encoding is that encoding and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is <i>certain</i>.</p>


  <h5 id=determining-the-character-encoding><span class=secno>12.2.2.2 </span>Determining the character encoding</h5>

  <p>In some cases, it might be impractical to unambiguously determine the encoding before parsing
  the document. Because of this, this specification provides for a two-pass mechanism with an
  optional pre-scan. Implementations are allowed, as described below, to apply a simplified parsing
  algorithm to whatever bytes they have available before beginning to parse the document. Then, the
  real parser is started, using a tentative encoding derived from this pre-parse and other
  out-of-band metadata. If, while the document is being loaded, the user agent discovers a character
  encoding declaration that conflicts with this information, then the parser can get reinvoked to
  perform a parse of the document with the real encoding.</p>

  <p id=documentEncoding>User agents must use the following algorithm, called the <dfn id=encoding-sniffing-algorithm>encoding
  sniffing algorithm</dfn>, to determine the character encoding to use when decoding a document in
  the first pass. This algorithm takes as input any out-of-band metadata available to the user agent
  (e.g. the <a href=#content-type title=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 title=concept-encoding-confidence>confidence</a> that is either <i>tentative</i> or
  <i>certain</i>.</p>

  <ol><li>

    <p>If the user has explicitly instructed the user agent to override the document's character
    encoding with a specific encoding, optionally return that encoding with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> <i>certain</i> and abort these steps.</p>

    <p class=note>Typically, user agents remember such user requests across sessions, and in some
    cases apply them to documents in <code><a href=#the-iframe-element>iframe</a></code>s as well.</p>

   </li>

   <li>

    <p>The user agent may wait for more bytes of the resource to be available, either in this step
    or at any later step in this algorithm. For instance, a user agent might wait 500ms or 1024
    bytes, whichever came first. In general preparsing the source to find the encoding improves
    performance, as it reduces the need to throw away the data structures used when parsing upon
    finding the encoding information. However, if the user agent delays too long to obtain data to
    determine the encoding, then the cost of the delay could outweigh any performance improvements
    from the preparse.</p>

    <p class=note>The authoring conformance requirements for character encoding declarations limit
    them to only appearing <a href=#charset1024>in the first 1024 bytes</a>. User agents are
    therefore encouraged to use the prescan algorithm below (as invoked by these steps) on the first
    1024 bytes, but not to stall beyond that.</p>

   </li>

   <li>

    <!-- Doing this step before honouring HTTP is important for supporting
            http://kb.dsqq.cn/html/2012-09/16/node_193.htm
         which is encoded as UTF-8 but is incorrectly labeled as
            Content-Type: text/html; charset=GB2312
    -->

    <p>For each of the rows in the following table, starting with the first one and going down, if
    there are as many or more bytes available than the number of bytes in the first column, and the
    first bytes of the file match the bytes given in the first column, then return the encoding
    given in the cell in the second column of that row, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> <i>certain</i>, and abort these steps:</p>

    <!-- this table is present in several forms in this file; keep them in sync -->
    <table><thead><tr><th>Bytes in Hexadecimal
       <th>Encoding
     <tbody><!-- nobody uses this
      <tr>
       <td>00 00 FE FF
       <td>UTF-32BE
      <tr>
       <td>FF FE 00 00
       <td>UTF-32LE
--><tr><td>FE FF
       <td>Big-endian UTF-16
      <tr><td>FF FE
       <td>Little-endian UTF-16
      <tr><td>EF BB BF
       <td>UTF-8
<!-- nobody uses this
      <tr>
       <td>DD 73 66 73
       <td>UTF-EBCDIC
-->
    </table><p class=note>This step looks for Unicode Byte Order Marks (BOMs).</p>

    <p class=note>That this step happens before the next one honoring the HTTP
    <code><a href=#content-type>Content-Type</a></code> header is a <a href=#willful-violation>willful violation</a> of the HTTP specification,
    motivated by a desire to be maximally compatible with legacy content. <a href=#refsHTTP>[HTTP]</a></p>

   </li>

   <li><p>If the transport layer specifies a character encoding, and it is supported, return that
   encoding with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> <i>certain</i>, and
   abort these steps.</li>

   <li>

    <p>Optionally <a href=#prescan-a-byte-stream-to-determine-its-encoding title="prescan a byte stream to determine its encoding">prescan the byte
    stream to determine its encoding</a>. The <var title="">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 title=concept-encoding-confidence>confidence</a> <i>tentative</i>.</p>

   </li>

   <li>

    <p>If the <a href=#html-parser>HTML parser</a> for which this algorithm is being run is associated with a
    <code><a href=#document>Document</a></code> that is itself in a <a href=#nested-browsing-context>nested browsing context</a>, run these
    substeps:</p>

    <ol><li><p>Let <var title="">new document</var> be the <code><a href=#document>Document</a></code> with which the
     <a href=#html-parser>HTML parser</a> is associated.</li>

     <li><p>Let <var title="">parent document</var> be the <code><a href=#document>Document</a></code> <a href=#browsing-context-nested-through title="browsing context nested through">through which <var title="">new document</var> is
     nested</a> (the <a href=#active-document>active document</a> of the <a href=#parent-browsing-context>parent browsing context</a> of
     <var title="">new document</var>).</li>

     <li><p>If <var title="">parent document</var>'s <a href=#origin>origin</a> is not the <a href=#same-origin>same
     origin</a> as <var title="">new document</var>'s <a href=#origin>origin</a>, then abort these
     substeps.</li>

     <li><p>If <var title="">parent document</var>'s <a href="#document's-character-encoding" title="document's character
     encoding">character encoding</a> is not an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>,
     then abort these substeps.</li>

     <li><p>Return <var title="">parent document</var>'s <a href="#document's-character-encoding" title="document's character
     encoding">character encoding</a>, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> <i>tentative</i>, and abort the
     <a href=#encoding-sniffing-algorithm>encoding sniffing algorithm</a>'s steps.</li>

    </ol></li>

   <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 title=concept-encoding-confidence>confidence</a> <i>tentative</i>, and abort these
   steps.</li>

   <li>

    <p>The user agent may attempt to autodetect the character encoding from applying frequency
    analysis or other algorithms to the data stream. Such algorithms may use information about the
    resource other than the resource's contents, including the address of the resource. If
    autodetection succeeds in determining a character encoding, and that encoding is a supported
    encoding, then return that encoding, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> <i>tentative</i>, and abort these steps.
    <a href=#refsUNIVCHARDET>[UNIVCHARDET]</a></p>

    <p class=note>The UTF-8 encoding has a highly detectable bit pattern. Documents 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. User-agents are
    therefore encouraged to search for this common encoding. <a href=#refsPPUTF8>[PPUTF8]</a> <a href=#refsUTF8DET>[UTF8DET]</a></p>

   </li>

   <li>

    <p>Otherwise, return an implementation-defined or user-specified default character encoding,
    with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>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 title="">UTF-8</code> encoding is suggested.</p>

    <p>In other environments, the default encoding is typically dependent on the user's locale (an
    approximation of the languages, and thus often encodings, of the pages that the user is likely
    to frequent). The following table gives suggested defaults based on the user's locale, for
    compatibility with legacy content. Locales are identified by BCP 47 language tags. <a href=#refsBCP47>[BCP47]</a> <a href=#refsENCODING>[ENCODING]</a></p>

    <!-- based on three sources:
          1. mozilla 1.9.1 localizations: http://mxr.mozilla.org/l10n-mozilla1.9.1/find?string=global%2Fintl.properties&tree=l10n-mozilla1.9.1&hint= 
          2. windows vista encodings: http://msdn.microsoft.com/en-us/goglobal/bb896001
          3. chrome encodings: https://code.google.com/p/chromium/codesearch#search/&q=IDS_DEFAULT_ENCODING
         several assumptions were made in this process; amongst them:
          - ISO-8859-1 and Windows-1252 are the same (supported by encoding.spec.whatwg.org)
          - ISO-8859-9 and Windows-1254 are the same (supported by encoding.spec.whatwg.org)
          - Windows-31J and Shift_JIS are the same (supported by encoding.spec.whatwg.org)
          - Windows-932 is close enough to Shift_JIS to be treated as equivalent (supported by wikipedia)
          - Windows-936 is a basically a subset of GBK which is basically a subset of GB18030 (supported by wikipedia)
          - Windows-950 is basically the same as Big5 (supported by wikipedia)
          - Firefox's UTF-8 defaults are all bogus
    -->

    <table><thead><tr><th colspan=2>Locale language
       <th>Suggested default encoding
     <tbody><!-- af, Afrikaans, uses windows-1252: Windows Vista and Firefox agreed --><!-- am, Amharic, uses windows-1252: Firefox and Chrome agreed --><tr><td>ar
       <td>Arabic
       <td>windows-1256 <!-- Windows Vista and Chrome agreed -->

      <!-- arn-CL, Mapudungun (Chile), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- az, Azeri, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1254 -->

      <!-- az-Cyrl-AZ, Azeri (Cyrillic, Azerbaijan), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- ba-RU, Bashkir (Russia), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- be, Belarusian, is not listed here because Windows Vista wanted windows-1251, Chrome wanted <none>, and Firefox wanted ISO-8859-5 -->

      <!-- be-BY, Belarusian (Belarus), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <tr><td>bg
       <td>Bulgarian
       <td>windows-1251 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- bn, Bengali, uses windows-1252: Firefox and Chrome agreed -->

      <!-- br-FR, Breton (France), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- bs-Cyrl-BA, Bosnian (Cyrillic, Bosnia and Herzegovina), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- bs-Latn-BA, Bosnian (Latin, Bosnia and Herzegovina), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- ca, Catalan, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- co-FR, Corsican (France), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>cs
       <td>Czech
       <td>windows-1250 <!-- Windows Vista and Chrome agreed (but disagreed with Firefox, which thought the encoding should be ISO-8859-2) -->

      <!-- cy-GB, Welsh (United Kingdom), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- da, Danish, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- de, German, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- el, Greek, is not listed here because Windows Vista wanted windows-1253, Chrome wanted ISO-8859-7, and Firefox wanted windows-1252 -->

      <!-- el-GR, Greek (Greece), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1253 -->

      <!-- en, English, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- es, Spanish, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <tr><td>et
       <td>Estonian
       <td>windows-1257 <!-- Windows Vista and Chrome agreed -->

      <!-- eu, Basque, uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>fa
       <td>Persian
       <td>windows-1256 <!-- Windows Vista and Chrome agreed -->

      <!-- fi, Finnish, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- fil, Filipino, uses windows-1252: Firefox and Chrome agreed -->

      <!-- fo, Faroese, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- fr, French, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- fy-NL, Frisian (Netherlands), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- ga-IE, Irish (Ireland), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- gl, Galician, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- gsw-FR, Alsatian (France), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- gu, Gujarati, uses windows-1252: Firefox and Chrome agreed -->

      <!-- ha-Latn-NG, Hausa (Latin, Nigeria), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>he
       <td>Hebrew
       <td>windows-1255 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- hi, Hindi, uses windows-1252: Firefox and Chrome agreed -->

      <tr><td>hr
       <td>Croatian
       <td>windows-1250 <!-- Windows Vista and Chrome agreed -->

      <tr><td>hu
       <td>Hungarian
       <td>ISO-8859-2 <!-- Chrome and Firefox agreed (but disagreed with Windows Vista, which thought the encoding should be windows-1250) -->

      <!-- hu-HU, Hungarian (Hungary), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- id, Indonesian, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- ig-NG, Igbo (Nigeria), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- is, Icelandic, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- it, Italian, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- iu-Latn-CA, Inuktitut (Latin, Canada), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>ja
       <td>Japanese
       <td>Shift_JIS <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- kk, Kazakh, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- kl-GL, Greenlandic (Greenland), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- kn, Kannada, uses windows-1252: Firefox and Chrome agreed -->

      <tr><td>ko
       <td>Korean
       <td>euc-kr <!-- Windows Vista, Chrome, and Firefox agreed -->

      <tr><td>ku
       <td>Kurdish
       <td>windows-1254 <!-- Best guess -->

      <!-- ky, Kyrgyz, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- lb-LU, Luxembourgish (Luxembourg), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>lt
       <td>Lithuanian
       <td>windows-1257 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <tr><td>lv
       <td>Latvian
       <td>windows-1257 <!-- Windows Vista and Chrome agreed (but disagreed with Firefox, which thought the encoding should be ISO-8859-13) -->

      <!-- mk, Macedonian, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- ml, Malayalam, uses windows-1252: Firefox and Chrome agreed -->

      <!-- mn, Mongolian, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- moh-CA, Mohawk (Mohawk), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- mr, Marathi, uses windows-1252: Firefox and Chrome agreed -->

      <!-- ms, Malay, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- nb, Norwegian Bokm&aring;l, uses windows-1252: Firefox and Chrome agreed -->

      <!-- nl, Dutch, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- nn-NO, Norwegian, Nynorsk (Norway), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- no, Norwegian, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- nso-ZA, Sesotho sa Leboa (South Africa), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- oc-FR, Occitan (France), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>pl
       <td>Polish
       <td>ISO-8859-2 <!-- Chrome and Firefox agreed (but disagreed with Windows Vista, which thought the encoding should be windows-1250) -->

      <!-- pl-PL, Polish (Poland), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- prs-AF, Dari (Afghanistan), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1256 -->

      <!-- pt, Portuguese, uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- qut-GT, K'iche (Guatemala), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- quz-BO, Quechua (Bolivia), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- quz-EC, Quechua (Ecuador), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- quz-PE, Quechua (Peru), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- rm-CH, Romansh (Switzerland), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- ro, Romanian, is not listed here because Windows Vista wanted windows-1250, Chrome wanted ISO-8859-2, and Firefox wanted <none> -->

      <!-- ro-RO, Romanian (Romania), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <tr><td>ru
       <td>Russian
       <td>windows-1251 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- rw-RW, Kinyarwanda (Rwanda), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- sah-RU, Yakut (Russia), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- se-FI, Sami, Northern (Finland), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- se-NO, Sami, Northern (Norway), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- se-SE, Sami, Northern (Sweden), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>sk
       <td>Slovak
       <td>windows-1250 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <tr><td>sl
       <td>Slovenian
       <td>ISO-8859-2 <!-- Chrome and Firefox agreed (but disagreed with Windows Vista, which thought the encoding should be windows-1250) -->

      <!-- sl-SI, Slovenian (Slovenia), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- sma-NO, Sami, Southern (Norway), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- sma-SE, Sami, Southern (Sweden), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- smj-NO, Sami, Lule (Norway), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- smj-SE, Sami, Lule (Sweden), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- smn-FI, Sami, Inari (Finland), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- sms-FI, Sami, Skolt (Finland), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- sq, Albanian, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <tr><td>sr
       <td>Serbian
       <td>windows-1251 <!-- Windows Vista and Chrome agreed -->

      <!-- sr-Latn-BA, Serbian (Latin, Bosnia and Herzegovina), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- sr-Latn-SP, Serbian (Latin, Serbia), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- sv, Swedish, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- sw, Kiswahili, uses windows-1252: Windows Vista, Chrome, and Firefox agreed -->

      <!-- ta, Tamil, uses windows-1252: Firefox and Chrome agreed -->

      <!-- te, Telugu, uses windows-1252: Firefox and Chrome agreed -->

      <!-- tg-Cyrl-TJ, Tajik (Cyrillic, Tajikistan), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <tr><td>th
       <td>Thai
       <td>windows-874 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- tk-TM, Turkmen (Turkmenistan), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1250 -->

      <!-- tn-ZA, Setswana (South Africa), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>tr
       <td>Turkish
       <td>windows-1254 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- tt, Tatar, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <!-- tzm-Latn-DZ, Tamazight (Latin, Algeria), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- ug-CN, Uighur (PRC), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1256 -->

      <tr><td>uk
       <td>Ukrainian
       <td>windows-1251 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- ur, Urdu, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1256 -->

      <!-- uz, Uzbek, is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1254 -->

      <!-- uz-Cyrl-UZ, Uzbek (Cyrillic, Uzbekistan), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted windows-1251 -->

      <tr><td>vi
       <td>Vietnamese
       <td>windows-1258 <!-- Windows Vista and Chrome agreed -->

      <!-- wee-DE, Lower Sorbian (Germany), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- wen-DE, Upper Sorbian (Germany), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- wo-SN, Wolof (Senegal), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- xh-ZA, isiXhosa (South Africa), uses windows-1252: Windows Vista and Firefox agreed -->

      <!-- yo-NG, Yoruba (Nigeria), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td>zh-CN
       <td>Chinese (People's Republic of China)
       <td>GB18030 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- zh-HK, Chinese (Hong Kong S.A.R.), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted Big5 -->

      <!-- zh-Hans, Chinese (Simplified), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted GB18030 -->

      <!-- zh-Hant, Chinese (Traditional), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted Big5 -->

      <!-- zh-MO, Chinese (Macao S.A.R.), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted Big5 -->

      <!-- zh-SG, Chinese (Singapore), is not listed here because neither Chrome nor Firefox knew about it. For what it's worth, Windows Vista wanted GB18030 -->

      <tr><td>zh-TW
       <td>Chinese (Taiwan)
       <td>Big5 <!-- Windows Vista, Chrome, and Firefox agreed -->

      <!-- zu-ZA, isiZulu (South Africa), uses windows-1252: Windows Vista and Firefox agreed -->

      <tr><td colspan=2>All other locales
       <td>windows-1252

    </table><p class=tablenote><small>The contents of this table are derived from the intersection of
    Windows, Chrome, and Firefox defaults.</small></p>

   </li>

  </ol><p>The <a href="#document's-character-encoding">document's character encoding</a> must immediately be set to the value returned
  from this algorithm, at the same time as the user agent uses the returned value to select the
  decoder to use for the input byte stream.</p>

  <hr><p>When an algorithm requires a user agent to <dfn id=prescan-a-byte-stream-to-determine-its-encoding>prescan a byte stream to determine its
  encoding</dfn>, given some defined <var title="">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 title=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 title="">position</var> pointer
  created in the first step below goes beyond the end of the byte stream obtained so far) or reaches
  its <var title="">end condition</var>, then abort the <a href=#prescan-a-byte-stream-to-determine-its-encoding>prescan a byte stream to determine its
  encoding</a> algorithm unsuccessfully.</p>

  <ol><li>

    <p>Let <var title="">position</var> be a pointer to a byte in the input byte stream, initially
    pointing at the first byte.</p>

   </li>

   <li>

    <p><i>Loop</i>: If <var title="">position</var> points to:</p>

    <dl class=switch><dt>A sequence of bytes starting with: 0x3C 0x21 0x2D 0x2D (ASCII '&lt;!--')</dt>
     <dd>

      <p>Advance the <var title="">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 '--&gt;' sequence) and comes
      after the 0x3C byte that was found. (The two 0x2D bytes can be the same as the those in the
      '&lt;!--' sequence.)</p>

     </dd>

     <dt>A sequence of bytes starting with: 0x3C, 0x4D or 0x6D, 0x45 or 0x65, 0x54 or 0x74, 0x41 or 0x61, and one of 0x09, 0x0A, 0x0C, 0x0D, 0x20, 0x2F (case-insensitive ASCII '&lt;meta' followed by a space or slash)</dt>
     <dd>

      <ol><li><p>Advance the <var title="">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>

       <li><p>Let <var title="">attribute list</var> be an empty list of strings.</li> <!-- so
       long as we only care about http-equiv, content, and charset, this can be a 3-bit bitfield -->

       <li><p>Let <var title="">got pragma</var> be false.</li>

       <li><p>Let <var title="">need pragma</var> be null.</li>

       <li><p>Let <var title="">charset</var> be the null value (which, for the purposes of this
       algorithm, is distinct from an unrecognised encoding or the empty string).</li>

       <li><p><i>Attributes</i>: <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>Get an
       attribute</a> and its value. If no attribute was sniffed, then jump to the
       <i>processing</i> step below.</li>

       <li><p>If the attribute's name is already in <var title="">attribute list</var>, then return
       to the step labeled <i>attributes</i>.</p>

       <li><p>Add the attribute's name to <var title="">attribute list</var>.</p>

       <li>

        <p>Run the appropriate step from the following list, if one applies:</p>

        <dl class=switch><dt>If the attribute's name is "<code title="">http-equiv</code>"</dt>

         <dd><p>If the attribute's value is "<code title="">content-type</code>", then set <var title="">got pragma</var> to true.</dd>

         <dt>If the attribute's name is "<code title="">content</code>"</dt>

         <dd><p>Apply the <a href=#algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a
         <code>meta</code> element</a>, giving the attribute's value as the string to parse. If a
         character encoding is returned, and if <var title="">charset</var> is still set to null,
         let <var title="">charset</var> be the encoding returned, and set <var title="">need
         pragma</var> to true.</dd>

         <dt>If the attribute's name is "<code title="">charset</code>"</dt>

         <dd><p>Let <var title="">charset</var> be the result of <a href=#getting-an-encoding>getting an encoding</a>
         from the attribute's value, and set <var title="">need pragma</var> to false.</dd>

        </dl></li>

       <li><p>Return to the step labeled <i>attributes</i>.</li>

       <li><p><i>Processing</i>: If <var title="">need pragma</var> is null, then jump to the step
       below labeled <i>next byte</i>.</li>

       <li><p>If <var title="">need pragma</var> is true but <var title="">got pragma</var> is
       false, then jump to the step below labeled <i>next byte</i>.</li>

       <li><p>If <var title="">charset</var> is <a href=#a-utf-16-encoding>a UTF-16 encoding</a>, change the value of
       <var title="">charset</var> to UTF-8.</li>

       <li><p>If <var title="">charset</var> is not a supported character encoding, then jump to the
       step below labeled <i>next byte</i>.</li>

       <li><p>Abort the <a href=#prescan-a-byte-stream-to-determine-its-encoding>prescan a byte stream to determine its encoding</a> algorithm,
       returning the encoding given by <var title="">charset</var>.</li>

      </ol></dd>

     <dt>A sequence of bytes starting with a 0x3C byte (ASCII &lt;), optionally a 0x2F byte (ASCII /), and finally a byte in the range 0x41-0x5A or 0x61-0x7A (an ASCII letter)</dt>
     <dd>

      <ol><li><p>Advance the <var title="">position</var> pointer so that it points at the next 0x09
       (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x3E
       (ASCII &gt;) byte.</li>

       <li><p>Repeatedly <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an attribute</a>
       until no further attributes can be found, then jump to the step below labeled <i>next
       byte</i>.</li>

      </ol></dd>

     <dt>A sequence of bytes starting with: 0x3C 0x21 (ASCII '&lt;!')</dt>
     <dt>A sequence of bytes starting with: 0x3C 0x2F (ASCII '&lt;/')</dt>
     <dt>A sequence of bytes starting with: 0x3C 0x3F (ASCII '&lt;?')</dt>
     <dd>

      <p>Advance the <var title="">position</var> pointer so that it points at the first 0x3E byte
      (ASCII &gt;) that comes after the 0x3C byte that was found.</p>

     </dd>

     <dt>Any other byte</dt>
     <dd>

      <p>Do nothing with that byte.</p>

     </dd>

    </dl></li>

   <li><i>Next byte</i>: Move <var title="">position</var> so it points at the next byte in the
   input byte stream, and return to the step above labeled <i>loop</i>.</li>

  </ol><p>When the <a href=#prescan-a-byte-stream-to-determine-its-encoding>prescan a byte stream to determine its encoding</a> algorithm says to <dfn id=concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an attribute</dfn>, it means doing this:</p>

  <ol><li><p>If the byte at <var title="">position</var> is one of 0x09
   (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR),
   0x20 (ASCII space), or 0x2F (ASCII /) then advance <var title="">position</var> to the next byte and redo this
   step.</li>

   <li><p>If the byte at <var title="">position</var> is 0x3E (ASCII
   &gt;), then abort the <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
   attribute</a> algorithm. There isn't one.</li>

   <li><p>Otherwise, the byte at <var title="">position</var> is the
   start of the attribute name. Let <var title="">attribute name</var>
   and <var title="">attribute value</var> be the empty
   string.</li>

   <li><p>Process the byte at <var title="">position</var> as follows:</p>

    <dl class=switch><dt>If it is 0x3D (ASCII =), and the <var title="">attribute
     name</var> is longer than the empty string</dt>

     <dd>Advance <var title="">position</var> to the next byte and
     jump to the step below labeled <i>value</i>.</dd>

     <dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII
     FF), 0x0D (ASCII CR), or 0x20 (ASCII space)</dt>

     <dd>Jump to the step below labeled <i>spaces</i>.</dd>

     <dt>If it is 0x2F (ASCII /) or 0x3E (ASCII &gt;)</dt>

     <dd>Abort the <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
     attribute</a> algorithm. The attribute's name is the value of
     <var title="">attribute name</var>, its value is the empty
     string.</dd>

     <dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII
     Z)</dt>

     <dd>Append the Unicode character with code point <span title=""><var title="">b</var>+0x20</span> to <var title="">attribute name</var> (where <var title="">b</var> is
     the value of the byte at <var title="">position</var>). (This
     converts the input to lowercase.)</dd>

     <dt>Anything else</dt>

     <dd>Append the Unicode character with the same code point as the
     value of the byte at <var title="">position</var> to <var title="">attribute name</var>. (It doesn't actually matter how
     bytes outside the ASCII range are handled here, since only
     ASCII characters can contribute to the detection of a character
     encoding.)</dd>

    </dl></li>

   <li><p>Advance <var title="">position</var> to the next byte and
   return to the previous step.</li>

   <li><p><i>Spaces</i>: If the byte at <var title="">position</var> is one of 0x09 (ASCII TAB), 0x0A (ASCII
   LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then
   advance <var title="">position</var> to the next byte, then,
   repeat this step.</li>

   <li><p>If the byte at <var title="">position</var> is <em>not</em>
   0x3D (ASCII =), abort the <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
   attribute</a> algorithm. The attribute's name is the value of
   <var title="">attribute name</var>, its value is the empty
   string.</li>

   <li><p>Advance <var title="">position</var> past the 0x3D (ASCII
   =) byte.</li>

   <li><p><i>Value</i>: If the byte at <var title="">position</var> is one of 0x09 (ASCII TAB), 0x0A (ASCII
   LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then
   advance <var title="">position</var> to the next byte, then,
   repeat this step.</li>

   <li><p>Process the byte at <var title="">position</var> as
   follows:</p>

    <dl class=switch><dt>If it is 0x22 (ASCII ") or 0x27 (ASCII ')</dt>

     <dd>

      <ol><li>Let <var title="">b</var> be the value of the byte at
       <var title="">position</var>.</li>

       <li><i>Quote loop</i>: Advance <var title="">position</var> to
       the next byte.</li>

       <li>If the value of the byte at <var title="">position</var> is
       the value of <var title="">b</var>, then advance <var title="">position</var> to the next byte and abort the "get an
       attribute" algorithm. The attribute's name is the value of <var title="">attribute name</var>, and its value is the value of
       <var title="">attribute value</var>.</li>

       <li>Otherwise, if the value of the byte at <var title="">position</var> is in the range 0x41 (ASCII A) to 0x5A
       (ASCII Z), then append a Unicode character to <var title="">attribute value</var> whose code point is 0x20 more
       than the value of the byte at <var title="">position</var>.</li>

       <li>Otherwise, append a Unicode character to <var title="">attribute value</var> whose code point is the same as
       the value of the byte at <var title="">position</var>.</li>

       <li>Return to the step above labeled <i>quote loop</i>.</li>

      </ol></dd>

     <dt>If it is 0x3E (ASCII &gt;)</dt>

     <dd>Abort the <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
     attribute</a> algorithm. The attribute's name is the value of
     <var title="">attribute name</var>, its value is the empty
     string.</dd>


     <dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII
     Z)</dt>

     <dd>Append the Unicode character with code point <span title=""><var title="">b</var>+0x20</span> to <var title="">attribute value</var> (where <var title="">b</var> is
     the value of the byte at <var title="">position</var>). Advance
     <var title="">position</var> to the next byte.</dd>

     <dt>Anything else</dt>

     <dd>Append the Unicode character with the same code point as the
     value of the byte at <var title="">position</var> to <var title="">attribute value</var>. Advance <var title="">position</var> to the next byte.</dd>

    </dl></li>

   <li><p>Process the byte at <var title="">position</var> as
   follows:</p>

    <dl class=switch><dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII
     FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x3E (ASCII
     &gt;)</dt>

     <dd>Abort the <a href=#concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an
     attribute</a> algorithm. The attribute's name is the value of
     <var title="">attribute name</var> and its value is the value of
     <var title="">attribute value</var>.</dd>

     <dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII Z)</dt>

     <dd>Append the Unicode character with code point <span title=""><var title="">b</var>+0x20</span> to <var title="">attribute value</var> (where <var title="">b</var> is
     the value of the byte at <var title="">position</var>).</dd>

     <dt>Anything else</dt>

     <dd>Append the Unicode character with the same code point as the
     value of the byte at <var title="">position</var> to <var title="">attribute value</var>.</dd>

    </dl></li>

   <li><p>Advance <var title="">position</var> to the next byte and
   return to the previous step.</li>

  </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>

<!--(removed this since the specs are being changed)
  <p class="note">These algorithms are a <span>willful
  violation</span> of the HTTP specification, which requires that the
  encoding be assumed to be ISO-8859-1 in the absence of a
  <span>character encoding declaration</span> to the contrary, and of
  RFC 2046, which requires that the encoding be assumed to be US-ASCII
  in the absence of a <span>character encoding declaration</span> to
  the contrary. This specification's third approach is motivated by a
  desire to be maximally compatible with legacy content. <a
  href="#refsHTTP">[HTTP]</a> <a href="#refsRFC2046">[RFC2046]</a></p>
-->



  <h5 id=character-encodings><span class=secno>12.2.2.3 </span>Character encodings</h5>

  <p>User agents must support the encodings defined in the WHATWG Encoding standard. User agents
  should not support other encodings.</p>

  <p>User agents must not support the CESU-8, UTF-7, BOCU-1 and SCSU encodings. <a href=#refsCESU8>[CESU8]</a> <a href=#refsUTF7>[UTF7]</a> <a href=#refsBOCU1>[BOCU1]</a> <a href=#refsSCSU>[SCSU]</a></p>

  <p>Support for encodings based on EBCDIC is especially discouraged. This encoding is rarely used
  for publicly-facing Web content. Support for UTF-32 is also especially discouraged. This encoding
  is rarely used, and frequently implemented incorrectly.</p>

  <p class=note>This specification does not make any attempt to support EBCDIC-based encodings and
  UTF-32 in its algorithms; support and use of these encodings can thus lead to unexpected behavior
  in implementations of this specification.</p>


  <h5 id=changing-the-encoding-while-parsing><span class=secno>12.2.2.4 </span>Changing the encoding while parsing</h5>

  <p>When the parser requires the user agent to <dfn id=change-the-encoding>change the encoding</dfn>, it must run the
  following steps. This might happen if the <a href=#encoding-sniffing-algorithm>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>If the encoding that is already being used to interpret the
   input stream is <a href=#a-utf-16-encoding>a UTF-16 encoding</a>, then set the <a href=#concept-encoding-confidence title=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>

   <li>If the new encoding is <a href=#a-utf-16-encoding>a UTF-16 encoding</a>, change
   it to UTF-8.</li>

   <li>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 title=concept-encoding-confidence>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>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>

   <li>If all the bytes up to the last byte converted by the current
   decoder have the same Unicode interpretations in both the current
   encoding and the new encoding, and if the user agent supports
   changing the converter on the fly, then the user agent may change
   to the new converter for the encoding on the fly. Set the
   <a href="#document's-character-encoding">document's character encoding</a> and the encoding used to
   convert the input stream to the new encoding, set the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
   <i>certain</i>, and abort these steps.</li>

   <li>Otherwise, <a href=#navigate>navigate</a><!--DONAV reparse--> to the
   document again, with <a href=#replacement-enabled>replacement enabled</a>, and using
   the same <a href=#source-browsing-context>source browsing context</a>, but this time skip
   the <a href=#encoding-sniffing-algorithm>encoding sniffing algorithm</a> and instead just set
   the encoding to the new encoding and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> to
   <i>certain</i>. Whenever possible, this should be done without
   actually contacting the network layer (the bytes should be
   re-parsed from memory), even if, e.g., the document is marked as
   not being cacheable. If this is not possible and contacting the
   network layer would involve repeating a request that uses a method
   other than HTTP GET (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or
   equivalent</a> for non-HTTP URLs), then instead set the <a href=#concept-encoding-confidence title=concept-encoding-confidence>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.</li>

  </ol><h5 id=preprocessing-the-input-stream><span class=secno>12.2.2.5 </span>Preprocessing the input stream</h5>
<!--CLEANUP-->

  <p>The <dfn id=input-stream>input stream</dfn> consists of the characters pushed
  into it as the <a href=#the-input-byte-stream>input byte stream</a> is decoded or from the
  various APIs that directly manipulate the input stream.</p>

  <p>One leading U+FEFF BYTE ORDER MARK character must be ignored if
  any are present in the <a href=#input-stream>input stream</a>.</p>

  <p class=note>The requirement to strip a U+FEFF BYTE ORDER MARK
  character regardless of whether that character was used to determine
  the byte order is a <a href=#willful-violation>willful violation</a> of Unicode,
  motivated by a desire to increase the resilience of user agents in
  the face of na&iuml;ve transcoders.</p>

  <p>Any occurrences of any characters in the ranges U+0001 to U+0008,
  <!-- HT, LF allowed --> <!-- U+000B is in the next list --> <!-- FF,
  CR allowed --> U+000E to U+001F, <!-- ASCII allowed --> U+007F
  <!--to U+0084, (U+0085 NEL not allowed), U+0086--> to U+009F, U+FDD0
  to U+FDEF, and characters U+000B, U+FFFE, U+FFFF, U+1FFFE, U+1FFFF,
  U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE,
  U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF,
  U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE,
  U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF,
  U+10FFFE, and U+10FFFF are <a href=#parse-error title="parse error">parse
  errors</a>. These are all control characters or permanently
  undefined Unicode characters (noncharacters).</p>

  <p>U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF)
  characters are treated specially. All CR characters must be
  converted to LF characters, and any LF characters that immediately
  follow a CR character must be ignored. Thus, newlines in HTML DOMs
  are represented by LF characters, and there are never any CR
  characters in the input to the <a href=#tokenization>tokenization</a> stage.</p>

  <p>The <dfn id=next-input-character>next input character</dfn> is the first character in the
  <a href=#input-stream>input stream</a> that has not yet been <dfn id=consumed>consumed</dfn>
  or explicitly ignored by the requirements in this section.
  Initially, the <i><a href=#next-input-character>next input character</a></i> is the first character in
  the input. The <dfn id=current-input-character>current input character</dfn> is the last
  character to have been <i><a href=#consumed>consumed</a></i>.</p>

  <p>The <dfn id=insertion-point>insertion point</dfn> is the position (just before a
  character or just before the end of the input stream) where content
  inserted using <code title=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>input stream</a>. If the parser
  is a <a href=#script-created-parser>script-created parser</a>, then the end of the
  <a href=#input-stream>input stream</a> is reached when an <dfn id=explicit-eof-character>explicit "EOF"
  character</dfn> (inserted by the <code title=dom-document-close><a href=#dom-document-close>document.close()</a></code> method) is
  consumed. Otherwise, the "EOF" character is not a real character in
  the stream, but rather the lack of any further characters.</p>

  <p class=note>The handling of U+0000 NULL characters varies based on where the characters are
  found. In general, they are ignored except where doing so could plausibly introduce an attack
  vector. This handling is, by necessity, spread across both the tokenization stage and the tree
  construction stage.</p>

  </div>


  <div class=impl>
<!--CLEANUP-->

  <h4 id=parse-state><span class=secno>12.2.3 </span>Parse state</h4>

  <h5 id=the-insertion-mode><span class=secno>12.2.3.1 </span>The insertion mode</h5>

  <p>The <dfn id=insertion-mode>insertion mode</dfn> is a state variable that controls
  the primary operation of the tree construction stage.</p>

  <p>Initially, the <a href=#insertion-mode>insertion mode</a> is "<a href=#the-initial-insertion-mode title="insertion mode: initial">initial</a>". It can change to
  "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>",
  "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before head</a>",
  "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>", "<a href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in head noscript</a>",
  "<a href=#the-after-head-insertion-mode title="insertion mode: after head">after head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>", "<a href=#parsing-main-incdata title="insertion mode: text">text</a>", "<a href=#parsing-main-intable title="insertion
  mode: in table">in table</a>", "<a href=#parsing-main-intabletext title="insertion mode: in
  table text">in table text</a>", "<a href=#parsing-main-incaption title="insertion mode: in
  caption">in caption</a>", "<a href=#parsing-main-incolgroup title="insertion mode: in column
  group">in column group</a>", "<a href=#parsing-main-intbody title="insertion mode: in
  table body">in table body</a>", "<a href=#parsing-main-intr title="insertion mode: in
  row">in row</a>", "<a href=#parsing-main-intd title="insertion mode: in cell">in
  cell</a>", "<a href=#parsing-main-inselect title="insertion mode: in select">in
  select</a>", "<a href=#parsing-main-inselectintable title="insertion mode: in select in table">in
  select in table</a>", "<a href=#parsing-main-intemplate title="insertion mode: in template">in
  template</a>", "<a href=#parsing-main-afterbody title="insertion mode: after
  body">after body</a>", "<a href=#parsing-main-inframeset title="insertion mode: in
  frameset">in frameset</a>", "<a href=#parsing-main-afterframeset title="insertion mode: after
  frameset">after frameset</a>", "<a href=#the-after-after-body-insertion-mode title="insertion mode:
  after after body">after after body</a>", and "<a href=#the-after-after-frameset-insertion-mode title="insertion mode: after after frameset">after after
  frameset</a>" during the course of the parsing, as described in
  the <a href=#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 title="insertion mode: in
  head">in head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in
  body</a>", "<a href=#parsing-main-intable title="insertion mode: in table">in
  table</a>", and "<a href=#parsing-main-inselect title="insertion mode: in select">in
  select</a>", are special, in that the other modes defer to them
  at various times. When the algorithm below says that the user agent
  is to do something "<dfn id=using-the-rules-for>using the rules for</dfn> the <var title="">m</var> insertion mode", where <var title="">m</var> is one
  of these modes, the user agent must use the rules described under
  the <var title="">m</var> <a href=#insertion-mode>insertion mode</a>'s section, but
  must leave the <a href=#insertion-mode>insertion mode</a> unchanged unless the
  rules in <var title="">m</var> themselves switch the <a href=#insertion-mode>insertion
  mode</a> to a new value.</p>

  <p>When the insertion mode is switched to "<a href=#parsing-main-incdata title="insertion
  mode: text">text</a>" or "<a href=#parsing-main-intabletext title="insertion mode: in table
  text">in table text</a>", the <dfn id=original-insertion-mode>original insertion mode</dfn>
  is also set. This is the insertion mode to which the tree
  construction stage will return.</p>

  <p>Similarly, to parse nested <code><a href=#the-template-element>template</a></code> elements, a <dfn id=stack-of-template-insertion-modes>stack of template insertion
  modes</dfn> is used. It is initially empty. The <dfn id=current-template-insertion-mode>current template insertion mode</dfn> is the
  insertion mode that was most recently added to the <a href=#stack-of-template-insertion-modes>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><!--CLEANUP--><!--<p>s--><p>When the steps below require the UA to <dfn id=reset-the-insertion-mode-appropriately>reset the insertion
  mode appropriately</dfn>, it means the UA must follow these
  steps:</p>

  <ol><li>Let <var title="">last</var> be false.</li>

   <li>Let <var title="">node</var> be the last node in the
   <a href=#stack-of-open-elements>stack of open elements</a>.</li>

   <li><i>Loop</i>: If <var title="">node</var> is the first node in
   the stack of open elements, then set <var title="">last</var> to
   true and set <var title="">node</var> to the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element.
   (<a href=#fragment-case>fragment case</a>)</li>

   <li>

    <p>If <var title="">node</var> is a <code><a href=#the-select-element>select</a></code> element, run these substeps:</p>

    <ol><li><p>If <var title="">last</var> is true, jump to the step below labeled
     <i>done</i>.</li>

     <li><p>Let <var title="">ancestor</var> be <var title="">node</var>.</li>

     <li><p><i>Loop</i>: If <var title="">ancestor</var> is the first node in the <a href=#stack-of-open-elements>stack of open
     elements</a>, jump to the step below labeled <i>done</i>.</li>

     <li><p>Let <var title="">ancestor</var> be the node before <var title="">ancestor</var> in the
     <a href=#stack-of-open-elements>stack of open elements</a>.</li>

     <li><p>If <var title="">ancestor</var> is a <code><a href=#the-template-element>template</a></code> node, jump to the step below
     labeled <i>done</i>.</li>

     <li><p>If <var title="">ancestor</var> is a <code><a href=#the-table-element>table</a></code> node, switch the <a href=#insertion-mode>insertion
     mode</a> to "<a href=#parsing-main-inselectintable title="insertion mode: in select in table">in select in table</a>" and
     abort these steps.</li>
      <!-- consider <table><tr><td><select><template></template><caption></table>
           http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2374 -->

     <li><p>Jump back to the step labeled <i>loop</i>.</li>

     <li><p><i>Done</i>: Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inselect title="insertion mode: in
     select">in select</a>" and abort these steps.</li>

    </ol></li>

   <li>If <var title="">node</var> is a <code><a href=#the-td-element>td</a></code> or
   <code><a href=#the-th-element>th</a></code> element and <var title="">last</var> is false, then
   switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intd title="insertion
   mode: in cell">in cell</a>" and abort these steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#the-tr-element>tr</a></code> element, then
   switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion
   mode: in row">in row</a>" and abort these steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#the-tbody-element>tbody</a></code>,
   <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tfoot-element>tfoot</a></code> element, then switch the
   <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in
   table body">in table body</a>" and abort these steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#the-caption-element>caption</a></code> element,
   then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>" and abort
   these steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#the-colgroup-element>colgroup</a></code> element,
   then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>" and
   abort these steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#the-table-element>table</a></code> element,
   then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" and abort these
   steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#the-template-element>template</a></code> element, then switch the
   <a href=#insertion-mode>insertion mode</a> to the <a href=#current-template-insertion-mode>current template insertion mode</a> and abort these
   steps.</li>

<!--
   <li>If <var title="">node</var> is a <code>head</code> element
   and <var title="">last</var> is true,
   then switch the <span>insertion mode</span> to "<span
   title="insertion mode: in body">in body</span>" ("<span
   title="insertion mode: in body">in body</span>"! <em> not "<span
   title="insertion mode: in head">in head</span>"</em>!) and abort
   these steps. (<span>fragment case</span>)</li>
--><!-- The above is only here in case people think that the spec accidentally omitted it and try to
        "fix" it. Note that noscript-in-head is also handled this way. This is all intentional. The
        only thing it doesn't handle is the scripting-disabled fragment parsing case for a <head>
        element containing a <noscript> which itself contains something other than a <link> or a
        <style> element; you'd expect that to break out of the <noscript> but it doesn't. This is an
        edge case that doesn't affect the spec, since the algorithm for fragment parsing is only
        used for innerHTML/outerHTML/insertAdjacentHTML(), where we know scripting is enabled. -->

   <li>If <var title="">node</var> is a <code><a href=#the-head-element>head</a></code> element and <var title="">last</var> is
   false, then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in
   head</a>" and abort these steps.</li> <!-- for the case of <head><template></template>... -->

   <li>If <var title="">node</var> is a <code><a href=#the-body-element>body</a></code> element,
   then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" and abort these
   steps.</li>

   <li>If <var title="">node</var> is a <code><a href=#frameset>frameset</a></code> element,
   then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>" and abort
   these steps. (<a href=#fragment-case>fragment case</a>)</li>

   <li>If <var title="">node</var> is an <code><a href=#the-html-element>html</a></code> element,
   then switch the <a href=#insertion-mode>insertion mode</a>
   to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before
   head</a>" and abort these steps. (<a href=#fragment-case>fragment
   case</a>)</li>

   <li>If <var title="">last</var> is true, then switch the
   <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in
   body">in body</a>" and abort these steps. (<a href=#fragment-case>fragment
   case</a>)</li>

   <li>Let <var title="">node</var> now be the node before <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
   elements</a>.</li>

   <li>Return to the step labeled <i>loop</i>.</li>

  </ol><h5 id=the-stack-of-open-elements><span class=secno>12.2.3.2 </span>The stack of open elements</h5>

  <p>Initially, the <dfn id=stack-of-open-elements>stack of open elements</dfn> is empty. The stack grows downwards; the
  topmost node on the stack is the first one added to the stack, and the bottommost node of the
  stack is the most recently added node in the stack (notwithstanding when the stack is manipulated
  in a random access fashion as part of <a href=#adoptionAgency>the handling for misnested
  tags</a>).</p>

  <p class=note>The "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>" <a href=#insertion-mode>insertion
  mode</a> creates the <code><a href=#the-html-element>html</a></code> root element node, which is then added to the stack.</p>

  <p class=note>In the <a href=#fragment-case>fragment case</a>, the <a href=#stack-of-open-elements>stack of open elements</a> is
  initialized to contain an <code><a href=#the-html-element>html</a></code> element that is created as part of <a href=#html-fragment-parsing-algorithm title="html
  fragment parsing algorithm">that algorithm</a>. (The <a href=#fragment-case>fragment case</a> skips the
  "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>" <a href=#insertion-mode>insertion mode</a>.)</p>

  <p>The <code><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 title="stop parsing">finishes</a>.</p>

  <p>The <dfn id=current-node>current node</dfn> is the bottommost node in this <a href=#stack-of-open-elements>stack of open
  elements</a>.</p>

  <p>The <dfn id=adjusted-current-node>adjusted current node</dfn> is the <i title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></i>
  element if the <a href=#stack-of-open-elements>stack of open elements</a> has only one element in it and the parser was
  created by the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a>; otherwise, the <a href=#adjusted-current-node>adjusted current
  node</a> is the <a href=#current-node>current node</a>.</p>

  <p>Elements in the <a href=#stack-of-open-elements>stack of open elements</a> fall into the following categories:</p>

  <dl><dt><dfn id=special>Special</dfn></dt>
<!--CLEANUP-->
   <dd><p>The following elements have varying levels of special parsing rules: HTML's
   <code><a href=#the-address-element>address</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#the-article-element>article</a></code>,
   <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-base-element>base</a></code>, <code><a href=#basefont>basefont</a></code>, <code><a href=#bgsound>bgsound</a></code>,
   <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#the-body-element>body</a></code>, <code><a href=#the-br-element>br</a></code>, <code><a href=#the-button-element>button</a></code>,
   <code><a href=#the-caption-element>caption</a></code>, <code><a href=#center>center</a></code>, <code><a href=#the-col-element>col</a></code>, <code><a href=#the-colgroup-element>colgroup</a></code>,
   <code><a href=#the-dd-element>dd</a></code>, <code><a href=#the-details-element>details</a></code>, <code><a href=#dir>dir</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-dl-element>dl</a></code>,
   <code><a href=#the-dt-element>dt</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>, <code><a href=#the-figcaption-element>figcaption</a></code>,
   <code><a href=#the-figure-element>figure</a></code>, <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
   <code><a href=#frameset>frameset</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>,
   <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code><a href=#the-head-element>head</a></code>, <code><a href=#the-header-element>header</a></code>, <code><a href=#the-hgroup-element>hgroup</a></code>,
   <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-html-element>html</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <!-- <code>image</code>, (commented out
   because this isn't an element that can end up on the stack, so it doesn't matter) -->
   <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#isindex-0>isindex</a></code>, <code><a href=#the-li-element>li</a></code>, <code><a href=#the-link-element>link</a></code>,
   <code><a href=#listing>listing</a></code>, <code><a href=#the-main-element>main</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-menu-element>menu</a></code>,
   <code><a href=#the-menuitem-element>menuitem</a></code>, <code><a href=#the-meta-element>meta</a></code>, <code><a href=#the-nav-element>nav</a></code>, <code><a href=#noembed>noembed</a></code>,
   <code><a href=#noframes>noframes</a></code>, <code><a href=#the-noscript-element>noscript</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-ol-element>ol</a></code>,
   <code><a href=#the-p-element>p</a></code>, <code><a href=#the-param-element>param</a></code>, <code><a href=#plaintext>plaintext</a></code>, <code><a href=#the-pre-element>pre</a></code>,
   <code><a href=#the-script-element>script</a></code>, <code><a href=#the-section-element>section</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-source-element>source</a></code>,
   <code><a href=#the-style-element>style</a></code>, <code><a href=#the-summary-element>summary</a></code>, <code><a href=#the-table-element>table</a></code>, <code><a href=#the-tbody-element>tbody</a></code>,
   <code><a href=#the-td-element>td</a></code>, <code><a href=#the-template-element>template</a></code>, <code><a href=#the-textarea-element>textarea</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-th-element>th</a></code>, <code><a href=#the-thead-element>thead</a></code>,
   <code><a href=#the-title-element>title</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-track-element>track</a></code>, <code><a href=#the-ul-element>ul</a></code>, <code><a href=#the-wbr-element>wbr</a></code>, and
   <code><a href=#xmp>xmp</a></code>; MathML's <code title="">mi</code>, <code title="">mo</code>, <code title="">mn</code>, <code title="">ms</code>, <code title="">mtext</code>, and <code title="">annotation-xml</code>; and SVG's <code title="">foreignObject</code>, <code title="">desc</code>, and <code title="">title</code>.</dd> <!-- we could actually put all
   non-HTML elements in this list, I think -->

   <dt><dfn id=formatting>Formatting</dfn></dt>
   <dd><p>The following HTML elements are those that end up in the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a>: <code><a href=#the-a-element>a</a></code>, <code><a href=#the-b-element>b</a></code>, <code><a href=#big>big</a></code>, <code><a href=#the-code-element>code</a></code>,
   <code><a href=#the-em-element>em</a></code>, <code><a href=#font>font</a></code>, <code><a href=#the-i-element>i</a></code>, <code><a href=#nobr>nobr</a></code>, <code><a href=#the-s-element>s</a></code>,
   <code><a href=#the-small-element>small</a></code>, <code><a href=#strike>strike</a></code>, <code><a href=#the-strong-element>strong</a></code>, <code><a href=#tt>tt</a></code>, and
   <code><a href=#the-u-element>u</a></code>.</dd>

   <dt><dfn id=ordinary>Ordinary</dfn></dt>
   <dd><p>All other elements found while parsing an HTML document.</dd>

  </dl><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-the-specific-scope title="has an element in the specific
  scope">have an element in a specific scope</dfn> consisting of a list of element types <var title="">list</var> when the following algorithm terminates in a match state:</p>

  <ol><li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current node</a> (the bottommost
   node of the stack).</li>

   <li><p>If <var title="">node</var> is the target node, terminate in a match state.</li>

   <li><p>Otherwise, if <var title="">node</var> is one of the element types in <var title="">list</var>, terminate in a failure state.</li>

   <li><p>Otherwise, set <var title="">node</var> to the previous entry in the <a href=#stack-of-open-elements>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 &mdash; an <code><a href=#the-html-element>html</a></code> element &mdash; is
   reached.)</li>

  </ol><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-scope title="has an element in scope">have an
  element in scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific scope</a> consisting of the
  following element types:</p>

  <ul class=brief><li><code><a href=#the-applet-element>applet</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-caption-element>caption</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-html-element>html</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li> <!-- (This can only happen if the <var title="">node</var> is the topmost node of the <span>stack of open elements</span>, and prevents the next step from being invoked if there are no more elements in the stack.) -->
   <li><code><a href=#the-table-element>table</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-td-element>td</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-th-element>th</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-marquee-element>marquee</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-object-element>object</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-template-element>template</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code title="">mi</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li><code title="">mo</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li><code title="">mn</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li><code title="">ms</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li><code title="">mtext</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li><code title="">annotation-xml</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li><code title="">foreignObject</code> in the <a href=#svg-namespace>SVG namespace</a></li>
   <li><code title="">desc</code> in the <a href=#svg-namespace>SVG namespace</a></li>
   <li><code title="">title</code> in the <a href=#svg-namespace>SVG namespace</a></li>
  </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-list-item-scope title="has an element in list item
  scope">have an element in list item scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
  scope</a> consisting of the following element types:</p>

  <ul class=brief><li>All the element types listed above for the <i><a href=#has-an-element-in-scope>has an element
   in scope</a></i> algorithm.</li>
   <li><code><a href=#the-ol-element>ol</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-ul-element>ul</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
  </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-button-scope title="has an element in button
  scope">have an element in button scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
  scope</a> consisting of the following element types:</p>

  <ul class=brief><li>All the element types listed above for the <i><a href=#has-an-element-in-scope>has an element
   in scope</a></i> algorithm.</li>
   <li><code><a href=#the-button-element>button</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
  </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-table-scope title="has an element in table
  scope">have an element in table scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
  scope</a> consisting of the following element types:</p>

  <ul class=brief><li><code><a href=#the-html-element>html</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li> <!-- (This can only happen if the <var title="">node</var> is the topmost node of the <span>stack of open elements</span>, and prevents the next step from being invoked if there are no more elements in the stack.) -->
   <li><code><a href=#the-table-element>table</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-template-element>template</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
  </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-select-scope title="has an element in select
  scope">have an element in select scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
  scope</a> consisting of all element types <em>except</em> the following:</p>

  <ul class=brief><!--<li><code>select</code> in the <span>HTML namespace</span></li>--><li><code><a href=#the-optgroup-element>optgroup</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   <li><code><a href=#the-option-element>option</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
  </ul><p>Nothing happens if at any time any of the elements in the <a href=#stack-of-open-elements>stack of open elements</a>
  are moved to a new location in, or removed from, the <code><a href=#document>Document</a></code> tree. In particular,
  the stack is not changed in this situation. This can cause, amongst other strange effects, content
  to be appended to nodes that are no longer in the DOM.</p>

  <p class=note>In some cases (namely, when <a href=#adoptionAgency>closing misnested formatting
  elements</a>), the stack is manipulated in a random-access fashion.</p>


  <h5 id=the-list-of-active-formatting-elements><span class=secno>12.2.3.3 </span>The list of active formatting elements</h5>

  <p>Initially, the <dfn id=list-of-active-formatting-elements>list of active formatting elements</dfn> is
  empty. It is used to handle mis-nested <a href=#formatting title=formatting>formatting element tags</a>.</p>

  <p>The list contains elements in the <a href=#formatting>formatting</a>
  category, and scope markers. The scope markers are inserted when
  entering <code><a href=#the-applet-element>applet</a></code> elements, buttons, <code><a href=#the-object-element>object</a></code>
  elements, marquees, table cells, and table captions, and are used to
  prevent formatting from "leaking" <em>into</em> <code><a href=#the-applet-element>applet</a></code>
  elements, buttons, <code><a href=#the-object-element>object</a></code> elements, marquees, and
  tables.</p>

  <p class=note>The scope markers are unrelated to the concept of an
  element being <a href=#has-an-element-in-scope title="has an element in scope">in
  scope</a>.</p>

  <p>In addition, each element in the <a href=#list-of-active-formatting-elements>list of active formatting
  elements</a> is associated with the token for which it was
  created, so that further elements can be created for that token if
  necessary.</p>

  <p>When the steps below require the UA to <dfn id=push-onto-the-list-of-active-formatting-elements>push onto the list of
  active formatting elements</dfn> an element <var title="">element</var>, the UA must perform the following steps:</p>

  <ol id=noah><li><p>If there are already three elements in the <a href=#list-of-active-formatting-elements>list of
   active formatting elements</a> after the last list marker, if
   any, or anywhere in the list if there are no list markers, that
   have the same tag name, namespace, and attributes as <var title="">element</var>, then remove the earliest such element from
   the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>. For these
   purposes, the attributes must be compared as they were when the
   elements were created by the parser; two elements have the same
   attributes if all their parsed attributes can be paired such that
   the two attributes in each pair have identical names, namespaces,
   and values (the order of the attributes does not matter).</p>

   <p class=note>This is the Noah's Ark clause. But with three per
   family instead of two.</li> <!-- A sort of polyamorous Noah's
   Ark, if you will. -->

   <li><p>Add <var title="">element</var> to the <a href=#list-of-active-formatting-elements>list of active
   formatting elements</a>.</li>

  </ol><p>When the steps below require the UA to <dfn id=reconstruct-the-active-formatting-elements>reconstruct the
  active formatting elements</dfn>, the UA must perform the following
  steps:</p>

  <ol><!--CLEANUP--><!--<p>s--><li>If there are no entries in the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a>, then there is nothing to reconstruct; stop this
   algorithm.</li>

   <li>If the last (most recently added) entry in the <a href=#list-of-active-formatting-elements>list of
   active formatting elements</a> is a marker, or if it is an
   element that is in the <a href=#stack-of-open-elements>stack of open elements</a>, then
   there is nothing to reconstruct; stop this algorithm.</li>

   <li>Let <var title="">entry</var> be the last (most recently added)
   element in the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a>.</li>

   <li><i>Rewind</i>: If there are no entries before <var title="">entry</var> in the
   <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, then jump to the step
   labeled <i>create</i>.</li>

   <li>Let <var title="">entry</var> be the entry one earlier than
   <var title="">entry</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a>.</li>

   <li>If <var title="">entry</var> is neither a marker nor an element
   that is also in the <a href=#stack-of-open-elements>stack of open elements</a>, go to the step labeled
   <i>rewind</i>.</li>

   <li><i>Advance</i>: Let <var title="">entry</var> be the element one later than
   <var title="">entry</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a>.</li>

   <li><i>Create</i>: <a href=#insert-an-html-element>Insert an HTML element</a> for the token for which the element <var title="">entry</var> was created, to obtain <var title="">new element</var>.</li>

   <li>Replace the entry for <var title="">entry</var> in the list
   with an entry for <var title="">new element</var>.</li>

   <li>If the entry for <var title="">new element</var> in the
   <a href=#list-of-active-formatting-elements>list of active formatting elements</a> is not the last
   entry in the list, return to the step labeled <i>advance</i>.</li>

  </ol><p>This has the effect of reopening all the formatting elements that
  were opened in the current body, cell, or caption (whichever is
  youngest) that haven't been explicitly closed.</p>

  <p class=note>The way this specification is written, the
  <a href=#list-of-active-formatting-elements>list of active formatting elements</a> always consists of
  elements in chronological order with the least recently added
  element first and the most recently added element last (except for
  while steps 8 to 11 of the above algorithm are being executed, of
  course).</p>

  <p>When the steps below require the UA to <dfn id=clear-the-list-of-active-formatting-elements-up-to-the-last-marker>clear the list of
  active formatting elements up to the last marker</dfn>, the UA must
  perform the following steps:</p>

  <ol><li>Let <var title="">entry</var> be the last (most recently added)
   entry in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>

   <li>Remove <var title="">entry</var> from the <a href=#list-of-active-formatting-elements>list of active
   formatting elements</a>.</li>

   <li>If <var title="">entry</var> was a marker, then stop the
   algorithm at this point. The list has been cleared up to the last
   marker.</li>

   <li>Go to step 1.</li>

  </ol><h5 id=the-element-pointers><span class=secno>12.2.3.4 </span>The element pointers</h5>

  <p>Initially, the <dfn id=head-element-pointer><code title="">head</code> element
  pointer</dfn> and the <dfn id=form-element-pointer><code title="">form</code> element
  pointer</dfn> are both null.</p>

  <p>Once a <code><a href=#the-head-element>head</a></code> element has been parsed (whether
  implicitly or explicitly) the <a href=#head-element-pointer><code title="">head</code>
  element pointer</a> gets set to point to this node.</p>

  <p>The <a href=#form-element-pointer><code title="">form</code> element pointer</a>
  points to the last <code><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.</p>


  <h5 id=other-parsing-state-flags><span class=secno>12.2.3.5 </span>Other parsing state flags</h5>

  <p>The <dfn id=scripting-flag>scripting flag</dfn> is set to "enabled" if <a href=#concept-n-script title=concept-n-script>scripting was enabled</a> for the
  <code><a href=#document>Document</a></code> with which the parser is associated when the
  parser was created, and "disabled" otherwise.</p>

  <p class=note>The <a href=#scripting-flag>scripting flag</a> can be enabled even
  when the parser was originally created for the <a href=#html-fragment-parsing-algorithm>HTML fragment
  parsing algorithm</a>, even though <code><a href=#the-script-element>script</a></code> elements
  don't execute in that case.</p>

  <p>The <dfn id=frameset-ok-flag>frameset-ok flag</dfn> is set to "ok" when the parser is
  created. It is set to "not ok" after certain tokens are seen.</p>

  </div>


  <div class=impl>

  <h4 id=tokenization><span class=secno>12.2.4 </span><dfn>Tokenization</dfn></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>data state</a>. Most states consume a single character,
  which may have various side-effects, and either switches the state
  machine to a new state to <i>reconsume</i> the same character, or
  switches it to a new state to consume the next character, or stays
  in the same state to consume the next character. Some states have
  more complicated behavior and can consume several characters before
  switching to another state. In some cases, the tokenizer state is
  also changed by the tree construction stage.</p>

  <p>The exact behavior of certain states depends on the
  <a href=#insertion-mode>insertion mode</a> and the <a href=#stack-of-open-elements>stack of open
  elements</a>. Certain states also use a <dfn id=temporary-buffer><var>temporary
  buffer</var></dfn> to track progress.</p>

  <p>The output of the tokenization step is a series of zero or more
  of the following tokens: DOCTYPE, start tag, end tag, comment,
  character, end-of-file. DOCTYPE tokens have a name, a public
  identifier, a system identifier, and a <i>force-quirks
  flag</i>. 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>force-quirks
  flag</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
  <i>self-closing flag</i>, 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>self-closing flag</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>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><a href=#the-script-element>script</a></code> element can result in scripts executing and
  using the <a href=#dynamic-markup-insertion>dynamic markup insertion</a> APIs to insert
  characters into the stream being tokenized.)</p>

  <p>When a start tag token is emitted with its <i>self-closing
  flag</i> set, if the flag is not <dfn id=acknowledge-self-closing-flag title="acknowledge
  self-closing flag">acknowledged</dfn> when it is processed by the
  tree construction stage, that is a <a href=#parse-error>parse error</a>.</p>

  <p>When an end tag token is emitted with attributes, that is a
  <a href=#parse-error>parse error</a>.</p>

  <p>When an end tag token is emitted with its <i>self-closing
  flag</i> set, that is a <a href=#parse-error>parse error</a>.</p>

  <p>An <dfn id=appropriate-end-tag-token>appropriate end tag token</dfn> is an end tag token whose
  tag name matches the tag name of the last start tag to have been
  emitted from this tokenizer, if any. If no start tag has been
  emitted from this tokenizer, then no end tag token is
  appropriate.</p>

  <p>Before each step of the tokenizer, the user agent must first
  check the <a href=#parser-pause-flag>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>


  <!-- Order of the lists below is supposed to be non-error then
  error, by unicode, then EOF, ending with "anything else" -->


  <h5 id=data-state><span class=secno>12.2.4.1 </span><dfn>Data state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href=#character-reference-in-data-state>character reference in data
   state</a>.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#tag-open-state>tag open state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=character-reference-in-data-state><span class=secno>12.2.4.2 </span><dfn>Character reference in data state</dfn></h5>

  <p>Switch to the <a href=#data-state>data state</a>.</p>

  <p>Attempt to <a href=#consume-a-character-reference>consume a character reference</a>, with no
  <a href=#additional-allowed-character>additional allowed character</a>.</p>

  <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
  token.</p>

  <p>Otherwise, emit the character tokens that were returned.</p>


  <h5 id=rcdata-state><span class=secno>12.2.4.3 </span><dfn>RCDATA state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href=#character-reference-in-rcdata-state>character reference in RCDATA
   state</a>.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#rcdata-less-than-sign-state>RCDATA less-than sign state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=character-reference-in-rcdata-state><span class=secno>12.2.4.4 </span><dfn>Character reference in RCDATA state</dfn></h5>

  <p>Switch to the <a href=#rcdata-state>RCDATA state</a>.</p>

  <p>Attempt to <a href=#consume-a-character-reference>consume a character reference</a>, with no
  <a href=#additional-allowed-character>additional allowed character</a>.</p>

  <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
  token.</p>

  <p>Otherwise, emit the character tokens that were returned.</p>


  <h5 id=rawtext-state><span class=secno>12.2.4.5 </span><dfn>RAWTEXT state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#rawtext-less-than-sign-state>RAWTEXT less-than sign state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=script-data-state><span class=secno>12.2.4.6 </span><dfn>Script data state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#script-data-less-than-sign-state>script data less-than sign state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=plaintext-state><span class=secno>12.2.4.7 </span><dfn>PLAINTEXT state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=tag-open-state><span class=secno>12.2.4.8 </span><dfn>Tag open state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0021 EXCLAMATION MARK (!)</dt>
   <dd>Switch to the <a href=#markup-declaration-open-state>markup declaration open state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href=#end-tag-open-state>end tag open state</a>.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new start tag token, set its tag name to the
   lowercase version of the <a href=#current-input-character>current input character</a> (add 0x0020 to the
   character's code point), then switch to the <a href=#tag-name-state>tag name
   state</a>. (Don't emit the token yet; further details will
   be filled in before it is emitted.)</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Create a new start tag token, set its tag name to the
   <a href=#current-input-character>current input character</a>, then switch to the <a href=#tag-name-state>tag
   name state</a>. (Don't emit the token yet; further details will
   be filled in before it is emitted.)</dd>

   <dt>U+003F QUESTION MARK (?)</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#bogus-comment-state>bogus
   comment state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit a U+003C LESS-THAN SIGN character token.
   Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=end-tag-open-state><span class=secno>12.2.4.9 </span><dfn>End tag open state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new end tag token, set its tag name to the lowercase
   version of the <a href=#current-input-character>current input character</a> (add 0x0020 to
   the character's code point), then switch to the <a href=#tag-name-state>tag name
   state</a>. (Don't emit the token yet; further details will be
   filled in before it is emitted.)</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Create a new end tag token, set its tag name to the
   <a href=#current-input-character>current input character</a>, then switch to the <a href=#tag-name-state>tag
   name state</a>. (Don't emit the token yet; further details will
   be filled in before it is emitted.)</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit a U+003C LESS-THAN SIGN character token and a
   U+002F SOLIDUS character token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#bogus-comment-state>bogus
   comment state</a>.</dd>

  </dl><h5 id=tag-name-state><span class=secno>12.2.4.10 </span><dfn>Tag name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current tag token's tag name.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   tag token's tag name.</dd>

  </dl><h5 id=rcdata-less-than-sign-state><span class=secno>12.2.4.11 </span><dfn>RCDATA less-than sign state</dfn></h5>
  <!-- identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
   to the <a href=#rcdata-end-tag-open-state>RCDATA end tag open state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#rcdata-state>RCDATA state</a>. Emit a U+003C
   LESS-THAN SIGN character token. Reconsume the <a href=#current-input-character>current
   input character</a>.</dd>

  </dl><h5 id=rcdata-end-tag-open-state><span class=secno>12.2.4.12 </span><dfn>RCDATA end tag open state</dfn></h5>
  <!-- identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href=#current-input-character>current input character</a> (add
   0x0020 to the character's code point). Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#rcdata-end-tag-name-state>RCDATA end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#rcdata-end-tag-name-state>RCDATA end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#rcdata-state>RCDATA state</a>. Emit a U+003C
   LESS-THAN SIGN character token and a U+002F SOLIDUS character token.
   Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=rcdata-end-tag-name-state><span class=secno>12.2.4.13 </span><dfn>RCDATA end tag name state</dfn></h5>
  <!-- identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#data-state>data state</a> and emit
   the current tag token. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#rcdata-state>RCDATA state</a>. Emit a U+003C
   LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
   and a character token for each of the characters in the
   <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the
   buffer). Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=rawtext-less-than-sign-state><span class=secno>12.2.4.14 </span><dfn>RAWTEXT less-than sign state</dfn></h5>
  <!-- identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
   to the <a href=#rawtext-end-tag-open-state>RAWTEXT end tag open state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#rawtext-state>RAWTEXT state</a>. Emit a U+003C
   LESS-THAN SIGN character token. Reconsume the <a href=#current-input-character>current
   input character</a>.</dd>

  </dl><h5 id=rawtext-end-tag-open-state><span class=secno>12.2.4.15 </span><dfn>RAWTEXT end tag open state</dfn></h5>
  <!-- identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href=#current-input-character>current input character</a> (add
   0x0020 to the character's code point). Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#rawtext-end-tag-name-state>RAWTEXT end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#rawtext-end-tag-name-state>RAWTEXT end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#rawtext-state>RAWTEXT state</a>. Emit a U+003C
   LESS-THAN SIGN character token and a U+002F SOLIDUS character
   token. Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=rawtext-end-tag-name-state><span class=secno>12.2.4.16 </span><dfn>RAWTEXT end tag name state</dfn></h5>
  <!-- identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#data-state>data state</a> and emit
   the current tag token. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#rawtext-state>RAWTEXT state</a>. Emit a U+003C
   LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
   and a character token for each of the characters in the
   <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the
   buffer). Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-less-than-sign-state><span class=secno>12.2.4.17 </span><dfn>Script data less-than sign state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
   to the <a href=#script-data-end-tag-open-state>script data end tag open state</a>.</dd>

   <dt>U+0021 EXCLAMATION MARK (!)</dt>
   <dd>Switch to the <a href=#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.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Emit a U+003C
   LESS-THAN SIGN character token. Reconsume the <a href=#current-input-character>current
   input character</a>.</dd>

  </dl><h5 id=script-data-end-tag-open-state><span class=secno>12.2.4.18 </span><dfn>Script data end tag open state</dfn></h5>
  <!-- identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href=#current-input-character>current input character</a> (add
   0x0020 to the character's code point). Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#script-data-end-tag-name-state>script data end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#script-data-end-tag-name-state>script data end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Emit a U+003C
   LESS-THAN SIGN character token and a U+002F SOLIDUS character token.
   Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-end-tag-name-state><span class=secno>12.2.4.19 </span><dfn>Script data end tag name state</dfn></h5>
  <!-- identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g -->

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#data-state>data state</a> and emit
   the current tag token. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Emit a U+003C
   LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
   and a character token for each of the characters in the
   <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the
   buffer). Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-escape-start-state><span class=secno>12.2.4.20 </span><dfn>Script data escape start state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#script-data-escape-start-dash-state>script data escape start dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Reconsume the
   <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-escape-start-dash-state><span class=secno>12.2.4.21 </span><dfn>Script data escape start dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#script-data-escaped-dash-dash-state>script data escaped dash dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Reconsume the
   <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-escaped-state><span class=secno>12.2.4.22 </span><dfn>Script data escaped state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#script-data-escaped-dash-state>script data escaped dash state</a>. Emit
   a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#script-data-escaped-less-than-sign-state>script data escaped less-than sign
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. <a href=#parse-error>Parse
   error</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=script-data-escaped-dash-state><span class=secno>12.2.4.23 </span><dfn>Script data escaped dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#script-data-escaped-dash-dash-state>script data escaped dash dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#script-data-escaped-less-than-sign-state>script data escaped less-than sign
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#script-data-escaped-state>script data
   escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
   token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-escaped-state>script data escaped state</a>. Emit the
   <a href=#current-input-character>current input character</a> as a character token.</dd>

  </dl><h5 id=script-data-escaped-dash-dash-state><span class=secno>12.2.4.24 </span><dfn>Script data escaped dash dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#script-data-escaped-less-than-sign-state>script data escaped less-than sign
   state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Emit a U+003E
   GREATER-THAN SIGN character token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#script-data-escaped-state>script data
   escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
   token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-escaped-state>script data escaped state</a>. Emit the
   <a href=#current-input-character>current input character</a> as a character token.</dd>

  </dl><h5 id=script-data-escaped-less-than-sign-state><span class=secno>12.2.4.25 </span><dfn>Script data escaped less-than sign state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
   to the <a href=#script-data-escaped-end-tag-open-state>script data escaped end tag open state</a>.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Append
   the lowercase version of the <a href=#current-input-character>current input character</a>
   (add 0x0020 to the character's code point) to the <var><a href=#temporary-buffer>temporary
   buffer</a></var>. Switch to the <a href=#script-data-double-escape-start-state>script data double escape start
   state</a>. Emit a U+003C LESS-THAN SIGN character token and the
   <a href=#current-input-character>current input character</a> as a character token.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Append
   the <a href=#current-input-character>current input character</a> to the <var><a href=#temporary-buffer>temporary
   buffer</a></var>. Switch to the <a href=#script-data-double-escape-start-state>script data double escape start
   state</a>. Emit a U+003C LESS-THAN SIGN character token and the
   <a href=#current-input-character>current input character</a> as a character token.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-escaped-state>script data escaped state</a>. Emit a U+003C
   LESS-THAN SIGN character token. Reconsume the <a href=#current-input-character>current
   input character</a>.</dd>

  </dl><h5 id=script-data-escaped-end-tag-open-state><span class=secno>12.2.4.26 </span><dfn>Script data escaped end tag open state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href=#current-input-character>current input character</a> (add
   0x0020 to the character's code point). Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#script-data-escaped-end-tag-name-state>script data escaped end tag name
   state</a>. (Don't emit the token yet; further details will be
   filled in before it is emitted.)</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href=#current-input-character>current input character</a>. Append the <a href=#current-input-character>current
   input character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>. Finally,
   switch to the <a href=#script-data-escaped-end-tag-name-state>script data escaped end tag name
   state</a>. (Don't emit the token yet; further details will be
   filled in before it is emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-escaped-state>script data escaped state</a>. Emit a
   U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS
   character token. Reconsume the <a href=#current-input-character>current input
   character</a>.</dd>

  </dl><h5 id=script-data-escaped-end-tag-name-state><span class=secno>12.2.4.27 </span><dfn>Script data escaped end tag name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#before-attribute-name-state>before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#self-closing-start-tag-state>self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href=#appropriate-end-tag-token>appropriate end tag
   token</a>, then switch to the <a href=#data-state>data state</a> and emit
   the current tag token. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   tag token's tag name. Append the <a href=#current-input-character>current input
   character</a> to the <var><a href=#temporary-buffer>temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-escaped-state>script data escaped state</a>. Emit a
   U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character
   token, and a character token for each of the characters in the
   <var><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the
   buffer). Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-double-escape-start-state><span class=secno>12.2.4.28 </span><dfn>Script data double escape start state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dt>U+002F SOLIDUS (/)</dt>
   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the <var><a href=#temporary-buffer>temporary buffer</a></var> is the string "<code title="">script</code>", then switch to the <a href=#script-data-double-escaped-state>script data
   double escaped state</a>. Otherwise, switch to the <a href=#script-data-escaped-state>script
   data escaped state</a>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   <var><a href=#temporary-buffer>temporary buffer</a></var>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the
   <var><a href=#temporary-buffer>temporary buffer</a></var>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-escaped-state>script data escaped state</a>. Reconsume
   the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-double-escaped-state><span class=secno>12.2.4.29 </span><dfn>Script data double escaped state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#script-data-double-escaped-dash-state>script data double escaped dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#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.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href=#current-input-character>current input character</a> as a character
   token.</dd>

  </dl><h5 id=script-data-double-escaped-dash-state><span class=secno>12.2.4.30 </span><dfn>Script data double escaped dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#script-data-double-escaped-dash-dash-state>script data double escaped dash dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#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.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#script-data-double-escaped-state>script data
   double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-double-escaped-state>script data double escaped
   state</a>. Emit the <a href=#current-input-character>current input character</a> as a
   character token.</dd>

  </dl><h5 id=script-data-double-escaped-dash-dash-state><span class=secno>12.2.4.31 </span><dfn>Script data double escaped dash dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href=#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.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#script-data-state>script data state</a>. Emit a U+003E
   GREATER-THAN SIGN character token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#script-data-double-escaped-state>script data
   double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-double-escaped-state>script data double escaped
   state</a>. Emit the <a href=#current-input-character>current input character</a> as a
   character token.</dd>

  </dl><h5 id=script-data-double-escaped-less-than-sign-state><span class=secno>12.2.4.32 </span><dfn>Script data double escaped less-than sign state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch
   to the <a href=#script-data-double-escape-end-state>script data double escape end state</a>. Emit a
   U+002F SOLIDUS character token.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-double-escaped-state>script data double escaped state</a>.
   Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=script-data-double-escape-end-state><span class=secno>12.2.4.33 </span><dfn>Script data double escape end state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dt>U+002F SOLIDUS (/)</dt>
   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the <var><a href=#temporary-buffer>temporary buffer</a></var> is the string "<code title="">script</code>", then switch to the <a href=#script-data-escaped-state>script data
   escaped state</a>. Otherwise, switch to the <a href=#script-data-double-escaped-state>script data
   double escaped state</a>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   <var><a href=#temporary-buffer>temporary buffer</a></var>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt><a href=#lowercase-ascii-letters title="lowercase ASCII letters">Lowercase ASCII letter</a></dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the
   <var><a href=#temporary-buffer>temporary buffer</a></var>. Emit the <a href=#current-input-character>current input
   character</a> as a character token.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href=#script-data-double-escaped-state>script data double escaped state</a>.
   Reconsume the <a href=#current-input-character>current input character</a>.</dd>

  </dl><h5 id=before-attribute-name-state><span class=secno>12.2.4.34 </span><dfn>Before attribute name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point), and its
   value to the empty string. Switch to the <a href=#attribute-name-state>attribute name
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Start a new attribute in the current
   tag token. Set that attribute's name to a U+FFFD REPLACEMENT
   CHARACTER character, and its value to the empty string. Switch to
   the <a href=#attribute-name-state>attribute name state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dt>U+003D EQUALS SIGN (=)</dt>
   <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the <a href=#current-input-character>current input character</a>, and
   its value to the empty string. Switch to the <a href=#attribute-name-state>attribute name
   state</a>.</dd>

  </dl><h5 id=attribute-name-state><span class=secno>12.2.4.35 </span><dfn>Attribute name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#after-attribute-name-state>after attribute name state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>

   <dt>U+003D EQUALS SIGN (=)</dt>
   <dd>Switch to the <a href=#before-attribute-value-state>before attribute value state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current attribute's name.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's name.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   attribute's name.</dd>

  </dl><p>When the user agent leaves the attribute name state (and before
  emitting the tag token, if appropriate), the complete attribute's
  name must be compared to the other attributes on the same token;
  if there is already an attribute on the token with the exact same
  name, then this is a <a href=#parse-error>parse error</a> and the new
  attribute must be removed from the token.</p>

  <p class=note>If an attribute is so removed from a token, it, along with the value that gets
  associated with it, if any, are never subsequently used by the parser, and are therefore
  effectively discarded. Removing the attribute in this way does not change its status as the
  "current attribute" for the purposes of the tokenizer, however.</p>


  <h5 id=after-attribute-name-state><span class=secno>12.2.4.36 </span><dfn>After attribute name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>

   <dt>U+003D EQUALS SIGN (=)</dt>
   <dd>Switch to the <a href=#before-attribute-value-state>before attribute value state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the lowercase version of the <a href=#current-input-character>current
   input character</a> (add 0x0020 to the character's code point),
   and its value to the empty string. Switch to the <a href=#attribute-name-state>attribute
   name state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Start a new attribute in the current
   tag token. Set that attribute's name to a U+FFFD REPLACEMENT
   CHARACTER character, and its value to the empty string. Switch to
   the <a href=#attribute-name-state>attribute name state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the <a href=#current-input-character>current input character</a>, and
   its value to the empty string. Switch to the <a href=#attribute-name-state>attribute name
   state</a>.</dd>

  </dl><h5 id=before-attribute-value-state><span class=secno>12.2.4.37 </span><dfn>Before attribute value state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href=#attribute-value-(double-quoted)-state>attribute value (double-quoted) state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href=#attribute-value-(unquoted)-state>attribute value (unquoted) state</a>.
   Reconsume the <a href=#current-input-character>current input character</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href=#attribute-value-(single-quoted)-state>attribute value (single-quoted) state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value. Switch to the
   <a href=#attribute-value-(unquoted)-state>attribute value (unquoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the current tag token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dt>U+003D EQUALS SIGN (=)</dt>
   <dt>U+0060 GRAVE ACCENT (`)</dt>
   <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   attribute's value. Switch to the <a href=#attribute-value-(unquoted)-state>attribute value (unquoted)
   state</a>.</dd>

  </dl><h5 id=attribute-value-(double-quoted)-state><span class=secno>12.2.4.38 </span><dfn>Attribute value (double-quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href=#after-attribute-value-(quoted)-state>after attribute value (quoted)
   state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href=#character-reference-in-attribute-value-state>character reference in attribute value
   state</a>, with the <a href=#additional-allowed-character>additional allowed character</a>
   being U+0022 QUOTATION MARK (").</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   attribute's value.</dd>

  </dl><h5 id=attribute-value-(single-quoted)-state><span class=secno>12.2.4.39 </span><dfn>Attribute value (single-quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href=#after-attribute-value-(quoted)-state>after attribute value (quoted)
   state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href=#character-reference-in-attribute-value-state>character reference in attribute value
   state</a>, with the <a href=#additional-allowed-character>additional allowed character</a>
   being U+0027 APOSTROPHE (').</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   attribute's value.</dd>

  </dl><h5 id=attribute-value-(unquoted)-state><span class=secno>12.2.4.40 </span><dfn>Attribute value (unquoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href=#character-reference-in-attribute-value-state>character reference in attribute value
   state</a>, with the <a href=#additional-allowed-character>additional allowed character</a>
   being U+003E GREATER-THAN SIGN (&gt;).</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dt>U+003D EQUALS SIGN (=)</dt>
   <dt>U+0060 GRAVE ACCENT (`)</dt>
   <dd><a href=#parse-error>Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   attribute's value.</dd>

  </dl><h5 id=character-reference-in-attribute-value-state><span class=secno>12.2.4.41 </span><dfn>Character reference in attribute value state</dfn></h5>

  <p>Attempt to <a href=#consume-a-character-reference>consume a character reference</a>.</p>

  <p>If nothing is returned, append a U+0026 AMPERSAND character
  (&amp;) to the current attribute's value.</p>

  <p>Otherwise, append the returned character tokens to the current
  attribute's value.</p>

  <p>Finally, switch back to the attribute value state that switched
  into this state.</p>


  <h5 id=after-attribute-value-(quoted)-state><span class=secno>12.2.4.42 </span><dfn>After attribute value (quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#before-attribute-name-state>before attribute name state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href=#self-closing-start-tag-state>self-closing start tag state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#before-attribute-name-state>before attribute
   name state</a>. Reconsume the character.</dd>

  </dl><h5 id=self-closing-start-tag-state><span class=secno>12.2.4.43 </span><dfn>Self-closing start tag state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Set the <i>self-closing flag</i> of the current tag
   token. Switch to the <a href=#data-state>data state</a>. Emit the current tag
   token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#before-attribute-name-state>before attribute
   name state</a>. Reconsume the character.</dd>

  </dl><h5 id=bogus-comment-state><span class=secno>12.2.4.44 </span><dfn>Bogus comment state</dfn></h5>

  <p>Consume every character up to and including the first U+003E
  GREATER-THAN SIGN character (&gt;) or the end of the file (EOF),
  whichever comes first. Emit a comment token whose data is the
  concatenation of all the characters starting from and including the
  character that caused the state machine to switch into the bogus
  comment state, up to and including the character immediately before
  the last consumed character (i.e. up to the character just before
  the U+003E or EOF character), but with any U+0000 NULL characters
  replaced by U+FFFD REPLACEMENT CHARACTER characters. (If the comment
  was started by the end of the file (EOF), the token is empty.
  Similarly, the token is empty if it was generated by the string
  "<code title="">&lt;!&gt;</code>".)</p>

  <p>Switch to the <a href=#data-state>data state</a>.</p>

  <p>If the end of the file was reached, reconsume the EOF
  character.</p>


  <h5 id=markup-declaration-open-state><span class=secno>12.2.4.45 </span><dfn>Markup declaration open state</dfn></h5>

  <p>If the next two characters are both U+002D HYPHEN-MINUS
  characters (-), consume those two characters, create a comment token
  whose data is the empty string, and switch to the <a href=#comment-start-state>comment
  start state</a>.</p>

  <p>Otherwise, if the next seven characters are an <a href=#ascii-case-insensitive>ASCII
  case-insensitive</a> match for the word "DOCTYPE", then consume
  those characters and switch to the <a href=#doctype-state>DOCTYPE state</a>.</p>

  <p>Otherwise, if there is an <a href=#adjusted-current-node>adjusted current node</a> and it is not
  an element in the <a href=#html-namespace-0>HTML namespace</a> and the next seven
  characters are a <a href=#case-sensitive>case-sensitive</a> match for the string
  "[CDATA[" (the five uppercase letters "CDATA" with a U+005B LEFT
  SQUARE BRACKET character before and after), then consume those
  characters and switch to the <a href=#cdata-section-state>CDATA section state</a>.</p>

  <p>Otherwise, this is a <a href=#parse-error>parse error</a>. Switch to the
  <a href=#bogus-comment-state>bogus comment state</a>. The next character that is
  consumed, if any, is the first character that will be in the
  comment.</p>


  <h5 id=comment-start-state><span class=secno>12.2.4.46 </span><dfn>Comment start state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#comment-start-dash-state>comment start dash state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the comment token's data. Switch to the <a href=#comment-state>comment
   state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token.</dd> <!-- see comment in
   comment end state -->

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the comment
   token's data. Switch to the <a href=#comment-state>comment state</a>.</dd>

  </dl><h5 id=comment-start-dash-state><span class=secno>12.2.4.47 </span><dfn>Comment start dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#comment-end-state>comment end state</a></dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+002D HYPHEN-MINUS
   character (-) and a U+FFFD REPLACEMENT CHARACTER character to the
   comment token's data. Switch to the <a href=#comment-state>comment
   state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token. Reconsume the EOF
   character.</dd> <!-- see comment in comment end state -->

   <dt>Anything else</dt>
   <dd>Append a U+002D HYPHEN-MINUS character (-) and the
   <a href=#current-input-character>current input character</a> to the comment token's
   data. Switch to the <a href=#comment-state>comment state</a>.</dd>

  </dl><h5 id=comment-state><span class=secno>12.2.4.48 </span><dfn id=comment>Comment state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#comment-end-dash-state>comment end dash state</a></dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the comment token's data.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token. Reconsume the EOF
   character.</dd> <!-- see comment in comment end state -->

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the comment
   token's data.</dd>

  </dl><h5 id=comment-end-dash-state><span class=secno>12.2.4.49 </span><dfn>Comment end dash state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href=#comment-end-state>comment end state</a></dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+002D HYPHEN-MINUS
   character (-) and a U+FFFD REPLACEMENT CHARACTER character to the
   comment token's data. Switch to the <a href=#comment-state>comment
   state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token. Reconsume the EOF
   character.</dd> <!-- see comment in comment end state -->

   <dt>Anything else</dt>
   <dd>Append a U+002D HYPHEN-MINUS character (-) and the
   <a href=#current-input-character>current input character</a> to the comment token's
   data. Switch to the <a href=#comment-state>comment state</a>.</dd>

  </dl><h5 id=comment-end-state><span class=secno>12.2.4.50 </span><dfn>Comment end state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the comment
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS
   characters (-) and a U+FFFD REPLACEMENT CHARACTER character to the
   comment token's data. Switch to the <a href=#comment-state>comment
   state</a>.</dd>

   <dt>U+0021 EXCLAMATION MARK (!)</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#comment-end-bang-state>comment end bang
   state</a>.</dd>

   <dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+002D HYPHEN-MINUS
   character (-) to the comment token's data.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token. Reconsume the EOF
   character.</dd> <!-- For security reasons: otherwise, hostile user
   could put a <script> in a comment e.g. in a blog comment and then
   DOS the server so that the end tag isn't read, and then the
   commented <script> tag would be treated as live code -->

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS
   characters (-) and the <a href=#current-input-character>current input character</a> to the
   comment token's data. Switch to the <a href=#comment-state>comment
   state</a>.</dd>

  </dl><h5 id=comment-end-bang-state><span class=secno>12.2.4.51 </span><dfn>Comment end bang state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021
   EXCLAMATION MARK character (!) to the comment token's data. Switch
   to the <a href=#comment-end-dash-state>comment end dash state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the comment
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS
   characters (-), a U+0021 EXCLAMATION MARK character (!), and a
   U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
   Switch to the <a href=#comment-state>comment state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Emit the comment token. Reconsume the EOF
   character.</dd> <!-- see comment in comment end state -->

   <dt>Anything else</dt>
   <dd>Append two U+002D HYPHEN-MINUS characters (-), a U+0021
   EXCLAMATION MARK character (!), and the <a href=#current-input-character>current input
   character</a> to the comment token's data. Switch to the
   <a href=#comment-state>comment state</a>.</dd>

  </dl><h5 id=doctype-state><span class=secno>12.2.4.52 </span><dfn>DOCTYPE state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#before-doctype-name-state>before DOCTYPE name state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Create a new DOCTYPE token. Set its <i>force-quirks
   flag</i> to <i>on</i>. Emit the token. Reconsume the EOF
   character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#before-doctype-name-state>before DOCTYPE
   name state</a>. Reconsume the character.</dd>

  </dl><h5 id=before-doctype-name-state><span class=secno>12.2.4.53 </span><dfn>Before DOCTYPE name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Create a new DOCTYPE token. Set the token's name to the
   lowercase version of the <a href=#current-input-character>current input character</a> (add 0x0020 to the
   character's code point). Switch to the <a href=#doctype-name-state>DOCTYPE name
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Create a new DOCTYPE token. Set the
   token's name to a U+FFFD REPLACEMENT CHARACTER character. Switch to
   the <a href=#doctype-name-state>DOCTYPE name state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Create a new DOCTYPE token. Set its
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit the token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Create a new DOCTYPE token. Set its <i>force-quirks
   flag</i> to <i>on</i>. Emit the token. Reconsume the EOF
   character.</dd>

   <dt>Anything else</dt>
   <dd>Create a new DOCTYPE token. Set the token's name to the
   <a href=#current-input-character>current input character</a>. Switch to the <a href=#doctype-name-state>DOCTYPE name
   state</a>.</dd>

  </dl><h5 id=doctype-name-state><span class=secno>12.2.4.54 </span><dfn>DOCTYPE name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#after-doctype-name-state>after DOCTYPE name state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt><a href=#uppercase-ascii-letters title="uppercase ASCII letters">Uppercase ASCII letter</a></dt>
   <dd>Append the lowercase version of the <a href=#current-input-character>current input
   character</a> (add 0x0020 to the character's code point) to the
   current DOCTYPE token's name.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's name.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   DOCTYPE token's name.</dd>

  </dl><h5 id=after-doctype-name-state><span class=secno>12.2.4.55 </span><dfn>After DOCTYPE name state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>

    <p>If the six characters starting from the <a href=#current-input-character>current input
    character</a> are an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match
    for the word "PUBLIC", then consume those characters and switch to
    the <a href=#after-doctype-public-keyword-state>after DOCTYPE public keyword state</a>.</p>

    <p>Otherwise, if the six characters starting from the
    <a href=#current-input-character>current input character</a> are an <a href=#ascii-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>after DOCTYPE system
    keyword state</a>.</p>

    <p>Otherwise, this is a <a href=#parse-error>parse error</a>. Set the
    DOCTYPE token's <i>force-quirks flag</i> to <i>on</i>. Switch to
    the <a href=#bogus-doctype-state>bogus DOCTYPE state</a>.</p>

   </dd>

  </dl><h5 id=after-doctype-public-keyword-state><span class=secno>12.2.4.56 </span><dfn>After DOCTYPE public keyword state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#before-doctype-public-identifier-state>before DOCTYPE public identifier
   state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's public
   identifier to the empty string (not missing), then switch to the
   <a href=#doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's public
   identifier to the empty string (not missing), then switch to the
   <a href=#doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id=before-doctype-public-identifier-state><span class=secno>12.2.4.57 </span><dfn>Before DOCTYPE public identifier state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Set the DOCTYPE token's public identifier to the empty string
   (not missing), then switch to the <a href=#doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier
   (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Set the DOCTYPE token's public identifier to the empty string
   (not missing), then switch to the <a href=#doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier
   (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id=doctype-public-identifier-(double-quoted)-state><span class=secno>12.2.4.58 </span><dfn>DOCTYPE public identifier (double-quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href=#after-doctype-public-identifier-state>after DOCTYPE public identifier state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's public identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   DOCTYPE token's public identifier.</dd>

  </dl><h5 id=doctype-public-identifier-(single-quoted)-state><span class=secno>12.2.4.59 </span><dfn>DOCTYPE public identifier (single-quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href=#after-doctype-public-identifier-state>after DOCTYPE public identifier state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's public identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   DOCTYPE token's public identifier.</dd>

  </dl><h5 id=after-doctype-public-identifier-state><span class=secno>12.2.4.60 </span><dfn>After DOCTYPE public identifier state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#between-doctype-public-and-system-identifiers-state>between DOCTYPE public and system
   identifiers state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id=between-doctype-public-and-system-identifiers-state><span class=secno>12.2.4.61 </span><dfn>Between DOCTYPE public and system identifiers state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier
   (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier
   (single-quoted) state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id=after-doctype-system-keyword-state><span class=secno>12.2.4.62 </span><dfn>After DOCTYPE system keyword state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href=#before-doctype-system-identifier-state>before DOCTYPE system identifier
   state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id=before-doctype-system-identifier-state><span class=secno>12.2.4.63 </span><dfn>Before DOCTYPE system identifier state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href=#doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier
   (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href=#doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier
   (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state>bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id=doctype-system-identifier-(double-quoted)-state><span class=secno>12.2.4.64 </span><dfn>DOCTYPE system identifier (double-quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href=#after-doctype-system-identifier-state>after DOCTYPE system identifier
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's system identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   DOCTYPE token's system identifier.</dd>

  </dl><h5 id=doctype-system-identifier-(single-quoted)-state><span class=secno>12.2.4.65 </span><dfn>DOCTYPE system identifier (single-quoted) state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href=#after-doctype-system-identifier-state>after DOCTYPE system identifier
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href=#parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's system identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href=#parse-error>Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href=#data-state>data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href=#current-input-character>current input character</a> to the current
   DOCTYPE token's system identifier.</dd>

  </dl><h5 id=after-doctype-system-identifier-state><span class=secno>12.2.4.66 </span><dfn>After DOCTYPE system identifier state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>EOF</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#data-state>data
   state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
   <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd><a href=#parse-error>Parse error</a>. Switch to the <a href=#bogus-doctype-state>bogus DOCTYPE
   state</a>. (This does <em>not</em> set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>.)</dd>

  </dl><h5 id=bogus-doctype-state><span class=secno>12.2.4.67 </span><dfn>Bogus DOCTYPE state</dfn></h5>

  <p>Consume the <a href=#next-input-character>next input character</a>:</p>

  <dl class=switch><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the DOCTYPE
   token.</dd>

   <dt>EOF</dt>
   <dd>Switch to the <a href=#data-state>data state</a>. Emit the DOCTYPE token.
   Reconsume the EOF character.</dd>

   <dt>Anything else</dt>
   <dd>Ignore the character.</dd>

  </dl><h5 id=cdata-section-state><span class=secno>12.2.4.68 </span><dfn>CDATA section state</dfn></h5>

  <p>Switch to the <a href=#data-state>data state</a>.</p>

  <p>Consume every character up to the next occurrence of the three
  character sequence U+005D RIGHT SQUARE BRACKET U+005D RIGHT SQUARE
  BRACKET U+003E GREATER-THAN SIGN (<code title="">]]&gt;</code>), or the
  end of the file (EOF), whichever comes first. Emit a series of
  character tokens consisting of all the characters consumed except
  the matching three character sequence at the end (if one was found
  before the end of the file)<!--(not needed; taken care of by the
  tree constructor), but with any U+0000 NULL characters replaced by
  U+FFFD REPLACEMENT CHARACTER characters-->.</p>

  <p>If the end of the file was reached, reconsume the EOF
  character.</p>



  <h5 id=tokenizing-character-references><span class=secno>12.2.4.69 </span>Tokenizing character references</h5>

  <p>This section defines how to <dfn id=consume-a-character-reference>consume a character reference</dfn>, optionally with an
  <dfn id=additional-allowed-character>additional allowed character</dfn>, which, if specified where the algorithm is invoked, adds
  a character to the list of characters that cause there to not be a character reference.</p>

  <p>This definition is used when parsing character
  references <a href=#character-reference-in-data-state title="character reference in data state">in
  text</a> and <a href=#character-reference-in-attribute-value-state title="character reference in attribute value
  state">in attributes</a>.</p>

  <p>The behavior depends on the identity of the next character (the
  one immediately after the U+0026 AMPERSAND character), as follows:</p>

  <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   <!--<dt>U+000D CARRIAGE RETURN (CR)</dt>-->
   <dt>U+0020 SPACE</dt>
   <dt>U+003C LESS-THAN SIGN</dt>
   <dt>U+0026 AMPERSAND</dt>
   <dt>EOF</dt>
   <dt>The <a href=#additional-allowed-character>additional allowed character</a>, if there is one</dt>

   <dd>Not a character reference. No characters are consumed, and
   nothing is returned. (This is not an error, either.)</dd>


   <dt>U+0023 NUMBER SIGN (#)</dt>

   <dd>

    <p>Consume the U+0023 NUMBER SIGN.</p>

    <p>The behavior further depends on the character after the U+0023
    NUMBER SIGN:</p>

    <dl class=switch><dt>U+0078 LATIN SMALL LETTER X</dt>
     <dt>U+0058 LATIN CAPITAL LETTER X</dt>

     <dd>

      <p>Consume the X.</p>

      <p>Follow the steps below, but using <a href=#ascii-hex-digits>ASCII hex digits</a>.</p>

      <p>When it comes to interpreting the number, interpret it as a hexadecimal number.</p>

     </dd>


     <dt>Anything else</dt>

     <dd>

      <p>Follow the steps below, but using <a href=#ascii-digits>ASCII digits</a>.</p>

      <p>When it comes to interpreting the number, interpret it as a
      decimal number.</p>

     </dd>

    </dl><p>Consume as many characters as match the range of characters given above (<a href=#ascii-hex-digits>ASCII hex
    digits</a> or <a href=#ascii-digits>ASCII digits</a>).</p>

<!--CLEANUP-->
    <p>If no characters match the range, then don't consume any
    characters (and unconsume the U+0023 NUMBER SIGN character and, if
    appropriate, the X character). This is a <a href=#parse-error>parse
    error</a>; nothing is returned.</p>

    <p>Otherwise, if the next character is a U+003B SEMICOLON, consume
    that too. If it isn't, there is a <a href=#parse-error>parse
    error</a>.</p>

    <p>If one or more characters match the range, then take them all
    and interpret the string of characters as a number (either
    hexadecimal or decimal as appropriate).</p>

    <p>If that number is one of the numbers in the first column of the
    following table, then this is a <a href=#parse-error>parse error</a>. Find the
    row with that number in the first column, and return a character
    token for the Unicode character given in the second column of that
    row.</p>

    <table id=table-charref-overrides><thead><tr><th>Number <th colspan=2>Unicode character
     <tbody><tr><td>0x00 <td>U+FFFD <td>REPLACEMENT CHARACTER
      <!-- <tr><td>0x0D <td>U+000D <td>CARRIAGE RETURN (CR) -->
      <tr><td>0x80 <td>U+20AC <td>EURO SIGN (&euro;)
      <!-- <tr><td>0x81 <td>U+0081 <td>&lt;control> -->
      <tr><td>0x82 <td>U+201A <td>SINGLE LOW-9 QUOTATION MARK (&sbquo;)
      <tr><td>0x83 <td>U+0192 <td>LATIN SMALL LETTER F WITH HOOK (&fnof;)
      <tr><td>0x84 <td>U+201E <td>DOUBLE LOW-9 QUOTATION MARK (&ldquor;)
      <tr><td>0x85 <td>U+2026 <td>HORIZONTAL ELLIPSIS (&mldr;)
      <tr><td>0x86 <td>U+2020 <td>DAGGER (&dagger;)
      <tr><td>0x87 <td>U+2021 <td>DOUBLE DAGGER (&ddagger;)
      <tr><td>0x88 <td>U+02C6 <td>MODIFIER LETTER CIRCUMFLEX ACCENT (&circ;)
      <tr><td>0x89 <td>U+2030 <td>PER MILLE SIGN (&permil;)
      <tr><td>0x8A <td>U+0160 <td>LATIN CAPITAL LETTER S WITH CARON (&Scaron;)
      <tr><td>0x8B <td>U+2039 <td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (&lsaquo;)
      <tr><td>0x8C <td>U+0152 <td>LATIN CAPITAL LIGATURE OE (&OElig;)
      <!-- <tr><td>0x8D <td>U+008D <td>&lt;control> -->
      <tr><td>0x8E <td>U+017D <td>LATIN CAPITAL LETTER Z WITH CARON (&Zcaron;)
      <!-- <tr><td>0x8F <td>U+008F <td>&lt;control> -->
      <!-- <tr><td>0x90 <td>U+0090 <td>&lt;control> -->
      <tr><td>0x91 <td>U+2018 <td>LEFT SINGLE QUOTATION MARK (&lsquo;)
      <tr><td>0x92 <td>U+2019 <td>RIGHT SINGLE QUOTATION MARK (&rsquor;)
      <tr><td>0x93 <td>U+201C <td>LEFT DOUBLE QUOTATION MARK (&ldquo;)
      <tr><td>0x94 <td>U+201D <td>RIGHT DOUBLE QUOTATION MARK (&rdquo;)
      <tr><td>0x95 <td>U+2022 <td>BULLET (&bullet;)
      <tr><td>0x96 <td>U+2013 <td>EN DASH (&ndash;)
      <tr><td>0x97 <td>U+2014 <td>EM DASH (&mdash;)
      <tr><td>0x98 <td>U+02DC <td>SMALL TILDE (&tilde;)
      <tr><td>0x99 <td>U+2122 <td>TRADE MARK SIGN (&trade;)
      <tr><td>0x9A <td>U+0161 <td>LATIN SMALL LETTER S WITH CARON (&scaron;)
      <tr><td>0x9B <td>U+203A <td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (&rsaquo;)
      <tr><td>0x9C <td>U+0153 <td>LATIN SMALL LIGATURE OE (&oelig;)
      <!-- <tr><td>0x9D <td>U+009D <td>&lt;control> -->
      <tr><td>0x9E <td>U+017E <td>LATIN SMALL LETTER Z WITH CARON (&zcaron;)
      <tr><td>0x9F <td>U+0178 <td>LATIN CAPITAL LETTER Y WITH DIAERESIS (&Yuml;)
    </table><p>Otherwise, if the number is in the range 0xD800 to 0xDFFF<!--
    surrogates --> or is greater than 0x10FFFF, then this is a
    <a href=#parse-error>parse error</a>. Return a U+FFFD REPLACEMENT
    CHARACTER character token.</p>

    <p>Otherwise, return a character token for the Unicode character
    whose code point is that number.

    <!-- this is the same as the equivalent list in the input stream section, except U+000D is not allowed -->
    Additionally, if the number is in the range 0x0001 to 0x0008, <!--
    HT, LF allowed --> <!-- U+000B is in the next list --> <!-- FF
    allowed --> 0x000D to 0x001F, <!-- ASCII allowed --> 0x007F <!--to
    0x0084, (0x0085 NEL not allowed), 0x0086--> to 0x009F, 0xFDD0 to
    0xFDEF, or is one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF,
    0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE,
    0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF,
    0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE,
    0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
    0x10FFFE, or 0x10FFFF, then this is a <a href=#parse-error>parse
    error</a>.</p>

   </dd>


   <dt>Anything else</dt>

   <dd>

    <p>Consume the maximum number of characters possible, with the
    consumed characters matching one of the identifiers in the first
    column of the <a href=#named-character-references>named character references</a> table (in a
    <a href=#case-sensitive>case-sensitive</a> manner).</p>

    <p>If no match can be made, then no characters are consumed, and nothing is returned. In this
    case, if the characters after the U+0026 AMPERSAND character (&amp;) consist of a sequence of
    one or more <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a> followed by a U+003B SEMICOLON character
    (;), then this is a <a href=#parse-error>parse error</a>.</p>

    <p>If the character reference is being consumed <a href=#character-reference-in-attribute-value-state title="character reference in attribute
    value state">as part of an attribute</a>, and the last character matched is not a U+003B
    SEMICOLON character (;), and the next character is either a U+003D EQUALS SIGN character (=) or
    an <a href=#alphanumeric-ascii-characters title="alphanumeric ASCII characters">alphanumeric ASCII character</a>, then, for
    historical reasons, all the characters that were matched after the U+0026 AMPERSAND character
    (&amp;) must be unconsumed, and nothing is returned. <!-- "=" added because of
    http://www.w3.org/Bugs/Public/show_bug.cgi?id=9207#c5 -->

    However, if this next character is in fact a U+003D EQUALS SIGN character (=), then this is a
    <a href=#parse-error>parse error</a>, because some legacy user agents <!-- IE, version 9 and before --> will
    misinterpret the markup in those cases.</p> <!-- v2: should make this no longer a conformance
    error at some point in the future; revisit in 2015? -->

    <p>Otherwise, a character reference is parsed. If the last
    character matched is not a U+003B SEMICOLON character (;), there
    is a <a href=#parse-error>parse error</a>.</p>

    <p>Return one or two character tokens for the character(s)
    corresponding to the character reference name (as given by the
    second column of the <a href=#named-character-references>named character references</a>
    table).</p>

    <div class=example>

     <p>If the markup contains (not in an attribute) the string <code title="">I'm &amp;notit; I tell you</code>, the character
     reference is parsed as "not", as in, <code title="">I'm &not;it;
     I tell you</code> (and this is a parse error). But if the markup
     was <code title="">I'm &amp;notin; I tell you</code>, the
     character reference would be parsed as "notin;", resulting in
     <code title="">I'm &notinva; I tell you</code> (and no parse
     error).</p>

    </div>

   </dd>

  </dl></div>


  <div class=impl>

  <!-- v2: One thing that this doesn't define is handling deeply
  nested documents. There are compatibility requirements around that:
  you can't throw away the elements altogether, consider Tux made only
  with opening <font> elements, one per character. Seems that the best
  thing to do is to close some formatting elements from the middle of
  the stack when you hit a limit, or something. -->

  <h4 id=tree-construction><span class=secno>12.2.5 </span><dfn>Tree construction</dfn></h4>

  <p>The input to the tree construction stage is a sequence of tokens from the
  <a href=#tokenization>tokenization</a> stage. The tree construction stage is associated with a DOM
  <code><a href=#document>Document</a></code> object when a parser is created. The "output" of this stage consists of
  dynamically modifying or extending that document's DOM tree.</p>

  <p>This specification does not define when an interactive user agent has to render the
  <code><a href=#document>Document</a></code> so that it is available to the user, or when it has to begin accepting user
  input.</p>

  <hr><p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps
  from the following list, known as the <dfn id=tree-construction-dispatcher>tree construction dispatcher</dfn>:</p>

  <dl class=switch><dt>If there is no <a href=#adjusted-current-node>adjusted current node</a></dt>
   <dt>If the <a href=#adjusted-current-node>adjusted current node</a> is an element in the <a href=#html-namespace-0>HTML namespace</a></dt>
   <dt>If the <a href=#adjusted-current-node>adjusted current node</a> is a <a href=#mathml-text-integration-point>MathML text integration point</a> and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"</dt>
   <dt>If the <a href=#adjusted-current-node>adjusted current node</a> is a <a href=#mathml-text-integration-point>MathML text integration point</a> and the token is a character token</dt>
   <dt>If the <a href=#adjusted-current-node>adjusted current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> and the token is a start tag whose tag name is "svg"</dt>
   <dt>If the <a href=#adjusted-current-node>adjusted current node</a> is an <a href=#html-integration-point>HTML integration point</a> and the token is a start tag</dt>
   <dt>If the <a href=#adjusted-current-node>adjusted current node</a> is an <a href=#html-integration-point>HTML integration point</a> and the token is a character token</dt>
   <dt>If the token is an end-of-file token</dt>

   <dd>Process the token according to the rules given in the section corresponding to the current
   <a href=#insertion-mode>insertion mode</a> in HTML content.</dd>

   <dt>Otherwise</dt>

   <dd>Process the token according to the rules given in the section for parsing tokens <a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign content</a>.</dd>

  </dl><p>The <dfn id=next-token>next token</dfn> is the token that is about to be processed by the <a href=#tree-construction-dispatcher>tree
  construction dispatcher</a> (even if the token is subsequently just ignored).</p>

  <p>A node is a <dfn id=mathml-text-integration-point>MathML text integration point</dfn> if it is one of the following
  elements:</p>

  <ul class=brief><li>An <code title="">mi</code> element in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li>An <code title="">mo</code> element in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li>An <code title="">mn</code> element in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li>An <code title="">ms</code> element in the <a href=#mathml-namespace>MathML namespace</a></li>
   <li>An <code title="">mtext</code> element in the <a href=#mathml-namespace>MathML namespace</a></li>
  </ul><p>A node is an <dfn id=html-integration-point>HTML integration point</dfn> if it is one of the following elements:</p>

  <ul class=brief><li>An <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">text/html</code>"</li>
   <li>An <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">application/xhtml+xml</code>"</li>
   <li>A <code title="">foreignObject</code> element in the <a href=#svg-namespace>SVG namespace</a></li>
   <li>A <code title="">desc</code> element in the <a href=#svg-namespace>SVG namespace</a></li>
   <li>A <code title="">title</code> element in the <a href=#svg-namespace>SVG namespace</a></li>
  </ul><p class=note>Not all of the tag names mentioned below are conformant tag names in this
  specification; many are included to handle legacy content. They still form part of the algorithm
  that implementations are required to implement to claim conformance.</p>

  <p class=note>The algorithm described below places no limit on the depth of the DOM tree
  generated, or on the length of tag names, attribute names, attribute values, <code><a href=#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 id=creating-and-inserting-nodes><span class=secno>12.2.5.1 </span>Creating and inserting nodes</h5>

  <p>While the parser is processing a token, it can enable or disable <dfn id=foster-parent title="foster
  parent">foster parenting</dfn>. This affects the following algorithm.</p>

  <p>The <dfn id=appropriate-place-for-inserting-a-node>appropriate place for inserting a node</dfn>, optionally using a particular
  <i>override target</i>, is the position in an element returned by running the following steps:</p>

  <ol><li>

    <p>If there was an <i>override target</i> specified, then let <var title="">target</var> be the
    <i>override target</i>.</p>

    <p>Otherwise, let <var title="">target</var> be the <a href=#current-node>current node</a>.</p>

   </li>

   <li>

    <p>Determine the <var title="">adjusted insertion location</var> using the first matching steps
    from the following list:</p>

    <dl class=switch><dt>If <a href=#foster-parent title="foster parent">foster parenting</a> is enabled and <var title="">target</var> is a <code><a href=#the-table-element>table</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>,
     <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tr-element>tr</a></code> element</dt>

     <dd>

      <p class=note>Foster parenting happens when content is misnested in tables.</p>

      <p>Run these substeps:</p>

      <ol><li><p>Let <var title="">last template</var> be the last <code><a href=#the-template-element>template</a></code> element in the
       <a href=#stack-of-open-elements>stack of open elements</a>, if any.</p>

       <li><p>Let <var title="">last table</var> be the last <code><a href=#the-table-element>table</a></code> element in the
       <a href=#stack-of-open-elements>stack of open elements</a>, if any.</p>

       <li><p>If there is a <var title="">last template</var> and either there is no <var title="">last table</var>, or there is one, but <var title="">last template</var> is lower
       (more recently added) than <var title="">last table</var> in the <a href=#stack-of-open-elements>stack of open
       elements</a>, then: let <var title="">adjusted insertion location</var> be inside <var title="">last template</var>'s <a href=#template-contents>template contents</a>, after its last child (if any),
       and abort these substeps.</li>

       <li><p>If there is no <var title="">last table</var>, <!-- there's also implicitly no last
       template, since we didn't hit the previous step --> then let <var title="">adjusted insertion
       location</var> be inside the first element in the <a href=#stack-of-open-elements>stack of open elements</a> (the
       <code><a href=#the-html-element>html</a></code> element), after its last child (if any), and abort these substeps.
       (<a href=#fragment-case>fragment case</a>)</p>

       <!-- if we get here, we know there's a last table, and if there's a last template, it's older
       than the last table. -->

       <li><p>If <var title="">last table</var> has a parent element, then let <var title="">adjusted insertion location</var> be inside <var title="">last table</var>'s parent
       element, immediately before <var title="">last table</var>, and abort these
       substeps.</li>

       <!-- if we get here, we know there's a last table, but it has no parent, and if there's a
       last template, it's older than the last table. -->

       <li><p>Let <var title="">previous element</var> be the element immediately above <var title="">last table</var> in the <a href=#stack-of-open-elements>stack of open elements</a>.</li>

       <li><p>Let <var title="">adjusted insertion location</var> be inside <var title="">previous
       element</var>, after its last child (if any).</li>

      </ol><p class=note>These steps are involved in part because it's possible for elements, the
      <code><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>

     </dd>

     <dt>Otherwise</dt>

     <dd>

      <p>Let <var title="">adjusted insertion location</var> be inside <var title="">target</var>,
      after its last child (if any).</p>

     </dd>

    </dl></li>

   <li>

    <p>If the <var title="">adjusted insertion location</var> is inside a <code><a href=#the-template-element>template</a></code>
    element, let it instead be inside the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template
    contents</a>, after its last child (if any).</p>

   </li>

   <li>

    <p>Return the <var title="">adjusted insertion location</var>.</p>

   </li>

  </ol><hr><p>When the steps below require the UA to <dfn id=create-an-element-for-the-token title="create an element for the token">create an
  element for a token</dfn> in a particular <var title="">given namespace</var> and with a
  particular <var title="">intended parent</var>, the UA must run the following steps:</p>

  <ol><li>

    <p>Create a node implementing the interface appropriate for the element type corresponding to
    the tag name of the token in <var title="">given namespace</var> (as given in the specification
    that defines that element, e.g. for an <code><a href=#the-a-element>a</a></code> element in the <a href=#html-namespace-0>HTML
    namespace</a>, this specification defines it to be the <code><a href=#htmlanchorelement>HTMLAnchorElement</a></code>
    interface), with the tag name being the name of that element, with the node being in the given
    namespace, and with the attributes on the node being those given in the given token.</p>

    <p>The interface appropriate for an element in the <a href=#html-namespace-0>HTML namespace</a> that is not
    defined in this specification (or <a href=#other-applicable-specifications>other applicable specifications</a>) is
    <code><a href=#htmlunknownelement>HTMLUnknownElement</a></code>. Elements in other namespaces whose interface is not defined by
    that namespace's specification must use the interface <code><a href=#element>Element</a></code>.</p>

    <p>The <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> of the newly created element
    must be the same as that of the <var title="">intended parent</var>.</p>

   </li>

   <li><p>If the newly created element has an <code title="">xmlns</code> attribute <em>in the
   <a href=#xmlns-namespace>XMLNS namespace</a></em> whose value is not exactly the same as the element's namespace,
   that is a <a href=#parse-error>parse error</a>. Similarly, if the newly created element has an <code title="">xmlns:xlink</code> attribute in the <a href=#xmlns-namespace>XMLNS namespace</a> whose value is not the
   <a href=#xlink-namespace>XLink Namespace</a>, that is a <a href=#parse-error>parse error</a>.</li>

   <li><p>If the newly created element is a <a href=#category-reset title=category-reset>resettable element</a>,
   invoke its <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a>. (This initializes the
   element's <a href=#concept-fe-value title=concept-fe-value>value</a> and <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> based on the element's attributes.)</li>

   <li><p>If the element is a <a href=#form-associated-element>form-associated element</a>, and the <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null, and there is no <code><a href=#the-template-element>template</a></code>
   element on the <a href=#stack-of-open-elements>stack of open elements</a>, and the newly created element is either not
   <a href=#category-form-attr title=category-form-attr>reassociateable</a> or doesn't have a <code title=attr-fae-form><a href=#attr-fae-form>form</a></code> attribute, <a href=#concept-form-association title=concept-form-association>associate</a> the newly created element with the
   <code><a href=#the-form-element>form</a></code> element pointed to by the <a href=#form-element-pointer><code title="">form</code> element
   pointer</a>, and suppress the running of the <a href=#reset-the-form-owner>reset the form owner</a> algorithm in
   the next step.</li>

   <li><p>Return the newly created element.</li>

  </ol><hr><!-- The names of these algorithms are kinda confusing; e.g. see the confusion in
         https://www.w3.org/Bugs/Public/show_bug.cgi?id=18367
       Not sure what we could call them instead, though... --><p>When the steps below require the user agent to <dfn id=insert-a-foreign-element>insert a foreign element</dfn> for a token
  in a given namespace, the user agent must run these steps:</p>

  <ol><li><p>Let the <var title="">adjusted insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node>appropriate place for
   inserting a node</a>.</li>

   <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> in the given namespace, with the intended
   parent being the element in which the <var title="">adjusted insertion location</var> finds
   itself.</li>

   <li>

    <p>If it is possible to insert an element at the <var title="">adjusted insertion
    location</var>, then insert the newly created element at the <var title="">adjusted insertion
    location</var>.</p>

    <p class=note>If the <var title="">adjusted insertion location</var> cannot accept more
    elements, e.g. because it's a <code><a href=#document>Document</a></code> that already has an element child, then the
    newly created element is dropped on the floor.</p>

   </li>

   <li><p>Push the element onto the <a href=#stack-of-open-elements>stack of open elements</a> so that it is the new
   <a href=#current-node>current node</a>.</li>

   <li><p>Return the newly created element.</li>

  </ol><p>When the steps below require the user agent to <dfn id=insert-an-html-element>insert an HTML element</dfn> for a token,
  the user agent must <a href=#insert-a-foreign-element>insert a foreign element</a> for the token, in the <a href=#html-namespace-0>HTML
  namespace</a>.</p>

  <hr><p>When the steps below require the user agent to <dfn id=adjust-mathml-attributes>adjust MathML attributes</dfn> for a token,
  then, if the token has an attribute named <code title="">definitionurl</code>, change its name to
  <code title="">definitionURL</code> (note the case difference).</p>

  <p>When the steps below require the user agent to <dfn id=adjust-svg-attributes>adjust SVG attributes</dfn> for a token,
  then, for each attribute on the token whose attribute name is one of the ones in the first column
  of the following table, change the attribute's name to the name given in the corresponding cell in
  the second column. (This fixes the case of SVG attributes that are not all lowercase.)</p>

  <table><thead><tr><th> Attribute name on token <th> Attribute name on element
   <tbody><tr><td> <code title="">attributename</code> <td> <code title="">attributeName</code>
    <tr><td> <code title="">attributetype</code> <td> <code title="">attributeType</code>
    <tr><td> <code title="">basefrequency</code> <td> <code title="">baseFrequency</code>
    <tr><td> <code title="">baseprofile</code> <td> <code title="">baseProfile</code>
    <tr><td> <code title="">calcmode</code> <td> <code title="">calcMode</code>
    <tr><td> <code title="">clippathunits</code> <td> <code title="">clipPathUnits</code>
    <tr><td> <code title="">contentscripttype</code> <td> <code title="">contentScriptType</code>
    <tr><td> <code title="">contentstyletype</code> <td> <code title="">contentStyleType</code>
    <tr><td> <code title="">diffuseconstant</code> <td> <code title="">diffuseConstant</code>
    <tr><td> <code title="">edgemode</code> <td> <code title="">edgeMode</code>
    <tr><td> <code title="">externalresourcesrequired</code> <td> <code title="">externalResourcesRequired</code>
    <tr><td> <code title="">filterres</code> <td> <code title="">filterRes</code>
    <tr><td> <code title="">filterunits</code> <td> <code title="">filterUnits</code>
    <tr><td> <code title="">glyphref</code> <td> <code title="">glyphRef</code>
    <tr><td> <code title="">gradienttransform</code> <td> <code title="">gradientTransform</code>
    <tr><td> <code title="">gradientunits</code> <td> <code title="">gradientUnits</code>
    <tr><td> <code title="">kernelmatrix</code> <td> <code title="">kernelMatrix</code>
    <tr><td> <code title="">kernelunitlength</code> <td> <code title="">kernelUnitLength</code>
    <tr><td> <code title="">keypoints</code> <td> <code title="">keyPoints</code>
    <tr><td> <code title="">keysplines</code> <td> <code title="">keySplines</code>
    <tr><td> <code title="">keytimes</code> <td> <code title="">keyTimes</code>
    <tr><td> <code title="">lengthadjust</code> <td> <code title="">lengthAdjust</code>
    <tr><td> <code title="">limitingconeangle</code> <td> <code title="">limitingConeAngle</code>
    <tr><td> <code title="">markerheight</code> <td> <code title="">markerHeight</code>
    <tr><td> <code title="">markerunits</code> <td> <code title="">markerUnits</code>
    <tr><td> <code title="">markerwidth</code> <td> <code title="">markerWidth</code>
    <tr><td> <code title="">maskcontentunits</code> <td> <code title="">maskContentUnits</code>
    <tr><td> <code title="">maskunits</code> <td> <code title="">maskUnits</code>
    <tr><td> <code title="">numoctaves</code> <td> <code title="">numOctaves</code>
    <tr><td> <code title="">pathlength</code> <td> <code title="">pathLength</code>
    <tr><td> <code title="">patterncontentunits</code> <td> <code title="">patternContentUnits</code>
    <tr><td> <code title="">patterntransform</code> <td> <code title="">patternTransform</code>
    <tr><td> <code title="">patternunits</code> <td> <code title="">patternUnits</code>
    <tr><td> <code title="">pointsatx</code> <td> <code title="">pointsAtX</code>
    <tr><td> <code title="">pointsaty</code> <td> <code title="">pointsAtY</code>
    <tr><td> <code title="">pointsatz</code> <td> <code title="">pointsAtZ</code>
    <tr><td> <code title="">preservealpha</code> <td> <code title="">preserveAlpha</code>
    <tr><td> <code title="">preserveaspectratio</code> <td> <code title="">preserveAspectRatio</code>
    <tr><td> <code title="">primitiveunits</code> <td> <code title="">primitiveUnits</code>
    <tr><td> <code title="">refx</code> <td> <code title="">refX</code>
    <tr><td> <code title="">refy</code> <td> <code title="">refY</code>
    <tr><td> <code title="">repeatcount</code> <td> <code title="">repeatCount</code>
    <tr><td> <code title="">repeatdur</code> <td> <code title="">repeatDur</code>
    <tr><td> <code title="">requiredextensions</code> <td> <code title="">requiredExtensions</code>
    <tr><td> <code title="">requiredfeatures</code> <td> <code title="">requiredFeatures</code>
    <tr><td> <code title="">specularconstant</code> <td> <code title="">specularConstant</code>
    <tr><td> <code title="">specularexponent</code> <td> <code title="">specularExponent</code>
    <tr><td> <code title="">spreadmethod</code> <td> <code title="">spreadMethod</code>
    <tr><td> <code title="">startoffset</code> <td> <code title="">startOffset</code>
    <tr><td> <code title="">stddeviation</code> <td> <code title="">stdDeviation</code>
    <tr><td> <code title="">stitchtiles</code> <td> <code title="">stitchTiles</code>
    <tr><td> <code title="">surfacescale</code> <td> <code title="">surfaceScale</code>
    <tr><td> <code title="">systemlanguage</code> <td> <code title="">systemLanguage</code>
    <tr><td> <code title="">tablevalues</code> <td> <code title="">tableValues</code>
    <tr><td> <code title="">targetx</code> <td> <code title="">targetX</code>
    <tr><td> <code title="">targety</code> <td> <code title="">targetY</code>
    <tr><td> <code title="">textlength</code> <td> <code title="">textLength</code>
    <tr><td> <code title="">viewbox</code> <td> <code title="">viewBox</code>
    <tr><td> <code title="">viewtarget</code> <td> <code title="">viewTarget</code>
    <tr><td> <code title="">xchannelselector</code> <td> <code title="">xChannelSelector</code>
    <tr><td> <code title="">ychannelselector</code> <td> <code title="">yChannelSelector</code>
    <tr><td> <code title="">zoomandpan</code> <td> <code title="">zoomAndPan</code>
  </table><p>When the steps below require the user agent to <dfn id=adjust-foreign-attributes>adjust foreign attributes</dfn> for a
  token, then, if any of the attributes on the token match the strings given in the first column of
  the following table, let the attribute be a namespaced attribute, with the prefix being the string
  given in the corresponding cell in the second column, the local name being the string given in the
  corresponding cell in the third column, and the namespace being the namespace given in the
  corresponding cell in the fourth column. (This fixes the use of namespaced attributes, in
  particular <a href=#attr-xml-lang title=attr-xml-lang><code title="">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 title="">xlink:actuate</code> <td> <code title="">xlink</code> <td> <code title="">actuate</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xlink:arcrole</code> <td> <code title="">xlink</code> <td> <code title="">arcrole</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xlink:href</code> <td> <code title="">xlink</code> <td> <code title="">href</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xlink:role</code> <td> <code title="">xlink</code> <td> <code title="">role</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xlink:show</code> <td> <code title="">xlink</code> <td> <code title="">show</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xlink:title</code> <td> <code title="">xlink</code> <td> <code title="">title</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xlink:type</code> <td> <code title="">xlink</code> <td> <code title="">type</code> <td> <a href=#xlink-namespace>XLink namespace</a>
    <tr><td> <code title="">xml:base</code> <td> <code title="">xml</code> <td> <code title="">base</code> <td> <a href=#xml-namespace>XML namespace</a> <!-- attr-xml-base -->
    <tr><td> <code title="">xml:lang</code> <td> <code title="">xml</code> <td> <code title="">lang</code> <td> <a href=#xml-namespace>XML namespace</a>
    <tr><td> <code title="">xml:space</code> <td> <code title="">xml</code> <td> <code title="">space</code> <td> <a href=#xml-namespace>XML namespace</a>
    <tr><td> <code title="">xmlns</code> <td> (none) <td> <code title="">xmlns</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a>
    <tr><td> <code title="">xmlns:xlink</code> <td> <code title="">xmlns</code> <td> <code title="">xlink</code> <td> <a href=#xmlns-namespace>XMLNS namespace</a>
  </table><hr><p>When the steps below require the user agent to <dfn id=insert-a-character>insert a character</dfn> while processing a
  token, the user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">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>

   <li><p>Let the <var title="">adjusted insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node>appropriate
   place for inserting a node</a>.</li>

   <li>

    <p>If the <var title="">adjusted insertion location</var> is in a <code><a href=#document>Document</a></code> node,
    then abort these steps.

    <p class=note>The DOM will not let <code><a href=#document>Document</a></code> nodes have <code><a href=#text>Text</a></code> node
    children, so they are dropped on the floor.</p>

   </li>

   <li>

    <p>If there is a <code><a href=#text>Text</a></code> node immediately before the <var title="">adjusted insertion
    location</var>, then append <var title="">data</var> to that <code><a href=#text>Text</a></code> node's data.</p>

    <p>Otherwise, create a new <code><a href=#text>Text</a></code> node whose data is <var title="">data</var> and
    whose <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is the same as that of the
    element in which the <var title="">adjusted insertion location</var> finds itself, and insert
    the newly created node at the <var title="">adjusted insertion location</var>.</p>

   </li>

  </ol><div class=example>

   <p>Here are some sample inputs to the parser and the corresponding number of <code><a href=#text>Text</a></code>
   nodes that they result in, assuming a user agent that executes scripts.</p>

   <table><thead><tr><th>Input <th>Number of <code><a href=#text>Text</a></code> nodes
    <tbody><tr><td><pre>A&lt;script&gt;
var&nbsp;script&nbsp;=&nbsp;document.getElementsByTagName('script')[0];
document.body.removeChild(script);
&lt;/script&gt;B</pre>
      <td>One <code><a href=#text>Text</a></code> node in the document, containing "AB".
     <tr><td><pre>A&lt;script&gt;
var&nbsp;text&nbsp;=&nbsp;document.createTextNode('B');
document.body.appendChild(text);
&lt;/script&gt;C</pre>
      <td>Three <code><a href=#text>Text</a></code> nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the <code><a href=#text>Text</a></code> node created by the script).
     <tr><td><pre>A&lt;script&gt;
var&nbsp;text&nbsp;=&nbsp;document.getElementsByTagName('script')[0].firstChild;
text.data&nbsp;=&nbsp;'B';
document.body.appendChild(text);
&lt;/script&gt;C</pre>
      <td>Two adjacent <code><a href=#text>Text</a></code> nodes in the document, containing "A" and "BC".
     <tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;D&lt;/table&gt;</pre>
      <td>One <code><a href=#text>Text</a></code> node before the table, containing "ABCD". (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
     <tr><td><pre>A&lt;table&gt;&lt;tr&gt;&nbsp;B&lt;/tr&gt;&nbsp;C&lt;/table&gt;</pre>
      <td>One <code><a href=#text>Text</a></code> node before the table, containing "A&nbsp;B&nbsp;C" (A-space-B-space-C). (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
     <tr><td><pre>A&lt;table&gt;&lt;tr&gt;&nbsp;B&lt;/tr&gt;&nbsp;&lt;/em&gt;C&lt;/table&gt;</pre>
      <td>One <code><a href=#text>Text</a></code> node before the table, containing "A&nbsp;BC" (A-space-B-C), and one <code><a href=#text>Text</a></code> node inside the table (as a child of a <code><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 title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
   </table></div>

  <hr><p>When the steps below require the user agent to <dfn id=insert-a-comment>insert a comment</dfn> while processing a
  comment token, optionally with an explicitly insertion position <var title="">position</var>, the
  user agent must run the following steps:</p>

  <ol><li><p>Let <var title="">data</var> be the data given in the comment token being
   processed.</li>

   <li><p>If <var title="">position</var> was specified, then let the <var title="">adjusted
   insertion location</var> be <var title="">position</var>. Otherwise, let <var title="">adjusted
   insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node>appropriate place for inserting a node</a>.</li>

   <li><p>Create a <code><a href=#comment-0>Comment</a></code> node whose <code title="">data</code> attribute is set to
   <var title="">data</var> and whose <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is
   the same as that of the node in which the <var title="">adjusted insertion location</var> finds
   itself.</p>

   <li><p>Insert the newly created node at the <var title="">adjusted insertion
   location</var>.</li>

  </ol><hr><p id=mutation-during-parsing>DOM mutation events must not fire for changes caused by the UA
  parsing the document. This includes the parsing of any content inserted using <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> and <code title=dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code> calls. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>

  <p>However, mutation observers <em>do</em> fire, as required by the DOM specification.</p>



  <h5 id=parsing-elements-that-contain-only-text><span class=secno>12.2.5.2 </span>Parsing elements that contain only text</h5>

  <p>The <dfn id=generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</dfn> and the <dfn id=generic-rcdata-element-parsing-algorithm>generic RCDATA element
  parsing algorithm</dfn> consist of the following steps. These algorithms are always invoked in
  response to a start tag token.</p>

  <ol><li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</li>

   <li><p>If the algorithm that was invoked is the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing
   algorithm</a>, switch the tokenizer to the <a href=#rawtext-state>RAWTEXT state</a>; otherwise the algorithm
   invoked was the <a href=#generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</a>, switch the tokenizer to
   the <a href=#rcdata-state>RCDATA state</a>.</li>

   <li><p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode>insertion
   mode</a>.</p>

   <li><p>Then, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incdata title="insertion mode:
   text">text</a>".</li>

  </ol><h5 id=closing-elements-that-have-implied-end-tags><span class=secno>12.2.5.3 </span>Closing elements that have implied end tags</h5>

  <p>When the steps below require the UA to <dfn id=generate-implied-end-tags>generate implied end
  tags</dfn>, then, while the <a href=#current-node>current node</a> is a
  <code><a href=#the-dd-element>dd</a></code> element, a <code><a href=#the-dt-element>dt</a></code> element, an
  <code><a href=#the-li-element>li</a></code> element, an <code><a href=#the-option-element>option</a></code> element, an
  <code><a href=#the-optgroup-element>optgroup</a></code> element, a <code><a href=#the-p-element>p</a></code> element, an
  <code><a href=#the-rp-element>rp</a></code> element, or an <code><a href=#the-rt-element>rt</a></code> element, the UA must
  pop the <a href=#current-node>current node</a> off the <a href=#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>



  <h5 id=parsing-main-inhtml><span class=secno>12.2.5.4 </span>The rules for parsing tokens in HTML content</h5>


  <h6 id=the-initial-insertion-mode><span class=secno>12.2.5.4.1 </span>The "<dfn title="insertion mode: initial">initial</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#the-initial-insertion-mode title="insertion mode: initial">initial</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p>Ignore the token.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a> as the last child of the <code><a href=#document>Document</a></code> object.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>

    <p>If the DOCTYPE token's name is not a
    <a href=#case-sensitive>case-sensitive</a> match for the string "<code title="">html</code>", or the token's public identifier is not
    missing, or the token's system identifier is neither missing nor a
    <a href=#case-sensitive>case-sensitive</a> match for the string
    "<code><a href=#about:legacy-compat>about:legacy-compat</a></code>", and none of the sets of
    conditions in the following list are matched, then there is a
    <a href=#parse-error>parse error</a>.</p>

    <ul><!-- only things that trigger no-quirks mode and were valid in
     some other spec are allowed in this list --><li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
     match for the string "<code title="">html</code>", the token's
     public identifier is the <a href=#case-sensitive>case-sensitive</a> string
     "<code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.0//EN</code>", and
     the token's system identifier is either missing or the
     <a href=#case-sensitive>case-sensitive</a> string "<code title="">http://www.w3.org/TR/REC-html40/strict.dtd</code>".</li>

     <li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
     match for the string "<code title="">html</code>", the token's
     public identifier is the <a href=#case-sensitive>case-sensitive</a> string
     "<code title="">-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN</code>", and
     the token's system identifier is either missing or the
     <a href=#case-sensitive>case-sensitive</a> string "<code title="">http://www.w3.org/TR/html4/strict.dtd</code>".</li>

     <li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
     match for the string "<code title="">html</code>", the token's
     public identifier is the <a href=#case-sensitive>case-sensitive</a> string
     "<code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN</code>",
     and the token's system identifier is the
     <a href=#case-sensitive>case-sensitive</a> string "<code title="">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>".</li>

     <li>The DOCTYPE token's name is a <a href=#case-sensitive>case-sensitive</a>
     match for the string "<code title="">html</code>", the token's
     public identifier is the <a href=#case-sensitive>case-sensitive</a> string
     "<code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1//EN</code>", and
     the token's system identifier is the <a href=#case-sensitive>case-sensitive</a>
     string "<code title="">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>".</li>

    </ul><p>Conformance checkers may, based on the values (including
    presence or lack thereof) of the DOCTYPE token's name, public
    identifier, or system identifier, switch to a conformance checking
    mode for another language (e.g. based on the DOCTYPE token a
    conformance checker could recognize that the document is an
    HTML4-era document, and defer to an HTML4 conformance
    checker.)</p>

    <p>Append a <code><a href=#documenttype>DocumentType</a></code> node to the
    <code><a href=#document>Document</a></code> node, with the <code title="">name</code>
    attribute set to the name given in the DOCTYPE token, or the empty
    string if the name was missing; the <code title="">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 title="">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><a href=#documenttype>DocumentType</a></code> objects set to null and empty lists
    as appropriate. Associate the <code><a href=#documenttype>DocumentType</a></code> node with
    the <code><a href=#document>Document</a></code> object so that it is returned as the
    value of the <code title="">doctype</code> attribute of the
    <code><a href=#document>Document</a></code> object.</p>

    <p id=quirks-mode-doctypes>Then, if the document is <em>not</em> <a href=#an-iframe-srcdoc-document>an <code>iframe</code>
    <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, and the DOCTYPE token matches
    one of the conditions in the following list, then set the <code><a href=#document>Document</a></code> to <a href=#quirks-mode>quirks
    mode</a>:</p>

    <ul class=brief><li> The <i>force-quirks flag</i> is set to <i>on</i>. </li>
     <li> The name is set to anything other than "<code title="">html</code>" (compared <a href=#case-sensitive title=case-sensitive>case-sensitively</a>). </li>
     <li> The public identifier starts with: "<code title="">+//Silmaril//dtd html Pro v0r11 19970101//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//AS//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 1//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 2//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 1//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 2//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.1E//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.0//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML 3.0//EN//</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2 Final//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 0//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 0//EN//2.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 1//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 1//EN//2.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 2//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 2//EN//2.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 3//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 3//EN//3.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 0//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 0//EN//2.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 1//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 1//EN//2.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 2//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 2//EN//2.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 3//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 3//EN//3.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//2.0</code>" </li>-->
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//3.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//2.0</code>" </li>-->
   <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//3.0</code>" </li>-->
     <li> The public identifier starts with: "<code title="">-//Metrius//DTD Metrius Presentational//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 Tables//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 Tables//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD Strict HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML 2.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended 1.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Spyglass//DTD HTML 2.0 Extended//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//SQ//DTD HTML 2.0 HoTMetaL + extensions//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava Strict HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3 1995-03-24//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Draft//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Final//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2S Draft//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Frameset//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Transitional//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 19960712//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 970421//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD W3 HTML//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3O//DTD W3 HTML 3.0//<!--EN--></code>" </li>
   <!--<li> The public identifier is set to: "<code title="">-//W3O//DTD W3 HTML 3.0//EN//</code>" </li>-->
     <li> The public identifier is set to: "<code title="">-//W3O//DTD W3 HTML Strict 3.0//EN//</code>" </li>
     <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML 2.0//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML//<!--EN--></code>" </li>
     <li> The public identifier is set to: "<code title="">-/W3C/DTD HTML 4.0 Transitional/EN</code>" </li>
     <li> The public identifier is set to: "<code title="">HTML</code>" </li>
     <li> The system identifier is set to: "<code title="">http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd</code>" </li>
     <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
     <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
    </ul><p>Otherwise, if the document is <em>not</em> <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, and the DOCTYPE token matches one of
    the conditions in the following list, then set the <code><a href=#document>Document</a></code> to <a href=#limited-quirks-mode>limited-quirks
    mode</a>:</p>

    <ul class=brief><li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Frameset//<!--EN--></code>" </li>
     <li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Transitional//<!--EN--></code>" </li>
     <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
     <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
    </ul><p>The system identifier and public identifier strings must be
    compared to the values given in the lists above in an <a href=#ascii-case-insensitive>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>insertion mode</a> to "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>".</p>

   </dd>

   <dt>Anything else</dt>
   <dd>

    <p>If the document is <em>not</em> <a href=#an-iframe-srcdoc-document>an <code>iframe</code>
    <code title=attr-iframe-srcdoc>srcdoc</code> document</a>,
    then this is a <a href=#parse-error>parse error</a>; set the
    <code><a href=#document>Document</a></code> to <a href=#quirks-mode>quirks mode</a>.</p>

    <p>In any case, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>", then
    reprocess the token.</p>

   </dd>

  </dl><h6 id=the-before-html-insertion-mode><span class=secno>12.2.5.4.2 </span>The "<dfn title="insertion mode: before html">before html</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#the-before-html-insertion-mode title="insertion mode: before html">before html</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a> as the last child of the <code><a href=#document>Document</a></code> object.</p>
   </dd>

   <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
   FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p>Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>

    <p><a href=#create-an-element-for-the-token>Create an element for the token</a> in the <a href=#html-namespace-0>HTML namespace</a>, with the
    <code><a href=#document>Document</a></code> as the intended parent. Append it to the <code><a href=#document>Document</a></code> object. Put
    this element in the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p id=parser-appcache>If the <code><a href=#document>Document</a></code> is being loaded as part of <a href=#navigate title=navigate>navigation</a> of a <a href=#browsing-context>browsing context</a>, then: if the newly
    created element has a <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute whose value is
    not the empty string, then <a href=#resolve-a-url title="resolve a url">resolve</a> the value of that
    attribute to an <a href=#absolute-url>absolute URL</a>, relative to the newly created element, and if that is
    successful, run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection
    algorithm</a> with the result of applying the <a href=#concept-url-serializer title=concept-url-serializer>URL
    serializer</a> algorithm to the resulting <a href=#parsed-url>parsed URL</a> with the <i>exclude
    fragment flag</i> set; otherwise, if there is no such attribute, or its value is the empty
    string, or resolving its value fails, run the <a href=#concept-appcache-init title=concept-appcache-init>application
    cache selection algorithm</a> with no manifest. The algorithm must be passed the
    <code><a href=#document>Document</a></code> object.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before
    head</a>".</p>

   </dd>

   <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
   <dd>
    <p>Act as described in the "anything else" entry below.</p>
   </dd>

   <dt>Any other end tag</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>

    <p>Create an <code><a href=#the-html-element>html</a></code> element whose <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is the <code><a href=#document>Document</a></code> object. Append
    it to the <code><a href=#document>Document</a></code> object. Put this element in the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>

    <p>If the <code><a href=#document>Document</a></code> is being loaded as part of <a href=#navigate title=navigate>navigation</a> of a <a href=#browsing-context>browsing context</a>, then: run the <a href=#concept-appcache-init title=concept-appcache-init>application cache selection algorithm</a> with no manifest,
    passing it the <code><a href=#document>Document</a></code> object.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before
    head</a>", then reprocess the token.</p>

   </dd>

  </dl><p>The root element can end up being removed from the <code><a href=#document>Document</a></code> object, e.g. by
  scripts; nothing in particular happens in such cases, content continues being appended to the
  nodes as described in the next section.</p>


  <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<dfn title="insertion mode: before head">before head</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before head</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p>Ignore the token.</p> <!-- :-( -->
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in
    body">in body</a>" <a href=#insertion-mode>insertion mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "head"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Set the <a href=#head-element-pointer><code title="">head</code> element pointer</a> to the newly created
    <code><a href=#the-head-element>head</a></code> element.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in
    head</a>".</p>

   </dd>

   <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
   <dd>

    <p>Act as described in the "anything else" entry below.</p>

   </dd>

   <dt>Any other end tag</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>

    <!-- fake <head> -->

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "head" start tag token with no attributes.</p>

    <p>Set the <a href=#head-element-pointer><code title="">head</code> element pointer</a> to the newly created
    <code><a href=#the-head-element>head</a></code> element.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in
    head</a>".</p>

    <!-- end of fake <head> -->

    <p>Reprocess the current token.</p>

   </dd>

  </dl><h6 id=parsing-main-inhead><span class=secno>12.2.5.4.4 </span>The "<dfn title="insertion mode: in head">in head</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p><a href=#insert-a-character title="insert a character">Insert the character</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in
    body">in body</a>" <a href=#insertion-mode>insertion mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is one of: "base", "basefont",
   "bgsound", "link"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node>current
    node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p>

   </dd>

   <dt>A start tag whose tag name is "meta"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node>current
    node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p>

    <p id=meta-charset-during-parse>If the element has a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute, and <a href=#getting-an-encoding>getting an encoding</a> from
    its value results in a supported <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a> or <a href=#a-utf-16-encoding>a
    UTF-16 encoding</a>, and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
    currently <i>tentative</i>, then <a href=#change-the-encoding>change the encoding</a> to the resulting encoding.</p>

    <p>Otherwise, if the element has an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>
    attribute whose value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">Content-Type</code>", and the element has a <code title=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>algorithm for
    extracting a character encoding from a <code>meta</code> element</a> to that attribute's
    value returns a supported <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a> or <a href=#a-utf-16-encoding>a UTF-16
    encoding</a>, and the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
    currently <i>tentative</i>, then <a href=#change-the-encoding>change the encoding</a> to the extracted encoding.</p>

   </dd>

   <dt>A start tag whose tag name is "title"</dt>
   <dd>
    <p>Follow the <a href=#generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag>scripting flag</a> is enabled</dt>
   <dt>A start tag whose tag name is one of: "noframes", "style"</dt>
   <dd>
    <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag>scripting flag</a> is disabled</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in
    head noscript</a>".</p>

   </dd>


   <dt id=scriptTag>A start tag whose tag name is "script"</dt>
   <dd>

    <p>Run these steps:</p>

    <ol><li><p>Let the <var title="">adjusted insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node>appropriate place
     for inserting a node</a>.</li>

     <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> in the <a href=#html-namespace-0>HTML namespace</a>, with
     the intended parent being the element in which the <var title="">adjusted insertion
     location</var> finds itself.</li>

     <li>

      <p>Mark the element as being <a href=#parser-inserted>"parser-inserted"</a> and unset the element's
      <a href=#force-async>"force-async"</a> flag.</p>

      <p class=note>This ensures that, if the script is external, any <code title=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>

     <li><p>If the parser was originally created for the <a href=#html-fragment-parsing-algorithm>HTML fragment parsing
     algorithm</a>, then mark the <code><a href=#the-script-element>script</a></code> element as <a href=#already-started>"already started"</a>.
     (<a href=#fragment-case>fragment case</a>)</li>

     <li><p>Insert the newly created element at the <var title="">adjusted insertion
     location</var>.</li>

     <li><p>Push the element onto the <a href=#stack-of-open-elements>stack of open elements</a> so that it is the new
     <a href=#current-node>current node</a>.</li>

     <li><p>Switch the tokenizer to the <a href=#script-data-state>script data state</a>.</li>

     <li><p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode>insertion
     mode</a>.</p>

     <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incdata title="insertion mode:
     text">text</a>".</li>

    </ol></dd>

   <dt>An end tag whose tag name is "head"</dt>
   <dd>

    <p>Pop the <a href=#current-node>current node</a> (which will be the <code><a href=#the-head-element>head</a></code> element) off the
    <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-head-insertion-mode title="insertion mode: after head">after
    head</a>".</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
   <dd>
    <p>Act as described in the "anything else" entry below.</p>
   </dd>

   <dt>A start tag whose tag name is "template"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intemplate title="insertion mode: in template">in
    template</a>".</p>

    <p>Push "<a href=#parsing-main-intemplate title="insertion mode: in template">in template</a>" onto the <a href=#stack-of-template-insertion-modes>stack of
    template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode>current template insertion
    mode</a>.</p>

   </dd>

   <dt>An end tag whose tag name is "template"</dt>
   <dd>

    <p>If there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then
    this is a <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

     <li><p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-template-element>template</a></code> element, then this is a
     <a href=#parse-error>parse error</a>.</li>

     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-template-element>template</a></code>
     element has been popped from the stack.</li>

     <li><a href=#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>

     <li><p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template
     insertion modes</a>.</p>

     <li><p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</li>

    </ol></dd>

   <dt>A start tag whose tag name is "head"</dt>
   <dt>Any other end tag</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>

    <!-- can't get here with an EOF and a fragment case -->

    <!-- start of fake </head> -->
    <p>Pop the <a href=#current-node>current node</a> (which will be the
    <code><a href=#the-head-element>head</a></code> element) off the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-head-insertion-mode title="insertion mode: after head">after head</a>".</p>
    <!-- end of fake </head> -->

    <p>Reprocess the token.</p>

   </dd>

  </dl><h6 id=parsing-main-inheadnoscript><span class=secno>12.2.5.4.5 </span>The "<dfn title="insertion mode: in head noscript">in head noscript</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in head noscript</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end tag whose tag name is "noscript"</dt>
   <dd>

    <p>Pop the <a href=#current-node>current node</a> (which will be a
    <code><a href=#the-noscript-element>noscript</a></code> element) from the <a href=#stack-of-open-elements>stack of open
    elements</a>; the new <a href=#current-node>current node</a> will be a
    <code><a href=#the-head-element>head</a></code> element.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>".</p>

   </dd>

   <dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dt>A comment token</dt>
   <dt>A start tag whose tag name is one of: "basefont", "bgsound",
   "link", "meta", "noframes", "style"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end tag whose tag name is "br"</dt>
   <dd>
    <p>Act as described in the "anything else" entry below.</p>
   </dd>

   <dt>A start tag whose tag name is one of: "head", "noscript"</dt>
   <dt>Any other end tag</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>

    <!-- can't get here with an EOF and a fragment case -->

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- fake </noscript> -->
    <p>Pop the <a href=#current-node>current node</a> (which will be a
    <code><a href=#the-noscript-element>noscript</a></code> element) from the <a href=#stack-of-open-elements>stack of open
    elements</a>; the new <a href=#current-node>current node</a> will be a
    <code><a href=#the-head-element>head</a></code> element.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>".</p>
    <!-- end fake </noscript> -->

    <p>Reprocess the token.</p>

   </dd>

  </dl><h6 id=the-after-head-insertion-mode><span class=secno>12.2.5.4.6 </span>The "<dfn title="insertion mode: after head">after head</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#the-after-head-insertion-mode title="insertion mode: after head">after head</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p><a href=#insert-a-character title="insert a character">Insert the character</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "body"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in
    body</a>".</p>

   </dd>

   <dt>A start tag whose tag name is "frameset"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in
    frameset</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta",
   "noframes", "script", "style", "title"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>Push the node pointed to by the <a href=#head-element-pointer><code title="">head</code> element pointer</a> onto
    the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in
    head">in head</a>" <a href=#insertion-mode>insertion mode</a>.</p>

    <p>Remove the node pointed to by the <a href=#head-element-pointer><code title="">head</code> element pointer</a>
    from the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p class=note>The <a href=#head-element-pointer><code title="">head</code> element pointer</a> cannot be null at
    this point.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
   <dd>
    <p>Act as described in the "anything else" entry below.</p>
   </dd>

   <dt>A start tag whose tag name is "head"</dt>
   <dt>Any other end tag</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>

    <!-- fake <body>, but without resetting frameset-ok -->
    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "body" start tag token with no attributes.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in
    body</a>".</p>
    <!-- end fake <body> -->

    <p>Reprocess the current token.</p>

   </dd>

  </dl><h6 id=parsing-main-inbody><span class=secno>12.2.5.4.7 </span>The "<dfn title="insertion mode: in body">in body</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is U+0000 NULL</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>

    <!-- The D-Link DSL-G604T ADSL router has a zero byte in its
         configuration UI before a <frameset>, which is why U+0000 is
         special-cased here.
         refs: https://bugzilla.mozilla.org/show_bug.cgi?id=563526
               http://www.w3.org/Bugs/Public/show_bug.cgi?id=9659
    -->

   </dd>

   <dt>A character token that is one of U+0009 CHARACTER TABULATION,
   U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE
   RETURN (CR), or U+0020 SPACE</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-a-character title="insert a character">Insert the token's character</a>.</p>

   </dd>

   <dt>Any other character token</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-a-character title="insert a character">Insert the token's character</a>.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If there is a <code><a href=#the-template-element>template</a></code> element on the <a href=#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>stack of open elements</a>. If it is not, add the attribute
    and its corresponding value to that element.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta",
   "noframes", "script", "style", "template", "title"</dt>
   <dt>An end tag whose tag name is "template"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in
    head">in head</a>" <a href=#insertion-mode>insertion mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "body"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the second element on the <a href=#stack-of-open-elements>stack of open elements</a> is not a <code><a href=#the-body-element>body</a></code>
    element, if the <a href=#stack-of-open-elements>stack of open elements</a> has only one node on it, or if there is a
    <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then ignore the token.
    (<a href=#fragment-case>fragment case</a>)</p>

    <p>Otherwise, set the <a href=#frameset-ok-flag>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><a href=#the-body-element>body</a></code> element (the
    second element) on the <a href=#stack-of-open-elements>stack of open elements</a>, and if it is not, add the attribute
    and its corresponding value to that element.</p>

   </dd>

   <dt>A start tag whose tag name is "frameset"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> has only one node on it, or if the second element
    on the <a href=#stack-of-open-elements>stack of open elements</a> is not a <code><a href=#the-body-element>body</a></code> element, then ignore the
    token. (<a href=#fragment-case>fragment case</a>)</p>

    <p>If the <a href=#frameset-ok-flag>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>stack of open elements</a> from its parent
     node, if it has one.</li>

     <li><p>Pop all the nodes from the bottom of the <a href=#stack-of-open-elements>stack of open elements</a>, from the
     <a href=#current-node>current node</a> up to, but not including, the root <code><a href=#the-html-element>html</a></code> element.</p>

     <li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</li>

     <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in
     frameset</a>".</p>

    </ol></dd>

   <dt>An end-of-file token</dt>
   <dd>

    <p>If there is a node in the <a href=#stack-of-open-elements>stack of open elements</a> that is not either a
    <code><a href=#the-dd-element>dd</a></code> element, a <code><a href=#the-dt-element>dt</a></code> element, an <code><a href=#the-li-element>li</a></code> element, a <code><a href=#the-p-element>p</a></code>
    element, a <code><a href=#the-tbody-element>tbody</a></code> element, a <code><a href=#the-td-element>td</a></code> element, a <code><a href=#the-tfoot-element>tfoot</a></code> element,
    a <code><a href=#the-th-element>th</a></code> element, a <code><a href=#the-thead-element>thead</a></code> element, a <code><a href=#the-tr-element>tr</a></code> element, the
    <code><a href=#the-body-element>body</a></code> element, or the <code><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error>parse
    error</a>.</p> <!-- (some of those are fragment cases) -->

    <p>If the <a href=#stack-of-template-insertion-modes>stack of template insertion modes</a> is not empty, then process the token
    <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intemplate title="insertion mode: in template">in
    template</a>" <a href=#insertion-mode>insertion mode</a>.</p>
    <!-- this is needed to handle <head><template>...[EOF] - otherwise we don't construct the <body> element -->

    <p>Otherwise, <a href=#stop-parsing>stop parsing</a>.</p>

   </dd>

   <dt>An end tag whose tag name is "body"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in
    scope">have a <code>body</code> element in scope</a>, this is a <a href=#parse-error>parse error</a>;
    ignore the token.</p>

    <!-- if we get here, the insertion mode here is forcibly "in body". -->

    <p>Otherwise, if there is a node in the <a href=#stack-of-open-elements>stack of open elements</a> that is not either a
    <code><a href=#the-dd-element>dd</a></code> element, a <code><a href=#the-dt-element>dt</a></code> element, an <code><a href=#the-li-element>li</a></code> element, an
    <code><a href=#the-optgroup-element>optgroup</a></code> element, an <code><a href=#the-option-element>option</a></code> element, a <code><a href=#the-p-element>p</a></code> element, an
    <code><a href=#the-rp-element>rp</a></code> element, an <code><a href=#the-rt-element>rt</a></code> element, a <code><a href=#the-tbody-element>tbody</a></code> element, a
    <code><a href=#the-td-element>td</a></code> element, a <code><a href=#the-tfoot-element>tfoot</a></code> element, a <code><a href=#the-th-element>th</a></code> element, a
    <code><a href=#the-thead-element>thead</a></code> element, a <code><a href=#the-tr-element>tr</a></code> element, the <code><a href=#the-body-element>body</a></code> element, or the
    <code><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error>parse error</a>.</p> <!-- (some of those are
    fragment cases, e.g. for <tbody> you'd have hit the first paragraph since the <body> wouldn't be
    in scope, unless it was a fragment case) -->

    <!-- If we ever change the frameset-ok flag to an insertion mode, then we'd have to somehow keep
    track of its state when we switch to after-body. -->

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-afterbody title="insertion mode: after body">after
    body</a>".</p>

   </dd>

   <dt>An end tag whose tag name is "html"</dt>
   <dd>

    <!-- fake </body> -->
    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in
    scope">have a <code>body</code> element in scope</a>, this is a <a href=#parse-error>parse error</a>;
    ignore the token.</p>

    <!-- if we get here, the insertion mode here is forcibly "in body". -->

    <p>Otherwise, if there is a node in the <a href=#stack-of-open-elements>stack of open elements</a> that is not either a
    <code><a href=#the-dd-element>dd</a></code> element, a <code><a href=#the-dt-element>dt</a></code> element, an <code><a href=#the-li-element>li</a></code> element, an
    <code><a href=#the-optgroup-element>optgroup</a></code> element, an <code><a href=#the-option-element>option</a></code> element, a <code><a href=#the-p-element>p</a></code> element, an
    <code><a href=#the-rp-element>rp</a></code> element, an <code><a href=#the-rt-element>rt</a></code> element, a <code><a href=#the-tbody-element>tbody</a></code> element, a
    <code><a href=#the-td-element>td</a></code> element, a <code><a href=#the-tfoot-element>tfoot</a></code> element, a <code><a href=#the-th-element>th</a></code> element, a
    <code><a href=#the-thead-element>thead</a></code> element, a <code><a href=#the-tr-element>tr</a></code> element, the <code><a href=#the-body-element>body</a></code> element, or the
    <code><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error>parse error</a>.</p> <!-- (some of those are
    fragment cases, e.g. for <tbody> you'd have hit the first paragraph since the <body> wouldn't be
    in scope, unless it was a fragment case) -->

    <!-- If we ever change the frameset-ok flag to an insertion mode, then we'd have to somehow keep
    track of its state when we switch to after-body. -->

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-afterbody title="insertion mode: after body">after
    body</a>".</p>
    <!-- end fake </body> -->

    <p>Reprocess the token.</p>

   </dd>

   <!-- start tags for non-phrasing flow content elements -->

   <!-- the normal ones -->
   <dt>A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center",
   "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header",
   "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"</dt>
   <dd>

    <!-- As of May 2008 this doesn't match any browser exactly, but is as close to what IE does as I
    can get without doing the non-tree DOM nonsense, and thus should actually afford better
    compatibility when implemented by the other browsers. -->

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

   </dd>

   <!-- as normal, but close h1-h6 if it's the current node -->
   <dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
   "h5", "h6"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p>If the <a href=#current-node>current node</a> is an <a href=#html-elements title="HTML elements">HTML element</a> whose
    tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a <a href=#parse-error>parse
    error</a>; pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>
    <!-- See https://bugs.webkit.org/show_bug.cgi?id=12646 -->

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

   </dd>

   <!-- as normal, but drops leading newline -->
   <dt>A start tag whose tag name is one of: "pre", "listing"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>If the <a href=#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><a href=#the-pre-element>pre</a></code> blocks are ignored
    as an authoring convenience.)</p>

    <!-- <pre>[CR]X will eat the [CR], <pre>&#x10;X will eat the
    &#x10;, but <pre>&#x13;X will not eat the &#x13;. -->

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

   </dd>

   <!-- as normal, but interacts with the form element pointer -->
   <dt>A start tag whose tag name is "form"</dt>
   <dd>

    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, then this is
    a <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element created.</p>

   </dd>

   <!-- as normal, but imply </li> when there's another <li> open in weird cases -->
   <dt>A start tag whose tag name is "li"</dt>
   <dd>

    <p>Run these steps:</p>

    <ol><li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</li>

     <li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
     node</a> (the bottommost node of the stack).</li>

     <li>

      <p><i>Loop</i>: If <var title="">node</var> is an <code><a href=#the-li-element>li</a></code> element, then run these
      substeps:</p>

      <ol><!-- fake </li> --><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except for <code><a href=#the-li-element>li</a></code> elements.</li>

       <li><p>If the <a href=#current-node>current node</a> is not an <code><a href=#the-li-element>li</a></code> element, then this is a
       <a href=#parse-error>parse error</a>.</li>

       <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until an <code><a href=#the-li-element>li</a></code>
       element has been popped from the stack.</li>
       <!-- end of fake </li> -->

       <li><p>Jump to the step labeled <i>done</i> below.</li>

      </ol></li>

     <li><p>If <var title="">node</var> is in the <a href=#special>special</a>
     category, but is not an <code><a href=#the-address-element>address</a></code>, <code><a href=#the-div-element>div</a></code>,
     or <code><a href=#the-p-element>p</a></code> element, then jump to the step labeled <i>done</i> below.</li>
     <!-- an element <foo> is in this list if the following markup:

         <!DOCTYPE html><body><ol><li><foo><li>

     ...results in the second <li> not being (in any way) a descendant
     of the first <li>, or if <foo> is a formatting element that gets
     reopened later. -->

     <li><p>Otherwise, set <var title="">node</var> to the previous
     entry in the <a href=#stack-of-open-elements>stack of open elements</a> and return to
     the step labeled <i>loop</i>.</li>

     <li><p><i>Done</i>: If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in
     button scope">has a <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a
     <code>p</code> element</a>.</li>

     <li><p>Finally, <a href=#insert-an-html-element>insert an HTML element</a> for the token.</li>

    </ol></dd>

   <!-- as normal, but imply </dt> or </dd> when there's another <dt> or <dd> open in weird cases  -->
   <dt>A start tag whose tag name is one of: "dd", "dt"</dt>
   <dd>

    <p>Run these steps:</p>

    <ol><li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</li>

     <li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current
     node</a> (the bottommost node of the stack).</li>

     <li>

      <p><i>Loop</i>: If <var title="">node</var> is a <code><a href=#the-dd-element>dd</a></code> element, then run these
      substeps:</p>

      <ol><!-- fake </dd> --><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except for <code><a href=#the-dd-element>dd</a></code> elements.</li>

       <li><p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-dd-element>dd</a></code> element, then this is a
       <a href=#parse-error>parse error</a>.</li>

       <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-dd-element>dd</a></code>
       element has been popped from the stack.</li>
       <!-- end of fake </dd> -->

       <li><p>Jump to the step labeled <i>done</i> below.</li>

      </ol></li>

     <li>

      <p>If <var title="">node</var> is a <code><a href=#the-dt-element>dt</a></code> element, then run these substeps:</p>

      <ol><!-- fake </dt> --><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except for <code><a href=#the-dt-element>dt</a></code> elements.</li>

       <li><p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-dt-element>dt</a></code> element, then this is a
       <a href=#parse-error>parse error</a>.</li>

       <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-dt-element>dt</a></code>
       element has been popped from the stack.</li>
       <!-- end of fake </dt> -->

       <li><p>Jump to the step labeled <i>done</i> below.</li>

      </ol></li>

     <li><p>If <var title="">node</var> is in the <a href=#special>special</a>
     category, but is not an <code><a href=#the-address-element>address</a></code>, <code><a href=#the-div-element>div</a></code>,
     or <code><a href=#the-p-element>p</a></code> element, then jump to the step labeled <i>done</i> below.</li>
     <!-- an element <foo> is in this list if the following markup:

         <!DOCTYPE html><body><dl><dt><foo><dt>

     ...results in the second <dt> not being (in any way) a descendant
     of the first <dt>, or if <foo> is a formatting element that gets
     reopened later. -->

     <li><p>Otherwise, set <var title="">node</var> to the previous
     entry in the <a href=#stack-of-open-elements>stack of open elements</a> and return to
     the step labeled <i>loop</i>.</li>

     <li><p><i>Done</i>: If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in
     button scope">has a <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a
     <code>p</code> element</a>.</li>

     <li><p>Finally, <a href=#insert-an-html-element>insert an HTML element</a> for the token.</li>

    </ol></dd>

   <!-- same as normal, but effectively ends parsing -->
   <dt>A start tag whose tag name is "plaintext"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has
    an element in button scope">has a <code>p</code> element in button
    scope</a>, then <a href=#close-a-p-element>close a <code>p</code> element</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Switch the tokenizer to the <a href=#plaintext-state>PLAINTEXT state</a>.</p>

    <p class=note>Once a start tag with the tag name "plaintext" has
    been seen, that will be the last token ever seen other than
    character tokens (and the end-of-file token), because there is no
    way to switch out of the <a href=#plaintext-state>PLAINTEXT state</a>.</p>

   </dd>

   <!-- button is a hybrid -->
   <dt>A start tag whose tag name is "button"</dt>
   <dd>

    <ol><li>

      <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an element in scope">has a
      <code>button</code> element in scope</a>, then run these substeps:</p>

      <ol><li><p><a href=#parse-error>Parse error</a>.</li>

       <li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

       <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-button-element>button</a></code>
       element has been popped from the stack.</li>

      </ol></li>

     <li><p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</li>

     <li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</li>

     <li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</li>

    </ol></dd>

   <!-- end tags for non-phrasing flow content elements (and button) -->

   <!-- the normal ones -->
   <dt>An end tag whose tag name is one of: "address", "article",
   "aside", "blockquote", "button", "center", "details", "dialog",
   "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
   "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre",
   "section", "summary", "ul"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
    that is an <a href=#html-elements title="HTML elements">HTML element</a> and
    with the same tag name as that of the token, then this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

     <li><p>If the <a href=#current-node>current node</a> is not an <a href=#html-elements title="HTML elements">HTML element</a> with
     the same tag name as that of the token, then this is a
     <a href=#parse-error>parse error</a>.</li>

     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
     until an <a href=#html-elements title="HTML elements">HTML element</a> with the same tag name as the token has been
     popped from the stack.</li>

    </ol></dd>

   <!-- removes the form element pointer instead of the matching node -->
   <dt>An end tag whose tag name is "form"</dt>
   <dd>

    <p>Let <var title="">node</var> be the element that the
    <a href=#form-element-pointer><code title="">form</code> element pointer</a> is set
    to.</p>

    <p>Set the <a href=#form-element-pointer><code title="">form</code> element pointer</a>
    to null.</p>

    <p>If <var title="">node</var> is null or the <a href=#stack-of-open-elements>stack of open
    elements</a> does not <a href=#has-an-element-in-scope title="has an element in
    scope">have <var title="">node</var> in scope</a>, then this is
    a <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

     <li><p>If the <a href=#current-node>current node</a> is not <var title="">node</var>, then this is a <a href=#parse-error>parse
     error</a>.</li>

     <li><p>Remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of
     open elements</a>.</li>

    </ol></dd>

   <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
   <dt>An end tag whose tag name is "p"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-button-scope title="has an element in button
    scope">have a <code>p</code> element in button scope</a>, then this is a <a href=#parse-error>parse
    error</a>; <a href=#insert-an-html-element>insert an HTML element</a> for a "p" start tag token with no
    attributes.</p>

    <p><a href=#close-a-p-element>Close a <code>p</code> element</a>.</p>

   </dd>

   <!-- as normal, but needs care as the elements have optional tags, and are further scoped by <ol>/<ul> -->
   <dt>An end tag whose tag name is "li"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-list-item-scope title="has an element in list item scope">have an <code>li</code> element in list
    item scope</a>,
    then this is a <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except
     for <code><a href=#the-li-element>li</a></code> elements.</li>

     <li><p>If the <a href=#current-node>current node</a> is not an <code><a href=#the-li-element>li</a></code> element, then this is a
     <a href=#parse-error>parse error</a>.</li>

     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
     until an <code><a href=#the-li-element>li</a></code> element has been
     popped from the stack.</li>

    </ol></dd>

   <!-- as normal, but needs care as the elements have optional tags -->
   <dt>An end tag whose tag name is one of: "dd", "dt"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
    that is an <a href=#html-elements title="HTML elements">HTML element</a> and
    with the same tag name as that of the token, then this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except
     for <a href=#html-elements>HTML elements</a> with the same tag name as the token.</li>

     <li><p>If the <a href=#current-node>current node</a> is not an <a href=#html-elements title="HTML elements">HTML element</a> with
     the same tag name as that of the token, then this is a
     <a href=#parse-error>parse error</a>.</li>

     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
     until an <a href=#html-elements title="HTML elements">HTML element</a> with the same tag name as the token has been
     popped from the stack.</li>

    </ol></dd>

   <!-- as normal, except acts as a closer for any of the h1-h6 elements -->
   <dt>An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have an element in scope</a>
    that is an <a href=#html-elements title="HTML elements">HTML element</a> and
    whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6",
    then this is a <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

     <li><p>If the <a href=#current-node>current node</a> is not an <a href=#html-elements title="HTML elements">HTML element</a> with
     the same tag name as that of the token, then this is a
     <a href=#parse-error>parse error</a>.</li>

     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
     until an <a href=#html-elements title="HTML elements">HTML element</a> whose tag name is one of "h1", "h2", "h3", "h4",
     "h5", or "h6" has been popped from the stack.</li>

    </ol></dd>

   <!-- see also applet/marquee/object lower down -->

   <dt>An end tag whose tag name is "sarcasm"</dt>
   <dd>
    <p>Take a deep breath, then act as described in the "any other end
    tag" entry below.</p>
   </dd>

   <!-- ADOPTION AGENCY ELEMENTS
        Mozilla-only: bdo blink del ins sub sup q
        Safari-only: code dfn kbd nobr samp var wbr
        Both: a b big em font i s small strike strong tt u -->

   <dt>A start tag whose tag name is "a"</dt>
   <dd>

    <p>If the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>
    contains an <code><a href=#the-a-element>a</a></code> element between the end of
    the list and the last marker on the list (or the start of the
    list if there is no marker on the list), then this is a
    <a href=#parse-error>parse error</a>; run the <a href=#adoption-agency-algorithm>adoption agency
    algorithm</a> for the tag name "a", then remove that element from the
    <a href=#list-of-active-formatting-elements>list of active formatting elements</a> and the
    <a href=#stack-of-open-elements>stack of open elements</a> if the <a href=#adoption-agency-algorithm>adoption agency
    algorithm</a> didn't
    already remove it (it might not have if the element is not
    <a href=#has-an-element-in-table-scope title="has an element in table scope">in table
    scope</a>).</p>

    <p class=example>In the non-conforming stream
    <code>&lt;a&nbsp;href="a"&gt;a&lt;table&gt;&lt;a&nbsp;href="b"&gt;b&lt;/table&gt;x</code>,
    the first <code><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><a href=#the-a-element>a</a></code>
    element is not in table scope (meaning that a regular
    <code>&lt;/a&gt;</code> end tag at the start of the table wouldn't
    close the outer <code><a href=#the-a-element>a</a></code> element). The result is that the
    two <code><a href=#the-a-element>a</a></code> elements are indirectly nested inside each
    other &mdash; non-conforming markup will often result in
    non-conforming DOMs when parsed.</p>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
    any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. <a href=#push-onto-the-list-of-active-formatting-elements>Push
    onto the list of active formatting elements</a> that
    element.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "b", "big", "code", "em",
   "font", "i", "s", "small", "strike", "strong", "tt", "u"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
    any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. <a href=#push-onto-the-list-of-active-formatting-elements>Push
    onto the list of active formatting elements</a> that
    element.</p>

   </dd>

   <dt>A start tag whose tag name is "nobr"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if
    any.</p>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an
    element in scope">has a <code>nobr</code> element in scope</a>,
    then this is a <a href=#parse-error>parse error</a>; run the <a href=#adoption-agency-algorithm>adoption agency algorithm</a> for
    the tag name "nobr", then once again
    <a href=#reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</a>, if
    any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. <a href=#push-onto-the-list-of-active-formatting-elements>Push
    onto the list of active formatting elements</a> that
    element.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "a",
   "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
   "strike", "strong", "tt", "u"</dt>
   <dd>

    <p>Run the <a href=#adoption-agency-algorithm>adoption agency algorithm</a> for the token's tag name.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "applet", "marquee", "object"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

   </dd>

   <dt>An end tag token whose tag name is one of: "applet", "marquee", "object"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in
    scope">have an element in scope</a> that is an <a href=#html-elements title="HTML elements">HTML
    element</a> and with the same tag name as that of the token, then this is a <a href=#parse-error>parse
    error</a>; ignore the token.</p>

    <p>Otherwise, run these steps:</p>

    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

     <li><p>If the <a href=#current-node>current node</a> is not an <a href=#html-elements title="HTML elements">HTML
     element</a> with the same tag name as that of the token, then this is a <a href=#parse-error>parse
     error</a>.</li>

     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until an <a href=#html-elements title="HTML
     elements">HTML element</a> with the same tag name as the token has been popped from the
     stack.</li>

     <li><a href=#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>

    </ol></dd>

   <dt>A start tag whose tag name is "table"</dt>
   <dd>

    <p>If the <code><a href=#document>Document</a></code> is <em>not</em> set to <a href=#quirks-mode>quirks mode</a>, and the
    <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p> <!-- i hate myself (this quirk was basically caused by acid2; if i'd
    realised we could change the specs when i wrote acid2, we could have avoided having any
    parsing-mode quirks) -Hixie -->

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in
    table</a>".</p>

   </dd>

   <dt>An end tag whose tag name is "br"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. Act as described in the next entry, as if this was a "br" start tag
    token, rather than an end tag token.</p>

   </dd>

   <!-- do not insert things here, since the previous entry refers to the next entry -->

   <dt>A start tag whose tag name is one of: "area", "br", "embed",
   "img", "keygen", "wbr"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node>current
    node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
    <!-- shouldn't really do this for <area> -->

   </dd>

   <dt>A start tag whose tag name is "input"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node>current
    node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p>

    <p>If the token does not have an attribute with the name "type", or if it does, but that
    attribute's value is not an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">hidden</code>", then: set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "menuitem", "param", "source", "track"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node>current
    node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p>

   </dd>

   <dt>A start tag whose tag name is "hr"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node>current
    node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

   </dd>

   <dt>A start tag whose tag name is "image"</dt>
   <dd>
    <!-- As of 2005-12, studies showed that around 0.2% of pages used the <image> element. -->
    <p><a href=#parse-error>Parse error</a>. Change the token's tag name to "img" and reprocess it. (Don't
    ask.)</p>
   </dd>

   <dt id=isindex>A start tag whose tag name is "isindex"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null, then ignore the
    token.</p>

    <p>Otherwise:</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
    flag</i></a>, if it is set.</p> <!-- purely to reduce the number of errors (we don't care if
    they included the /, they're not supposed to be including the tag at all! -->

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <!-- fake <form> -->
    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "form" start tag token with no attributes, and set
    the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element
    created.</p>

    <p>If the token has an attribute called "action", set the <code title=attr-fs-action><a href=#attr-fs-action>action</a></code> attribute on the resulting <code><a href=#the-form-element>form</a></code> element to the
    value of the "action" attribute of the token.</p>

    <!-- fake <hr> -->
    <p><a href=#insert-an-html-element>Insert an HTML element</a> for an "hr" start tag token with no attributes.
    Immediately pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <!-- fake <label> -->
    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "label" start tag token with no attributes.</p>

    <!-- fake text -->
    <p><a href=#insert-a-character title="insert a character">Insert characters</a> (see below for <a href=#attr-isindex-prompt title=attr-isindex-prompt>what they should say</a>).</p>

    <!-- fake <input> -->
    <p><a href=#insert-an-html-element>Insert an HTML element</a> for an "input" start tag token with all the attributes
    from the "isindex" token except "name", "action", and "prompt", and with an attribute named
    "name" with the value "isindex". (This creates an <code><a href=#the-input-element>input</a></code> element with the <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute set to the magic balue "<code title=attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code>".) Immediately pop the <a href=#current-node>current node</a> off
    the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <!-- fake text -->
    <p><a href=#insert-a-character title="insert a character">Insert more characters</a> (see below for <a href=#attr-isindex-prompt title=attr-isindex-prompt>what they should say</a>).</p>

    <!-- fake </label> -->
    <p>Pop the <a href=#current-node>current node</a> (which will be the <code><a href=#the-label-element>label</a></code> element created
    earlier) off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <!-- fake <hr> -->
    <p><a href=#insert-an-html-element>Insert an HTML element</a> for an "hr" start tag token with no attributes.
    Immediately pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <!-- fake </form> -->
    <p>Pop the <a href=#current-node>current node</a> (which will be the <code><a href=#the-form-element>form</a></code> element created
    earlier) off the <a href=#stack-of-open-elements>stack of open elements</a>. Set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to null.</p>

    <!-- explanation of text -->
    <p><dfn id=attr-isindex-prompt title=attr-isindex-prompt><strong>Prompt</strong></dfn>: If the token has an attribute
    with the name "prompt", then the first stream of characters must be the same string as given in
    that attribute, and the second stream of characters must be empty. Otherwise, the two streams of
    character tokens together should, together with the <code><a href=#the-input-element>input</a></code> element, express the
    equivalent of "This is a searchable index. Enter search keywords: (input field)" in the user's
    preferred language.</p>

   </dd>

   <dt>A start tag whose tag name is "textarea"</dt>
   <dd>

    <p>Run these steps:</p>

    <ol><li><p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</li>

     <li><p>If the <a href=#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><a href=#the-textarea-element>textarea</a></code>
     elements are ignored as an authoring convenience.)</li>

     <!-- see comment in <pre> start tag bit -->

     <li><p>Switch the tokenizer to the <a href=#rcdata-state>RCDATA state</a>.</li>

     <li><p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode>insertion
     mode</a>.</p>

     <li><p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</li>

     <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incdata title="insertion mode:
     text">text</a>".</li>

    </ol></dd>

   <dt>A start tag whose tag name is "xmp"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-button-scope title="has an element in button scope">has a
    <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
    element</a>.</p>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>

   </dd>

   <dt>A start tag whose tag name is "iframe"</dt>
   <dd>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>

   </dd>

   <dt>A start tag whose tag name is "noembed"</dt>
   <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag>scripting flag</a> is enabled</dt>
   <dd>

    <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>

   </dd>

   <dt>A start tag whose tag name is "select"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

    <p>If the <a href=#insertion-mode>insertion mode</a> is one of "<a href=#parsing-main-intable title="insertion mode: in table">in
    table</a>", "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>", "<a href=#parsing-main-intbody title="insertion mode: in table body">in table body</a>", "<a href=#parsing-main-intr title="insertion mode: in
    row">in row</a>", or "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>", then switch the
    <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inselectintable title="insertion mode: in select in table">in select in
    table</a>". Otherwise, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inselect title="insertion
    mode: in select">in select</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "optgroup", "option"</dt>
   <dd>

    <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code> element, then pop the
    <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "rp", "rt"</dt>
   <dd>

    <!-- the parsing rules for ruby really don't match IE much at all,
         but in practice the markup used is very simple and so strict
         compatibility with IE isn't required. For example, as defined
         here we get very, very different behaviour than IE for
         pathological cases like:

           <ruby><ol><li><p>a<rt>b
           <ruby>a<rt>b<p>c

         But in practice most ruby markup falls into these cases:

           <ruby>a<rt>b</ruby>
           <ruby>a<rp>b<rt>c<rp>d</ruby>
           <ruby>a<rt>b</rt></ruby>
           <ruby>a<rp>b</rp><rt>c</rt><rp>d</rp></ruby>

         (Note: the comment above was written when this section did
         something slightly more radical for handling <rp> and <rt>
         elements, so it might be out of date now.)

    -->

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an element in scope">has a
    <code>ruby</code> element in scope</a>, then <a href=#generate-implied-end-tags>generate implied end tags</a>. If the
    <a href=#current-node>current node</a> is not then a <code><a href=#the-ruby-element>ruby</a></code> element, this is a <a href=#parse-error>parse
    error</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

   </dd>

   <dt>A start tag whose tag name is "math"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#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>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>Insert a foreign element</a> for the token, in the <a href=#mathml-namespace>MathML
    namespace</a>.</p>

    <!-- If we ever change the frameset-ok flag to an insertion mode, the following change would be
    implied, except we'd have to do it even in the face of a self-closed tag:
    <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
    -->

    <p>If the token has its <i>self-closing flag</i> set, pop the <a href=#current-node>current node</a> off the
    <a href=#stack-of-open-elements>stack of open elements</a> and <a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">acknowledge
    the token's <i>self-closing flag</i></a>.</p>

   </dd>

   <dt>A start tag whose tag name is "svg"</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#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>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>Insert a foreign element</a> for the token, in the <a href=#svg-namespace>SVG namespace</a>.</p>

    <!-- If we ever change the frameset-ok flag to an insertion mode, the following change would be
    implied, except we'd have to do it even in the face of a self-closed tag:
    <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
    -->

    <p>If the token has its <i>self-closing flag</i> set, pop the <a href=#current-node>current node</a> off the
    <a href=#stack-of-open-elements>stack of open elements</a> and <a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">acknowledge
    the token's <i>self-closing flag</i></a>.</p>

   </dd>

   <dt>A start <!--or end--> tag whose tag name is one of: "caption", "col", "colgroup", "frame",
   "head", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
   <!--<dt>An end tag whose tag name is one of: "area", "base", "basefont", "bgsound", "embed",
   "hr", "iframe", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta",
   "noembed", "noframes", "param", "script", "select", "source", "style", "table", "textarea",
   "title", "track", "wbr"</dt>-->
   <!--<dt>An end tag whose tag name is "noscript", if the <span>scripting flag</span> is
   enabled</dt>-->
   <dd>

    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>

    <!-- end tags are commented out because since they can never end up on the stack anyway, the
    default end tag clause will automatically handle them. we don't want to have text in the spec
    that is just an optimisation, as that detracts from the spec itself -->

   </dd>

   <dt>Any other start tag</dt>
   <dd>

    <p><a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p class=note>This element will be an <a href=#ordinary>ordinary</a>
    element.</p>

   </dd>

   <dt>Any other end tag</dt>
   <dd>

    <p>Run these steps:</p>

    <ol><li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current node</a> (the bottommost
     node of the stack).</li>

     <li><p><i>Loop</i>: If <var title="">node</var> is an <a href=#html-elements title="HTML elements">HTML
     element</a> with the same tag name as the token, then:</p>

      <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except for <a href=#html-elements>HTML elements</a> with the
       same tag name as the token.</li>

       <li><p>If <var title="">node</var> is not the <a href=#current-node>current node</a>, then this is a
       <a href=#parse-error>parse error</a>.</li>

       <li><p>Pop all the nodes from the <a href=#current-node>current node</a> up to <var title="">node</var>,
       including <var title="">node</var>, then stop these steps.</li>

      </ol></li>

     <li><p>Otherwise, if <var title="">node</var> is in the <a href=#special>special</a> category, then
     this is a <a href=#parse-error>parse error</a>; ignore the token, and abort these steps.</li>

     <li><p>Set <var title="">node</var> to the previous entry in the <a href=#stack-of-open-elements>stack of open
     elements</a>.</li>

     <li><p>Return to the step labeled <i>loop</i>.</li>

    </ol></dd>

  </dl><p>When the steps above say the user agent is to <dfn id=close-a-p-element>close a <code>p</code> element</dfn>, it
  means that the user agent must run the following steps:</p>

  <ol><!-- prereq: p in scope --><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>, except for <code><a href=#the-p-element>p</a></code> elements.</li>

   <li><p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-p-element>p</a></code> element, then this is a
   <a href=#parse-error>parse error</a>.</li>

   <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-p-element>p</a></code> element
   has been popped from the stack.</li>

  </ol><!-- AAA --><p id=adoptionAgency>The <dfn id=adoption-agency-algorithm>adoption agency algorithm</dfn>, which takes as its only argument
  a tag name <var title="">subject</var> for which the algorithm is being run, consists of the
  following steps:</p>

  <ol><!-- don't forget about the noah's ark clause when looking at this algorithm! --><li>

    <p>If the <a href=#current-node>current node</a> is an <a href=#html-elements title="HTML elements">HTML element</a> whose
    tag name is <var title="">subject</var>, then run these substeps:

    <ol><li><p>Let <var title="">element</var> be the <a href=#current-node>current node</a>.</li>

     <li><p>Pop <var title="">element</var> off the <a href=#stack-of-open-elements>stack of open elements</a>.</li>

     <li><p>If <var title="">element</var> is also in the <a href=#list-of-active-formatting-elements>list of active formatting
     elements</a>, remove the element from the list.</li>

     <li><p>Abort the <a href=#adoption-agency-algorithm>adoption agency algorithm</a>.</li>

    </ol></li>

   <li><p>Let <var title="">outer loop counter</var> be zero.</li>

   <li><p><i>Outer loop</i>: If <var title="">outer loop counter</var> is greater than or equal to
   eight, then abort these steps.</li>

   <li><p>Increment <var title="">outer loop counter</var> by one.</li>

   <li>

    <p>Let <var title="">formatting element</var> be the last element in the <a href=#list-of-active-formatting-elements>list of active
    formatting elements</a> that:</p>

    <ul><li>is between the end of the list and the last scope marker in the list, if any, or the start
     of the list otherwise, and</li>

     <li>has the tag name <var title="">subject</var>.</li>

    </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>

   <li><p>If <var title="">formatting element</var> is not in the <a href=#stack-of-open-elements>stack of open
   elements</a>, then this is a <a href=#parse-error>parse error</a>; remove the element from the list, and
   abort these steps.</li>

   <li><p>If <var title="">formatting element</var> is in the <a href=#stack-of-open-elements>stack of open elements</a>,
   but the element is not <a href=#has-an-element-in-scope title="has an element in scope">in scope</a>, then this is a
   <a href=#parse-error>parse error</a>; abort these steps.</li>

   <!-- at this point, <var title="">formatting element</var> is in <span title="stack of open
        elements">the stack</span> and <span title="list of active formatting elements">the
        list</span>, and is <span title="has an element in scope">in scope</span>. -->

   <li><p>If <var title="">formatting element</var> is not the <a href=#current-node>current node</a>, this is a
   <a href=#parse-error>parse error</a>. (But do not abort these steps.)</li>

   <li><p>Let <var title="">furthest block</var> be the topmost node in the <a href=#stack-of-open-elements>stack of open
   elements</a> that is lower in the stack than <var title="">formatting element</var>, and is an
   element in the <a href=#special>special</a> category. There might not be one.</li>

   <!-- <html> ... <formatting element> ... <furthest block> ... <current node> -->

   <li><p>If there is no <var title="">furthest block</var>, then the UA must first pop all the
   nodes from the bottom of the <a href=#stack-of-open-elements>stack of open elements</a>, from the <a href=#current-node>current
   node</a> up to and including <var title="">formatting element</var>, then remove <var title="">formatting element</var> from the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and
   finally abort these steps.</li> <!-- the "reconstruct the active formatting elements"
   algorithm will rebuild them later -->

   <li><p>Let <var title="">common ancestor</var> be the element immediately above <var title="">formatting element</var> in the <a href=#stack-of-open-elements>stack of open elements</a>.</li>

   <!-- <html> ... <common ancestor> <formatting element> ... <furthest block> ... <current node> -->

   <li><p>Let a bookmark note the position of <var title="">formatting element</var> in the
   <a href=#list-of-active-formatting-elements>list of active formatting elements</a> relative to the elements on either side of it in
   the list.</li>

   <li>

    <p>Let <var title="">node</var> and <var title="">last node</var> be <var title="">furthest
    block</var>. Follow these steps:</p>

    <ol><li><p>Let <var title="">inner loop counter</var> be zero.</li>

     <li><p><i>Inner loop</i>: Increment <var title="">inner loop counter</var> by one.</li>

     <li><p>Let <var title="">node</var> be the element immediately above <var title="">node</var>
     in the <a href=#stack-of-open-elements>stack of open elements</a>, or if <var title="">node</var> is no longer in the
     <a href=#stack-of-open-elements>stack of open elements</a> (e.g. because it got removed by this algorithm<!-- in
     particular, the step labeled "removal" below -->), the element that was immediately above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open elements</a> before <var title="">node</var>
     was removed.</li>

     <li><p>If <var title="">node</var> is <var title="">formatting element</var>, then go to the
     next step in the overall algorithm.</li>

     <li><p>If <var title="">inner loop counter</var> is greater than three and <var title="">node</var> is in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, then remove <var title="">node</var> from the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>

     <li><p><!-- "removal" step: -->If <var title="">node</var> is not in the <a href=#list-of-active-formatting-elements>list of active
     formatting elements</a>, then remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open
     elements</a> and then go back to the step labeled <i>inner loop</i>.</li>

     <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the element <var title="">node</var> was created, in the <a href=#html-namespace-0>HTML namespace</a>, with <var title="">common
     ancestor</var> as the intended parent; replace the entry for <var title="">node</var> in the
     <a href=#list-of-active-formatting-elements>list of active formatting elements</a> with an entry for the new element, replace the
     entry for <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open elements</a> with an entry for
     the new element, and let <var title="">node</var> be the new element.</li>

     <li><p>If <var title="">last node</var> is <var title="">furthest block</var>, then move the
     aforementioned bookmark to be immediately after the new <var title="">node</var> in the
     <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>

     <li><p>Insert <var title="">last node</var> into <var title="">node</var>, first removing it
     from its previous parent node if any.</li>

     <li><p>Let <var title="">last node</var> be <var title="">node</var>.</li>

     <li><p>Return to the step labeled <i>inner loop</i>.</li>

    </ol></li>

   <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the
   <a href=#appropriate-place-for-inserting-a-node>appropriate place for inserting a node</a>, but using <var title="">common
   ancestor</var> as the <i>override target</i>.</li>

   <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which <var title="">formatting
   element</var> was created, in the <a href=#html-namespace-0>HTML namespace</a>, with <var title="">furthest
   block</var> as the intended parent.</li>

   <li><p>Take all of the child nodes of <var title="">furthest block</var> and append them to the
   element created in the last step.</li>

   <li><p>Append that new element to <var title="">furthest block</var>.</li>

   <li><p>Remove <var title="">formatting element</var> from the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a>, and insert the new element into the <a href=#list-of-active-formatting-elements>list of active formatting
   elements</a> at the position of the aforementioned bookmark.</li>

   <li><p>Remove <var title="">formatting element</var> from the <a href=#stack-of-open-elements>stack of open
   elements</a>, and insert the new element into the <a href=#stack-of-open-elements>stack of open elements</a>
   immediately below the position of <var title="">furthest block</var> in that stack.</li>

   <li><p>Jump back to the step labeled <i>outer loop</i>.</li>

  </ol><p class=note>This algorithm's name, the "adoption agency algorithm", comes from the way it
  causes elements to change parents, and is in contrast with other possible algorithms for dealing
  with misnested content, which included the "incest algorithm", the "secret affair algorithm", and
  the "Heisenberg algorithm".</p>





  <h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-incdata title="insertion mode: text">text</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token</dt>
   <dd>

    <p><a href=#insert-a-character title="insert a character">Insert the token's character</a>.</p>

    <p class=note>This can never be a U+0000 NULL character; the tokenizer converts those to
    U+FFFD REPLACEMENT CHARACTER characters.</p>

   </dd>

   <dt>An end-of-file token</dt>
   <dd>

    <!-- can't be the fragment case -->
    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the <a href=#current-node>current node</a> is a <code><a href=#the-script-element>script</a></code> element, mark the
    <code><a href=#the-script-element>script</a></code> element as <a href=#already-started>"already started"</a>.</p>

    <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original insertion mode</a> and
    reprocess the token.</p>

   </dd>

   <dt id=scriptEndTag>An end tag whose tag name is "script"</dt>
   <dd>

    <p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</p>

    <p><a href=#provide-a-stable-state>Provide a stable state</a>.</p>

    <p>Let <var title="">script</var> be the <a href=#current-node>current node</a> (which will be a
    <code><a href=#the-script-element>script</a></code> element).</p>

    <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original insertion mode</a>.</p>

    <p>Let the <var title="">old insertion point</var> have the same value as the current
    <a href=#insertion-point>insertion point</a>. Let the <a href=#insertion-point>insertion point</a> be just before the <a href=#next-input-character>next
    input character</a>.</p>

    <p>Increment the parser's <a href=#script-nesting-level>script nesting level</a> by one.</p>

    <p><a href=#prepare-a-script title="prepare a script">Prepare</a> the <var title="">script</var>. This might
    cause some script to execute, which might cause <a href=#dom-document-write title=dom-document-write>new characters
    to be inserted into the tokenizer</a>, and might cause the tokenizer to output more tokens,
    resulting in a <a href=#nestedParsing>reentrant invocation of the parser</a>.</p>

    <p>Decrement the parser's <a href=#script-nesting-level>script nesting level</a> by one. If the parser's <a href=#script-nesting-level>script
    nesting level</a> is zero, then set the <a href=#parser-pause-flag>parser pause flag</a> to false.</p>

    <p>Let the <a href=#insertion-point>insertion point</a> have the value of the <var title="">old insertion
    point</var>. (In other words, restore the <a href=#insertion-point>insertion point</a> to its previous value.
    This value might be the "undefined" value.)</p>

    <p id=scriptTagParserResumes>At this stage, if there is a <a href=#pending-parsing-blocking-script>pending parsing-blocking
    script</a>, then:</p>

    <dl class=switch><dt>If the <a href=#script-nesting-level>script nesting level</a> is not zero:</dt>

     <dd>

      <p>Set the <a href=#parser-pause-flag>parser pause flag</a> to true, and abort the processing of any nested
      invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume
      when the caller returns to the "outer" tree construction stage.)</p>

      <p class=note>The tree construction stage of this particular parser is <a href=#nestedParsing>being called reentrantly</a>, say from a call to <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code>.</p>

     </dd>


     <dt>Otherwise:</dt>

     <dd>

      <p>Run these steps:</p>

      <ol><li><p>Let <var title="">the script</var> be the <a href=#pending-parsing-blocking-script>pending parsing-blocking
       script</a>. There is no longer a <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>.</li>

       <li><p>Block the <a href=#tokenization title=tokenization>tokenizer</a> for this instance of the
       <a href=#html-parser>HTML parser</a>, such that the <a href=#event-loop>event loop</a> will not run <a href=#concept-task title=concept-task>tasks</a> that invoke the <a href=#tokenization title=tokenization>tokenizer</a>.</li>

       <li><p>If the parser's <code><a href=#document>Document</a></code> <a href=#has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking
       scripts</a> or <var title="">the script</var>'s <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a>
       flag is not set: <a href=#spin-the-event-loop>spin the event loop</a> until the parser's <code><a href=#document>Document</a></code>
       <a href=#has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts</a> and <var title="">the script</var>'s
       <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag is set.</li>

       <li><p>Unblock the <a href=#tokenization title=tokenization>tokenizer</a> for this instance of the
       <a href=#html-parser>HTML parser</a>, such that <a href=#concept-task title=concept-task>tasks</a> that invoke the
       <a href=#tokenization title=tokenization>tokenizer</a> can again be run.</li>

       <li><p>Let the <a href=#insertion-point>insertion point</a> be just before the <a href=#next-input-character>next input
       character</a>.</li>

       <li><p>Increment the parser's <a href=#script-nesting-level>script nesting level</a> by one (it should be zero
       before this step, so this sets it to one).</li>

       <li><p><a href=#execute-the-script-block title="execute the script block">Execute</a> <var title="">the
       script</var>.</li>

       <li><p>Decrement the parser's <a href=#script-nesting-level>script nesting level</a> by one. If the parser's
       <a href=#script-nesting-level>script nesting level</a> is zero (which it always should be at this point), then set
       the <a href=#parser-pause-flag>parser pause flag</a> to false.</p>

       <li><p>Let the <a href=#insertion-point>insertion point</a> be undefined again.</li>

       <li><p>If there is once again a <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>, then repeat
       these steps from step 1.</li>

      </ol></dd>

    </dl></dd>

   <dt>Any other end tag</dt>
   <dd>

    <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original insertion mode</a>.</p>

   </dd>

  </dl><!--CLEANUP--><h6 id=parsing-main-intable><span class=secno>12.2.5.4.9 </span>The "<dfn title="insertion mode: in table">in table</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token, if the <a href=#current-node>current node</a> is <code><a href=#the-table-element>table</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tr-element>tr</a></code> element</dt>
   <dd>

     <p>Let the <dfn id=pending-table-character-tokens><var>pending table character tokens</var></dfn>
     be an empty list of tokens.</p>

     <p>Let the <a href=#original-insertion-mode>original insertion mode</a> be the current
     <a href=#insertion-mode>insertion mode</a>.</p>

     <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intabletext title="insertion mode: in table text">in table text</a>" and
     reprocess the token.</p>

   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "caption"</dt>
   <dd>

    <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
    below.)</p>

    <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active
    formatting elements</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then
    switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>".</p>

   </dd>

   <dt>A start tag whose tag name is "colgroup"</dt>
   <dd>

    <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
    below.)</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then
    switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column
    group</a>".</p>

   </dd>

   <dt>A start tag whose tag name is "col"</dt>
   <dd>

    <!-- fake <colgroup> -->
    <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
    below.)</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "colgroup" start tag token with no attributes, then
    switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column
    group</a>".</p>
    <!-- end of fake <colgroup> -->

    <p>Reprocess the current token.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"</dt>
   <dd>

    <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
    below.)</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, then
    switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
    body</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "td", "th", "tr"</dt>
   <dd>

    <!-- fake <colgroup> -->
    <p><a href=#clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See
    below.)</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "tbody" start tag token with no attributes, then
    switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
    body</a>".</p>
    <!-- end of fake <colgroup> -->

    <p>Reprocess the current token.</p>

   </dd>

   <dt>A start tag whose tag name is "table"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- fake </table> -->
    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="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><a href=#the-table-element>table</a></code>
    element has been popped from the stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
    <!-- end of fake </table> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is "table"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>table</code> element in table
    scope</a>, this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p>Pop elements from this stack until a <code><a href=#the-table-element>table</a></code>
    element has been popped from the stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "caption",
   "col", "colgroup", "html", "tbody", "td", "tfoot", "th",
   "thead", "tr"</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is one of: "style", "script", "template"</dt>
   <dt>An end tag whose tag name is "template"</dt>
   <dd>

    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>

   </dd>

   <dt>A start tag whose tag name is "input"</dt>
   <dd>

    <p>If the token does not have an attribute with the name "type",
    or if it does, but that attribute's value is not an <a href=#ascii-case-insensitive>ASCII
    case-insensitive</a> match for the string "<code title="">hidden</code>", then: act as described in the "anything
    else" entry below.</p>

    <p>Otherwise:</p>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

    <p>Pop that <code><a href=#the-input-element>input</a></code> element off the <a href=#stack-of-open-elements>stack of
    open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
    token's <i>self-closing flag</i></a>, if it is set.</p>

   </dd>

   <dt>A start tag whose tag name is "form"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the <a href=#form-element-pointer><code title=form>form</code> element
    pointer</a> is not null, ignore the token.</p>

    <p>Otherwise:</p>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and set the
    <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to
    point to the element created.</p>

    <p>Pop that <code><a href=#the-form-element>form</a></code> element off the <a href=#stack-of-open-elements>stack of
    open elements</a>.</p>

   </dd>

   <!-- "form" end tag falls through to in-body, which does the right thing -->

   <dt>An end-of-file token</dt>
   <dd>

    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. Enable <a href=#foster-parent title="foster parent">foster parenting</a>, process
    the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in
    body</a>" <a href=#insertion-mode>insertion mode</a>, and then disable <a href=#foster-parent title="foster parent">foster
    parenting</a>.</p>

   </dd>

  </dl><p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-context>clear the stack
  back to a table context</dfn>, it means that the UA must, while
  the <a href=#current-node>current node</a> is not a <code><a href=#the-table-element>table</a></code>,
  <code><a href=#the-template-element>template</a></code>, or <code><a href=#the-html-element>html</a></code> element, pop elements from the
  <a href=#stack-of-open-elements>stack of open elements</a>.</p>

  <p class=note>The <a href=#current-node>current node</a> being an
  <code><a href=#the-html-element>html</a></code> element after this process is a <a href=#fragment-case>fragment
  case</a>.</p>



  <h6 id=parsing-main-intabletext><span class=secno>12.2.5.4.10 </span>The "<dfn title="insertion mode: in table text">in table text</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intabletext title="insertion mode: in table text">in table text</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is U+0000 NULL</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>

   </dd>


   <dt>Any other character token</dt>
   <dd>

    <p>Append the character token to the <var><a href=#pending-table-character-tokens>pending table character
    tokens</a></var> list.</p>

   </dd>


   <dt>Anything else</dt>
   <dd>

    <!-- this can only be called if the current node is one of the
    table model elements -->

    <p>If any of the tokens in the <var><a href=#pending-table-character-tokens>pending table character
    tokens</a></var> list are character tokens that are not <a href=#space-character title="space character">space characters</a>, then reprocess
    the character tokens in the <var><a href=#pending-table-character-tokens>pending table character
    tokens</a></var> list using the rules given in the "anything else"
    entry in the "<a href=#parsing-main-intable title="insertion mode: in table">in
    table</a>" insertion mode.</p>

    <!-- if there's active formatting elements, it'll recreate those
    and foster parent the top one and then put the text nodes in the
    formatting elements; otherwise, it'll foster parent the character
    tokens. -->

    <p>Otherwise, <a href=#insert-a-character title="insert a character">insert the
    characters</a> given by the <var><a href=#pending-table-character-tokens>pending table character
    tokens</a></var> list.</p> <!--
    i.e. inter-element whitespace in the table model isn't foster
    parented -->

    <!-- no need to empty the list, we're leaving the insertion mode
    and the list is always emptied before we reenter the mode -->

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to the <a href=#original-insertion-mode>original
    insertion mode</a> and reprocess the token.</p>

   </dd>

  </dl><h6 id=parsing-main-incaption><span class=secno>12.2.5.4.11 </span>The "<dfn title="insertion mode: in caption">in caption</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>An end tag whose tag name is "caption"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>caption</code> element in table
    scope</a>, this is a
    <a href=#parse-error>parse error</a>; ignore the token. (<a href=#fragment-case>fragment
    case</a>)</p>

    <p>Otherwise:</p>

    <p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</p>

    <p>Now, if the <a href=#current-node>current node</a> is not a
    <code><a href=#the-caption-element>caption</a></code> element, then this is a <a href=#parse-error>parse
    error</a>.</p>

    <p>Pop elements from this stack until a <code><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>Clear the list of active formatting elements up to
    the last marker</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "caption", "col",
   "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
   <dt>An end tag whose tag name is "table"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- fake </caption> -->
    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>caption</code> element in table
    scope</a>, ignore the token. (<a href=#fragment-case>fragment
    case</a>)</p>

    <p>Otherwise:</p>

    <p>Pop elements from this stack until a <code><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>Clear the list of active formatting elements up to
    the last marker</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
    <!-- end of fake </caption> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "col",
   "colgroup", "html", "tbody", "td", "tfoot", "th", "thead",
   "tr"</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

  </dl><h6 id=parsing-main-incolgroup><span class=secno>12.2.5.4.12 </span>The "<dfn title="insertion mode: in column group">in column group</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p><a href=#insert-a-character title="insert a character">Insert the character</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "col"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately
    pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
    token's <i>self-closing flag</i></a>, if it is set.</p>

   </dd>

   <dt>An end tag whose tag name is "colgroup"</dt>
   <dd>

    <p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-colgroup-element>colgroup</a></code> element, then this is a <a href=#parse-error>parse
    error</a>; ignore the token.</p> <!-- e.g. colgroup fragment case, or <template><col></colgroup> -->

    <p>Otherwise, pop the <a href=#current-node>current node</a> from the <a href=#stack-of-open-elements>stack of open
    elements</a>. Switch the <a href=#insertion-mode>insertion mode</a> to
    "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>

   </dd>

   <dt>An end tag whose tag name is "col"</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "template"</dt>
   <dt>An end tag whose tag name is "template"</dt>
   <dd>

    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>

   </dd>

   <dt>An end-of-file token</dt>
   <dd>

    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>

    <!-- fake </colgroup> -->
    <p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-colgroup-element>colgroup</a></code> element, then this is a <a href=#parse-error>parse
    error</a>; ignore the token.</p> <!-- e.g. colgroup fragment case, or <template><col></colgroup> -->

    <p>Otherwise, pop the <a href=#current-node>current node</a> from the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to
    "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
    <!-- end of fake </colgroup> -->

    <p>Reprocess the token.</p>

   </dd>

  </dl><h6 id=parsing-main-intbody><span class=secno>12.2.5.4.13 </span>The "<dfn title="insertion mode: in table body">in table body</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intbody title="insertion mode: in table body">in table body</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A start tag whose tag name is "tr"</dt>
   <dd>

    <p><a href=#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>Insert an HTML element</a> for the token, then switch
    the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode:
    in row">in row</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "th", "td"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- fake </tr> -->
    <p><a href=#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>Insert an HTML element</a> for a "tr" start tag token with no attributes, then switch
    the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode:
    in row">in row</a>".</p>
    <!-- end of fake </tr> -->

    <p>Reprocess the current token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "tbody", "tfoot",
   "thead"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
    scope</a> that is an <a href=#html-elements title="HTML elements">HTML element</a> and with the same tag name as the token, this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p><a href=#clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body
    context</a>. (See below.)</p>

    <p>Pop the <a href=#current-node>current node</a> from the <a href=#stack-of-open-elements>stack of
    open elements</a>. Switch the <a href=#insertion-mode>insertion mode</a>
    to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "caption", "col",
   "colgroup", "tbody", "tfoot", "thead"</dt>
   <dt>An end tag whose tag name is "table"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a
    <code>tbody</code>, <code>thead</code>, or <code>tfoot</code>
    element in table scope</a>, this is a <a href=#parse-error>parse
    error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p><a href=#clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body
    context</a>. (See below.)</p>

    <!-- fake </tbody>, </tfoot>, or </thead>, whatever is the current node -->
    <p>Pop the <a href=#current-node>current node</a> from the <a href=#stack-of-open-elements>stack of
    open elements</a>. Switch the <a href=#insertion-mode>insertion mode</a>
    to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>".</p>
    <!-- end of fake </tbody>, </tfoot>, or </thead>, whatever was the current node -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "caption",
   "col", "colgroup", "html", "td", "th", "tr"</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

  </dl><p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-body-context>clear the stack
  back to a table body context</dfn>, it means that the UA must,
  while the <a href=#current-node>current node</a> is not a <code><a href=#the-tbody-element>tbody</a></code>,
  <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-template-element>template</a></code>, or <code><a href=#the-html-element>html</a></code>
  element, pop elements from the <a href=#stack-of-open-elements>stack of open
  elements</a>.</p>

  <p class=note>The <a href=#current-node>current node</a> being an
  <code><a href=#the-html-element>html</a></code> element after this process is a <a href=#fragment-case>fragment
  case</a>.</p>


  <h6 id=parsing-main-intr><span class=secno>12.2.5.4.14 </span>The "<dfn title="insertion mode: in row">in row</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A start tag whose tag name is one of: "th", "td"</dt>
   <dd>

    <p><a href=#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>Insert an HTML element</a> for the token, then switch
    the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intd title="insertion mode:
    in cell">in cell</a>".</p>

    <p>Insert a marker at the end of the <a href=#list-of-active-formatting-elements>list of active
    formatting elements</a>.</p>

   </dd>

   <dt>An end tag whose tag name is "tr"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>tr</code> element in table
    scope</a>, this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p><a href=#clear-the-stack-back-to-a-table-row-context>Clear the stack back to a table row
    context</a>. (See below.)</p>

    <p>Pop the <a href=#current-node>current node</a> (which will be a
    <code><a href=#the-tr-element>tr</a></code> element) from the <a href=#stack-of-open-elements>stack of open
    elements</a>. Switch the <a href=#insertion-mode>insertion mode</a> to
    "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
    body</a>".</p>

   </dd>

   <dt>A start tag whose tag name is one of: "caption", "col",
   "colgroup", "tbody", "tfoot", "thead", "tr"</dt>
   <dt>An end tag whose tag name is "table"</dt>
   <dd>

    <!-- fake <tr> -->
    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>tr</code> element in table
    scope</a>, this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p><a href=#clear-the-stack-back-to-a-table-row-context>Clear the stack back to a table row
    context</a>. (See below.)</p>

    <p>Pop the <a href=#current-node>current node</a> (which will be a
    <code><a href=#the-tr-element>tr</a></code> element) from the <a href=#stack-of-open-elements>stack of open
    elements</a>. Switch the <a href=#insertion-mode>insertion mode</a> to
    "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
    body</a>".</p>
    <!-- end of fake </tr> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "tbody", "tfoot",
   "thead"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
    scope</a> that is an <a href=#html-elements title="HTML elements">HTML element</a> and with the same tag name as the token, this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

    <!-- fake <tr> -->
    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">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>Clear the stack back to a table row
    context</a>. (See below.)</p>

    <p>Pop the <a href=#current-node>current node</a> (which will be a
    <code><a href=#the-tr-element>tr</a></code> element) from the <a href=#stack-of-open-elements>stack of open
    elements</a>. Switch the <a href=#insertion-mode>insertion mode</a> to
    "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
    body</a>".</p>
    <!-- end of fake </tr> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "caption",
   "col", "colgroup", "html", "td", "th"</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

  </dl><p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-row-context>clear the stack
  back to a table row context</dfn>, it means that the UA must,
  while the <a href=#current-node>current node</a> is not a <code><a href=#the-tr-element>tr</a></code>,
  <code><a href=#the-template-element>template</a></code>, or <code><a href=#the-html-element>html</a></code> element, pop elements from the
  <a href=#stack-of-open-elements>stack of open elements</a>.</p>

  <p class=note>The <a href=#current-node>current node</a> being an
  <code><a href=#the-html-element>html</a></code> element after this process is a <a href=#fragment-case>fragment
  case</a>.</p>


  <h6 id=parsing-main-intd><span class=secno>12.2.5.4.15 </span>The "<dfn title="insertion mode: in cell">in cell</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>An end tag whose tag name is one of: "td", "th"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
    scope</a> that is an <a href=#html-elements title="HTML elements">HTML element</a> and with the same tag name as that of the token, then
    this is a <a href=#parse-error>parse error</a>; ignore the token.</p>

    <p>Otherwise:</p>

    <p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</p>

    <p>Now, if the <a href=#current-node>current node</a> is not an <a href=#html-elements title="HTML elements">HTML element</a>
    with the same tag name as the token, then this is a
    <a href=#parse-error>parse error</a>.</p>

    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> stack
    until an <a href=#html-elements title="HTML elements">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>Clear the list of active formatting elements up to
    the last marker</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>".</p> <!-- current
    node here will be a <tr> normally; but could be <html> in the
    fragment case, or <template> in the template case -->

   </dd>

   <dt>A start tag whose tag name is one of: "caption", "col",
   "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does
    <em>not</em> <a href=#has-an-element-in-table-scope title="has an element in table scope">have
    a <code>td</code> or <code>th</code> element in table
    scope</a>, then this is a <a href=#parse-error>parse error</a>; ignore
    the token. (<a href=#fragment-case>fragment case</a>)</p>

    <p>Otherwise, <a href=#close-the-cell>close the cell</a> (see below) and
    reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "body", "caption",
   "col", "colgroup", "html"</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>An end tag whose tag name is one of: "table", "tbody",
   "tfoot", "thead", "tr"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
    scope</a> that is an <a href=#html-elements title="HTML elements">HTML element</a> and with the same tag name as that of the token, then this is a <a href=#parse-error>parse
    error</a>; ignore the token.</p>

    <p>Otherwise, <a href=#close-the-cell>close the cell</a> (see below) and
    reprocess the token.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

  </dl><p>Where the steps above say to <dfn id=close-the-cell>close the cell</dfn>, they
  mean to run the following algorithm:</p>

  <ol><!-- fake </td> or </th> --><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>

   <li><p>If the <a href=#current-node>current node</a> is not now a <code><a href=#the-td-element>td</a></code> element or a <code><a href=#the-th-element>th</a></code>
   element, then this is a <a href=#parse-error>parse error</a>.</li>

   <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> stack until a <code><a href=#the-td-element>td</a></code>
   element or a <code><a href=#the-th-element>th</a></code> element has been popped from the stack.</li>

   <li><p><a href=#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>

   <li><p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode: in row">in
   row</a>".</li> <!-- current node here will be a <tr> normally; but could be <html> in the
   fragment case, or <template> in the template case -->
   <!-- end of fake </td> or </th> -->

  </ol><p class=note>The <a href=#stack-of-open-elements>stack of open elements</a> cannot have
  both a <code><a href=#the-td-element>td</a></code> and a <code><a href=#the-th-element>th</a></code> element <a href=#has-an-element-in-table-scope title="has an element in table scope">in table scope</a> at the
  same time, nor can it have neither when the <a href=#close-the-cell>close the
  cell</a> algorithm is invoked.</p>


  <h6 id=parsing-main-inselect><span class=secno>12.2.5.4.16 </span>The "<dfn title="insertion mode: in select">in select</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is U+0000 NULL</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>Any other character token</dt>
   <dd>
    <p><a href=#insert-a-character title="insert a character">Insert the token's
    character</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "option"</dt>
   <dd>

    <!-- fake </option> (maybe) -->
    <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code>
    element, pop that node from the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>
    <!-- end of fake </option> -->

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

   </dd>

   <dt>A start tag whose tag name is "optgroup"</dt>
   <dd>

    <!-- fake </option> (maybe) -->
    <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code>
    element, pop that node from the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>
    <!-- end of fake </option> -->

    <!-- fake </optgroup> (maybe) -->
    <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-optgroup-element>optgroup</a></code>
    element, pop that node from the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>
    <!-- end of fake </optgroup> -->

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>

   </dd>

   <dt>An end tag whose tag name is "optgroup"</dt>
   <dd>

    <!-- fake </option> (maybe) -->
    <p>First, if the <a href=#current-node>current node</a> is an
    <code><a href=#the-option-element>option</a></code> element, and the node immediately before
    it in the <a href=#stack-of-open-elements>stack of open elements</a> is an
    <code><a href=#the-optgroup-element>optgroup</a></code> element, then pop the <a href=#current-node>current node</a> from the <a href=#stack-of-open-elements>stack of open
    elements</a>.</p>
    <!-- end of fake </option> -->

    <p>If the <a href=#current-node>current node</a> is an
    <code><a href=#the-optgroup-element>optgroup</a></code> element, then pop that node from the
    <a href=#stack-of-open-elements>stack of open elements</a>. Otherwise, this is a
    <a href=#parse-error>parse error</a>; ignore the token.</p>

   </dd>

   <dt>An end tag whose tag name is "option"</dt>
   <dd>

    <p>If the <a href=#current-node>current node</a> is an <code><a href=#the-option-element>option</a></code>
    element, then pop that node from the <a href=#stack-of-open-elements>stack of open
    elements</a>. Otherwise, this is a <a href=#parse-error>parse
    error</a>; ignore the token.</p>

   </dd>

   <dt>An end tag whose tag name is "select"</dt>
   <dd>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-select-scope title="has an element in select scope">have a <code>select</code> element in select
    scope</a>, this is a
    <a href=#parse-error>parse error</a>; ignore the token. (<a href=#fragment-case>fragment
    case</a>)</p>

    <p>Otherwise:</p>

    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
    until a <code><a href=#the-select-element>select</a></code> element has been popped from the
    stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>

   </dd>

   <dt>A start tag whose tag name is "select"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- fake </select> -->
    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
    until a <code><a href=#the-select-element>select</a></code> element has been popped from the
    stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
    <!-- end of fake </select> -->

    <p class=note>It just gets treated like an end tag.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "input", "keygen", "textarea"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-select-scope title="has an element in select scope">have a <code>select</code>
    element in select scope</a>, ignore the token. (<a href=#fragment-case>fragment
    case</a>)</p>

    <!-- fake </select> -->
    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
    until a <code><a href=#the-select-element>select</a></code> element has been popped from the
    stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
    <!-- end of fake </select> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "script", "template"</dt>
   <dt>An end tag whose tag name is "template"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end-of-file token</dt>
   <dd>

    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

  </dl><h6 id=parsing-main-inselectintable><span class=secno>12.2.5.4.17 </span>The "<dfn title="insertion mode: in select in table">in select in table</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inselectintable title="insertion mode: in select in table">in select in table</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A start tag whose tag name is one of: "caption", "table",
   "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- fake </select> -->
    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
    until a <code><a href=#the-select-element>select</a></code> element has been popped from the
    stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
    <!-- end of fake </select> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>An end tag whose tag name is one of: "caption", "table",
   "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an
    element in table scope</a> that is an <a href=#html-elements title="HTML elements">HTML element</a> and with the same tag name as that
    of the token, then ignore the token.</p>

    <p>Otherwise:</p>

    <!-- fake </select> -->
    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a>
    until a <code><a href=#the-select-element>select</a></code> element has been popped from the
    stack.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
    <!-- end of fake </select> -->

    <p>Reprocess the token.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

  </dl><h6 id=parsing-main-intemplate><span class=secno>12.2.5.4.18 </span>The "<dfn title="insertion mode: in template">in template</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intemplate title="insertion mode: in template">in template</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><!-- first, tokens we always ignore: --><!-- html: ignored in "in body" mode if there's a <template> on the stack --><!-- head: ignored in "in body" mode always --><!-- body: ignored in "in body" mode if there's a <template> on the stack --><!-- frameset: ignored in "in body" mode if frameset-ok is set to not-ok, which <template> sets it to --><!-- second, tokens that are ambiguous (allowed in multiple modes), let's just handle them in a generic way and not pick a mode: --><dt>A character token</dt>
   <dt>A comment token</dt>
   <dt>A DOCTYPE token</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"</dt>
   <dt>An end tag whose tag name is "template"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <!-- now, tokens that imply certain modes -->

   <dt>A start tag whose tag name is one of: "caption", "colgroup", "tbody", "tfoot", "thead"</dt>
   <dd>

    <p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a>.</p>

    <p>Push "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" onto the <a href=#stack-of-template-insertion-modes>stack of
    template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode>current template insertion
    mode</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in
    table</a>", and reprocess the token.</p>

   </dd>

   <dt>A start tag whose tag name is "col"</dt>
   <dd>

    <p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a>.</p>

    <p>Push "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>" onto the
    <a href=#stack-of-template-insertion-modes>stack of template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode>current template
    insertion mode</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in
    column group</a>", and reprocess the token.</p>

   </dd>

   <dt>A start tag whose tag name is "tr"</dt>
   <dd>

    <p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a>.</p>

    <p>Push "<a href=#parsing-main-intbody title="insertion mode: in table body">in table body</a>" onto the <a href=#stack-of-template-insertion-modes>stack
    of template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode>current template insertion
    mode</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in table body">in
    table body</a>", and reprocess the token.</p>

   </dd>

   <dt>A start tag whose tag name is one of: "td", "th"</dt>
   <dd>

    <p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a>.</p>

    <p>Push "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>" onto the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a> so that it is the new <a href=#current-template-insertion-mode>current template insertion mode</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion mode: in row">in
    row</a>", and reprocess the token.</p>

   </dd>

   <!-- default to in-body mode -->

   <dt>Any other start tag</dt>
   <dd>

    <p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a>.</p>

    <p>Push "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" onto the <a href=#stack-of-template-insertion-modes>stack of template
    insertion modes</a> so that it is the new <a href=#current-template-insertion-mode>current template insertion mode</a>.</p>

    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in
    body</a>", and reprocess the token.</p>

   </dd>

   <dt>Any other end tag</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <!-- EOF -->


   <dt>An end-of-file token</dt>
   <dd>

    <p>If there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then
    <a href=#stop-parsing>stop parsing</a>. (<a href=#fragment-case>fragment case</a>)</p>

    <p>Otherwise, this is a <a href=#parse-error>parse error</a>.</p>

    <!-- fake </template> -->
    <p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><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>Clear the list of active formatting elements up to the last marker</a>.</p>

    <p>Pop the <a href=#current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes>stack of template insertion modes</a>.</p>

    <p><a href=#reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
    <!-- end of fake </template> -->

    <p>Reprocess the token.</p>

   </dd>

  </dl><h6 id=parsing-main-afterbody><span class=secno>12.2.5.4.19 </span>The "<dfn title="insertion mode: after body">after body</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-afterbody title="insertion mode: after body">after body</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a> as the last child of the first element in
    the <a href=#stack-of-open-elements>stack of open elements</a> (the <code><a href=#the-html-element>html</a></code>
    element).</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end tag whose tag name is "html"</dt>
   <dd>

    <p>If the parser was originally created as part of the <a href=#html-fragment-parsing-algorithm>HTML
    fragment parsing algorithm</a>, this is a <a href=#parse-error>parse
    error</a>; ignore the token. (<a href=#fragment-case>fragment case</a>)</p>

    <p>Otherwise, switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-after-body-insertion-mode title="insertion mode: after after body">after after
    body</a>".</p>

   </dd>

   <dt>An end-of-file token</dt>
   <dd>
    <p><a href=#stop-parsing>Stop parsing</a>.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. Switch the <a href=#insertion-mode>insertion
    mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in
    body</a>" and reprocess the token.</p>

   </dd>

  </dl><h6 id=parsing-main-inframeset><span class=secno>12.2.5.4.20 </span>The "<dfn title="insertion mode: in frameset">in frameset</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p><a href=#insert-a-character title="insert a character">Insert the character</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "frameset"</dt>
   <dd>
    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.</p>
   </dd>

   <dt>An end tag whose tag name is "frameset"</dt>
   <dd>

    <p>If the <a href=#current-node>current node</a> is the root
    <code><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error>parse
    error</a>; ignore the token. (<a href=#fragment-case>fragment
    case</a>)</p>

    <p>Otherwise, pop the <a href=#current-node>current node</a> from the
    <a href=#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>HTML fragment parsing algorithm</a>
    (<a href=#fragment-case>fragment case</a>), and the <a href=#current-node>current
    node</a> is no longer a <code><a href=#frameset>frameset</a></code> element, then
    switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-afterframeset title="insertion mode: after frameset">after
    frameset</a>".</p>

   </dd>

   <dt>A start tag whose tag name is "frame"</dt>
   <dd>

    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token.
    Immediately pop the <a href=#current-node>current node</a> off the
    <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the
    token's <i>self-closing flag</i></a>, if it is set.</p>

   </dd>

   <dt>A start tag whose tag name is "noframes"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end-of-file token</dt>
   <dd>

    <p>If the <a href=#current-node>current node</a> is not the root
    <code><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error>parse
    error</a>.</p>

    <p class=note>The <a href=#current-node>current node</a> can only be the root
    <code><a href=#the-html-element>html</a></code> element in the <a href=#fragment-case>fragment case</a>.</p>

    <p><a href=#stop-parsing>Stop parsing</a>.</p>

   </dd>

   <dt>Anything else</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

  </dl><h6 id=parsing-main-afterframeset><span class=secno>12.2.5.4.21 </span>The "<dfn title="insertion mode: after frameset">after frameset</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#parsing-main-afterframeset title="insertion mode: after frameset">after frameset</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <!-- due to rules in the "in frameset" mode, this can't be entered in the fragment case -->
  <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>
    <p><a href=#insert-a-character title="insert a character">Insert the character</a>.</p>
   </dd>

   <dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a>.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end tag whose tag name is "html"</dt>
   <dd>
    <p>Switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#the-after-after-frameset-insertion-mode title="insertion mode: after after frameset">after after
    frameset</a>".</p>
   </dd>

   <dt>A start tag whose tag name is "noframes"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end-of-file token</dt>
   <dd>
    <p><a href=#stop-parsing>Stop parsing</a>.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

  </dl><h6 id=the-after-after-body-insertion-mode><span class=secno>12.2.5.4.22 </span>The "<dfn title="insertion mode: after after body">after after body</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#the-after-after-body-insertion-mode title="insertion mode: after after body">after after body</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a> as the last child of the <code><a href=#document>Document</a></code> object.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end-of-file token</dt>
   <dd>
    <p><a href=#stop-parsing>Stop parsing</a>.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Switch the <a href=#insertion-mode>insertion mode</a>
    to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" and
    reprocess the token.</p>
   </dd>

  </dl><h6 id=the-after-after-frameset-insertion-mode><span class=secno>12.2.5.4.23 </span>The "<dfn title="insertion mode: after after frameset">after after frameset</dfn>" insertion mode</h6>

  <p>When the user agent is to apply the rules for the "<a href=#the-after-after-frameset-insertion-mode title="insertion mode: after after frameset">after after frameset</a>" <a href=#insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A comment token</dt>
   <dd>
    <p><a href=#insert-a-comment>Insert a comment</a> as the last child of the <code><a href=#document>Document</a></code> object.</p>
   </dd>

   <dt>A DOCTYPE token</dt>
   <dt>A character token that is one of U+0009 CHARACTER
   TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
   U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dt>A start tag whose tag name is "html"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>An end-of-file token</dt>
   <dd>
    <p><a href=#stop-parsing>Stop parsing</a>.</p>
   </dd>

   <dt>A start tag whose tag name is "noframes"</dt>
   <dd>
    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion
    mode</a>.</p>
   </dd>

   <dt>Anything else</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

  </dl><h5 id=parsing-main-inforeign><span class=secno>12.2.5.5 </span>The rules for parsing tokens <dfn title="insertion mode: in foreign content">in foreign content</dfn></h5>

  <p>When the user agent is to apply the rules for parsing tokens in foreign content, the user agent must handle the token as follows:</p>

  <dl class=switch><dt>A character token that is U+0000 NULL</dt>
   <dd>

    <p><a href=#parse-error>Parse error</a>. <a href=#insert-a-character title="insert a character">Insert a U+FFFD REPLACEMENT
    CHARACTER character</a>.</p>

   </dd>

   <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
   FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE</dt>
   <dd>

    <p><a href=#insert-a-character title="insert a character">Insert the token's character</a>.</p>

   </dd>

   <dt>Any other character token</dt>
   <dd>

    <p><a href=#insert-a-character title="insert a character">Insert the token's character</a>.</p>

    <p>Set the <a href=#frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>

   </dd>

   <dt>A comment token</dt>
   <dd>

    <p><a href=#insert-a-comment>Insert a comment</a>.</p>

   </dd>

   <dt>A DOCTYPE token</dt>
   <dd>
    <p><a href=#parse-error>Parse error</a>. Ignore the token.</p>
   </dd>

   <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big", "blockquote", "body"<!--by
   inspection-->, "br", "center", "code", "dd", "div", "dl", "dt"<!-- so that dd and dt can be
   handled uniformly throughout the parser -->, "em", "embed", "h1", "h2", "h3", "h4"<!--for
   completeness-->, "h5", "h6"<!--for completeness-->, "head"<!--by inspection-->, "hr", "i", "img",
   "li", "listing"<!-- so that pre and listing can be handled uniformly throughout the parser -->,
   "menu", "meta", "nobr", "ol"<!-- so that dl, ul, and ol can be handled uniformly throughout the
   parser -->, "p", "pre", "ruby", "s", <!--"script",--> "small", "span", "strong", "strike"<!-- so
   that s and strike can be handled uniformly throughout the parser -->, <!--"style",--> "sub",
   "sup", "table"<!--by inspection-->, "tt", "u", "ul", "var"</dt> <!-- this list was determined
   empirically by studying over 6,000,000,000 pages that were specifically not XML pages -->
   <dt>A start tag whose tag name is "font", if the token has any attributes named "color", "face",
   or "size"</dt> <!-- the attributes here are required so that SVG <font> will go through as SVG
   but legacy <font>s won't -->

   <dd>

    <p><a href=#parse-error>Parse error</a>.</p>

    <!-- for sanity's sake, we limit this wacked quirk to legacy full-document parsing, not to
    innerHTML. We have no data showing whether (or that) this is needed for innerHTML. If innerHTML
    is used on an SVG or MathML node, it definitely doesn't make any sense (there's nothing to pop
    to in the first place). Therefore, rather than trying to figure out in what convoluted
    conditions we could actually do this quirk for innerHTML, we just don't do it at all. -->

    <p>If the parser was originally created for the <a href=#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>fragment case</a>)</p>

    <p>Otherwise:</p>

    <p>Pop an element from the <a href=#stack-of-open-elements>stack of open elements</a>, and then keep popping more
    elements from the <a href=#stack-of-open-elements>stack of open elements</a> until the <a href=#current-node>current node</a> is a
    <a href=#mathml-text-integration-point>MathML text integration point</a>, an <a href=#html-integration-point>HTML integration point</a>, or an
    element in the <a href=#html-namespace-0>HTML namespace</a>.</p>

    <p>Then, reprocess the token.</p>

   </dd>

   <dt>Any other start tag</dt>
   <dd>

    <p>If the <a href=#adjusted-current-node>adjusted current node</a> is an element in the <a href=#mathml-namespace>MathML namespace</a>,
    <a href=#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>adjusted current node</a> is an element in the <a href=#svg-namespace>SVG namespace</a>, and the
    token's tag name is one of the ones in the first column of the following table, change the tag
    name to the name given in the corresponding cell in the second column. (This fixes the case of
    SVG elements that are not all lowercase.)</p>

    <table><thead><tr><th> Tag name <th> Element name
     <tbody><tr><td> <code title="">altglyph</code> <td> <code title="">altGlyph</code>
      <tr><td> <code title="">altglyphdef</code> <td> <code title="">altGlyphDef</code>
      <tr><td> <code title="">altglyphitem</code> <td> <code title="">altGlyphItem</code>
      <tr><td> <code title="">animatecolor</code> <td> <code title="">animateColor</code>
      <tr><td> <code title="">animatemotion</code> <td> <code title="">animateMotion</code>
      <tr><td> <code title="">animatetransform</code> <td> <code title="">animateTransform</code>
      <tr><td> <code title="">clippath</code> <td> <code title="">clipPath</code>
      <tr><td> <code title="">feblend</code> <td> <code title="">feBlend</code>
      <tr><td> <code title="">fecolormatrix</code> <td> <code title="">feColorMatrix</code>
      <tr><td> <code title="">fecomponenttransfer</code> <td> <code title="">feComponentTransfer</code>
      <tr><td> <code title="">fecomposite</code> <td> <code title="">feComposite</code>
      <tr><td> <code title="">feconvolvematrix</code> <td> <code title="">feConvolveMatrix</code>
      <tr><td> <code title="">fediffuselighting</code> <td> <code title="">feDiffuseLighting</code>
      <tr><td> <code title="">fedisplacementmap</code> <td> <code title="">feDisplacementMap</code>
      <tr><td> <code title="">fedistantlight</code> <td> <code title="">feDistantLight</code>
      <tr><td> <code title="">feflood</code> <td> <code title="">feFlood</code>
      <tr><td> <code title="">fefunca</code> <td> <code title="">feFuncA</code>
      <tr><td> <code title="">fefuncb</code> <td> <code title="">feFuncB</code>
      <tr><td> <code title="">fefuncg</code> <td> <code title="">feFuncG</code>
      <tr><td> <code title="">fefuncr</code> <td> <code title="">feFuncR</code>
      <tr><td> <code title="">fegaussianblur</code> <td> <code title="">feGaussianBlur</code>
      <tr><td> <code title="">feimage</code> <td> <code title="">feImage</code>
      <tr><td> <code title="">femerge</code> <td> <code title="">feMerge</code>
      <tr><td> <code title="">femergenode</code> <td> <code title="">feMergeNode</code>
      <tr><td> <code title="">femorphology</code> <td> <code title="">feMorphology</code>
      <tr><td> <code title="">feoffset</code> <td> <code title="">feOffset</code>
      <tr><td> <code title="">fepointlight</code> <td> <code title="">fePointLight</code>
      <tr><td> <code title="">fespecularlighting</code> <td> <code title="">feSpecularLighting</code>
      <tr><td> <code title="">fespotlight</code> <td> <code title="">feSpotLight</code>
      <tr><td> <code title="">fetile</code> <td> <code title="">feTile</code>
      <tr><td> <code title="">feturbulence</code> <td> <code title="">feTurbulence</code>
      <tr><td> <code title="">foreignobject</code> <td> <code title="">foreignObject</code>
      <tr><td> <code title="">glyphref</code> <td> <code title="">glyphRef</code>
      <tr><td> <code title="">lineargradient</code> <td> <code title="">linearGradient</code>
      <tr><td> <code title="">radialgradient</code> <td> <code title="">radialGradient</code>
      <!--<tr> <td> <code title="">solidcolor</code> <td> <code title="">solidColor</code> (SVG 1.2)-->
      <tr><td> <code title="">textpath</code> <td> <code title="">textPath</code>
    </table><p>If the <a href=#adjusted-current-node>adjusted current node</a> is an element in the <a href=#svg-namespace>SVG namespace</a>,
    <a href=#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>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>Insert a foreign element</a> for the token, in the same namespace as the
    <a href=#adjusted-current-node>adjusted current node</a>.</p>

    <p>If the token has its <i>self-closing flag</i> set, then run the appropriate steps from the
    following list:</p>

    <dl class=switch><dt>If the token's tag name is "script"</dt>

     <dd>

      <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
      flag</i></a>, and then act as described in the steps for a "script" end tag below.</p>

     </dd>

     <dt>Otherwise</dt>

     <dd>

      <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a> and <a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">acknowledge the token's <i>self-closing
      flag</i></a>.</p>

     </dd>

    </dl></dd>

   <dt id=scriptForeignEndTag>An end tag whose tag name is "script", if the <a href=#current-node>current node</a> is a <code title="">script</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
   <dd>

    <p>Pop the <a href=#current-node>current node</a> off the <a href=#stack-of-open-elements>stack of open elements</a>.</p>

    <p>Let the <var title="">old insertion point</var> have the same value as the current
    <a href=#insertion-point>insertion point</a>. Let the <a href=#insertion-point>insertion point</a> be just before the <a href=#next-input-character>next
    input character</a>.</p>

    <p>Increment the parser's <a href=#script-nesting-level>script nesting level</a> by one. Set the <a href=#parser-pause-flag>parser pause
    flag</a> to true.</p>

    <p><a href=http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing>Process the
    <code title="">script</code> element</a> according to the SVG rules, if the user agent supports
    SVG. <a href=#refsSVG>[SVG]</a></p>

    <p class=note>Even if this causes <a href=#dom-document-write title=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>parser pause flag</a> is true.</p>

    <p>Decrement the parser's <a href=#script-nesting-level>script nesting level</a> by one. If the parser's <a href=#script-nesting-level>script
    nesting level</a> is zero, then set the <a href=#parser-pause-flag>parser pause flag</a> to false.</p>

    <p>Let the <a href=#insertion-point>insertion point</a> have the value of the <var title="">old insertion
    point</var>. (In other words, restore the <a href=#insertion-point>insertion point</a> to its previous value.
    This value might be the "undefined" value.)</p>

   </dd>

   <dt>Any other end tag</dt>

   <dd>

    <p>Run these steps:</p>

    <ol><li><p>Initialize <var title="">node</var> to be the <a href=#current-node>current node</a> (the bottommost
     node of the stack).</li>

     <li><p>If <var title="">node</var>'s tag name, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, is
     not the same as the tag name of the token, then this is a <a href=#parse-error>parse error</a>.</li>

     <li><p><i>Loop</i>: If <var title="">node</var> is the topmost element in the <a href=#stack-of-open-elements>stack of
     open elements</a>, abort these steps. (<a href=#fragment-case>fragment case</a>)</li>

     <li><p>If <var title="">node</var>'s tag name, <a href=#converted-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>stack of open
     elements</a> until <var title="">node</var> has been popped from the stack, and then abort
     these steps.</li>

     <li><p>Set <var title="">node</var> to the previous entry in the <a href=#stack-of-open-elements>stack of open
     elements</a>.</li>

     <li><p>If <var title="">node</var> is not an element in the <a href=#html-namespace-0>HTML namespace</a>, return
     to the step labeled <i>loop</i>.</li>

     <li><p>Otherwise, process the token according to the rules given in the section corresponding
     to the current <a href=#insertion-mode>insertion mode</a> in HTML content.</li>

    </ol></dd>

  </dl></div>


  <div class=impl>

  <h4 id=the-end><span class=secno>12.2.6 </span>The end</h4>

  <p>Once the user agent <dfn id=stop-parsing title="stop parsing">stops parsing</dfn> the document, the user agent
  must run the following steps:</p>

  <ol><!-- this happens as part of one of the tasks that runs the parser --><li><p>Set the <a href=#current-document-readiness>current document readiness</a> to "<code title="">interactive</code>"
   <!-- this also synchronously fires an event --> and the <a href=#insertion-point>insertion point</a> to
   undefined.</li>

   <li><p>Pop <em>all</em> the nodes off the <a href=#stack-of-open-elements>stack of open elements</a>.</li>

   <li><p>If the <a href=#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>Spin the event loop</a> until the first <code><a href=#the-script-element>script</a></code> in the <a href=#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> has its <a href=#ready-to-be-parser-executed>"ready
     to be parser-executed"</a> flag set <em>and</em> the parser's <code><a href=#document>Document</a></code>
     <a href=#has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts</a>.</li>

     <li><p><a href=#execute-the-script-block title="execute the script block">Execute</a> the first <code><a href=#the-script-element>script</a></code> in
     the <a href=#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>.</li>

     <li><p>Remove the first <code><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>list of scripts that will
     execute when the document has finished parsing</a> (i.e. shift out the first entry in the
     list).</li>

     <li><p>If the <a href=#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 still not empty, repeat these substeps again from substep 1.</p>

    </ol></li>

   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-DOMContentLoaded>DOMContentLoaded</code> at the <code><a href=#document>Document</a></code>.</li>

   <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until the <a href=#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>list of scripts that will execute in order as soon as
   possible</a> are empty.</li> <!-- this step is not redundant with the next one, since
   <script> nodes delay the load event of the document they are in, but they might change document
   between being added to one document's set/list and executing those scripts, so they might be
   delaying another document but still be in this document's set/list. -->

   <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until there is nothing that <dfn id=delay-the-load-event title="delay the load
   event">delays the load event</dfn> in the <code><a href=#document>Document</a></code>.</li>

   <li>

    <p><a href=#queue-a-task>Queue a task</a> to run the following substeps:</p>

    <ol><li><p>Set the <a href=#current-document-readiness>current document readiness</a> to "<code title="">complete</code>"<!--
     this also fires an event synchronously during the task -->.</li>

     <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing context</a>, <a href=#fire-a-simple-event>fire a simple
     event</a> named <code title=event-load>load</code> at the <code><a href=#document>Document</a></code>'s
     <code><a href=#window>Window</a></code> object, but with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to
     the <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the <code><a href=#window>Window</a></code>
     object).</li>

    </ol></li>

   <li>

    <p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing context</a>, then <a href=#queue-a-task>queue a
    task</a> to run the following substeps:</p>

    <ol><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a> flag is true, then abort this
     task (i.e. don't fire the event below).</li> <!-- i don't see how this could be, but just
     to be sure... -->

     <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a> flag to true.</li>

     <li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> at the <code><a href=#window>Window</a></code> object of the
     <code><a href=#document>Document</a></code>, but with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
     <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the <code><a href=#window>Window</a></code> object),
     using the <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialized to false. This
     event must not bubble, must not be cancelable, and has no default action.</li>

    </ol></li>

   <li><p>If the <code><a href=#document>Document</a></code> has any <a href=#pending-application-cache-download-process-tasks>pending application cache download process
   tasks</a>, then <a href=#queue-a-task title="queue a task">queue</a> each such <a href=#concept-task title=concept-task>task</a> in the order they were added to the list of <a href=#pending-application-cache-download-process-tasks>pending
   application cache download process tasks</a>, and then empty the list of <a href=#pending-application-cache-download-process-tasks>pending
   application cache download process tasks</a>. The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task source</a>.</li>

   <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#print-when-loaded>print when loaded</a> flag is set, then run the
   <a href=#printing-steps>printing steps</a>.</li>

   <li><p>The <code><a href=#document>Document</a></code> is now <dfn id=ready-for-post-load-tasks>ready for post-load tasks</dfn>.</li>

   <li><p><a href=#queue-a-task>Queue a task</a> to mark the <code><a href=#document>Document</a></code> as <dfn id=completely-loaded>completely
   loaded</dfn>.</li>

  </ol><p>When the user agent is to <dfn id=abort-a-parser>abort a parser</dfn>, it must run the following steps:</p>

  <ol><li><p>Throw away any pending content in the <a href=#input-stream>input stream</a>, and discard any future
   content that would have been added to it.</li>

   <li><p>Set the <a href=#current-document-readiness>current document readiness</a> to "<code title="">interactive</code>"<!--
   this synchronously fires an event -->.</li>

   <li><p>Pop <em>all</em> the nodes off the <a href=#stack-of-open-elements>stack of open elements</a>.</li>

   <li><p>Set the <a href=#current-document-readiness>current document readiness</a> to "<code title="">complete</code>"<!--
   this also synchronously fires an event -->.</li>

   <!-- anything else? this is things that happen when you call document.open() on a document that's
   still being parsed, or when you navigate a document that's still parsing, or navigate the parent
   of a frame with a document that's still parsing, or the user hits "stop". Should the pending
   scripts be blown away or anything? -->

  </ol><p>Except where otherwise specified, the <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> mentioned in this section is the <a href=#dom-manipulation-task-source>DOM manipulation task
  source</a>.</p>

  </div>


  <div class=impl>

  <h4 id=coercing-an-html-dom-into-an-infoset><span class=secno>12.2.7 </span>Coercing an HTML DOM into an infoset</h4>

  <p>When an application uses an <a href=#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 title="">xmlns</code>,
  since they conflict with the Namespaces in XML syntax. There is also
  some data that the <a href=#html-parser>HTML parser</a> generates that isn't
  included in the DOM itself. This section specifies some rules for
  handling these issues.</p>

  <p>If the XML API being used doesn't support DOCTYPEs, the tool may
  drop DOCTYPEs altogether.</p>

  <p>If the XML API doesn't support attributes in no namespace that
  are named "<code title="">xmlns</code>", attributes whose names
  start with "<code title="">xmlns:</code>", or attributes in the
  <a href=#xmlns-namespace>XMLNS namespace</a>, then the tool may drop such
  attributes.</p>

  <p>The tool may annotate the output with any namespace declarations
  required for proper operation.</p>

  <p>If the XML API being used restricts the allowable characters in
  the local names of elements and attributes, then the tool may map
  all element and attribute local names that the API wouldn't support
  to a set of names that <em>are</em> allowed, by replacing any
  character that isn't supported with the uppercase letter U and the
  six digits of the character's Unicode code point when expressed in
  hexadecimal, using digits 0-9 and capital letters A-F as the
  symbols, in increasing numeric order.</p>

  <p class=example>For example, the element name <code title="">foo&lt;bar</code>, which can be output by the <a href=#html-parser>HTML
  parser</a>, though it is neither a legal HTML element name nor a
  well-formed XML element name, would be converted into <code title="">fooU00003Cbar</code>, which <em>is</em> a well-formed XML
  element name (though it's still not legal in HTML by any means).</p>

  <p class=example>As another example, consider the attribute
  <code>xlink:href</code>. Used on a MathML element, it becomes, after
  being <a href=#adjust-foreign-attributes title="adjust foreign attributes">adjusted</a>, an
  attribute with a prefix "<code title="">xlink</code>" and a local
  name "<code title="">href</code>". However, used on an HTML element,
  it becomes an attribute with no prefix and the local name "<code title="">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 title="">xlinkU00003Ahref</code>".</p>

  <p class=note>The resulting names from this conversion
  conveniently can't clash with any attribute generated by the
  <a href=#html-parser>HTML parser</a>, since those are all either lowercase or
  those listed in the <a href=#adjust-foreign-attributes>adjust foreign attributes</a>
  algorithm's table.</p>

  <p>If the XML API restricts comments from having two consecutive
  U+002D HYPHEN-MINUS characters (--), the tool may insert a single
  U+0020 SPACE character between any such offending characters.</p>

  <p>If the XML API restricts comments from ending in a
  U+002D HYPHEN-MINUS character (-), the tool may insert a single
  U+0020 SPACE character at the end of such comments.</p>

  <p>If the XML API restricts allowed characters in character data,
  attribute values, or comments, the tool may replace any U+000C FORM
  FEED (FF) character with a U+0020 SPACE character, and any other
  literal non-XML character with a U+FFFD REPLACEMENT CHARACTER.</p>

  <p>If the tool has no way to convey out-of-band information, then
  the tool may drop the following information:</p>

  <ul><li>Whether the document is set to <i><a href=#no-quirks-mode>no-quirks mode</a></i>,
   <i><a href=#limited-quirks-mode>limited-quirks mode</a></i>, or <i><a href=#quirks-mode>quirks mode</a></i></li>

   <li>The association between form controls and forms that aren't
   their nearest <code><a href=#the-form-element>form</a></code> element ancestor (use of the
   <a href=#form-element-pointer><code>form</code> element pointer</a> in the parser)</li>

   <li>The <a href=#template-contents>template contents</a> of any <code><a href=#the-template-element>template</a></code> elements.</li>

  </ul><p class=note>The mutations allowed by this section apply
  <em>after</em> the <a href=#html-parser>HTML parser</a>'s rules have been
  applied. For example, a <code title="">&lt;a::&gt;</code> start tag
  will be closed by a <code title="">&lt;/a::&gt;</code> end tag, and
  never by a <code title="">&lt;/aU00003AU00003A&gt;</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 title="">aU00003AU00003A</code> for that start tag.</p>

  </div>


  <div class=impl>

  <h4 id=an-introduction-to-error-handling-and-strange-cases-in-the-parser><span class=secno>12.2.8 </span>An introduction to error handling and strange cases in the parser</h4>

  <p><i>This section is non-normative.</i></p>

  <p>This section examines some erroneous markup and discusses how
  the <a href=#html-parser>HTML parser</a> handles these cases.</p>


  <h5 id=misnested-tags:-b-i-/b-/i><span class=secno>12.2.8.1 </span>Misnested tags: &lt;b&gt;&lt;i&gt;&lt;/b&gt;&lt;/i&gt;</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The most-often discussed example of erroneous markup is as
  follows:</p>

  <pre>&lt;p&gt;1&lt;b&gt;2&lt;i&gt;3&lt;/b&gt;4&lt;/i&gt;5&lt;/p&gt;</pre>

  <p>The parsing of this markup is straightforward up to the "3". At
  this point, the DOM looks like this:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">3</span></ul></ul></ul></ul></ul></ul><p>Here, the <a href=#stack-of-open-elements>stack of open elements</a> has five elements
  on it: <code><a href=#the-html-element>html</a></code>, <code><a href=#the-body-element>body</a></code>, <code><a href=#the-p-element>p</a></code>,
  <code><a href=#the-b-element>b</a></code>, and <code><a href=#the-i-element>i</a></code>. The <a href=#list-of-active-formatting-elements>list of active
  formatting elements</a> just has two: <code><a href=#the-b-element>b</a></code> and
  <code><a href=#the-i-element>i</a></code>. The <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inbody title="insertion mode: in body">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 title="">formatting
  element</var> is the <code><a href=#the-b-element>b</a></code> element, and there is no
  <var title="">furthest block</var>. Thus, the <a href=#stack-of-open-elements>stack of open
  elements</a> ends up with just three elements: <code><a href=#the-html-element>html</a></code>,
  <code><a href=#the-body-element>body</a></code>, and <code><a href=#the-p-element>p</a></code>, while the <a href=#list-of-active-formatting-elements>list of
  active formatting elements</a> has just one: <code><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 title="reconstruct the active formatting elements">reconstruction of
  the active formatting elements</a>, in this case just the
  <code><a href=#the-i-element>i</a></code> element. A new <code><a href=#the-i-element>i</a></code> element is thus created
  for the "4" <code><a href=#text>Text</a></code> node. After the end tag token for the
  "i" is also received, and the "5" <code><a href=#text>Text</a></code> node is
  inserted, the DOM looks as follows:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">3</span></ul></ul><li class=t1><code><a href=#the-i-element>i</a></code><ul><li class=t3><code>#text</code>: <span title="">4</span></ul><li class=t3><code>#text</code>: <span title="">5</span></ul></ul></ul></ul><h5 id=misnested-tags:-b-p-/b-/p><span class=secno>12.2.8.2 </span>Misnested tags: &lt;b&gt;&lt;p&gt;&lt;/b&gt;&lt;/p&gt;</h5>

  <p><i>This section is non-normative.</i></p>

  <p>A case similar to the previous one is the following:</p>

  <pre>&lt;b&gt;1&lt;p&gt;2&lt;/b&gt;3&lt;/p&gt;</pre>

  <p>Up to the "2" the parsing here is straightforward:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">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>stack of open
  elements</a> has four elements on it: <code><a href=#the-html-element>html</a></code>,
  <code><a href=#the-body-element>body</a></code>, <code><a href=#the-b-element>b</a></code>, and <code><a href=#the-p-element>p</a></code>. The
  <a href=#list-of-active-formatting-elements>list of active formatting elements</a> just has the one:
  <code><a href=#the-b-element>b</a></code>. The <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-inbody title="insertion mode: in body">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 title="">furthest block</var>, namely the <code><a href=#the-p-element>p</a></code> element. Thus,
  this time the adoption agency algorithm isn't skipped over.</p>

  <p>The <var title="">common ancestor</var> is the <code><a href=#the-body-element>body</a></code>
  element. A conceptual "bookmark" marks the position of the
  <code><a href=#the-b-element>b</a></code> in the <a href=#list-of-active-formatting-elements>list of active formatting
  elements</a>, but since that list has only one element in it,
  the bookmark won't have much effect.</p>

  <p>As the algorithm progresses, <var title="">node</var> ends up set
  to the formatting element (<code><a href=#the-b-element>b</a></code>), and <var title="">last
  node</var> ends up set to the <var title="">furthest block</var>
  (<code><a href=#the-p-element>p</a></code>).</p>

  <p>The <var title="">last node</var> gets appended (moved) to the
  <var title="">common ancestor</var>, so that the DOM looks like:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul></ul></ul><p>A new <code><a href=#the-b-element>b</a></code> element is created, and the children of the
  <code><a href=#the-p-element>p</a></code> element are moved to it:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code></ul></ul></ul><ul class=domTree><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul><p>Finally, the new <code><a href=#the-b-element>b</a></code> element is appended to the
  <code><a href=#the-p-element>p</a></code> element, so that the DOM looks like:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul></ul></ul></ul></ul><p>The <code><a href=#the-b-element>b</a></code> element is removed from the <a href=#list-of-active-formatting-elements>list of
  active formatting elements</a> and the <a href=#stack-of-open-elements>stack of open
  elements</a>, so that when the "3" is parsed, it is appended to
  the <code><a href=#the-p-element>p</a></code> element:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">1</span></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">2</span></ul><li class=t3><code>#text</code>: <span title="">3</span></ul></ul></ul></ul><h5 id=unexpected-markup-in-tables><span class=secno>12.2.8.3 </span>Unexpected markup in tables</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Error handling in tables is, for historical reasons, especially
  strange. For example, consider the following markup:</p>

  <pre>&lt;table&gt;<strong>&lt;b&gt;</strong>&lt;tr&gt;&lt;td&gt;aaa&lt;/td&gt;&lt;/tr&gt;<strong>bbb</strong>&lt;/table&gt;ccc</pre>

  <p>The highlighted <code><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 title="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><a href=#the-table-element>table</a></code> element's start tag has been seen:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-table-element>table</a></code></ul></ul></ul><p>...and then immediately after the <code><a href=#the-b-element>b</a></code> element start
  tag has been seen:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code></ul></ul></ul><p>At this point, the <a href=#stack-of-open-elements>stack of open elements</a> has on it
  the elements <code><a href=#the-html-element>html</a></code>, <code><a href=#the-body-element>body</a></code>,
  <code><a href=#the-table-element>table</a></code>, and <code><a href=#the-b-element>b</a></code> (in that order, despite the
  resulting DOM tree); the <a href=#list-of-active-formatting-elements>list of active formatting
  elements</a> just has the <code><a href=#the-b-element>b</a></code> element in it; and the
  <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intable title="insertion mode: in
  table">in table</a>".</p>

  <p>The <code><a href=#the-tr-element>tr</a></code> start tag causes the <code><a href=#the-b-element>b</a></code> element
  to be popped off the stack and a <code><a href=#the-tbody-element>tbody</a></code> start tag to be
  implied; the <code><a href=#the-tbody-element>tbody</a></code> and <code><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 title="insertion mode: in table body">in table
  body</a>" and "<a href=#parsing-main-intr title="insertion mode: in row">in
  row</a>" insertion modes, after which the DOM looks as
  follows:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code></ul></ul></ul></ul></ul><p>Here, the <a href=#stack-of-open-elements>stack of open elements</a> has on it the
  elements <code><a href=#the-html-element>html</a></code>, <code><a href=#the-body-element>body</a></code>, <code><a href=#the-table-element>table</a></code>,
  <code><a href=#the-tbody-element>tbody</a></code>, and <code><a href=#the-tr-element>tr</a></code>; the <a href=#list-of-active-formatting-elements>list of active
  formatting elements</a> still has the <code><a href=#the-b-element>b</a></code> element in
  it; and the <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intr title="insertion
  mode: in row">in row</a>".</p>

  <p>The <code><a href=#the-td-element>td</a></code> element start tag token, after putting a
  <code><a href=#the-td-element>td</a></code> element on the tree, puts a marker on the <a href=#list-of-active-formatting-elements>list
  of active formatting elements</a> (it also switches to the "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>" <a href=#insertion-mode>insertion
  mode</a>).</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code></ul></ul></ul></ul></ul></ul><p>The marker means that when the "aaa" character tokens are seen,
  no <code><a href=#the-b-element>b</a></code> element is created to hold the resulting <code><a href=#text>Text</a></code> node:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code><ul><li class=t3><code>#text</code>: <span title="">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>stack of open elements</a> has on it the
  elements <code><a href=#the-html-element>html</a></code>, <code><a href=#the-body-element>body</a></code>, <code><a href=#the-table-element>table</a></code>,
  and <code><a href=#the-tbody-element>tbody</a></code>; the <a href=#list-of-active-formatting-elements>list of active formatting
  elements</a> still has the <code><a href=#the-b-element>b</a></code> element in it (the
  marker having been removed by the "td" end tag token); and the
  <a href=#insertion-mode>insertion mode</a> is "<a href=#parsing-main-intbody title="insertion mode: in
  table body">in table body</a>".</p>

  <p>Thus it is that the "bbb" character tokens are found. These
  trigger the "<a href=#parsing-main-intabletext title="insertion mode: in table text">in table
  text</a>" insertion mode to be used (with the <a href=#original-insertion-mode>original
  insertion mode</a> set to "<a href=#parsing-main-intbody title="insertion mode: in table
  body">in table body</a>"). The character tokens are collected,
  and when the next token (the <code><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 title="insertion mode: in table">in table</a>" insertion mode,
  which defer to the "<a href=#parsing-main-inbody title="insertion mode: in body">in
  body</a>" insertion mode but with <a href=#foster-parent title="foster
  parent">foster parenting</a>.</p>

  <p>When <a href=#reconstruct-the-active-formatting-elements title="reconstruct the active formatting elements">the
  active formatting elements are reconstructed</a>, a
  <code><a href=#the-b-element>b</a></code> element is created and <a href=#foster-parent title="foster
  parent">foster parented</a>, and then the "bbb" <code><a href=#text>Text</a></code>
  node is appended to it:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">bbb</span></ul><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code><ul><li class=t3><code>#text</code>: <span title="">aaa</span></ul></ul></ul></ul></ul></ul></ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> has on it the elements
  <code><a href=#the-html-element>html</a></code>, <code><a href=#the-body-element>body</a></code>, <code><a href=#the-table-element>table</a></code>,
  <code><a href=#the-tbody-element>tbody</a></code>, and the new <code><a href=#the-b-element>b</a></code> (again, note that
  this doesn't match the resulting tree!); the <a href=#list-of-active-formatting-elements>list of active
  formatting elements</a> has the new <code><a href=#the-b-element>b</a></code> element in it;
  and the <a href=#insertion-mode>insertion mode</a> is still "<a href=#parsing-main-intbody title="insertion
  mode: in table body">in table body</a>".</p>

  <p>Had the character tokens been only <a href=#space-character title="space
  character">space characters</a> instead of "bbb", then those
  <a href=#space-character title="space character">space characters</a> would just be
  appended to the <code><a href=#the-tbody-element>tbody</a></code> element.</p>

  <p>Finally, the <code><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>stack of open
  elements</a> up to and including the <code><a href=#the-table-element>table</a></code> element,
  but it doesn't affect the <a href=#list-of-active-formatting-elements>list of active formatting
  elements</a>, so the "ccc" character tokens after the table
  result in yet another <code><a href=#the-b-element>b</a></code> element being created, this
  time after the table:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">bbb</span></ul><li class=t1><code><a href=#the-table-element>table</a></code><ul><li class=t1><code><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code><a href=#the-tr-element>tr</a></code><ul><li class=t1><code><a href=#the-td-element>td</a></code><ul><li class=t3><code>#text</code>: <span title="">aaa</span></ul></ul></ul></ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">ccc</span></ul></ul></ul></ul><h5 id=scripts-that-modify-the-page-as-it-is-being-parsed><span class=secno>12.2.8.4 </span>Scripts that modify the page as it is being parsed</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Consider the following markup, which for this example we will
  assume is the document with <a href=#url>URL</a> <code title="">http://example.com/inner</code>, being rendered as the
  content of an <code><a href=#the-iframe-element>iframe</a></code> in another document with the
  <a href=#url>URL</a> <code title="">http://example.com/outer</code>:</p>

  <pre>&lt;div id=a&gt;
 &lt;script&gt;
  var div = document.getElementById('a');
  parent.document.body.appendChild(div);
 &lt;/script&gt;
 &lt;script&gt;
  alert(document.URL);
 &lt;/script&gt;
&lt;/div&gt;
&lt;script&gt;
 alert(document.URL);
&lt;/script&gt;</pre>

  <p>Up to the first "script" end tag, before the script is parsed,
  the result is relatively straightforward:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-div-element>div</a></code> <span class=t2 title=""><code class="attribute name">id</code>="<code class="attribute value"><a href=#the-a-element>a</a></code>"</span><ul><li class=t3><code>#text</code>: <span title="">
 </span><li class=t1><code><a href=#the-script-element>script</a></code><ul><li class=t3><code>#text</code>: <span title="">var div = document.getElementById('a'); &#x23ce; parent.document.body.appendChild(div);</span></ul></ul></ul></ul></ul><p>After the script is parsed, though, the <code><a href=#the-div-element>div</a></code> element
  and its child <code><a href=#the-script-element>script</a></code> element are gone:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code></ul></ul><p>They are, at this point, in the <code><a href=#document>Document</a></code> of the
  aforementioned outer <a href=#browsing-context>browsing context</a>. However, the
  <a href=#stack-of-open-elements>stack of open elements</a> <em>still contains the
  <code><a href=#the-div-element>div</a></code> element</em>.</p>

  <p>Thus, when the second <code><a href=#the-script-element>script</a></code> element is parsed, it
  is inserted <em>into the outer <code><a href=#document>Document</a></code>
  object</em>.</p>

  <p>Those parsed into different <code><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><a href=#the-div-element>div</a></code> element's end tag is parsed, the
  <code><a href=#the-div-element>div</a></code> element is popped off the stack, and so the next
  <code><a href=#the-script-element>script</a></code> element is in the inner <code><a href=#document>Document</a></code>:</p>

  <ul class=domTree><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-script-element>script</a></code><ul><li class=t3><code>#text</code>: <span title="">alert(document.URL);</span></ul></ul></ul></ul><p>This script does execute, resulting in an alert that says "http://example.com/inner".</p>


  <h5 id=the-execution-of-scripts-that-are-moving-across-multiple-documents><span class=secno>12.2.8.5 </span>The execution of scripts that are moving across multiple documents</h5>

  <p><i>This section is non-normative.</i></p>

  <p>Elaborating on the example in the previous section, consider the
  case where the second <code><a href=#the-script-element>script</a></code> element is an external
  script (i.e. one with a <code title=attr-script-src><a href=#attr-script-src>src</a></code>
  attribute). Since the element was not in the parser's
  <code><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><a href=#the-script-element>script</a></code> element with a <code title=attr-script-src><a href=#attr-script-src>src</a></code> attribute is parsed normally into
  its parser's <code><a href=#document>Document</a></code>, but while the external script is
  being downloaded, the element is moved to another document, the
  script continues to download, but does not execute.</p>

  <p class=note>In general, moving <code><a href=#the-script-element>script</a></code> elements
  between <code><a href=#document>Document</a></code>s is considered a bad practice.</p>



  <h5 id=unclosed-formatting-elements><span class=secno>12.2.8.6 </span>Unclosed formatting elements</h5>

  <p><i>This section is non-normative.</i></p>

  <p>The following markup shows how nested formatting elements (such
  as <code><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>&lt;!DOCTYPE html&gt;
&lt;p&gt;&lt;b class=x&gt;&lt;b class=x&gt;&lt;b&gt;&lt;b class=x&gt;&lt;b class=x&gt;&lt;b&gt;X
&lt;p&gt;X
&lt;p&gt;&lt;b&gt;&lt;b class=x&gt;&lt;b&gt;X
&lt;p&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;X</pre>

  <p>The resulting DOM tree is as follows:</p>

  <ul class=domTree><li class=t10>DOCTYPE: <code><a href=#the-html-element>html</a></code><li class=t1><code><a href=#the-html-element>html</a></code><ul><li class=t1><code><a href=#the-head-element>head</a></code><li class=t1><code><a href=#the-body-element>body</a></code><ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">X&#x23ce;</span></ul></ul></ul></ul></ul></ul></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">X&#x23ce;</span></ul></ul></ul></ul></ul></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t1><code><a href=#the-b-element>b</a></code> <span class=t2 title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code><a href=#the-b-element>b</a></code><ul><li class=t3><code>#text</code>: <span title="">X&#x23ce;</span></ul></ul></ul></ul></ul></ul></ul></ul></ul><li class=t1><code><a href=#the-p-element>p</a></code><ul><li class=t3><code>#text</code>: <span title="">X&#x23ce;</span></ul></ul></ul></ul><p>Note how the second <code><a href=#the-p-element>p</a></code> element in the markup has no
  explicit <code><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><a href=#the-b-element>b</a></code> elements with the class attribute, and two unadorned
  <code><a href=#the-b-element>b</a></code> elements) get reconstructed before the element's
  "X".</p>

  <p>Also note how this means that in the final paragraph only six
  <code><a href=#the-b-element>b</a></code> end tags are needed to completely clear the list of
  formatting elements, even though nine <code><a href=#the-b-element>b</a></code> start tags have
  been seen up to this point.</p>


<!--/HTMLPARSER-->


  <h3 id=serializing-html-fragments><span class=secno>12.3 </span>Serializing HTML fragments</h3>

  <p>The following steps form the <dfn id=html-fragment-serialization-algorithm>HTML fragment serialization
  algorithm</dfn>. The algorithm takes as input a DOM
  <code><a href=#element>Element</a></code>, <code><a href=#document>Document</a></code>, or
  <code><a href=#documentfragment>DocumentFragment</a></code> referred to as <var title="">the
  node</var>, and either returns a string or throws an exception.</p>

  <p class=note>This algorithm serializes the <em>children</em> of
  the node being serialized, not the node itself.</p>

  <ol><li><p>Let <var title="">s</var> be a string, and initialize it to
   the empty string.</li>

   <li><p>If <var title="">the node</var> is a <code><a href=#the-template-element>template</a></code> element, then let <var title="">the node</var> instead be the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template
   contents</a> (a <code><a href=#documentfragment>DocumentFragment</a></code> node).</li>

   <li>

    <p>For each child node of <var title="">the node</var>, in
    <a href=#tree-order>tree order</a>, run the following steps:

    <ol><li><p>Let <var title="">current node</var> be the child node
     being processed.</li>

     <li>

      <p>Append the appropriate string from the following list to
      <var title="">s</var>:</p>

      <dl class=switch><dt>If <var title="">current node</var> is an <code title="">Element</code></dt>

       <dd>

        <p>If <var title="">current node</var> is an element in the
        <a href=#html-namespace-0>HTML namespace</a>, the <a href=#mathml-namespace>MathML
        namespace</a>, or the <a href=#svg-namespace>SVG namespace</a>, then let
        <var title="">tagname</var> be <var title="">current
        node</var>'s local name. Otherwise, let <var title="">tagname</var> be <var title="">current node</var>'s
        qualified name.</p>

        <p>Append a U+003C LESS-THAN SIGN character (&lt;), followed
        by <var title="">tagname</var>.</p>

        <p class=note>For <a href=#html-elements>HTML elements</a> created by the
        <a href=#html-parser>HTML parser</a> or <code title="">Document.createElement()</code>, <var title="">tagname</var> will be lowercase.</p>

        <p>For each attribute that the element has, append a U+0020
        SPACE character, the <a href="#attribute's-serialized-name" title="attribute's serialized
        name">attribute's serialized name as described below</a>, a
        U+003D EQUALS SIGN character (=), a U+0022 QUOTATION MARK
        character ("), the attribute's value, <a href=#escapingString title="escaping a string">escaped as described below</a> in
        <i>attribute mode</i>, and a second U+0022 QUOTATION MARK
        character (").</p>

        <p>An <dfn id="attribute's-serialized-name">attribute's serialized name</dfn> for the purposes
        of the previous paragraph must be determined as follows:</p>

        <dl class=switch><dt>If the attribute has no namespace</dt>

         <dd>

          <p>The attribute's serialized name is the attribute's local
          name.</p>

          <p class=note>For attributes on <a href=#html-elements>HTML elements</a>
          set by the <a href=#html-parser>HTML parser</a> or by <code title="">Element.setAttribute()</code>, the local name will
          be lowercase.</p>

         </dd>


         <dt>If the attribute is in the <a href=#xml-namespace>XML namespace</a></dt>

         <dd><p>The attribute's serialized name is the string "<code title="">xml:</code>" followed by the attribute's local
         name.</dd>


         <dt>If the attribute is in the <a href=#xmlns-namespace>XMLNS namespace</a> and the attribute's local name is <code title="">xmlns</code></dt>

         <dd><p>The attribute's serialized name is the string "<code title="">xmlns</code>".</dd>


         <dt>If the attribute is in the <a href=#xmlns-namespace>XMLNS namespace</a> and the attribute's local name is not <code title="">xmlns</code></dt>

         <dd><p>The attribute's serialized name is the string "<code title="">xmlns:</code>" followed by the attribute's local
         name.</dd>


         <dt>If the attribute is in the <a href=#xlink-namespace>XLink namespace</a></dt>

         <dd><p>The attribute's serialized name is the string "<code title="">xlink:</code>" followed by the attribute's local
         name.</dd>


         <dt>If the attribute is in some other namespace</dt>

         <dd><p>The attribute's serialized name is the attribute's
         qualified name.</dd>

        </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
        element's attributes in the same order.</p>

        <p>Append a U+003E GREATER-THAN SIGN character (&gt;).</p>

        <p>If <var title="">current node</var> is an <code><a href=#the-area-element>area</a></code>, <code><a href=#the-base-element>base</a></code>,
        <code><a href=#basefont>basefont</a></code>, <code><a href=#bgsound>bgsound</a></code>, <code><a href=#the-br-element>br</a></code>, <code><a href=#the-col-element>col</a></code>,
        <code><a href=#the-embed-element>embed</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-img-element>img</a></code>,
        <code><a href=#the-input-element>input</a></code>, <code><a href=#the-keygen-element>keygen</a></code>, <code><a href=#the-link-element>link</a></code>, <code><a href=#the-menuitem-element>menuitem</a></code>,
        <code><a href=#the-meta-element>meta</a></code>, <code><a href=#the-param-element>param</a></code>, <code><a href=#the-source-element>source</a></code>, <code><a href=#the-track-element>track</a></code> or
        <code><a href=#the-wbr-element>wbr</a></code> element, then continue on to the next child node at this point.</p>
        <!-- VOIDLIST superset -->
        <!-- also, i guess: image and isindex, but we don't list those
        because we don't consider those "elements", more "macros", and
        thus we should never serialize them -->

        <p>If <var title="">current node</var> is a <code><a href=#the-pre-element>pre</a></code>,
        <code><a href=#the-textarea-element>textarea</a></code>, or <code><a href=#listing>listing</a></code> element, and
        the first child node of the element, if any, is a
        <code><a href=#text>Text</a></code> node whose character data has as its first
        character a U+000A LINE FEED (LF) character, then append a
        U+000A LINE FEED (LF) character.</p>

        <p>Append the value of running the <a href=#html-fragment-serialization-algorithm>HTML fragment
        serialization algorithm</a> on the <var title="">current
        node</var> element (thus recursing into this algorithm for
        that element), followed by a U+003C LESS-THAN SIGN character
        (&lt;), a U+002F SOLIDUS character (/), <var title="">tagname</var> again, and finally a U+003E
        GREATER-THAN SIGN character (&gt;).</p>

       </dd>


       <dt>If <var title="">current node</var> is a <code title="">Text</code> node</dt>

       <dd>

        <p>If the parent of <var title="">current node</var> is a
        <code><a href=#the-style-element>style</a></code>, <code><a href=#the-script-element>script</a></code>, <code><a href=#xmp>xmp</a></code>,
        <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#noembed>noembed</a></code>,
        <code><a href=#noframes>noframes</a></code>, or <code><a href=#plaintext>plaintext</a></code> element, or
        if the parent of <var title="">current node</var> is
        <code><a href=#the-noscript-element>noscript</a></code> element and <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
        node, then append the value of <var title="">current
        node</var>'s <code title="">data</code> IDL attribute
        literally.</p>

        <p>Otherwise, append the value of <var title="">current
        node</var>'s <code title="">data</code> IDL attribute, <a href=#escapingString title="escaping a string">escaped as described
        below</a>.</p>

       </dd>


       <dt>If <var title="">current node</var> is a <code title="">Comment</code></dt>

       <dd>

        <p>Append the literal string <code>&lt;!--</code> (U+003C
        LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS,
        U+002D HYPHEN-MINUS), followed by the value of <var title="">current node</var>'s <code title="">data</code> IDL
        attribute, followed by the literal string <code>--&gt;</code>
        (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN
        SIGN).</p>

       </dd>


       <dt>If <var title="">current node</var> is a <code title="">ProcessingInstruction</code></dt>

       <dd>

        <p>Append the literal string <code>&lt;?</code> (U+003C
        LESS-THAN SIGN, U+003F QUESTION MARK), followed by the value
        of <var title="">current node</var>'s <code title="">target</code> IDL attribute, followed by a single
        U+0020 SPACE character, followed by the value of <var title="">current node</var>'s <code title="">data</code> IDL
        attribute, followed by a single U+003E GREATER-THAN SIGN
        character (&gt;).</p>

       </dd>


       <dt>If <var title="">current node</var> is a <code title="">DocumentType</code></dt>

       <dd>

        <p>Append the literal string <code>&lt;!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 title="">current node</var>'s <code title="">name</code> IDL attribute, followed by the literal
        string <code>&gt;</code> (U+003E GREATER-THAN SIGN).</p>

       </dd>


      </dl><!--
      <p>Other node types (e.g. <code title="">Attr</code>) cannot
      occur as children of elements. If, despite this, they somehow do
      occur, this algorithm must throw an
      <code>InvalidStateError</code> exception.</p>
      --></li>

    </ol></li>

   <li><p>The result of the algorithm is the string <var title="">s</var>.</li>

  </ol><p class=warning>It is possible that the output of this algorithm, if
  parsed with an <a href=#html-parser>HTML parser</a>, will not return the
  original tree structure.</p>

  <div class=example>

   <p>For instance, if a <code><a href=#the-textarea-element>textarea</a></code> element to which a
   <code title="">Comment</code> node has been appended is serialized
   and the output is then reparsed, the comment will end up being
   displayed in the text field. Similarly, if, as a result of DOM
   manipulation, an element contains a comment that contains the
   literal string "<code title="">--&gt;</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><a href=#the-script-element>script</a></code> element
   contain a <code><a href=#text>Text</a></code> node with the text string
   "<code>&lt;/script&gt;</code>", or having a <code><a href=#the-p-element>p</a></code> element
   that contains a <code><a href=#the-ul-element>ul</a></code> element (as the <code><a href=#the-ul-element>ul</a></code>
   element's <a href=#syntax-start-tag title=syntax-start-tag>start tag</a> would
   imply the end tag for the <code><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><a href=#the-style-element>style</a></code> block via
   the DOM and which then uses the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> IDL attribute to get
   the HTML serialization of that <code><a href=#the-style-element>style</a></code> element: if the user enters
   "<code>&lt;/style&gt;&lt;script&gt;attack&lt;/script&gt;</code>" as a font family name, <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> will return markup that, if parsed in a different context,
   would contain a <code><a href=#the-script-element>script</a></code> node, even though no <code><a href=#the-script-element>script</a></code> node existed in the
   original DOM.</p>

  </div>

  <p><dfn id=escapingString>Escaping a string</dfn> (for the
  purposes of the algorithm above) consists of running the following
  steps:</p>

  <ol><li><p>Replace any occurrence of the "<code title="">&amp;</code>"
   character by the string "<code title="">&amp;amp;</code>".</li>

   <li><p>Replace any occurrences of the U+00A0 NO-BREAK SPACE
   character by the string "<code title="">&amp;nbsp;</code>".</li>

   <li><p>If the algorithm was invoked in the <i>attribute mode</i>,
   replace any occurrences of the "<code title="">"</code>"
   character by the string "<code title="">&amp;quot;</code>".</li>

   <li><p>If the algorithm was <em>not</em> invoked in the
   <i>attribute mode</i>, replace any occurrences of the "<code title="">&lt;</code>" character by the string "<code title="">&amp;lt;</code>", and any occurrences of the "<code title="">&gt;</code>" character by the string "<code title="">&amp;gt;</code>".</li>

  </ol><h3 id=parsing-html-fragments><span class=secno>12.4 </span>Parsing HTML fragments</h3>

  <p>The following steps form the <dfn id=html-fragment-parsing-algorithm>HTML fragment parsing
  algorithm</dfn>. The algorithm optionally takes as input an
  <code><a href=#element>Element</a></code> node, referred to as the <dfn id=concept-frag-parse-context title=concept-frag-parse-context><var>context</var></dfn> element,
  which gives the context for the parser, as well as <var title="">input</var>, a string to parse, and returns a list of zero
  or more nodes.</p>

  <p class=note>Parts marked <dfn id=fragment-case>fragment case</dfn> in algorithms
  in the parser section are parts that only occur if the parser was
  created for the purposes of this algorithm (and with a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element). The
  algorithms have been annotated with such markings for informational
  purposes only; such markings have no normative weight. If it is
  possible for a condition described as a <a href=#fragment-case>fragment case</a>
  to occur even when the parser wasn't created for the purposes of
  handling this algorithm, then that is an error in the
  specification.</p>

  <ol><li>

    <p>Create a new <code><a href=#document>Document</a></code> node, and mark it as being
    an <a href=#html-documents title="HTML documents">HTML document</a>.</p>

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, and the
    <code><a href=#document>Document</a></code> of the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element is in
    <a href=#quirks-mode>quirks mode</a>, then let the <code><a href=#document>Document</a></code> be in
    <a href=#quirks-mode>quirks mode</a>. Otherwise, if there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, and the
    <code><a href=#document>Document</a></code> of the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element is in
    <a href=#limited-quirks-mode>limited-quirks mode</a>, then let the
    <code><a href=#document>Document</a></code> be in <a href=#limited-quirks-mode>limited-quirks mode</a>.
    Otherwise, leave the <code><a href=#document>Document</a></code> in <a href=#no-quirks-mode>no-quirks
    mode</a>.</p>

   </li>

   <li>

    <p>Create a new <a href=#html-parser>HTML parser</a>, and associate it with
    the just created <code><a href=#document>Document</a></code> node.</p>

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, run
    these substeps:</p>

    <ol><li>

      <p>Set the state of the <a href=#html-parser>HTML parser</a>'s
      <a href=#tokenization>tokenization</a> stage as follows:</p>

      <dl class=switch><dt>If it is a <code><a href=#the-title-element>title</a></code> or <code><a href=#the-textarea-element>textarea</a></code>
       element</dt>

       <dd>Switch the tokenizer to the <a href=#rcdata-state>RCDATA state</a>.</dd>


       <dt>If it is a <code><a href=#the-style-element>style</a></code>, <code><a href=#xmp>xmp</a></code>,
       <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#noembed>noembed</a></code>, or
       <code><a href=#noframes>noframes</a></code> element</dt>

       <dd>Switch the tokenizer to the <a href=#rawtext-state>RAWTEXT state</a>.</dd>


       <dt>If it is a <code><a href=#the-script-element>script</a></code> element</dt>

       <dd>Switch the tokenizer to the <a href=#script-data-state>script data state</a>.</dd>


       <dt>If it is a <code><a href=#the-noscript-element>noscript</a></code> element</dt>

       <dd>If the <a href=#scripting-flag>scripting flag</a> is enabled, switch the
       tokenizer to the <a href=#rawtext-state>RAWTEXT state</a>.  Otherwise,
       leave the tokenizer in the <a href=#data-state>data state</a>.</dd>


       <dt>If it is a <code><a href=#plaintext>plaintext</a></code> element</dt>

       <dd>Switch the tokenizer to the <a href=#plaintext-state>PLAINTEXT
       state</a>.</dd>


       <dt>Otherwise</dt>

       <dd>Leave the tokenizer in the <a href=#data-state>data state</a>.</dd>

      </dl><p class=note>For performance reasons, an implementation that
      does not report errors and that uses the actual state machine
      described in this specification directly could use the PLAINTEXT
      state instead of the RAWTEXT and script data states where those
      are mentioned in the list above. Except for rules regarding
      parse errors, they are equivalent, since there is no
      <a href=#appropriate-end-tag-token>appropriate end tag token</a> in the fragment case, yet
      they involve far fewer state transitions.</p>

     </li>

     <li>

      <p>Let <var title="">root</var> be a new <code><a href=#the-html-element>html</a></code> element
      with no attributes.</p>

     </li>

     <li>

      <p>Append the element <var title="">root</var> to the
      <code><a href=#document>Document</a></code> node created above.</p>

     </li>

     <li>

      <p>Set up the parser's <a href=#stack-of-open-elements>stack of open elements</a> so that
      it contains just the single element <var title="">root</var>.</p>

     </li>

     <li>

      <p>If the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element is a
      <code><a href=#the-template-element>template</a></code> element, push "<a href=#parsing-main-intemplate title="insertion mode: in template">in
      template</a>" onto the <a href=#stack-of-template-insertion-modes>stack of template insertion modes</a> so that it is the new
      <a href=#current-template-insertion-mode>current template insertion mode</a>.</p>

     </li>

     <li>

      <p><a href=#reset-the-insertion-mode-appropriately title="reset the insertion mode appropriately">Reset the
      parser's insertion mode appropriately</a>.</p>

      <p class=note>The parser will reference the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element as part
      of that algorithm.</p>

     </li>

     <li>

      <p>Set the parser's <a href=#form-element-pointer><code>form</code> element
      pointer</a> to the nearest node to the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element that is
      a <code><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><a href=#the-form-element>form</a></code> element), or, if there is no such
      <code><a href=#the-form-element>form</a></code> element, to null.</p>

     </li>

    </ol></li>

   <li>

    <p>Place into the <a href=#input-stream>input stream</a> for the <a href=#html-parser>HTML
    parser</a> just created the <var title="">input</var>. The
    encoding <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a> is
    <i>irrelevant</i>.</p>

   </li>

   <li>

    <p>Start the parser and let it run until it has consumed all the
    characters just inserted into the input stream.</p>

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, return
    the child nodes of <var title="">root</var>, in <a href=#tree-order>tree
    order</a>.</p>

    <p>Otherwise, return the children of the <code><a href=#document>Document</a></code>
    object, in <a href=#tree-order>tree order</a>.</p>

   </li>

  </ol></div>



  <h3 id=named-character-references><span class=secno>12.5 </span><dfn>Named character references</dfn></h3>

  <p>This table lists the character reference names that are supported
  by HTML, and the code points to which they refer. It is referenced
  by the previous sections.</p>

  <div id=named-character-references-table>
   <table><thead><tr><th> Name </th> <th> Character(s) </th> <th> Glyph </th> <tbody><tr id=entity-Aacute><td> <code title="">Aacute;</code> </td> <td> U+000C1 </td> <td> <span class=glyph title="">&Aacute;</span> </td> <tr id=entity-Aacute-legacy class=impl><td> <code title="">Aacute</code> </td> <td> U+000C1 </td> <td> <span title="">&Aacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-aacute><td> <code title="">aacute;</code> </td> <td> U+000E1 </td> <td> <span class=glyph title="">&aacute;</span> </td> <tr id=entity-aacute-legacy class=impl><td> <code title="">aacute</code> </td> <td> U+000E1 </td> <td> <span title="">&aacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Abreve><td> <code title="">Abreve;</code> </td> <td> U+00102 </td> <td> <span class=glyph title="">&Abreve;</span> </td> <tr id=entity-abreve><td> <code title="">abreve;</code> </td> <td> U+00103 </td> <td> <span class=glyph title="">&abreve;</span> </td> <tr id=entity-ac><td> <code title="">ac;</code> </td> <td> U+0223E </td> <td> <span class=glyph title="">&ac;</span> </td> <tr id=entity-acd><td> <code title="">acd;</code> </td> <td> U+0223F </td> <td> <span class=glyph title="">&acd;</span> </td> <tr id=entity-acE><td> <code title="">acE;</code> </td> <td> U+0223E U+00333 </td> <td> <span class="glyph compound" title="">&ac;&#x333;</span> </td> <tr id=entity-Acirc><td> <code title="">Acirc;</code> </td> <td> U+000C2 </td> <td> <span class=glyph title="">&Acirc;</span> </td> <tr id=entity-Acirc-legacy class=impl><td> <code title="">Acirc</code> </td> <td> U+000C2 </td> <td> <span title="">&Acirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-acirc><td> <code title="">acirc;</code> </td> <td> U+000E2 </td> <td> <span class=glyph title="">&acirc;</span> </td> <tr id=entity-acirc-legacy class=impl><td> <code title="">acirc</code> </td> <td> U+000E2 </td> <td> <span title="">&acirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-acute><td> <code title="">acute;</code> </td> <td> U+000B4 </td> <td> <span class=glyph title="">&acute;</span> </td> <tr id=entity-acute-legacy class=impl><td> <code title="">acute</code> </td> <td> U+000B4 </td> <td> <span title="">&acute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Acy><td> <code title="">Acy;</code> </td> <td> U+00410 </td> <td> <span class=glyph title="">&Acy;</span> </td> <tr id=entity-acy><td> <code title="">acy;</code> </td> <td> U+00430 </td> <td> <span class=glyph title="">&acy;</span> </td> <tr id=entity-AElig><td> <code title="">AElig;</code> </td> <td> U+000C6 </td> <td> <span class=glyph title="">&AElig;</span> </td> <tr id=entity-AElig-legacy class=impl><td> <code title="">AElig</code> </td> <td> U+000C6 </td> <td> <span title="">&AElig;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-aelig><td> <code title="">aelig;</code> </td> <td> U+000E6 </td> <td> <span class=glyph title="">&aelig;</span> </td> <tr id=entity-aelig-legacy class=impl><td> <code title="">aelig</code> </td> <td> U+000E6 </td> <td> <span title="">&aelig;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-af><td> <code title="">af;</code> </td> <td> U+02061 </td> <td> <span class=glyph title="">&af;</span> </td> <tr id=entity-Afr><td> <code title="">Afr;</code> </td> <td> U+1D504 </td> <td> <span class=glyph title="">&Afr;</span> </td> <tr id=entity-afr><td> <code title="">afr;</code> </td> <td> U+1D51E </td> <td> <span class=glyph title="">&afr;</span> </td> <tr id=entity-Agrave><td> <code title="">Agrave;</code> </td> <td> U+000C0 </td> <td> <span class=glyph title="">&Agrave;</span> </td> <tr id=entity-Agrave-legacy class=impl><td> <code title="">Agrave</code> </td> <td> U+000C0 </td> <td> <span title="">&Agrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-agrave><td> <code title="">agrave;</code> </td> <td> U+000E0 </td> <td> <span class=glyph title="">&agrave;</span> </td> <tr id=entity-agrave-legacy class=impl><td> <code title="">agrave</code> </td> <td> U+000E0 </td> <td> <span title="">&agrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-alefsym><td> <code title="">alefsym;</code> </td> <td> U+02135 </td> <td> <span class=glyph title="">&aleph;</span> </td> <tr id=entity-aleph><td> <code title="">aleph;</code> </td> <td> U+02135 </td> <td> <span class=glyph title="">&aleph;</span> </td> <tr id=entity-Alpha><td> <code title="">Alpha;</code> </td> <td> U+00391 </td> <td> <span class=glyph title="">&Alpha;</span> </td> <tr id=entity-alpha><td> <code title="">alpha;</code> </td> <td> U+003B1 </td> <td> <span class=glyph title="">&alpha;</span> </td> <tr id=entity-Amacr><td> <code title="">Amacr;</code> </td> <td> U+00100 </td> <td> <span class=glyph title="">&Amacr;</span> </td> <tr id=entity-amacr><td> <code title="">amacr;</code> </td> <td> U+00101 </td> <td> <span class=glyph title="">&amacr;</span> </td> <tr id=entity-amalg><td> <code title="">amalg;</code> </td> <td> U+02A3F </td> <td> <span class=glyph title="">&amalg;</span> </td> <tr id=entity-AMP><td> <code title="">AMP;</code> </td> <td> U+00026 </td> <td> <span class=glyph title="">&amp;</span> </td> <tr id=entity-AMP-legacy class=impl><td> <code title="">AMP</code> </td> <td> U+00026 </td> <td> <span title="">&amp;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-amp><td> <code title="">amp;</code> </td> <td> U+00026 </td> <td> <span class=glyph title="">&amp;</span> </td> <tr id=entity-amp-legacy class=impl><td> <code title="">amp</code> </td> <td> U+00026 </td> <td> <span title="">&amp;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-And><td> <code title="">And;</code> </td> <td> U+02A53 </td> <td> <span class=glyph title="">&And;</span> </td> <tr id=entity-and><td> <code title="">and;</code> </td> <td> U+02227 </td> <td> <span class=glyph title="">&wedge;</span> </td> <tr id=entity-andand><td> <code title="">andand;</code> </td> <td> U+02A55 </td> <td> <span class=glyph title="">&andand;</span> </td> <tr id=entity-andd><td> <code title="">andd;</code> </td> <td> U+02A5C </td> <td> <span class=glyph title="">&andd;</span> </td> <tr id=entity-andslope><td> <code title="">andslope;</code> </td> <td> U+02A58 </td> <td> <span class=glyph title="">&andslope;</span> </td> <tr id=entity-andv><td> <code title="">andv;</code> </td> <td> U+02A5A </td> <td> <span class=glyph title="">&andv;</span> </td> <tr id=entity-ang><td> <code title="">ang;</code> </td> <td> U+02220 </td> <td> <span class=glyph title="">&angle;</span> </td> <tr id=entity-ange><td> <code title="">ange;</code> </td> <td> U+029A4 </td> <td> <span class=glyph title="">&ange;</span> </td> <tr id=entity-angle><td> <code title="">angle;</code> </td> <td> U+02220 </td> <td> <span class=glyph title="">&angle;</span> </td> <tr id=entity-angmsd><td> <code title="">angmsd;</code> </td> <td> U+02221 </td> <td> <span class=glyph title="">&angmsd;</span> </td> <tr id=entity-angmsdaa><td> <code title="">angmsdaa;</code> </td> <td> U+029A8 </td> <td> <span class=glyph title="">&angmsdaa;</span> </td> <tr id=entity-angmsdab><td> <code title="">angmsdab;</code> </td> <td> U+029A9 </td> <td> <span class=glyph title="">&angmsdab;</span> </td> <tr id=entity-angmsdac><td> <code title="">angmsdac;</code> </td> <td> U+029AA </td> <td> <span class=glyph title="">&angmsdac;</span> </td> <tr id=entity-angmsdad><td> <code title="">angmsdad;</code> </td> <td> U+029AB </td> <td> <span class=glyph title="">&angmsdad;</span> </td> <tr id=entity-angmsdae><td> <code title="">angmsdae;</code> </td> <td> U+029AC </td> <td> <span class=glyph title="">&angmsdae;</span> </td> <tr id=entity-angmsdaf><td> <code title="">angmsdaf;</code> </td> <td> U+029AD </td> <td> <span class=glyph title="">&angmsdaf;</span> </td> <tr id=entity-angmsdag><td> <code title="">angmsdag;</code> </td> <td> U+029AE </td> <td> <span class=glyph title="">&angmsdag;</span> </td> <tr id=entity-angmsdah><td> <code title="">angmsdah;</code> </td> <td> U+029AF </td> <td> <span class=glyph title="">&angmsdah;</span> </td> <tr id=entity-angrt><td> <code title="">angrt;</code> </td> <td> U+0221F </td> <td> <span class=glyph title="">&angrt;</span> </td> <tr id=entity-angrtvb><td> <code title="">angrtvb;</code> </td> <td> U+022BE </td> <td> <span class=glyph title="">&angrtvb;</span> </td> <tr id=entity-angrtvbd><td> <code title="">angrtvbd;</code> </td> <td> U+0299D </td> <td> <span class=glyph title="">&angrtvbd;</span> </td> <tr id=entity-angsph><td> <code title="">angsph;</code> </td> <td> U+02222 </td> <td> <span class=glyph title="">&angsph;</span> </td> <tr id=entity-angst><td> <code title="">angst;</code> </td> <td> U+000C5 </td> <td> <span class=glyph title="">&angst;</span> </td> <tr id=entity-angzarr><td> <code title="">angzarr;</code> </td> <td> U+0237C </td> <td> <span class=glyph title="">&angzarr;</span> </td> <tr id=entity-Aogon><td> <code title="">Aogon;</code> </td> <td> U+00104 </td> <td> <span class=glyph title="">&Aogon;</span> </td> <tr id=entity-aogon><td> <code title="">aogon;</code> </td> <td> U+00105 </td> <td> <span class=glyph title="">&aogon;</span> </td> <tr id=entity-Aopf><td> <code title="">Aopf;</code> </td> <td> U+1D538 </td> <td> <span class=glyph title="">&Aopf;</span> </td> <tr id=entity-aopf><td> <code title="">aopf;</code> </td> <td> U+1D552 </td> <td> <span class=glyph title="">&aopf;</span> </td> <tr id=entity-ap><td> <code title="">ap;</code> </td> <td> U+02248 </td> <td> <span class=glyph title="">&thkap;</span> </td> <tr id=entity-apacir><td> <code title="">apacir;</code> </td> <td> U+02A6F </td> <td> <span class=glyph title="">&apacir;</span> </td> <tr id=entity-apE><td> <code title="">apE;</code> </td> <td> U+02A70 </td> <td> <span class=glyph title="">&apE;</span> </td> <tr id=entity-ape><td> <code title="">ape;</code> </td> <td> U+0224A </td> <td> <span class=glyph title="">&approxeq;</span> </td> <tr id=entity-apid><td> <code title="">apid;</code> </td> <td> U+0224B </td> <td> <span class=glyph title="">&apid;</span> </td> <tr id=entity-apos><td> <code title="">apos;</code> </td> <td> U+00027 </td> <td> <span class=glyph title="">'</span> </td> <tr id=entity-ApplyFunction><td> <code title="">ApplyFunction;</code> </td> <td> U+02061 </td> <td> <span class=glyph title="">&af;</span> </td> <tr id=entity-approx><td> <code title="">approx;</code> </td> <td> U+02248 </td> <td> <span class=glyph title="">&thkap;</span> </td> <tr id=entity-approxeq><td> <code title="">approxeq;</code> </td> <td> U+0224A </td> <td> <span class=glyph title="">&approxeq;</span> </td> <tr id=entity-Aring><td> <code title="">Aring;</code> </td> <td> U+000C5 </td> <td> <span class=glyph title="">&angst;</span> </td> <tr id=entity-Aring-legacy class=impl><td> <code title="">Aring</code> </td> <td> U+000C5 </td> <td> <span title="">&angst;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-aring><td> <code title="">aring;</code> </td> <td> U+000E5 </td> <td> <span class=glyph title="">&aring;</span> </td> <tr id=entity-aring-legacy class=impl><td> <code title="">aring</code> </td> <td> U+000E5 </td> <td> <span title="">&aring;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Ascr><td> <code title="">Ascr;</code> </td> <td> U+1D49C </td> <td> <span class=glyph title="">&Ascr;</span> </td> <tr id=entity-ascr><td> <code title="">ascr;</code> </td> <td> U+1D4B6 </td> <td> <span class=glyph title="">&ascr;</span> </td> <tr id=entity-Assign><td> <code title="">Assign;</code> </td> <td> U+02254 </td> <td> <span class=glyph title="">&coloneq;</span> </td> <tr id=entity-ast><td> <code title="">ast;</code> </td> <td> U+0002A </td> <td> <span class=glyph title="">*</span> </td> <tr id=entity-asymp><td> <code title="">asymp;</code> </td> <td> U+02248 </td> <td> <span class=glyph title="">&thkap;</span> </td> <tr id=entity-asympeq><td> <code title="">asympeq;</code> </td> <td> U+0224D </td> <td> <span class=glyph title="">&asympeq;</span> </td> <tr id=entity-Atilde><td> <code title="">Atilde;</code> </td> <td> U+000C3 </td> <td> <span class=glyph title="">&Atilde;</span> </td> <tr id=entity-Atilde-legacy class=impl><td> <code title="">Atilde</code> </td> <td> U+000C3 </td> <td> <span title="">&Atilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-atilde><td> <code title="">atilde;</code> </td> <td> U+000E3 </td> <td> <span class=glyph title="">&atilde;</span> </td> <tr id=entity-atilde-legacy class=impl><td> <code title="">atilde</code> </td> <td> U+000E3 </td> <td> <span title="">&atilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Auml><td> <code title="">Auml;</code> </td> <td> U+000C4 </td> <td> <span class=glyph title="">&Auml;</span> </td> <tr id=entity-Auml-legacy class=impl><td> <code title="">Auml</code> </td> <td> U+000C4 </td> <td> <span title="">&Auml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-auml><td> <code title="">auml;</code> </td> <td> U+000E4 </td> <td> <span class=glyph title="">&auml;</span> </td> <tr id=entity-auml-legacy class=impl><td> <code title="">auml</code> </td> <td> U+000E4 </td> <td> <span title="">&auml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-awconint><td> <code title="">awconint;</code> </td> <td> U+02233 </td> <td> <span class=glyph title="">&awconint;</span> </td> <tr id=entity-awint><td> <code title="">awint;</code> </td> <td> U+02A11 </td> <td> <span class=glyph title="">&awint;</span> </td> <tr id=entity-backcong><td> <code title="">backcong;</code> </td> <td> U+0224C </td> <td> <span class=glyph title="">&bcong;</span> </td> <tr id=entity-backepsilon><td> <code title="">backepsilon;</code> </td> <td> U+003F6 </td> <td> <span class=glyph title="">&backepsilon;</span> </td> <tr id=entity-backprime><td> <code title="">backprime;</code> </td> <td> U+02035 </td> <td> <span class=glyph title="">&bprime;</span> </td> <tr id=entity-backsim><td> <code title="">backsim;</code> </td> <td> U+0223D </td> <td> <span class=glyph title="">&backsim;</span> </td> <tr id=entity-backsimeq><td> <code title="">backsimeq;</code> </td> <td> U+022CD </td> <td> <span class=glyph title="">&backsimeq;</span> </td> <tr id=entity-Backslash><td> <code title="">Backslash;</code> </td> <td> U+02216 </td> <td> <span class=glyph title="">&smallsetminus;</span> </td> <tr id=entity-Barv><td> <code title="">Barv;</code> </td> <td> U+02AE7 </td> <td> <span class=glyph title="">&Barv;</span> </td> <tr id=entity-barvee><td> <code title="">barvee;</code> </td> <td> U+022BD </td> <td> <span class=glyph title="">&barvee;</span> </td> <tr id=entity-Barwed><td> <code title="">Barwed;</code> </td> <td> U+02306 </td> <td> <span class=glyph title="">&doublebarwedge;</span> </td> <tr id=entity-barwed><td> <code title="">barwed;</code> </td> <td> U+02305 </td> <td> <span class=glyph title="">&barwedge;</span> </td> <tr id=entity-barwedge><td> <code title="">barwedge;</code> </td> <td> U+02305 </td> <td> <span class=glyph title="">&barwedge;</span> </td> <tr id=entity-bbrk><td> <code title="">bbrk;</code> </td> <td> U+023B5 </td> <td> <span class=glyph title="">&bbrk;</span> </td> <tr id=entity-bbrktbrk><td> <code title="">bbrktbrk;</code> </td> <td> U+023B6 </td> <td> <span class=glyph title="">&bbrktbrk;</span> </td> <tr id=entity-bcong><td> <code title="">bcong;</code> </td> <td> U+0224C </td> <td> <span class=glyph title="">&bcong;</span> </td> <tr id=entity-Bcy><td> <code title="">Bcy;</code> </td> <td> U+00411 </td> <td> <span class=glyph title="">&Bcy;</span> </td> <tr id=entity-bcy><td> <code title="">bcy;</code> </td> <td> U+00431 </td> <td> <span class=glyph title="">&bcy;</span> </td> <tr id=entity-bdquo><td> <code title="">bdquo;</code> </td> <td> U+0201E </td> <td> <span class=glyph title="">&ldquor;</span> </td> <tr id=entity-becaus><td> <code title="">becaus;</code> </td> <td> U+02235 </td> <td> <span class=glyph title="">&becaus;</span> </td> <tr id=entity-Because><td> <code title="">Because;</code> </td> <td> U+02235 </td> <td> <span class=glyph title="">&becaus;</span> </td> <tr id=entity-because><td> <code title="">because;</code> </td> <td> U+02235 </td> <td> <span class=glyph title="">&becaus;</span> </td> <tr id=entity-bemptyv><td> <code title="">bemptyv;</code> </td> <td> U+029B0 </td> <td> <span class=glyph title="">&bemptyv;</span> </td> <tr id=entity-bepsi><td> <code title="">bepsi;</code> </td> <td> U+003F6 </td> <td> <span class=glyph title="">&backepsilon;</span> </td> <tr id=entity-bernou><td> <code title="">bernou;</code> </td> <td> U+0212C </td> <td> <span class=glyph title="">&bernou;</span> </td> <tr id=entity-Bernoullis><td> <code title="">Bernoullis;</code> </td> <td> U+0212C </td> <td> <span class=glyph title="">&bernou;</span> </td> <tr id=entity-Beta><td> <code title="">Beta;</code> </td> <td> U+00392 </td> <td> <span class=glyph title="">&Beta;</span> </td> <tr id=entity-beta><td> <code title="">beta;</code> </td> <td> U+003B2 </td> <td> <span class=glyph title="">&beta;</span> </td> <tr id=entity-beth><td> <code title="">beth;</code> </td> <td> U+02136 </td> <td> <span class=glyph title="">&beth;</span> </td> <tr id=entity-between><td> <code title="">between;</code> </td> <td> U+0226C </td> <td> <span class=glyph title="">&between;</span> </td> <tr id=entity-Bfr><td> <code title="">Bfr;</code> </td> <td> U+1D505 </td> <td> <span class=glyph title="">&Bfr;</span> </td> <tr id=entity-bfr><td> <code title="">bfr;</code> </td> <td> U+1D51F </td> <td> <span class=glyph title="">&bfr;</span> </td> <tr id=entity-bigcap><td> <code title="">bigcap;</code> </td> <td> U+022C2 </td> <td> <span class=glyph title="">&bigcap;</span> </td> <tr id=entity-bigcirc><td> <code title="">bigcirc;</code> </td> <td> U+025EF </td> <td> <span class=glyph title="">&xcirc;</span> </td> <tr id=entity-bigcup><td> <code title="">bigcup;</code> </td> <td> U+022C3 </td> <td> <span class=glyph title="">&xcup;</span> </td> <tr id=entity-bigodot><td> <code title="">bigodot;</code> </td> <td> U+02A00 </td> <td> <span class=glyph title="">&bigodot;</span> </td> <tr id=entity-bigoplus><td> <code title="">bigoplus;</code> </td> <td> U+02A01 </td> <td> <span class=glyph title="">&bigoplus;</span> </td> <tr id=entity-bigotimes><td> <code title="">bigotimes;</code> </td> <td> U+02A02 </td> <td> <span class=glyph title="">&xotime;</span> </td> <tr id=entity-bigsqcup><td> <code title="">bigsqcup;</code> </td> <td> U+02A06 </td> <td> <span class=glyph title="">&bigsqcup;</span> </td> <tr id=entity-bigstar><td> <code title="">bigstar;</code> </td> <td> U+02605 </td> <td> <span class=glyph title="">&bigstar;</span> </td> <tr id=entity-bigtriangledown><td> <code title="">bigtriangledown;</code> </td> <td> U+025BD </td> <td> <span class=glyph title="">&xdtri;</span> </td> <tr id=entity-bigtriangleup><td> <code title="">bigtriangleup;</code> </td> <td> U+025B3 </td> <td> <span class=glyph title="">&bigtriangleup;</span> </td> <tr id=entity-biguplus><td> <code title="">biguplus;</code> </td> <td> U+02A04 </td> <td> <span class=glyph title="">&xuplus;</span> </td> <tr id=entity-bigvee><td> <code title="">bigvee;</code> </td> <td> U+022C1 </td> <td> <span class=glyph title="">&bigvee;</span> </td> <tr id=entity-bigwedge><td> <code title="">bigwedge;</code> </td> <td> U+022C0 </td> <td> <span class=glyph title="">&xwedge;</span> </td> <tr id=entity-bkarow><td> <code title="">bkarow;</code> </td> <td> U+0290D </td> <td> <span class=glyph title="">&rbarr;</span> </td> <tr id=entity-blacklozenge><td> <code title="">blacklozenge;</code> </td> <td> U+029EB </td> <td> <span class=glyph title="">&lozf;</span> </td> <tr id=entity-blacksquare><td> <code title="">blacksquare;</code> </td> <td> U+025AA </td> <td> <span class=glyph title="">&blacksquare;</span> </td> <tr id=entity-blacktriangle><td> <code title="">blacktriangle;</code> </td> <td> U+025B4 </td> <td> <span class=glyph title="">&utrif;</span> </td> <tr id=entity-blacktriangledown><td> <code title="">blacktriangledown;</code> </td> <td> U+025BE </td> <td> <span class=glyph title="">&blacktriangledown;</span> </td> <tr id=entity-blacktriangleleft><td> <code title="">blacktriangleleft;</code> </td> <td> U+025C2 </td> <td> <span class=glyph title="">&blacktriangleleft;</span> </td> <tr id=entity-blacktriangleright><td> <code title="">blacktriangleright;</code> </td> <td> U+025B8 </td> <td> <span class=glyph title="">&blacktriangleright;</span> </td> <tr id=entity-blank><td> <code title="">blank;</code> </td> <td> U+02423 </td> <td> <span class=glyph title="">&blank;</span> </td> <tr id=entity-blk12><td> <code title="">blk12;</code> </td> <td> U+02592 </td> <td> <span class=glyph title="">&blk12;</span> </td> <tr id=entity-blk14><td> <code title="">blk14;</code> </td> <td> U+02591 </td> <td> <span class=glyph title="">&blk14;</span> </td> <tr id=entity-blk34><td> <code title="">blk34;</code> </td> <td> U+02593 </td> <td> <span class=glyph title="">&blk34;</span> </td> <tr id=entity-block><td> <code title="">block;</code> </td> <td> U+02588 </td> <td> <span class=glyph title="">&block;</span> </td> <tr id=entity-bne><td> <code title="">bne;</code> </td> <td> U+0003D U+020E5 </td> <td> <span class="glyph compound" title="">=&#x20e5;</span> </td> <tr id=entity-bnequiv><td> <code title="">bnequiv;</code> </td> <td> U+02261 U+020E5 </td> <td> <span class="glyph compound" title="">&equiv;&#x20e5;</span> </td> <tr id=entity-bNot><td> <code title="">bNot;</code> </td> <td> U+02AED </td> <td> <span class=glyph title="">&bNot;</span> </td> <tr id=entity-bnot><td> <code title="">bnot;</code> </td> <td> U+02310 </td> <td> <span class=glyph title="">&bnot;</span> </td> <tr id=entity-Bopf><td> <code title="">Bopf;</code> </td> <td> U+1D539 </td> <td> <span class=glyph title="">&Bopf;</span> </td> <tr id=entity-bopf><td> <code title="">bopf;</code> </td> <td> U+1D553 </td> <td> <span class=glyph title="">&bopf;</span> </td> <tr id=entity-bot><td> <code title="">bot;</code> </td> <td> U+022A5 </td> <td> <span class=glyph title="">&bottom;</span> </td> <tr id=entity-bottom><td> <code title="">bottom;</code> </td> <td> U+022A5 </td> <td> <span class=glyph title="">&bottom;</span> </td> <tr id=entity-bowtie><td> <code title="">bowtie;</code> </td> <td> U+022C8 </td> <td> <span class=glyph title="">&bowtie;</span> </td> <tr id=entity-boxbox><td> <code title="">boxbox;</code> </td> <td> U+029C9 </td> <td> <span class=glyph title="">&boxbox;</span> </td> <tr id=entity-boxDL><td> <code title="">boxDL;</code> </td> <td> U+02557 </td> <td> <span class=glyph title="">&boxDL;</span> </td> <tr id=entity-boxDl><td> <code title="">boxDl;</code> </td> <td> U+02556 </td> <td> <span class=glyph title="">&boxDl;</span> </td> <tr id=entity-boxdL><td> <code title="">boxdL;</code> </td> <td> U+02555 </td> <td> <span class=glyph title="">&boxdL;</span> </td> <tr id=entity-boxdl><td> <code title="">boxdl;</code> </td> <td> U+02510 </td> <td> <span class=glyph title="">&boxdl;</span> </td> <tr id=entity-boxDR><td> <code title="">boxDR;</code> </td> <td> U+02554 </td> <td> <span class=glyph title="">&boxDR;</span> </td> <tr id=entity-boxDr><td> <code title="">boxDr;</code> </td> <td> U+02553 </td> <td> <span class=glyph title="">&boxDr;</span> </td> <tr id=entity-boxdR><td> <code title="">boxdR;</code> </td> <td> U+02552 </td> <td> <span class=glyph title="">&boxdR;</span> </td> <tr id=entity-boxdr><td> <code title="">boxdr;</code> </td> <td> U+0250C </td> <td> <span class=glyph title="">&boxdr;</span> </td> <tr id=entity-boxH><td> <code title="">boxH;</code> </td> <td> U+02550 </td> <td> <span class=glyph title="">&boxH;</span> </td> <tr id=entity-boxh><td> <code title="">boxh;</code> </td> <td> U+02500 </td> <td> <span class=glyph title="">&boxh;</span> </td> <tr id=entity-boxHD><td> <code title="">boxHD;</code> </td> <td> U+02566 </td> <td> <span class=glyph title="">&boxHD;</span> </td> <tr id=entity-boxHd><td> <code title="">boxHd;</code> </td> <td> U+02564 </td> <td> <span class=glyph title="">&boxHd;</span> </td> <tr id=entity-boxhD><td> <code title="">boxhD;</code> </td> <td> U+02565 </td> <td> <span class=glyph title="">&boxhD;</span> </td> <tr id=entity-boxhd><td> <code title="">boxhd;</code> </td> <td> U+0252C </td> <td> <span class=glyph title="">&boxhd;</span> </td> <tr id=entity-boxHU><td> <code title="">boxHU;</code> </td> <td> U+02569 </td> <td> <span class=glyph title="">&boxHU;</span> </td> <tr id=entity-boxHu><td> <code title="">boxHu;</code> </td> <td> U+02567 </td> <td> <span class=glyph title="">&boxHu;</span> </td> <tr id=entity-boxhU><td> <code title="">boxhU;</code> </td> <td> U+02568 </td> <td> <span class=glyph title="">&boxhU;</span> </td> <tr id=entity-boxhu><td> <code title="">boxhu;</code> </td> <td> U+02534 </td> <td> <span class=glyph title="">&boxhu;</span> </td> <tr id=entity-boxminus><td> <code title="">boxminus;</code> </td> <td> U+0229F </td> <td> <span class=glyph title="">&minusb;</span> </td> <tr id=entity-boxplus><td> <code title="">boxplus;</code> </td> <td> U+0229E </td> <td> <span class=glyph title="">&boxplus;</span> </td> <tr id=entity-boxtimes><td> <code title="">boxtimes;</code> </td> <td> U+022A0 </td> <td> <span class=glyph title="">&timesb;</span> </td> <tr id=entity-boxUL><td> <code title="">boxUL;</code> </td> <td> U+0255D </td> <td> <span class=glyph title="">&boxUL;</span> </td> <tr id=entity-boxUl><td> <code title="">boxUl;</code> </td> <td> U+0255C </td> <td> <span class=glyph title="">&boxUl;</span> </td> <tr id=entity-boxuL><td> <code title="">boxuL;</code> </td> <td> U+0255B </td> <td> <span class=glyph title="">&boxuL;</span> </td> <tr id=entity-boxul><td> <code title="">boxul;</code> </td> <td> U+02518 </td> <td> <span class=glyph title="">&boxul;</span> </td> <tr id=entity-boxUR><td> <code title="">boxUR;</code> </td> <td> U+0255A </td> <td> <span class=glyph title="">&boxUR;</span> </td> <tr id=entity-boxUr><td> <code title="">boxUr;</code> </td> <td> U+02559 </td> <td> <span class=glyph title="">&boxUr;</span> </td> <tr id=entity-boxuR><td> <code title="">boxuR;</code> </td> <td> U+02558 </td> <td> <span class=glyph title="">&boxuR;</span> </td> <tr id=entity-boxur><td> <code title="">boxur;</code> </td> <td> U+02514 </td> <td> <span class=glyph title="">&boxur;</span> </td> <tr id=entity-boxV><td> <code title="">boxV;</code> </td> <td> U+02551 </td> <td> <span class=glyph title="">&boxV;</span> </td> <tr id=entity-boxv><td> <code title="">boxv;</code> </td> <td> U+02502 </td> <td> <span class=glyph title="">&boxv;</span> </td> <tr id=entity-boxVH><td> <code title="">boxVH;</code> </td> <td> U+0256C </td> <td> <span class=glyph title="">&boxVH;</span> </td> <tr id=entity-boxVh><td> <code title="">boxVh;</code> </td> <td> U+0256B </td> <td> <span class=glyph title="">&boxVh;</span> </td> <tr id=entity-boxvH><td> <code title="">boxvH;</code> </td> <td> U+0256A </td> <td> <span class=glyph title="">&boxvH;</span> </td> <tr id=entity-boxvh><td> <code title="">boxvh;</code> </td> <td> U+0253C </td> <td> <span class=glyph title="">&boxvh;</span> </td> <tr id=entity-boxVL><td> <code title="">boxVL;</code> </td> <td> U+02563 </td> <td> <span class=glyph title="">&boxVL;</span> </td> <tr id=entity-boxVl><td> <code title="">boxVl;</code> </td> <td> U+02562 </td> <td> <span class=glyph title="">&boxVl;</span> </td> <tr id=entity-boxvL><td> <code title="">boxvL;</code> </td> <td> U+02561 </td> <td> <span class=glyph title="">&boxvL;</span> </td> <tr id=entity-boxvl><td> <code title="">boxvl;</code> </td> <td> U+02524 </td> <td> <span class=glyph title="">&boxvl;</span> </td> <tr id=entity-boxVR><td> <code title="">boxVR;</code> </td> <td> U+02560 </td> <td> <span class=glyph title="">&boxVR;</span> </td> <tr id=entity-boxVr><td> <code title="">boxVr;</code> </td> <td> U+0255F </td> <td> <span class=glyph title="">&boxVr;</span> </td> <tr id=entity-boxvR><td> <code title="">boxvR;</code> </td> <td> U+0255E </td> <td> <span class=glyph title="">&boxvR;</span> </td> <tr id=entity-boxvr><td> <code title="">boxvr;</code> </td> <td> U+0251C </td> <td> <span class=glyph title="">&boxvr;</span> </td> <tr id=entity-bprime><td> <code title="">bprime;</code> </td> <td> U+02035 </td> <td> <span class=glyph title="">&bprime;</span> </td> <tr id=entity-Breve><td> <code title="">Breve;</code> </td> <td> U+002D8 </td> <td> <span class=glyph title="">&breve;</span> </td> <tr id=entity-breve><td> <code title="">breve;</code> </td> <td> U+002D8 </td> <td> <span class=glyph title="">&breve;</span> </td> <tr id=entity-brvbar><td> <code title="">brvbar;</code> </td> <td> U+000A6 </td> <td> <span class=glyph title="">&brvbar;</span> </td> <tr id=entity-brvbar-legacy class=impl><td> <code title="">brvbar</code> </td> <td> U+000A6 </td> <td> <span title="">&brvbar;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Bscr><td> <code title="">Bscr;</code> </td> <td> U+0212C </td> <td> <span class=glyph title="">&bernou;</span> </td> <tr id=entity-bscr><td> <code title="">bscr;</code> </td> <td> U+1D4B7 </td> <td> <span class=glyph title="">&bscr;</span> </td> <tr id=entity-bsemi><td> <code title="">bsemi;</code> </td> <td> U+0204F </td> <td> <span class=glyph title="">&bsemi;</span> </td> <tr id=entity-bsim><td> <code title="">bsim;</code> </td> <td> U+0223D </td> <td> <span class=glyph title="">&backsim;</span> </td> <tr id=entity-bsime><td> <code title="">bsime;</code> </td> <td> U+022CD </td> <td> <span class=glyph title="">&backsimeq;</span> </td> <tr id=entity-bsol><td> <code title="">bsol;</code> </td> <td> U+0005C </td> <td> <span class=glyph title="">\</span> </td> <tr id=entity-bsolb><td> <code title="">bsolb;</code> </td> <td> U+029C5 </td> <td> <span class=glyph title="">&bsolb;</span> </td> <tr id=entity-bsolhsub><td> <code title="">bsolhsub;</code> </td> <td> U+027C8 </td> <td> <span class=glyph title="">&bsolhsub;</span> </td> <tr id=entity-bull><td> <code title="">bull;</code> </td> <td> U+02022 </td> <td> <span class=glyph title="">&bullet;</span> </td> <tr id=entity-bullet><td> <code title="">bullet;</code> </td> <td> U+02022 </td> <td> <span class=glyph title="">&bullet;</span> </td> <tr id=entity-bump><td> <code title="">bump;</code> </td> <td> U+0224E </td> <td> <span class=glyph title="">&bump;</span> </td> <tr id=entity-bumpE><td> <code title="">bumpE;</code> </td> <td> U+02AAE </td> <td> <span class=glyph title="">&bumpE;</span> </td> <tr id=entity-bumpe><td> <code title="">bumpe;</code> </td> <td> U+0224F </td> <td> <span class=glyph title="">&bumpeq;</span> </td> <tr id=entity-Bumpeq><td> <code title="">Bumpeq;</code> </td> <td> U+0224E </td> <td> <span class=glyph title="">&bump;</span> </td> <tr id=entity-bumpeq><td> <code title="">bumpeq;</code> </td> <td> U+0224F </td> <td> <span class=glyph title="">&bumpeq;</span> </td> <tr id=entity-Cacute><td> <code title="">Cacute;</code> </td> <td> U+00106 </td> <td> <span class=glyph title="">&Cacute;</span> </td> <tr id=entity-cacute><td> <code title="">cacute;</code> </td> <td> U+00107 </td> <td> <span class=glyph title="">&cacute;</span> </td> <tr id=entity-Cap><td> <code title="">Cap;</code> </td> <td> U+022D2 </td> <td> <span class=glyph title="">&Cap;</span> </td> <tr id=entity-cap><td> <code title="">cap;</code> </td> <td> U+02229 </td> <td> <span class=glyph title="">&cap;</span> </td> <tr id=entity-capand><td> <code title="">capand;</code> </td> <td> U+02A44 </td> <td> <span class=glyph title="">&capand;</span> </td> <tr id=entity-capbrcup><td> <code title="">capbrcup;</code> </td> <td> U+02A49 </td> <td> <span class=glyph title="">&capbrcup;</span> </td> <tr id=entity-capcap><td> <code title="">capcap;</code> </td> <td> U+02A4B </td> <td> <span class=glyph title="">&capcap;</span> </td> <tr id=entity-capcup><td> <code title="">capcup;</code> </td> <td> U+02A47 </td> <td> <span class=glyph title="">&capcup;</span> </td> <tr id=entity-capdot><td> <code title="">capdot;</code> </td> <td> U+02A40 </td> <td> <span class=glyph title="">&capdot;</span> </td> <tr id=entity-CapitalDifferentialD><td> <code title="">CapitalDifferentialD;</code> </td> <td> U+02145 </td> <td> <span class=glyph title="">&DD;</span> </td> <tr id=entity-caps><td> <code title="">caps;</code> </td> <td> U+02229 U+0FE00 </td> <td> <span class="glyph compound" title="">&cap;&#xfe00;</span> </td> <tr id=entity-caret><td> <code title="">caret;</code> </td> <td> U+02041 </td> <td> <span class=glyph title="">&caret;</span> </td> <tr id=entity-caron><td> <code title="">caron;</code> </td> <td> U+002C7 </td> <td> <span class=glyph title="">&caron;</span> </td> <tr id=entity-Cayleys><td> <code title="">Cayleys;</code> </td> <td> U+0212D </td> <td> <span class=glyph title="">&Cayleys;</span> </td> <tr id=entity-ccaps><td> <code title="">ccaps;</code> </td> <td> U+02A4D </td> <td> <span class=glyph title="">&ccaps;</span> </td> <tr id=entity-Ccaron><td> <code title="">Ccaron;</code> </td> <td> U+0010C </td> <td> <span class=glyph title="">&Ccaron;</span> </td> <tr id=entity-ccaron><td> <code title="">ccaron;</code> </td> <td> U+0010D </td> <td> <span class=glyph title="">&ccaron;</span> </td> <tr id=entity-Ccedil><td> <code title="">Ccedil;</code> </td> <td> U+000C7 </td> <td> <span class=glyph title="">&Ccedil;</span> </td> <tr id=entity-Ccedil-legacy class=impl><td> <code title="">Ccedil</code> </td> <td> U+000C7 </td> <td> <span title="">&Ccedil;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ccedil><td> <code title="">ccedil;</code> </td> <td> U+000E7 </td> <td> <span class=glyph title="">&ccedil;</span> </td> <tr id=entity-ccedil-legacy class=impl><td> <code title="">ccedil</code> </td> <td> U+000E7 </td> <td> <span title="">&ccedil;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Ccirc><td> <code title="">Ccirc;</code> </td> <td> U+00108 </td> <td> <span class=glyph title="">&Ccirc;</span> </td> <tr id=entity-ccirc><td> <code title="">ccirc;</code> </td> <td> U+00109 </td> <td> <span class=glyph title="">&ccirc;</span> </td> <tr id=entity-Cconint><td> <code title="">Cconint;</code> </td> <td> U+02230 </td> <td> <span class=glyph title="">&Cconint;</span> </td> <tr id=entity-ccups><td> <code title="">ccups;</code> </td> <td> U+02A4C </td> <td> <span class=glyph title="">&ccups;</span> </td> <tr id=entity-ccupssm><td> <code title="">ccupssm;</code> </td> <td> U+02A50 </td> <td> <span class=glyph title="">&ccupssm;</span> </td> <tr id=entity-Cdot><td> <code title="">Cdot;</code> </td> <td> U+0010A </td> <td> <span class=glyph title="">&Cdot;</span> </td> <tr id=entity-cdot><td> <code title="">cdot;</code> </td> <td> U+0010B </td> <td> <span class=glyph title="">&cdot;</span> </td> <tr id=entity-cedil><td> <code title="">cedil;</code> </td> <td> U+000B8 </td> <td> <span class=glyph title="">&cedil;</span> </td> <tr id=entity-cedil-legacy class=impl><td> <code title="">cedil</code> </td> <td> U+000B8 </td> <td> <span title="">&cedil;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Cedilla><td> <code title="">Cedilla;</code> </td> <td> U+000B8 </td> <td> <span class=glyph title="">&cedil;</span> </td> <tr id=entity-cemptyv><td> <code title="">cemptyv;</code> </td> <td> U+029B2 </td> <td> <span class=glyph title="">&cemptyv;</span> </td> <tr id=entity-cent><td> <code title="">cent;</code> </td> <td> U+000A2 </td> <td> <span class=glyph title="">&cent;</span> </td> <tr id=entity-cent-legacy class=impl><td> <code title="">cent</code> </td> <td> U+000A2 </td> <td> <span title="">&cent;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-CenterDot><td> <code title="">CenterDot;</code> </td> <td> U+000B7 </td> <td> <span class=glyph title="">&middot;</span> </td> <tr id=entity-centerdot><td> <code title="">centerdot;</code> </td> <td> U+000B7 </td> <td> <span class=glyph title="">&middot;</span> </td> <tr id=entity-Cfr><td> <code title="">Cfr;</code> </td> <td> U+0212D </td> <td> <span class=glyph title="">&Cayleys;</span> </td> <tr id=entity-cfr><td> <code title="">cfr;</code> </td> <td> U+1D520 </td> <td> <span class=glyph title="">&cfr;</span> </td> <tr id=entity-CHcy><td> <code title="">CHcy;</code> </td> <td> U+00427 </td> <td> <span class=glyph title="">&CHcy;</span> </td> <tr id=entity-chcy><td> <code title="">chcy;</code> </td> <td> U+00447 </td> <td> <span class=glyph title="">&chcy;</span> </td> <tr id=entity-check><td> <code title="">check;</code> </td> <td> U+02713 </td> <td> <span class=glyph title="">&check;</span> </td> <tr id=entity-checkmark><td> <code title="">checkmark;</code> </td> <td> U+02713 </td> <td> <span class=glyph title="">&check;</span> </td> <tr id=entity-Chi><td> <code title="">Chi;</code> </td> <td> U+003A7 </td> <td> <span class=glyph title="">&Chi;</span> </td> <tr id=entity-chi><td> <code title="">chi;</code> </td> <td> U+003C7 </td> <td> <span class=glyph title="">&chi;</span> </td> <tr id=entity-cir><td> <code title="">cir;</code> </td> <td> U+025CB </td> <td> <span class=glyph title="">&cir;</span> </td> <tr id=entity-circ><td> <code title="">circ;</code> </td> <td> U+002C6 </td> <td> <span class=glyph title="">&circ;</span> </td> <tr id=entity-circeq><td> <code title="">circeq;</code> </td> <td> U+02257 </td> <td> <span class=glyph title="">&cire;</span> </td> <tr id=entity-circlearrowleft><td> <code title="">circlearrowleft;</code> </td> <td> U+021BA </td> <td> <span class=glyph title="">&olarr;</span> </td> <tr id=entity-circlearrowright><td> <code title="">circlearrowright;</code> </td> <td> U+021BB </td> <td> <span class=glyph title="">&orarr;</span> </td> <tr id=entity-circledast><td> <code title="">circledast;</code> </td> <td> U+0229B </td> <td> <span class=glyph title="">&oast;</span> </td> <tr id=entity-circledcirc><td> <code title="">circledcirc;</code> </td> <td> U+0229A </td> <td> <span class=glyph title="">&ocir;</span> </td> <tr id=entity-circleddash><td> <code title="">circleddash;</code> </td> <td> U+0229D </td> <td> <span class=glyph title="">&circleddash;</span> </td> <tr id=entity-CircleDot><td> <code title="">CircleDot;</code> </td> <td> U+02299 </td> <td> <span class=glyph title="">&odot;</span> </td> <tr id=entity-circledR><td> <code title="">circledR;</code> </td> <td> U+000AE </td> <td> <span class=glyph title="">&reg;</span> </td> <tr id=entity-circledS><td> <code title="">circledS;</code> </td> <td> U+024C8 </td> <td> <span class=glyph title="">&oS;</span> </td> <tr id=entity-CircleMinus><td> <code title="">CircleMinus;</code> </td> <td> U+02296 </td> <td> <span class=glyph title="">&ominus;</span> </td> <tr id=entity-CirclePlus><td> <code title="">CirclePlus;</code> </td> <td> U+02295 </td> <td> <span class=glyph title="">&oplus;</span> </td> <tr id=entity-CircleTimes><td> <code title="">CircleTimes;</code> </td> <td> U+02297 </td> <td> <span class=glyph title="">&otimes;</span> </td> <tr id=entity-cirE><td> <code title="">cirE;</code> </td> <td> U+029C3 </td> <td> <span class=glyph title="">&cirE;</span> </td> <tr id=entity-cire><td> <code title="">cire;</code> </td> <td> U+02257 </td> <td> <span class=glyph title="">&cire;</span> </td> <tr id=entity-cirfnint><td> <code title="">cirfnint;</code> </td> <td> U+02A10 </td> <td> <span class=glyph title="">&cirfnint;</span> </td> <tr id=entity-cirmid><td> <code title="">cirmid;</code> </td> <td> U+02AEF </td> <td> <span class=glyph title="">&cirmid;</span> </td> <tr id=entity-cirscir><td> <code title="">cirscir;</code> </td> <td> U+029C2 </td> <td> <span class=glyph title="">&cirscir;</span> </td> <tr id=entity-ClockwiseContourIntegral><td> <code title="">ClockwiseContourIntegral;</code> </td> <td> U+02232 </td> <td> <span class=glyph title="">&cwconint;</span> </td> <tr id=entity-CloseCurlyDoubleQuote><td> <code title="">CloseCurlyDoubleQuote;</code> </td> <td> U+0201D </td> <td> <span class=glyph title="">&rdquo;</span> </td> <tr id=entity-CloseCurlyQuote><td> <code title="">CloseCurlyQuote;</code> </td> <td> U+02019 </td> <td> <span class=glyph title="">&rsquor;</span> </td> <tr id=entity-clubs><td> <code title="">clubs;</code> </td> <td> U+02663 </td> <td> <span class=glyph title="">&clubs;</span> </td> <tr id=entity-clubsuit><td> <code title="">clubsuit;</code> </td> <td> U+02663 </td> <td> <span class=glyph title="">&clubs;</span> </td> <tr id=entity-Colon><td> <code title="">Colon;</code> </td> <td> U+02237 </td> <td> <span class=glyph title="">&Colon;</span> </td> <tr id=entity-colon><td> <code title="">colon;</code> </td> <td> U+0003A </td> <td> <span class=glyph title="">:</span> </td> <tr id=entity-Colone><td> <code title="">Colone;</code> </td> <td> U+02A74 </td> <td> <span class=glyph title="">&Colone;</span> </td> <tr id=entity-colone><td> <code title="">colone;</code> </td> <td> U+02254 </td> <td> <span class=glyph title="">&coloneq;</span> </td> <tr id=entity-coloneq><td> <code title="">coloneq;</code> </td> <td> U+02254 </td> <td> <span class=glyph title="">&coloneq;</span> </td> <tr id=entity-comma><td> <code title="">comma;</code> </td> <td> U+0002C </td> <td> <span class=glyph title="">,</span> </td> <tr id=entity-commat><td> <code title="">commat;</code> </td> <td> U+00040 </td> <td> <span class=glyph title="">@</span> </td> <tr id=entity-comp><td> <code title="">comp;</code> </td> <td> U+02201 </td> <td> <span class=glyph title="">&complement;</span> </td> <tr id=entity-compfn><td> <code title="">compfn;</code> </td> <td> U+02218 </td> <td> <span class=glyph title="">&compfn;</span> </td> <tr id=entity-complement><td> <code title="">complement;</code> </td> <td> U+02201 </td> <td> <span class=glyph title="">&complement;</span> </td> <tr id=entity-complexes><td> <code title="">complexes;</code> </td> <td> U+02102 </td> <td> <span class=glyph title="">&complexes;</span> </td> <tr id=entity-cong><td> <code title="">cong;</code> </td> <td> U+02245 </td> <td> <span class=glyph title="">&cong;</span> </td> <tr id=entity-congdot><td> <code title="">congdot;</code> </td> <td> U+02A6D </td> <td> <span class=glyph title="">&congdot;</span> </td> <tr id=entity-Congruent><td> <code title="">Congruent;</code> </td> <td> U+02261 </td> <td> <span class=glyph title="">&equiv;</span> </td> <tr id=entity-Conint><td> <code title="">Conint;</code> </td> <td> U+0222F </td> <td> <span class=glyph title="">&Conint;</span> </td> <tr id=entity-conint><td> <code title="">conint;</code> </td> <td> U+0222E </td> <td> <span class=glyph title="">&conint;</span> </td> <tr id=entity-ContourIntegral><td> <code title="">ContourIntegral;</code> </td> <td> U+0222E </td> <td> <span class=glyph title="">&conint;</span> </td> <tr id=entity-Copf><td> <code title="">Copf;</code> </td> <td> U+02102 </td> <td> <span class=glyph title="">&complexes;</span> </td> <tr id=entity-copf><td> <code title="">copf;</code> </td> <td> U+1D554 </td> <td> <span class=glyph title="">&copf;</span> </td> <tr id=entity-coprod><td> <code title="">coprod;</code> </td> <td> U+02210 </td> <td> <span class=glyph title="">&coprod;</span> </td> <tr id=entity-Coproduct><td> <code title="">Coproduct;</code> </td> <td> U+02210 </td> <td> <span class=glyph title="">&coprod;</span> </td> <tr id=entity-COPY><td> <code title="">COPY;</code> </td> <td> U+000A9 </td> <td> <span class=glyph title="">&copy;</span> </td> <tr id=entity-COPY-legacy class=impl><td> <code title="">COPY</code> </td> <td> U+000A9 </td> <td> <span title="">&copy;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-copy><td> <code title="">copy;</code> </td> <td> U+000A9 </td> <td> <span class=glyph title="">&copy;</span> </td> <tr id=entity-copy-legacy class=impl><td> <code title="">copy</code> </td> <td> U+000A9 </td> <td> <span title="">&copy;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-copysr><td> <code title="">copysr;</code> </td> <td> U+02117 </td> <td> <span class=glyph title="">&copysr;</span> </td> <tr id=entity-CounterClockwiseContourIntegral><td> <code title="">CounterClockwiseContourIntegral;</code> </td> <td> U+02233 </td> <td> <span class=glyph title="">&awconint;</span> </td> <tr id=entity-crarr><td> <code title="">crarr;</code> </td> <td> U+021B5 </td> <td> <span class=glyph title="">&crarr;</span> </td> <tr id=entity-Cross><td> <code title="">Cross;</code> </td> <td> U+02A2F </td> <td> <span class=glyph title="">&Cross;</span> </td> <tr id=entity-cross><td> <code title="">cross;</code> </td> <td> U+02717 </td> <td> <span class=glyph title="">&cross;</span> </td> <tr id=entity-Cscr><td> <code title="">Cscr;</code> </td> <td> U+1D49E </td> <td> <span class=glyph title="">&Cscr;</span> </td> <tr id=entity-cscr><td> <code title="">cscr;</code> </td> <td> U+1D4B8 </td> <td> <span class=glyph title="">&cscr;</span> </td> <tr id=entity-csub><td> <code title="">csub;</code> </td> <td> U+02ACF </td> <td> <span class=glyph title="">&csub;</span> </td> <tr id=entity-csube><td> <code title="">csube;</code> </td> <td> U+02AD1 </td> <td> <span class=glyph title="">&csube;</span> </td> <tr id=entity-csup><td> <code title="">csup;</code> </td> <td> U+02AD0 </td> <td> <span class=glyph title="">&csup;</span> </td> <tr id=entity-csupe><td> <code title="">csupe;</code> </td> <td> U+02AD2 </td> <td> <span class=glyph title="">&csupe;</span> </td> <tr id=entity-ctdot><td> <code title="">ctdot;</code> </td> <td> U+022EF </td> <td> <span class=glyph title="">&ctdot;</span> </td> <tr id=entity-cudarrl><td> <code title="">cudarrl;</code> </td> <td> U+02938 </td> <td> <span class=glyph title="">&cudarrl;</span> </td> <tr id=entity-cudarrr><td> <code title="">cudarrr;</code> </td> <td> U+02935 </td> <td> <span class=glyph title="">&cudarrr;</span> </td> <tr id=entity-cuepr><td> <code title="">cuepr;</code> </td> <td> U+022DE </td> <td> <span class=glyph title="">&cuepr;</span> </td> <tr id=entity-cuesc><td> <code title="">cuesc;</code> </td> <td> U+022DF </td> <td> <span class=glyph title="">&curlyeqsucc;</span> </td> <tr id=entity-cularr><td> <code title="">cularr;</code> </td> <td> U+021B6 </td> <td> <span class=glyph title="">&curvearrowleft;</span> </td> <tr id=entity-cularrp><td> <code title="">cularrp;</code> </td> <td> U+0293D </td> <td> <span class=glyph title="">&cularrp;</span> </td> <tr id=entity-Cup><td> <code title="">Cup;</code> </td> <td> U+022D3 </td> <td> <span class=glyph title="">&Cup;</span> </td> <tr id=entity-cup><td> <code title="">cup;</code> </td> <td> U+0222A </td> <td> <span class=glyph title="">&cup;</span> </td> <tr id=entity-cupbrcap><td> <code title="">cupbrcap;</code> </td> <td> U+02A48 </td> <td> <span class=glyph title="">&cupbrcap;</span> </td> <tr id=entity-CupCap><td> <code title="">CupCap;</code> </td> <td> U+0224D </td> <td> <span class=glyph title="">&asympeq;</span> </td> <tr id=entity-cupcap><td> <code title="">cupcap;</code> </td> <td> U+02A46 </td> <td> <span class=glyph title="">&cupcap;</span> </td> <tr id=entity-cupcup><td> <code title="">cupcup;</code> </td> <td> U+02A4A </td> <td> <span class=glyph title="">&cupcup;</span> </td> <tr id=entity-cupdot><td> <code title="">cupdot;</code> </td> <td> U+0228D </td> <td> <span class=glyph title="">&cupdot;</span> </td> <tr id=entity-cupor><td> <code title="">cupor;</code> </td> <td> U+02A45 </td> <td> <span class=glyph title="">&cupor;</span> </td> <tr id=entity-cups><td> <code title="">cups;</code> </td> <td> U+0222A U+0FE00 </td> <td> <span class="glyph compound" title="">&cup;&#xfe00;</span> </td> <tr id=entity-curarr><td> <code title="">curarr;</code> </td> <td> U+021B7 </td> <td> <span class=glyph title="">&curarr;</span> </td> <tr id=entity-curarrm><td> <code title="">curarrm;</code> </td> <td> U+0293C </td> <td> <span class=glyph title="">&curarrm;</span> </td> <tr id=entity-curlyeqprec><td> <code title="">curlyeqprec;</code> </td> <td> U+022DE </td> <td> <span class=glyph title="">&cuepr;</span> </td> <tr id=entity-curlyeqsucc><td> <code title="">curlyeqsucc;</code> </td> <td> U+022DF </td> <td> <span class=glyph title="">&curlyeqsucc;</span> </td> <tr id=entity-curlyvee><td> <code title="">curlyvee;</code> </td> <td> U+022CE </td> <td> <span class=glyph title="">&cuvee;</span> </td> <tr id=entity-curlywedge><td> <code title="">curlywedge;</code> </td> <td> U+022CF </td> <td> <span class=glyph title="">&curlywedge;</span> </td> <tr id=entity-curren><td> <code title="">curren;</code> </td> <td> U+000A4 </td> <td> <span class=glyph title="">&curren;</span> </td> <tr id=entity-curren-legacy class=impl><td> <code title="">curren</code> </td> <td> U+000A4 </td> <td> <span title="">&curren;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-curvearrowleft><td> <code title="">curvearrowleft;</code> </td> <td> U+021B6 </td> <td> <span class=glyph title="">&curvearrowleft;</span> </td> <tr id=entity-curvearrowright><td> <code title="">curvearrowright;</code> </td> <td> U+021B7 </td> <td> <span class=glyph title="">&curarr;</span> </td> <tr id=entity-cuvee><td> <code title="">cuvee;</code> </td> <td> U+022CE </td> <td> <span class=glyph title="">&cuvee;</span> </td> <tr id=entity-cuwed><td> <code title="">cuwed;</code> </td> <td> U+022CF </td> <td> <span class=glyph title="">&curlywedge;</span> </td> <tr id=entity-cwconint><td> <code title="">cwconint;</code> </td> <td> U+02232 </td> <td> <span class=glyph title="">&cwconint;</span> </td> <tr id=entity-cwint><td> <code title="">cwint;</code> </td> <td> U+02231 </td> <td> <span class=glyph title="">&cwint;</span> </td> <tr id=entity-cylcty><td> <code title="">cylcty;</code> </td> <td> U+0232D </td> <td> <span class=glyph title="">&cylcty;</span> </td> <tr id=entity-Dagger><td> <code title="">Dagger;</code> </td> <td> U+02021 </td> <td> <span class=glyph title="">&ddagger;</span> </td> <tr id=entity-dagger><td> <code title="">dagger;</code> </td> <td> U+02020 </td> <td> <span class=glyph title="">&dagger;</span> </td> <tr id=entity-daleth><td> <code title="">daleth;</code> </td> <td> U+02138 </td> <td> <span class=glyph title="">&daleth;</span> </td> <tr id=entity-Darr><td> <code title="">Darr;</code> </td> <td> U+021A1 </td> <td> <span class=glyph title="">&Darr;</span> </td> <tr id=entity-dArr><td> <code title="">dArr;</code> </td> <td> U+021D3 </td> <td> <span class=glyph title="">&DoubleDownArrow;</span> </td> <tr id=entity-darr><td> <code title="">darr;</code> </td> <td> U+02193 </td> <td> <span class=glyph title="">&downarrow;</span> </td> <tr id=entity-dash><td> <code title="">dash;</code> </td> <td> U+02010 </td> <td> <span class=glyph title="">&dash;</span> </td> <tr id=entity-Dashv><td> <code title="">Dashv;</code> </td> <td> U+02AE4 </td> <td> <span class=glyph title="">&DoubleLeftTee;</span> </td> <tr id=entity-dashv><td> <code title="">dashv;</code> </td> <td> U+022A3 </td> <td> <span class=glyph title="">&dashv;</span> </td> <tr id=entity-dbkarow><td> <code title="">dbkarow;</code> </td> <td> U+0290F </td> <td> <span class=glyph title="">&dbkarow;</span> </td> <tr id=entity-dblac><td> <code title="">dblac;</code> </td> <td> U+002DD </td> <td> <span class=glyph title="">&dblac;</span> </td> <tr id=entity-Dcaron><td> <code title="">Dcaron;</code> </td> <td> U+0010E </td> <td> <span class=glyph title="">&Dcaron;</span> </td> <tr id=entity-dcaron><td> <code title="">dcaron;</code> </td> <td> U+0010F </td> <td> <span class=glyph title="">&dcaron;</span> </td> <tr id=entity-Dcy><td> <code title="">Dcy;</code> </td> <td> U+00414 </td> <td> <span class=glyph title="">&Dcy;</span> </td> <tr id=entity-dcy><td> <code title="">dcy;</code> </td> <td> U+00434 </td> <td> <span class=glyph title="">&dcy;</span> </td> <tr id=entity-DD><td> <code title="">DD;</code> </td> <td> U+02145 </td> <td> <span class=glyph title="">&DD;</span> </td> <tr id=entity-dd><td> <code title="">dd;</code> </td> <td> U+02146 </td> <td> <span class=glyph title="">&dd;</span> </td> <tr id=entity-ddagger><td> <code title="">ddagger;</code> </td> <td> U+02021 </td> <td> <span class=glyph title="">&ddagger;</span> </td> <tr id=entity-ddarr><td> <code title="">ddarr;</code> </td> <td> U+021CA </td> <td> <span class=glyph title="">&ddarr;</span> </td> <tr id=entity-DDotrahd><td> <code title="">DDotrahd;</code> </td> <td> U+02911 </td> <td> <span class=glyph title="">&DDotrahd;</span> </td> <tr id=entity-ddotseq><td> <code title="">ddotseq;</code> </td> <td> U+02A77 </td> <td> <span class=glyph title="">&ddotseq;</span> </td> <tr id=entity-deg><td> <code title="">deg;</code> </td> <td> U+000B0 </td> <td> <span class=glyph title="">&deg;</span> </td> <tr id=entity-deg-legacy class=impl><td> <code title="">deg</code> </td> <td> U+000B0 </td> <td> <span title="">&deg;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Del><td> <code title="">Del;</code> </td> <td> U+02207 </td> <td> <span class=glyph title="">&nabla;</span> </td> <tr id=entity-Delta><td> <code title="">Delta;</code> </td> <td> U+00394 </td> <td> <span class=glyph title="">&Delta;</span> </td> <tr id=entity-delta><td> <code title="">delta;</code> </td> <td> U+003B4 </td> <td> <span class=glyph title="">&delta;</span> </td> <tr id=entity-demptyv><td> <code title="">demptyv;</code> </td> <td> U+029B1 </td> <td> <span class=glyph title="">&demptyv;</span> </td> <tr id=entity-dfisht><td> <code title="">dfisht;</code> </td> <td> U+0297F </td> <td> <span class=glyph title="">&dfisht;</span> </td> <tr id=entity-Dfr><td> <code title="">Dfr;</code> </td> <td> U+1D507 </td> <td> <span class=glyph title="">&Dfr;</span> </td> <tr id=entity-dfr><td> <code title="">dfr;</code> </td> <td> U+1D521 </td> <td> <span class=glyph title="">&dfr;</span> </td> <tr id=entity-dHar><td> <code title="">dHar;</code> </td> <td> U+02965 </td> <td> <span class=glyph title="">&dHar;</span> </td> <tr id=entity-dharl><td> <code title="">dharl;</code> </td> <td> U+021C3 </td> <td> <span class=glyph title="">&downharpoonleft;</span> </td> <tr id=entity-dharr><td> <code title="">dharr;</code> </td> <td> U+021C2 </td> <td> <span class=glyph title="">&dharr;</span> </td> <tr id=entity-DiacriticalAcute><td> <code title="">DiacriticalAcute;</code> </td> <td> U+000B4 </td> <td> <span class=glyph title="">&acute;</span> </td> <tr id=entity-DiacriticalDot><td> <code title="">DiacriticalDot;</code> </td> <td> U+002D9 </td> <td> <span class=glyph title="">&dot;</span> </td> <tr id=entity-DiacriticalDoubleAcute><td> <code title="">DiacriticalDoubleAcute;</code> </td> <td> U+002DD </td> <td> <span class=glyph title="">&dblac;</span> </td> <tr id=entity-DiacriticalGrave><td> <code title="">DiacriticalGrave;</code> </td> <td> U+00060 </td> <td> <span class=glyph title="">`</span> </td> <tr id=entity-DiacriticalTilde><td> <code title="">DiacriticalTilde;</code> </td> <td> U+002DC </td> <td> <span class=glyph title="">&tilde;</span> </td> <tr id=entity-diam><td> <code title="">diam;</code> </td> <td> U+022C4 </td> <td> <span class=glyph title="">&diamond;</span> </td> <tr id=entity-Diamond><td> <code title="">Diamond;</code> </td> <td> U+022C4 </td> <td> <span class=glyph title="">&diamond;</span> </td> <tr id=entity-diamond><td> <code title="">diamond;</code> </td> <td> U+022C4 </td> <td> <span class=glyph title="">&diamond;</span> </td> <tr id=entity-diamondsuit><td> <code title="">diamondsuit;</code> </td> <td> U+02666 </td> <td> <span class=glyph title="">&diams;</span> </td> <tr id=entity-diams><td> <code title="">diams;</code> </td> <td> U+02666 </td> <td> <span class=glyph title="">&diams;</span> </td> <tr id=entity-die><td> <code title="">die;</code> </td> <td> U+000A8 </td> <td> <span class=glyph title="">&die;</span> </td> <tr id=entity-DifferentialD><td> <code title="">DifferentialD;</code> </td> <td> U+02146 </td> <td> <span class=glyph title="">&dd;</span> </td> <tr id=entity-digamma><td> <code title="">digamma;</code> </td> <td> U+003DD </td> <td> <span class=glyph title="">&gammad;</span> </td> <tr id=entity-disin><td> <code title="">disin;</code> </td> <td> U+022F2 </td> <td> <span class=glyph title="">&disin;</span> </td> <tr id=entity-div><td> <code title="">div;</code> </td> <td> U+000F7 </td> <td> <span class=glyph title="">&divide;</span> </td> <tr id=entity-divide><td> <code title="">divide;</code> </td> <td> U+000F7 </td> <td> <span class=glyph title="">&divide;</span> </td> <tr id=entity-divide-legacy class=impl><td> <code title="">divide</code> </td> <td> U+000F7 </td> <td> <span title="">&divide;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-divideontimes><td> <code title="">divideontimes;</code> </td> <td> U+022C7 </td> <td> <span class=glyph title="">&divonx;</span> </td> <tr id=entity-divonx><td> <code title="">divonx;</code> </td> <td> U+022C7 </td> <td> <span class=glyph title="">&divonx;</span> </td> <tr id=entity-DJcy><td> <code title="">DJcy;</code> </td> <td> U+00402 </td> <td> <span class=glyph title="">&DJcy;</span> </td> <tr id=entity-djcy><td> <code title="">djcy;</code> </td> <td> U+00452 </td> <td> <span class=glyph title="">&djcy;</span> </td> <tr id=entity-dlcorn><td> <code title="">dlcorn;</code> </td> <td> U+0231E </td> <td> <span class=glyph title="">&dlcorn;</span> </td> <tr id=entity-dlcrop><td> <code title="">dlcrop;</code> </td> <td> U+0230D </td> <td> <span class=glyph title="">&dlcrop;</span> </td> <tr id=entity-dollar><td> <code title="">dollar;</code> </td> <td> U+00024 </td> <td> <span class=glyph title="">$</span> </td> <tr id=entity-Dopf><td> <code title="">Dopf;</code> </td> <td> U+1D53B </td> <td> <span class=glyph title="">&Dopf;</span> </td> <tr id=entity-dopf><td> <code title="">dopf;</code> </td> <td> U+1D555 </td> <td> <span class=glyph title="">&dopf;</span> </td> <tr id=entity-Dot><td> <code title="">Dot;</code> </td> <td> U+000A8 </td> <td> <span class=glyph title="">&die;</span> </td> <tr id=entity-dot><td> <code title="">dot;</code> </td> <td> U+002D9 </td> <td> <span class=glyph title="">&dot;</span> </td> <tr id=entity-DotDot><td> <code title="">DotDot;</code> </td> <td> U+020DC </td> <td> <span class="glyph composition" title="">&#x25cc;&DotDot;</span> </td> <tr id=entity-doteq><td> <code title="">doteq;</code> </td> <td> U+02250 </td> <td> <span class=glyph title="">&esdot;</span> </td> <tr id=entity-doteqdot><td> <code title="">doteqdot;</code> </td> <td> U+02251 </td> <td> <span class=glyph title="">&doteqdot;</span> </td> <tr id=entity-DotEqual><td> <code title="">DotEqual;</code> </td> <td> U+02250 </td> <td> <span class=glyph title="">&esdot;</span> </td> <tr id=entity-dotminus><td> <code title="">dotminus;</code> </td> <td> U+02238 </td> <td> <span class=glyph title="">&dotminus;</span> </td> <tr id=entity-dotplus><td> <code title="">dotplus;</code> </td> <td> U+02214 </td> <td> <span class=glyph title="">&dotplus;</span> </td> <tr id=entity-dotsquare><td> <code title="">dotsquare;</code> </td> <td> U+022A1 </td> <td> <span class=glyph title="">&dotsquare;</span> </td> <tr id=entity-doublebarwedge><td> <code title="">doublebarwedge;</code> </td> <td> U+02306 </td> <td> <span class=glyph title="">&doublebarwedge;</span> </td> <tr id=entity-DoubleContourIntegral><td> <code title="">DoubleContourIntegral;</code> </td> <td> U+0222F </td> <td> <span class=glyph title="">&Conint;</span> </td> <tr id=entity-DoubleDot><td> <code title="">DoubleDot;</code> </td> <td> U+000A8 </td> <td> <span class=glyph title="">&die;</span> </td> <tr id=entity-DoubleDownArrow><td> <code title="">DoubleDownArrow;</code> </td> <td> U+021D3 </td> <td> <span class=glyph title="">&DoubleDownArrow;</span> </td> <tr id=entity-DoubleLeftArrow><td> <code title="">DoubleLeftArrow;</code> </td> <td> U+021D0 </td> <td> <span class=glyph title="">&lArr;</span> </td> <tr id=entity-DoubleLeftRightArrow><td> <code title="">DoubleLeftRightArrow;</code> </td> <td> U+021D4 </td> <td> <span class=glyph title="">&iff;</span> </td> <tr id=entity-DoubleLeftTee><td> <code title="">DoubleLeftTee;</code> </td> <td> U+02AE4 </td> <td> <span class=glyph title="">&DoubleLeftTee;</span> </td> <tr id=entity-DoubleLongLeftArrow><td> <code title="">DoubleLongLeftArrow;</code> </td> <td> U+027F8 </td> <td> <span class=glyph title="">&Longleftarrow;</span> </td> <tr id=entity-DoubleLongLeftRightArrow><td> <code title="">DoubleLongLeftRightArrow;</code> </td> <td> U+027FA </td> <td> <span class=glyph title="">&DoubleLongLeftRightArrow;</span> </td> <tr id=entity-DoubleLongRightArrow><td> <code title="">DoubleLongRightArrow;</code> </td> <td> U+027F9 </td> <td> <span class=glyph title="">&xrArr;</span> </td> <tr id=entity-DoubleRightArrow><td> <code title="">DoubleRightArrow;</code> </td> <td> U+021D2 </td> <td> <span class=glyph title="">&Implies;</span> </td> <tr id=entity-DoubleRightTee><td> <code title="">DoubleRightTee;</code> </td> <td> U+022A8 </td> <td> <span class=glyph title="">&vDash;</span> </td> <tr id=entity-DoubleUpArrow><td> <code title="">DoubleUpArrow;</code> </td> <td> U+021D1 </td> <td> <span class=glyph title="">&Uparrow;</span> </td> <tr id=entity-DoubleUpDownArrow><td> <code title="">DoubleUpDownArrow;</code> </td> <td> U+021D5 </td> <td> <span class=glyph title="">&DoubleUpDownArrow;</span> </td> <tr id=entity-DoubleVerticalBar><td> <code title="">DoubleVerticalBar;</code> </td> <td> U+02225 </td> <td> <span class=glyph title="">&spar;</span> </td> <tr id=entity-DownArrow><td> <code title="">DownArrow;</code> </td> <td> U+02193 </td> <td> <span class=glyph title="">&downarrow;</span> </td> <tr id=entity-Downarrow><td> <code title="">Downarrow;</code> </td> <td> U+021D3 </td> <td> <span class=glyph title="">&DoubleDownArrow;</span> </td> <tr id=entity-downarrow><td> <code title="">downarrow;</code> </td> <td> U+02193 </td> <td> <span class=glyph title="">&downarrow;</span> </td> <tr id=entity-DownArrowBar><td> <code title="">DownArrowBar;</code> </td> <td> U+02913 </td> <td> <span class=glyph title="">&DownArrowBar;</span> </td> <tr id=entity-DownArrowUpArrow><td> <code title="">DownArrowUpArrow;</code> </td> <td> U+021F5 </td> <td> <span class=glyph title="">&duarr;</span> </td> <tr id=entity-DownBreve><td> <code title="">DownBreve;</code> </td> <td> U+00311 </td> <td> <span class="glyph composition" title="">&#x25cc;&DownBreve;</span> </td> <tr id=entity-downdownarrows><td> <code title="">downdownarrows;</code> </td> <td> U+021CA </td> <td> <span class=glyph title="">&ddarr;</span> </td> <tr id=entity-downharpoonleft><td> <code title="">downharpoonleft;</code> </td> <td> U+021C3 </td> <td> <span class=glyph title="">&downharpoonleft;</span> </td> <tr id=entity-downharpoonright><td> <code title="">downharpoonright;</code> </td> <td> U+021C2 </td> <td> <span class=glyph title="">&dharr;</span> </td> <tr id=entity-DownLeftRightVector><td> <code title="">DownLeftRightVector;</code> </td> <td> U+02950 </td> <td> <span class=glyph title="">&DownLeftRightVector;</span> </td> <tr id=entity-DownLeftTeeVector><td> <code title="">DownLeftTeeVector;</code> </td> <td> U+0295E </td> <td> <span class=glyph title="">&DownLeftTeeVector;</span> </td> <tr id=entity-DownLeftVector><td> <code title="">DownLeftVector;</code> </td> <td> U+021BD </td> <td> <span class=glyph title="">&leftharpoondown;</span> </td> <tr id=entity-DownLeftVectorBar><td> <code title="">DownLeftVectorBar;</code> </td> <td> U+02956 </td> <td> <span class=glyph title="">&DownLeftVectorBar;</span> </td> <tr id=entity-DownRightTeeVector><td> <code title="">DownRightTeeVector;</code> </td> <td> U+0295F </td> <td> <span class=glyph title="">&DownRightTeeVector;</span> </td> <tr id=entity-DownRightVector><td> <code title="">DownRightVector;</code> </td> <td> U+021C1 </td> <td> <span class=glyph title="">&rhard;</span> </td> <tr id=entity-DownRightVectorBar><td> <code title="">DownRightVectorBar;</code> </td> <td> U+02957 </td> <td> <span class=glyph title="">&DownRightVectorBar;</span> </td> <tr id=entity-DownTee><td> <code title="">DownTee;</code> </td> <td> U+022A4 </td> <td> <span class=glyph title="">&top;</span> </td> <tr id=entity-DownTeeArrow><td> <code title="">DownTeeArrow;</code> </td> <td> U+021A7 </td> <td> <span class=glyph title="">&mapstodown;</span> </td> <tr id=entity-drbkarow><td> <code title="">drbkarow;</code> </td> <td> U+02910 </td> <td> <span class=glyph title="">&drbkarow;</span> </td> <tr id=entity-drcorn><td> <code title="">drcorn;</code> </td> <td> U+0231F </td> <td> <span class=glyph title="">&drcorn;</span> </td> <tr id=entity-drcrop><td> <code title="">drcrop;</code> </td> <td> U+0230C </td> <td> <span class=glyph title="">&drcrop;</span> </td> <tr id=entity-Dscr><td> <code title="">Dscr;</code> </td> <td> U+1D49F </td> <td> <span class=glyph title="">&Dscr;</span> </td> <tr id=entity-dscr><td> <code title="">dscr;</code> </td> <td> U+1D4B9 </td> <td> <span class=glyph title="">&dscr;</span> </td> <tr id=entity-DScy><td> <code title="">DScy;</code> </td> <td> U+00405 </td> <td> <span class=glyph title="">&DScy;</span> </td> <tr id=entity-dscy><td> <code title="">dscy;</code> </td> <td> U+00455 </td> <td> <span class=glyph title="">&dscy;</span> </td> <tr id=entity-dsol><td> <code title="">dsol;</code> </td> <td> U+029F6 </td> <td> <span class=glyph title="">&dsol;</span> </td> <tr id=entity-Dstrok><td> <code title="">Dstrok;</code> </td> <td> U+00110 </td> <td> <span class=glyph title="">&Dstrok;</span> </td> <tr id=entity-dstrok><td> <code title="">dstrok;</code> </td> <td> U+00111 </td> <td> <span class=glyph title="">&dstrok;</span> </td> <tr id=entity-dtdot><td> <code title="">dtdot;</code> </td> <td> U+022F1 </td> <td> <span class=glyph title="">&dtdot;</span> </td> <tr id=entity-dtri><td> <code title="">dtri;</code> </td> <td> U+025BF </td> <td> <span class=glyph title="">&triangledown;</span> </td> <tr id=entity-dtrif><td> <code title="">dtrif;</code> </td> <td> U+025BE </td> <td> <span class=glyph title="">&blacktriangledown;</span> </td> <tr id=entity-duarr><td> <code title="">duarr;</code> </td> <td> U+021F5 </td> <td> <span class=glyph title="">&duarr;</span> </td> <tr id=entity-duhar><td> <code title="">duhar;</code> </td> <td> U+0296F </td> <td> <span class=glyph title="">&duhar;</span> </td> <tr id=entity-dwangle><td> <code title="">dwangle;</code> </td> <td> U+029A6 </td> <td> <span class=glyph title="">&dwangle;</span> </td> <tr id=entity-DZcy><td> <code title="">DZcy;</code> </td> <td> U+0040F </td> <td> <span class=glyph title="">&DZcy;</span> </td> <tr id=entity-dzcy><td> <code title="">dzcy;</code> </td> <td> U+0045F </td> <td> <span class=glyph title="">&dzcy;</span> </td> <tr id=entity-dzigrarr><td> <code title="">dzigrarr;</code> </td> <td> U+027FF </td> <td> <span class=glyph title="">&dzigrarr;</span> </td> <tr id=entity-Eacute><td> <code title="">Eacute;</code> </td> <td> U+000C9 </td> <td> <span class=glyph title="">&Eacute;</span> </td> <tr id=entity-Eacute-legacy class=impl><td> <code title="">Eacute</code> </td> <td> U+000C9 </td> <td> <span title="">&Eacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-eacute><td> <code title="">eacute;</code> </td> <td> U+000E9 </td> <td> <span class=glyph title="">&eacute;</span> </td> <tr id=entity-eacute-legacy class=impl><td> <code title="">eacute</code> </td> <td> U+000E9 </td> <td> <span title="">&eacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-easter><td> <code title="">easter;</code> </td> <td> U+02A6E </td> <td> <span class=glyph title="">&easter;</span> </td> <tr id=entity-Ecaron><td> <code title="">Ecaron;</code> </td> <td> U+0011A </td> <td> <span class=glyph title="">&Ecaron;</span> </td> <tr id=entity-ecaron><td> <code title="">ecaron;</code> </td> <td> U+0011B </td> <td> <span class=glyph title="">&ecaron;</span> </td> <tr id=entity-ecir><td> <code title="">ecir;</code> </td> <td> U+02256 </td> <td> <span class=glyph title="">&eqcirc;</span> </td> <tr id=entity-Ecirc><td> <code title="">Ecirc;</code> </td> <td> U+000CA </td> <td> <span class=glyph title="">&Ecirc;</span> </td> <tr id=entity-Ecirc-legacy class=impl><td> <code title="">Ecirc</code> </td> <td> U+000CA </td> <td> <span title="">&Ecirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ecirc><td> <code title="">ecirc;</code> </td> <td> U+000EA </td> <td> <span class=glyph title="">&ecirc;</span> </td> <tr id=entity-ecirc-legacy class=impl><td> <code title="">ecirc</code> </td> <td> U+000EA </td> <td> <span title="">&ecirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ecolon><td> <code title="">ecolon;</code> </td> <td> U+02255 </td> <td> <span class=glyph title="">&eqcolon;</span> </td> <tr id=entity-Ecy><td> <code title="">Ecy;</code> </td> <td> U+0042D </td> <td> <span class=glyph title="">&Ecy;</span> </td> <tr id=entity-ecy><td> <code title="">ecy;</code> </td> <td> U+0044D </td> <td> <span class=glyph title="">&ecy;</span> </td> <tr id=entity-eDDot><td> <code title="">eDDot;</code> </td> <td> U+02A77 </td> <td> <span class=glyph title="">&ddotseq;</span> </td> <tr id=entity-Edot><td> <code title="">Edot;</code> </td> <td> U+00116 </td> <td> <span class=glyph title="">&Edot;</span> </td> <tr id=entity-eDot><td> <code title="">eDot;</code> </td> <td> U+02251 </td> <td> <span class=glyph title="">&doteqdot;</span> </td> <tr id=entity-edot><td> <code title="">edot;</code> </td> <td> U+00117 </td> <td> <span class=glyph title="">&edot;</span> </td> <tr id=entity-ee><td> <code title="">ee;</code> </td> <td> U+02147 </td> <td> <span class=glyph title="">&exponentiale;</span> </td> <tr id=entity-efDot><td> <code title="">efDot;</code> </td> <td> U+02252 </td> <td> <span class=glyph title="">&fallingdotseq;</span> </td> <tr id=entity-Efr><td> <code title="">Efr;</code> </td> <td> U+1D508 </td> <td> <span class=glyph title="">&Efr;</span> </td> <tr id=entity-efr><td> <code title="">efr;</code> </td> <td> U+1D522 </td> <td> <span class=glyph title="">&efr;</span> </td> <tr id=entity-eg><td> <code title="">eg;</code> </td> <td> U+02A9A </td> <td> <span class=glyph title="">&eg;</span> </td> <tr id=entity-Egrave><td> <code title="">Egrave;</code> </td> <td> U+000C8 </td> <td> <span class=glyph title="">&Egrave;</span> </td> <tr id=entity-Egrave-legacy class=impl><td> <code title="">Egrave</code> </td> <td> U+000C8 </td> <td> <span title="">&Egrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-egrave><td> <code title="">egrave;</code> </td> <td> U+000E8 </td> <td> <span class=glyph title="">&egrave;</span> </td> <tr id=entity-egrave-legacy class=impl><td> <code title="">egrave</code> </td> <td> U+000E8 </td> <td> <span title="">&egrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-egs><td> <code title="">egs;</code> </td> <td> U+02A96 </td> <td> <span class=glyph title="">&egs;</span> </td> <tr id=entity-egsdot><td> <code title="">egsdot;</code> </td> <td> U+02A98 </td> <td> <span class=glyph title="">&egsdot;</span> </td> <tr id=entity-el><td> <code title="">el;</code> </td> <td> U+02A99 </td> <td> <span class=glyph title="">&el;</span> </td> <tr id=entity-Element><td> <code title="">Element;</code> </td> <td> U+02208 </td> <td> <span class=glyph title="">&in;</span> </td> <tr id=entity-elinters><td> <code title="">elinters;</code> </td> <td> U+023E7 </td> <td> <span class=glyph title="">&elinters;</span> </td> <tr id=entity-ell><td> <code title="">ell;</code> </td> <td> U+02113 </td> <td> <span class=glyph title="">&ell;</span> </td> <tr id=entity-els><td> <code title="">els;</code> </td> <td> U+02A95 </td> <td> <span class=glyph title="">&eqslantless;</span> </td> <tr id=entity-elsdot><td> <code title="">elsdot;</code> </td> <td> U+02A97 </td> <td> <span class=glyph title="">&elsdot;</span> </td> <tr id=entity-Emacr><td> <code title="">Emacr;</code> </td> <td> U+00112 </td> <td> <span class=glyph title="">&Emacr;</span> </td> <tr id=entity-emacr><td> <code title="">emacr;</code> </td> <td> U+00113 </td> <td> <span class=glyph title="">&emacr;</span> </td> <tr id=entity-empty><td> <code title="">empty;</code> </td> <td> U+02205 </td> <td> <span class=glyph title="">&emptyv;</span> </td> <tr id=entity-emptyset><td> <code title="">emptyset;</code> </td> <td> U+02205 </td> <td> <span class=glyph title="">&emptyv;</span> </td> <tr id=entity-EmptySmallSquare><td> <code title="">EmptySmallSquare;</code> </td> <td> U+025FB </td> <td> <span class=glyph title="">&EmptySmallSquare;</span> </td> <tr id=entity-emptyv><td> <code title="">emptyv;</code> </td> <td> U+02205 </td> <td> <span class=glyph title="">&emptyv;</span> </td> <tr id=entity-EmptyVerySmallSquare><td> <code title="">EmptyVerySmallSquare;</code> </td> <td> U+025AB </td> <td> <span class=glyph title="">&EmptyVerySmallSquare;</span> </td> <tr id=entity-emsp><td> <code title="">emsp;</code> </td> <td> U+02003 </td> <td> <span class=glyph title="">&emsp;</span> </td> <tr id=entity-emsp13><td> <code title="">emsp13;</code> </td> <td> U+02004 </td> <td> <span class=glyph title="">&emsp13;</span> </td> <tr id=entity-emsp14><td> <code title="">emsp14;</code> </td> <td> U+02005 </td> <td> <span class=glyph title="">&emsp14;</span> </td> <tr id=entity-ENG><td> <code title="">ENG;</code> </td> <td> U+0014A </td> <td> <span class=glyph title="">&ENG;</span> </td> <tr id=entity-eng><td> <code title="">eng;</code> </td> <td> U+0014B </td> <td> <span class=glyph title="">&eng;</span> </td> <tr id=entity-ensp><td> <code title="">ensp;</code> </td> <td> U+02002 </td> <td> <span class=glyph title="">&ensp;</span> </td> <tr id=entity-Eogon><td> <code title="">Eogon;</code> </td> <td> U+00118 </td> <td> <span class=glyph title="">&Eogon;</span> </td> <tr id=entity-eogon><td> <code title="">eogon;</code> </td> <td> U+00119 </td> <td> <span class=glyph title="">&eogon;</span> </td> <tr id=entity-Eopf><td> <code title="">Eopf;</code> </td> <td> U+1D53C </td> <td> <span class=glyph title="">&Eopf;</span> </td> <tr id=entity-eopf><td> <code title="">eopf;</code> </td> <td> U+1D556 </td> <td> <span class=glyph title="">&eopf;</span> </td> <tr id=entity-epar><td> <code title="">epar;</code> </td> <td> U+022D5 </td> <td> <span class=glyph title="">&epar;</span> </td> <tr id=entity-eparsl><td> <code title="">eparsl;</code> </td> <td> U+029E3 </td> <td> <span class=glyph title="">&eparsl;</span> </td> <tr id=entity-eplus><td> <code title="">eplus;</code> </td> <td> U+02A71 </td> <td> <span class=glyph title="">&eplus;</span> </td> <tr id=entity-epsi><td> <code title="">epsi;</code> </td> <td> U+003B5 </td> <td> <span class=glyph title="">&epsi;</span> </td> <tr id=entity-Epsilon><td> <code title="">Epsilon;</code> </td> <td> U+00395 </td> <td> <span class=glyph title="">&Epsilon;</span> </td> <tr id=entity-epsilon><td> <code title="">epsilon;</code> </td> <td> U+003B5 </td> <td> <span class=glyph title="">&epsi;</span> </td> <tr id=entity-epsiv><td> <code title="">epsiv;</code> </td> <td> U+003F5 </td> <td> <span class=glyph title="">&straightepsilon;</span> </td> <tr id=entity-eqcirc><td> <code title="">eqcirc;</code> </td> <td> U+02256 </td> <td> <span class=glyph title="">&eqcirc;</span> </td> <tr id=entity-eqcolon><td> <code title="">eqcolon;</code> </td> <td> U+02255 </td> <td> <span class=glyph title="">&eqcolon;</span> </td> <tr id=entity-eqsim><td> <code title="">eqsim;</code> </td> <td> U+02242 </td> <td> <span class=glyph title="">&esim;</span> </td> <tr id=entity-eqslantgtr><td> <code title="">eqslantgtr;</code> </td> <td> U+02A96 </td> <td> <span class=glyph title="">&egs;</span> </td> <tr id=entity-eqslantless><td> <code title="">eqslantless;</code> </td> <td> U+02A95 </td> <td> <span class=glyph title="">&eqslantless;</span> </td> <tr id=entity-Equal><td> <code title="">Equal;</code> </td> <td> U+02A75 </td> <td> <span class=glyph title="">&Equal;</span> </td> <tr id=entity-equals><td> <code title="">equals;</code> </td> <td> U+0003D </td> <td> <span class=glyph title="">=</span> </td> <tr id=entity-EqualTilde><td> <code title="">EqualTilde;</code> </td> <td> U+02242 </td> <td> <span class=glyph title="">&esim;</span> </td> <tr id=entity-equest><td> <code title="">equest;</code> </td> <td> U+0225F </td> <td> <span class=glyph title="">&questeq;</span> </td> <tr id=entity-Equilibrium><td> <code title="">Equilibrium;</code> </td> <td> U+021CC </td> <td> <span class=glyph title="">&rlhar;</span> </td> <tr id=entity-equiv><td> <code title="">equiv;</code> </td> <td> U+02261 </td> <td> <span class=glyph title="">&equiv;</span> </td> <tr id=entity-equivDD><td> <code title="">equivDD;</code> </td> <td> U+02A78 </td> <td> <span class=glyph title="">&equivDD;</span> </td> <tr id=entity-eqvparsl><td> <code title="">eqvparsl;</code> </td> <td> U+029E5 </td> <td> <span class=glyph title="">&eqvparsl;</span> </td> <tr id=entity-erarr><td> <code title="">erarr;</code> </td> <td> U+02971 </td> <td> <span class=glyph title="">&erarr;</span> </td> <tr id=entity-erDot><td> <code title="">erDot;</code> </td> <td> U+02253 </td> <td> <span class=glyph title="">&risingdotseq;</span> </td> <tr id=entity-Escr><td> <code title="">Escr;</code> </td> <td> U+02130 </td> <td> <span class=glyph title="">&expectation;</span> </td> <tr id=entity-escr><td> <code title="">escr;</code> </td> <td> U+0212F </td> <td> <span class=glyph title="">&escr;</span> </td> <tr id=entity-esdot><td> <code title="">esdot;</code> </td> <td> U+02250 </td> <td> <span class=glyph title="">&esdot;</span> </td> <tr id=entity-Esim><td> <code title="">Esim;</code> </td> <td> U+02A73 </td> <td> <span class=glyph title="">&Esim;</span> </td> <tr id=entity-esim><td> <code title="">esim;</code> </td> <td> U+02242 </td> <td> <span class=glyph title="">&esim;</span> </td> <tr id=entity-Eta><td> <code title="">Eta;</code> </td> <td> U+00397 </td> <td> <span class=glyph title="">&Eta;</span> </td> <tr id=entity-eta><td> <code title="">eta;</code> </td> <td> U+003B7 </td> <td> <span class=glyph title="">&eta;</span> </td> <tr id=entity-ETH><td> <code title="">ETH;</code> </td> <td> U+000D0 </td> <td> <span class=glyph title="">&ETH;</span> </td> <tr id=entity-ETH-legacy class=impl><td> <code title="">ETH</code> </td> <td> U+000D0 </td> <td> <span title="">&ETH;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-eth><td> <code title="">eth;</code> </td> <td> U+000F0 </td> <td> <span class=glyph title="">&eth;</span> </td> <tr id=entity-eth-legacy class=impl><td> <code title="">eth</code> </td> <td> U+000F0 </td> <td> <span title="">&eth;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Euml><td> <code title="">Euml;</code> </td> <td> U+000CB </td> <td> <span class=glyph title="">&Euml;</span> </td> <tr id=entity-Euml-legacy class=impl><td> <code title="">Euml</code> </td> <td> U+000CB </td> <td> <span title="">&Euml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-euml><td> <code title="">euml;</code> </td> <td> U+000EB </td> <td> <span class=glyph title="">&euml;</span> </td> <tr id=entity-euml-legacy class=impl><td> <code title="">euml</code> </td> <td> U+000EB </td> <td> <span title="">&euml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-euro><td> <code title="">euro;</code> </td> <td> U+020AC </td> <td> <span class=glyph title="">&euro;</span> </td> <tr id=entity-excl><td> <code title="">excl;</code> </td> <td> U+00021 </td> <td> <span class=glyph title="">!</span> </td> <tr id=entity-exist><td> <code title="">exist;</code> </td> <td> U+02203 </td> <td> <span class=glyph title="">&exist;</span> </td> <tr id=entity-Exists><td> <code title="">Exists;</code> </td> <td> U+02203 </td> <td> <span class=glyph title="">&exist;</span> </td> <tr id=entity-expectation><td> <code title="">expectation;</code> </td> <td> U+02130 </td> <td> <span class=glyph title="">&expectation;</span> </td> <tr id=entity-ExponentialE><td> <code title="">ExponentialE;</code> </td> <td> U+02147 </td> <td> <span class=glyph title="">&exponentiale;</span> </td> <tr id=entity-exponentiale><td> <code title="">exponentiale;</code> </td> <td> U+02147 </td> <td> <span class=glyph title="">&exponentiale;</span> </td> <tr id=entity-fallingdotseq><td> <code title="">fallingdotseq;</code> </td> <td> U+02252 </td> <td> <span class=glyph title="">&fallingdotseq;</span> </td> <tr id=entity-Fcy><td> <code title="">Fcy;</code> </td> <td> U+00424 </td> <td> <span class=glyph title="">&Fcy;</span> </td> <tr id=entity-fcy><td> <code title="">fcy;</code> </td> <td> U+00444 </td> <td> <span class=glyph title="">&fcy;</span> </td> <tr id=entity-female><td> <code title="">female;</code> </td> <td> U+02640 </td> <td> <span class=glyph title="">&female;</span> </td> <tr id=entity-ffilig><td> <code title="">ffilig;</code> </td> <td> U+0FB03 </td> <td> <span class=glyph title="">&ffilig;</span> </td> <tr id=entity-fflig><td> <code title="">fflig;</code> </td> <td> U+0FB00 </td> <td> <span class=glyph title="">&fflig;</span> </td> <tr id=entity-ffllig><td> <code title="">ffllig;</code> </td> <td> U+0FB04 </td> <td> <span class=glyph title="">&ffllig;</span> </td> <tr id=entity-Ffr><td> <code title="">Ffr;</code> </td> <td> U+1D509 </td> <td> <span class=glyph title="">&Ffr;</span> </td> <tr id=entity-ffr><td> <code title="">ffr;</code> </td> <td> U+1D523 </td> <td> <span class=glyph title="">&ffr;</span> </td> <tr id=entity-filig><td> <code title="">filig;</code> </td> <td> U+0FB01 </td> <td> <span class=glyph title="">&filig;</span> </td> <tr id=entity-FilledSmallSquare><td> <code title="">FilledSmallSquare;</code> </td> <td> U+025FC </td> <td> <span class=glyph title="">&FilledSmallSquare;</span> </td> <tr id=entity-FilledVerySmallSquare><td> <code title="">FilledVerySmallSquare;</code> </td> <td> U+025AA </td> <td> <span class=glyph title="">&blacksquare;</span> </td> <tr id=entity-fjlig><td> <code title="">fjlig;</code> </td> <td> U+00066 U+0006A </td> <td> <span class="glyph compound" title="">fj</span> </td> <tr id=entity-flat><td> <code title="">flat;</code> </td> <td> U+0266D </td> <td> <span class=glyph title="">&flat;</span> </td> <tr id=entity-fllig><td> <code title="">fllig;</code> </td> <td> U+0FB02 </td> <td> <span class=glyph title="">&fllig;</span> </td> <tr id=entity-fltns><td> <code title="">fltns;</code> </td> <td> U+025B1 </td> <td> <span class=glyph title="">&fltns;</span> </td> <tr id=entity-fnof><td> <code title="">fnof;</code> </td> <td> U+00192 </td> <td> <span class=glyph title="">&fnof;</span> </td> <tr id=entity-Fopf><td> <code title="">Fopf;</code> </td> <td> U+1D53D </td> <td> <span class=glyph title="">&Fopf;</span> </td> <tr id=entity-fopf><td> <code title="">fopf;</code> </td> <td> U+1D557 </td> <td> <span class=glyph title="">&fopf;</span> </td> <tr id=entity-ForAll><td> <code title="">ForAll;</code> </td> <td> U+02200 </td> <td> <span class=glyph title="">&forall;</span> </td> <tr id=entity-forall><td> <code title="">forall;</code> </td> <td> U+02200 </td> <td> <span class=glyph title="">&forall;</span> </td> <tr id=entity-fork><td> <code title="">fork;</code> </td> <td> U+022D4 </td> <td> <span class=glyph title="">&fork;</span> </td> <tr id=entity-forkv><td> <code title="">forkv;</code> </td> <td> U+02AD9 </td> <td> <span class=glyph title="">&forkv;</span> </td> <tr id=entity-Fouriertrf><td> <code title="">Fouriertrf;</code> </td> <td> U+02131 </td> <td> <span class=glyph title="">&Fscr;</span> </td> <tr id=entity-fpartint><td> <code title="">fpartint;</code> </td> <td> U+02A0D </td> <td> <span class=glyph title="">&fpartint;</span> </td> <tr id=entity-frac12><td> <code title="">frac12;</code> </td> <td> U+000BD </td> <td> <span class=glyph title="">&half;</span> </td> <tr id=entity-frac12-legacy class=impl><td> <code title="">frac12</code> </td> <td> U+000BD </td> <td> <span title="">&half;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-frac13><td> <code title="">frac13;</code> </td> <td> U+02153 </td> <td> <span class=glyph title="">&frac13;</span> </td> <tr id=entity-frac14><td> <code title="">frac14;</code> </td> <td> U+000BC </td> <td> <span class=glyph title="">&frac14;</span> </td> <tr id=entity-frac14-legacy class=impl><td> <code title="">frac14</code> </td> <td> U+000BC </td> <td> <span title="">&frac14;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-frac15><td> <code title="">frac15;</code> </td> <td> U+02155 </td> <td> <span class=glyph title="">&frac15;</span> </td> <tr id=entity-frac16><td> <code title="">frac16;</code> </td> <td> U+02159 </td> <td> <span class=glyph title="">&frac16;</span> </td> <tr id=entity-frac18><td> <code title="">frac18;</code> </td> <td> U+0215B </td> <td> <span class=glyph title="">&frac18;</span> </td> <tr id=entity-frac23><td> <code title="">frac23;</code> </td> <td> U+02154 </td> <td> <span class=glyph title="">&frac23;</span> </td> <tr id=entity-frac25><td> <code title="">frac25;</code> </td> <td> U+02156 </td> <td> <span class=glyph title="">&frac25;</span> </td> <tr id=entity-frac34><td> <code title="">frac34;</code> </td> <td> U+000BE </td> <td> <span class=glyph title="">&frac34;</span> </td> <tr id=entity-frac34-legacy class=impl><td> <code title="">frac34</code> </td> <td> U+000BE </td> <td> <span title="">&frac34;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-frac35><td> <code title="">frac35;</code> </td> <td> U+02157 </td> <td> <span class=glyph title="">&frac35;</span> </td> <tr id=entity-frac38><td> <code title="">frac38;</code> </td> <td> U+0215C </td> <td> <span class=glyph title="">&frac38;</span> </td> <tr id=entity-frac45><td> <code title="">frac45;</code> </td> <td> U+02158 </td> <td> <span class=glyph title="">&frac45;</span> </td> <tr id=entity-frac56><td> <code title="">frac56;</code> </td> <td> U+0215A </td> <td> <span class=glyph title="">&frac56;</span> </td> <tr id=entity-frac58><td> <code title="">frac58;</code> </td> <td> U+0215D </td> <td> <span class=glyph title="">&frac58;</span> </td> <tr id=entity-frac78><td> <code title="">frac78;</code> </td> <td> U+0215E </td> <td> <span class=glyph title="">&frac78;</span> </td> <tr id=entity-frasl><td> <code title="">frasl;</code> </td> <td> U+02044 </td> <td> <span class=glyph title="">&frasl;</span> </td> <tr id=entity-frown><td> <code title="">frown;</code> </td> <td> U+02322 </td> <td> <span class=glyph title="">&frown;</span> </td> <tr id=entity-Fscr><td> <code title="">Fscr;</code> </td> <td> U+02131 </td> <td> <span class=glyph title="">&Fscr;</span> </td> <tr id=entity-fscr><td> <code title="">fscr;</code> </td> <td> U+1D4BB </td> <td> <span class=glyph title="">&fscr;</span> </td> <tr id=entity-gacute><td> <code title="">gacute;</code> </td> <td> U+001F5 </td> <td> <span class=glyph title="">&gacute;</span> </td> <tr id=entity-Gamma><td> <code title="">Gamma;</code> </td> <td> U+00393 </td> <td> <span class=glyph title="">&Gamma;</span> </td> <tr id=entity-gamma><td> <code title="">gamma;</code> </td> <td> U+003B3 </td> <td> <span class=glyph title="">&gamma;</span> </td> <tr id=entity-Gammad><td> <code title="">Gammad;</code> </td> <td> U+003DC </td> <td> <span class=glyph title="">&Gammad;</span> </td> <tr id=entity-gammad><td> <code title="">gammad;</code> </td> <td> U+003DD </td> <td> <span class=glyph title="">&gammad;</span> </td> <tr id=entity-gap><td> <code title="">gap;</code> </td> <td> U+02A86 </td> <td> <span class=glyph title="">&gap;</span> </td> <tr id=entity-Gbreve><td> <code title="">Gbreve;</code> </td> <td> U+0011E </td> <td> <span class=glyph title="">&Gbreve;</span> </td> <tr id=entity-gbreve><td> <code title="">gbreve;</code> </td> <td> U+0011F </td> <td> <span class=glyph title="">&gbreve;</span> </td> <tr id=entity-Gcedil><td> <code title="">Gcedil;</code> </td> <td> U+00122 </td> <td> <span class=glyph title="">&Gcedil;</span> </td> <tr id=entity-Gcirc><td> <code title="">Gcirc;</code> </td> <td> U+0011C </td> <td> <span class=glyph title="">&Gcirc;</span> </td> <tr id=entity-gcirc><td> <code title="">gcirc;</code> </td> <td> U+0011D </td> <td> <span class=glyph title="">&gcirc;</span> </td> <tr id=entity-Gcy><td> <code title="">Gcy;</code> </td> <td> U+00413 </td> <td> <span class=glyph title="">&Gcy;</span> </td> <tr id=entity-gcy><td> <code title="">gcy;</code> </td> <td> U+00433 </td> <td> <span class=glyph title="">&gcy;</span> </td> <tr id=entity-Gdot><td> <code title="">Gdot;</code> </td> <td> U+00120 </td> <td> <span class=glyph title="">&Gdot;</span> </td> <tr id=entity-gdot><td> <code title="">gdot;</code> </td> <td> U+00121 </td> <td> <span class=glyph title="">&gdot;</span> </td> <tr id=entity-gE><td> <code title="">gE;</code> </td> <td> U+02267 </td> <td> <span class=glyph title="">&geqq;</span> </td> <tr id=entity-ge><td> <code title="">ge;</code> </td> <td> U+02265 </td> <td> <span class=glyph title="">&ge;</span> </td> <tr id=entity-gEl><td> <code title="">gEl;</code> </td> <td> U+02A8C </td> <td> <span class=glyph title="">&gtreqqless;</span> </td> <tr id=entity-gel><td> <code title="">gel;</code> </td> <td> U+022DB </td> <td> <span class=glyph title="">&gel;</span> </td> <tr id=entity-geq><td> <code title="">geq;</code> </td> <td> U+02265 </td> <td> <span class=glyph title="">&ge;</span> </td> <tr id=entity-geqq><td> <code title="">geqq;</code> </td> <td> U+02267 </td> <td> <span class=glyph title="">&geqq;</span> </td> <tr id=entity-geqslant><td> <code title="">geqslant;</code> </td> <td> U+02A7E </td> <td> <span class=glyph title="">&ges;</span> </td> <tr id=entity-ges><td> <code title="">ges;</code> </td> <td> U+02A7E </td> <td> <span class=glyph title="">&ges;</span> </td> <tr id=entity-gescc><td> <code title="">gescc;</code> </td> <td> U+02AA9 </td> <td> <span class=glyph title="">&gescc;</span> </td> <tr id=entity-gesdot><td> <code title="">gesdot;</code> </td> <td> U+02A80 </td> <td> <span class=glyph title="">&gesdot;</span> </td> <tr id=entity-gesdoto><td> <code title="">gesdoto;</code> </td> <td> U+02A82 </td> <td> <span class=glyph title="">&gesdoto;</span> </td> <tr id=entity-gesdotol><td> <code title="">gesdotol;</code> </td> <td> U+02A84 </td> <td> <span class=glyph title="">&gesdotol;</span> </td> <tr id=entity-gesl><td> <code title="">gesl;</code> </td> <td> U+022DB U+0FE00 </td> <td> <span class="glyph compound" title="">&gel;&#xfe00;</span> </td> <tr id=entity-gesles><td> <code title="">gesles;</code> </td> <td> U+02A94 </td> <td> <span class=glyph title="">&gesles;</span> </td> <tr id=entity-Gfr><td> <code title="">Gfr;</code> </td> <td> U+1D50A </td> <td> <span class=glyph title="">&Gfr;</span> </td> <tr id=entity-gfr><td> <code title="">gfr;</code> </td> <td> U+1D524 </td> <td> <span class=glyph title="">&gfr;</span> </td> <tr id=entity-Gg><td> <code title="">Gg;</code> </td> <td> U+022D9 </td> <td> <span class=glyph title="">&ggg;</span> </td> <tr id=entity-gg><td> <code title="">gg;</code> </td> <td> U+0226B </td> <td> <span class=glyph title="">&gg;</span> </td> <tr id=entity-ggg><td> <code title="">ggg;</code> </td> <td> U+022D9 </td> <td> <span class=glyph title="">&ggg;</span> </td> <tr id=entity-gimel><td> <code title="">gimel;</code> </td> <td> U+02137 </td> <td> <span class=glyph title="">&gimel;</span> </td> <tr id=entity-GJcy><td> <code title="">GJcy;</code> </td> <td> U+00403 </td> <td> <span class=glyph title="">&GJcy;</span> </td> <tr id=entity-gjcy><td> <code title="">gjcy;</code> </td> <td> U+00453 </td> <td> <span class=glyph title="">&gjcy;</span> </td> <tr id=entity-gl><td> <code title="">gl;</code> </td> <td> U+02277 </td> <td> <span class=glyph title="">&gtrless;</span> </td> <tr id=entity-gla><td> <code title="">gla;</code> </td> <td> U+02AA5 </td> <td> <span class=glyph title="">&gla;</span> </td> <tr id=entity-glE><td> <code title="">glE;</code> </td> <td> U+02A92 </td> <td> <span class=glyph title="">&glE;</span> </td> <tr id=entity-glj><td> <code title="">glj;</code> </td> <td> U+02AA4 </td> <td> <span class=glyph title="">&glj;</span> </td> <tr id=entity-gnap><td> <code title="">gnap;</code> </td> <td> U+02A8A </td> <td> <span class=glyph title="">&gnap;</span> </td> <tr id=entity-gnapprox><td> <code title="">gnapprox;</code> </td> <td> U+02A8A </td> <td> <span class=glyph title="">&gnap;</span> </td> <tr id=entity-gnE><td> <code title="">gnE;</code> </td> <td> U+02269 </td> <td> <span class=glyph title="">&gneqq;</span> </td> <tr id=entity-gne><td> <code title="">gne;</code> </td> <td> U+02A88 </td> <td> <span class=glyph title="">&gne;</span> </td> <tr id=entity-gneq><td> <code title="">gneq;</code> </td> <td> U+02A88 </td> <td> <span class=glyph title="">&gne;</span> </td> <tr id=entity-gneqq><td> <code title="">gneqq;</code> </td> <td> U+02269 </td> <td> <span class=glyph title="">&gneqq;</span> </td> <tr id=entity-gnsim><td> <code title="">gnsim;</code> </td> <td> U+022E7 </td> <td> <span class=glyph title="">&gnsim;</span> </td> <tr id=entity-Gopf><td> <code title="">Gopf;</code> </td> <td> U+1D53E </td> <td> <span class=glyph title="">&Gopf;</span> </td> <tr id=entity-gopf><td> <code title="">gopf;</code> </td> <td> U+1D558 </td> <td> <span class=glyph title="">&gopf;</span> </td> <tr id=entity-grave><td> <code title="">grave;</code> </td> <td> U+00060 </td> <td> <span class=glyph title="">`</span> </td> <tr id=entity-GreaterEqual><td> <code title="">GreaterEqual;</code> </td> <td> U+02265 </td> <td> <span class=glyph title="">&ge;</span> </td> <tr id=entity-GreaterEqualLess><td> <code title="">GreaterEqualLess;</code> </td> <td> U+022DB </td> <td> <span class=glyph title="">&gel;</span> </td> <tr id=entity-GreaterFullEqual><td> <code title="">GreaterFullEqual;</code> </td> <td> U+02267 </td> <td> <span class=glyph title="">&geqq;</span> </td> <tr id=entity-GreaterGreater><td> <code title="">GreaterGreater;</code> </td> <td> U+02AA2 </td> <td> <span class=glyph title="">&GreaterGreater;</span> </td> <tr id=entity-GreaterLess><td> <code title="">GreaterLess;</code> </td> <td> U+02277 </td> <td> <span class=glyph title="">&gtrless;</span> </td> <tr id=entity-GreaterSlantEqual><td> <code title="">GreaterSlantEqual;</code> </td> <td> U+02A7E </td> <td> <span class=glyph title="">&ges;</span> </td> <tr id=entity-GreaterTilde><td> <code title="">GreaterTilde;</code> </td> <td> U+02273 </td> <td> <span class=glyph title="">&gtrsim;</span> </td> <tr id=entity-Gscr><td> <code title="">Gscr;</code> </td> <td> U+1D4A2 </td> <td> <span class=glyph title="">&Gscr;</span> </td> <tr id=entity-gscr><td> <code title="">gscr;</code> </td> <td> U+0210A </td> <td> <span class=glyph title="">&gscr;</span> </td> <tr id=entity-gsim><td> <code title="">gsim;</code> </td> <td> U+02273 </td> <td> <span class=glyph title="">&gtrsim;</span> </td> <tr id=entity-gsime><td> <code title="">gsime;</code> </td> <td> U+02A8E </td> <td> <span class=glyph title="">&gsime;</span> </td> <tr id=entity-gsiml><td> <code title="">gsiml;</code> </td> <td> U+02A90 </td> <td> <span class=glyph title="">&gsiml;</span> </td> <tr id=entity-GT><td> <code title="">GT;</code> </td> <td> U+0003E </td> <td> <span class=glyph title="">&gt;</span> </td> <tr id=entity-GT-legacy class=impl><td> <code title="">GT</code> </td> <td> U+0003E </td> <td> <span title="">&gt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Gt><td> <code title="">Gt;</code> </td> <td> U+0226B </td> <td> <span class=glyph title="">&gg;</span> </td> <tr id=entity-gt><td> <code title="">gt;</code> </td> <td> U+0003E </td> <td> <span class=glyph title="">&gt;</span> </td> <tr id=entity-gt-legacy class=impl><td> <code title="">gt</code> </td> <td> U+0003E </td> <td> <span title="">&gt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-gtcc><td> <code title="">gtcc;</code> </td> <td> U+02AA7 </td> <td> <span class=glyph title="">&gtcc;</span> </td> <tr id=entity-gtcir><td> <code title="">gtcir;</code> </td> <td> U+02A7A </td> <td> <span class=glyph title="">&gtcir;</span> </td> <tr id=entity-gtdot><td> <code title="">gtdot;</code> </td> <td> U+022D7 </td> <td> <span class=glyph title="">&gtdot;</span> </td> <tr id=entity-gtlPar><td> <code title="">gtlPar;</code> </td> <td> U+02995 </td> <td> <span class=glyph title="">&gtlPar;</span> </td> <tr id=entity-gtquest><td> <code title="">gtquest;</code> </td> <td> U+02A7C </td> <td> <span class=glyph title="">&gtquest;</span> </td> <tr id=entity-gtrapprox><td> <code title="">gtrapprox;</code> </td> <td> U+02A86 </td> <td> <span class=glyph title="">&gap;</span> </td> <tr id=entity-gtrarr><td> <code title="">gtrarr;</code> </td> <td> U+02978 </td> <td> <span class=glyph title="">&gtrarr;</span> </td> <tr id=entity-gtrdot><td> <code title="">gtrdot;</code> </td> <td> U+022D7 </td> <td> <span class=glyph title="">&gtdot;</span> </td> <tr id=entity-gtreqless><td> <code title="">gtreqless;</code> </td> <td> U+022DB </td> <td> <span class=glyph title="">&gel;</span> </td> <tr id=entity-gtreqqless><td> <code title="">gtreqqless;</code> </td> <td> U+02A8C </td> <td> <span class=glyph title="">&gtreqqless;</span> </td> <tr id=entity-gtrless><td> <code title="">gtrless;</code> </td> <td> U+02277 </td> <td> <span class=glyph title="">&gtrless;</span> </td> <tr id=entity-gtrsim><td> <code title="">gtrsim;</code> </td> <td> U+02273 </td> <td> <span class=glyph title="">&gtrsim;</span> </td> <tr id=entity-gvertneqq><td> <code title="">gvertneqq;</code> </td> <td> U+02269 U+0FE00 </td> <td> <span class="glyph compound" title="">&gneqq;&#xfe00;</span> </td> <tr id=entity-gvnE><td> <code title="">gvnE;</code> </td> <td> U+02269 U+0FE00 </td> <td> <span class="glyph compound" title="">&gneqq;&#xfe00;</span> </td> <tr id=entity-Hacek><td> <code title="">Hacek;</code> </td> <td> U+002C7 </td> <td> <span class=glyph title="">&caron;</span> </td> <tr id=entity-hairsp><td> <code title="">hairsp;</code> </td> <td> U+0200A </td> <td> <span class=glyph title="">&hairsp;</span> </td> <tr id=entity-half><td> <code title="">half;</code> </td> <td> U+000BD </td> <td> <span class=glyph title="">&half;</span> </td> <tr id=entity-hamilt><td> <code title="">hamilt;</code> </td> <td> U+0210B </td> <td> <span class=glyph title="">&hamilt;</span> </td> <tr id=entity-HARDcy><td> <code title="">HARDcy;</code> </td> <td> U+0042A </td> <td> <span class=glyph title="">&HARDcy;</span> </td> <tr id=entity-hardcy><td> <code title="">hardcy;</code> </td> <td> U+0044A </td> <td> <span class=glyph title="">&hardcy;</span> </td> <tr id=entity-hArr><td> <code title="">hArr;</code> </td> <td> U+021D4 </td> <td> <span class=glyph title="">&iff;</span> </td> <tr id=entity-harr><td> <code title="">harr;</code> </td> <td> U+02194 </td> <td> <span class=glyph title="">&leftrightarrow;</span> </td> <tr id=entity-harrcir><td> <code title="">harrcir;</code> </td> <td> U+02948 </td> <td> <span class=glyph title="">&harrcir;</span> </td> <tr id=entity-harrw><td> <code title="">harrw;</code> </td> <td> U+021AD </td> <td> <span class=glyph title="">&leftrightsquigarrow;</span> </td> <tr id=entity-Hat><td> <code title="">Hat;</code> </td> <td> U+0005E </td> <td> <span class=glyph title="">^</span> </td> <tr id=entity-hbar><td> <code title="">hbar;</code> </td> <td> U+0210F </td> <td> <span class=glyph title="">&hslash;</span> </td> <tr id=entity-Hcirc><td> <code title="">Hcirc;</code> </td> <td> U+00124 </td> <td> <span class=glyph title="">&Hcirc;</span> </td> <tr id=entity-hcirc><td> <code title="">hcirc;</code> </td> <td> U+00125 </td> <td> <span class=glyph title="">&hcirc;</span> </td> <tr id=entity-hearts><td> <code title="">hearts;</code> </td> <td> U+02665 </td> <td> <span class=glyph title="">&hearts;</span> </td> <tr id=entity-heartsuit><td> <code title="">heartsuit;</code> </td> <td> U+02665 </td> <td> <span class=glyph title="">&hearts;</span> </td> <tr id=entity-hellip><td> <code title="">hellip;</code> </td> <td> U+02026 </td> <td> <span class=glyph title="">&mldr;</span> </td> <tr id=entity-hercon><td> <code title="">hercon;</code> </td> <td> U+022B9 </td> <td> <span class=glyph title="">&hercon;</span> </td> <tr id=entity-Hfr><td> <code title="">Hfr;</code> </td> <td> U+0210C </td> <td> <span class=glyph title="">&Hfr;</span> </td> <tr id=entity-hfr><td> <code title="">hfr;</code> </td> <td> U+1D525 </td> <td> <span class=glyph title="">&hfr;</span> </td> <tr id=entity-HilbertSpace><td> <code title="">HilbertSpace;</code> </td> <td> U+0210B </td> <td> <span class=glyph title="">&hamilt;</span> </td> <tr id=entity-hksearow><td> <code title="">hksearow;</code> </td> <td> U+02925 </td> <td> <span class=glyph title="">&hksearow;</span> </td> <tr id=entity-hkswarow><td> <code title="">hkswarow;</code> </td> <td> U+02926 </td> <td> <span class=glyph title="">&hkswarow;</span> </td> <tr id=entity-hoarr><td> <code title="">hoarr;</code> </td> <td> U+021FF </td> <td> <span class=glyph title="">&hoarr;</span> </td> <tr id=entity-homtht><td> <code title="">homtht;</code> </td> <td> U+0223B </td> <td> <span class=glyph title="">&homtht;</span> </td> <tr id=entity-hookleftarrow><td> <code title="">hookleftarrow;</code> </td> <td> U+021A9 </td> <td> <span class=glyph title="">&hookleftarrow;</span> </td> <tr id=entity-hookrightarrow><td> <code title="">hookrightarrow;</code> </td> <td> U+021AA </td> <td> <span class=glyph title="">&hookrightarrow;</span> </td> <tr id=entity-Hopf><td> <code title="">Hopf;</code> </td> <td> U+0210D </td> <td> <span class=glyph title="">&quaternions;</span> </td> <tr id=entity-hopf><td> <code title="">hopf;</code> </td> <td> U+1D559 </td> <td> <span class=glyph title="">&hopf;</span> </td> <tr id=entity-horbar><td> <code title="">horbar;</code> </td> <td> U+02015 </td> <td> <span class=glyph title="">&horbar;</span> </td> <tr id=entity-HorizontalLine><td> <code title="">HorizontalLine;</code> </td> <td> U+02500 </td> <td> <span class=glyph title="">&boxh;</span> </td> <tr id=entity-Hscr><td> <code title="">Hscr;</code> </td> <td> U+0210B </td> <td> <span class=glyph title="">&hamilt;</span> </td> <tr id=entity-hscr><td> <code title="">hscr;</code> </td> <td> U+1D4BD </td> <td> <span class=glyph title="">&hscr;</span> </td> <tr id=entity-hslash><td> <code title="">hslash;</code> </td> <td> U+0210F </td> <td> <span class=glyph title="">&hslash;</span> </td> <tr id=entity-Hstrok><td> <code title="">Hstrok;</code> </td> <td> U+00126 </td> <td> <span class=glyph title="">&Hstrok;</span> </td> <tr id=entity-hstrok><td> <code title="">hstrok;</code> </td> <td> U+00127 </td> <td> <span class=glyph title="">&hstrok;</span> </td> <tr id=entity-HumpDownHump><td> <code title="">HumpDownHump;</code> </td> <td> U+0224E </td> <td> <span class=glyph title="">&bump;</span> </td> <tr id=entity-HumpEqual><td> <code title="">HumpEqual;</code> </td> <td> U+0224F </td> <td> <span class=glyph title="">&bumpeq;</span> </td> <tr id=entity-hybull><td> <code title="">hybull;</code> </td> <td> U+02043 </td> <td> <span class=glyph title="">&hybull;</span> </td> <tr id=entity-hyphen><td> <code title="">hyphen;</code> </td> <td> U+02010 </td> <td> <span class=glyph title="">&dash;</span> </td> <tr id=entity-Iacute><td> <code title="">Iacute;</code> </td> <td> U+000CD </td> <td> <span class=glyph title="">&Iacute;</span> </td> <tr id=entity-Iacute-legacy class=impl><td> <code title="">Iacute</code> </td> <td> U+000CD </td> <td> <span title="">&Iacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-iacute><td> <code title="">iacute;</code> </td> <td> U+000ED </td> <td> <span class=glyph title="">&iacute;</span> </td> <tr id=entity-iacute-legacy class=impl><td> <code title="">iacute</code> </td> <td> U+000ED </td> <td> <span title="">&iacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ic><td> <code title="">ic;</code> </td> <td> U+02063 </td> <td> <span class=glyph title="">&ic;</span> </td> <tr id=entity-Icirc><td> <code title="">Icirc;</code> </td> <td> U+000CE </td> <td> <span class=glyph title="">&Icirc;</span> </td> <tr id=entity-Icirc-legacy class=impl><td> <code title="">Icirc</code> </td> <td> U+000CE </td> <td> <span title="">&Icirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-icirc><td> <code title="">icirc;</code> </td> <td> U+000EE </td> <td> <span class=glyph title="">&icirc;</span> </td> <tr id=entity-icirc-legacy class=impl><td> <code title="">icirc</code> </td> <td> U+000EE </td> <td> <span title="">&icirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Icy><td> <code title="">Icy;</code> </td> <td> U+00418 </td> <td> <span class=glyph title="">&Icy;</span> </td> <tr id=entity-icy><td> <code title="">icy;</code> </td> <td> U+00438 </td> <td> <span class=glyph title="">&icy;</span> </td> <tr id=entity-Idot><td> <code title="">Idot;</code> </td> <td> U+00130 </td> <td> <span class=glyph title="">&Idot;</span> </td> <tr id=entity-IEcy><td> <code title="">IEcy;</code> </td> <td> U+00415 </td> <td> <span class=glyph title="">&IEcy;</span> </td> <tr id=entity-iecy><td> <code title="">iecy;</code> </td> <td> U+00435 </td> <td> <span class=glyph title="">&iecy;</span> </td> <tr id=entity-iexcl><td> <code title="">iexcl;</code> </td> <td> U+000A1 </td> <td> <span class=glyph title="">&iexcl;</span> </td> <tr id=entity-iexcl-legacy class=impl><td> <code title="">iexcl</code> </td> <td> U+000A1 </td> <td> <span title="">&iexcl;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-iff><td> <code title="">iff;</code> </td> <td> U+021D4 </td> <td> <span class=glyph title="">&iff;</span> </td> <tr id=entity-Ifr><td> <code title="">Ifr;</code> </td> <td> U+02111 </td> <td> <span class=glyph title="">&image;</span> </td> <tr id=entity-ifr><td> <code title="">ifr;</code> </td> <td> U+1D526 </td> <td> <span class=glyph title="">&ifr;</span> </td> <tr id=entity-Igrave><td> <code title="">Igrave;</code> </td> <td> U+000CC </td> <td> <span class=glyph title="">&Igrave;</span> </td> <tr id=entity-Igrave-legacy class=impl><td> <code title="">Igrave</code> </td> <td> U+000CC </td> <td> <span title="">&Igrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-igrave><td> <code title="">igrave;</code> </td> <td> U+000EC </td> <td> <span class=glyph title="">&igrave;</span> </td> <tr id=entity-igrave-legacy class=impl><td> <code title="">igrave</code> </td> <td> U+000EC </td> <td> <span title="">&igrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ii><td> <code title="">ii;</code> </td> <td> U+02148 </td> <td> <span class=glyph title="">&ii;</span> </td> <tr id=entity-iiiint><td> <code title="">iiiint;</code> </td> <td> U+02A0C </td> <td> <span class=glyph title="">&iiiint;</span> </td> <tr id=entity-iiint><td> <code title="">iiint;</code> </td> <td> U+0222D </td> <td> <span class=glyph title="">&iiint;</span> </td> <tr id=entity-iinfin><td> <code title="">iinfin;</code> </td> <td> U+029DC </td> <td> <span class=glyph title="">&iinfin;</span> </td> <tr id=entity-iiota><td> <code title="">iiota;</code> </td> <td> U+02129 </td> <td> <span class=glyph title="">&iiota;</span> </td> <tr id=entity-IJlig><td> <code title="">IJlig;</code> </td> <td> U+00132 </td> <td> <span class=glyph title="">&IJlig;</span> </td> <tr id=entity-ijlig><td> <code title="">ijlig;</code> </td> <td> U+00133 </td> <td> <span class=glyph title="">&ijlig;</span> </td> <tr id=entity-Im><td> <code title="">Im;</code> </td> <td> U+02111 </td> <td> <span class=glyph title="">&image;</span> </td> <tr id=entity-Imacr><td> <code title="">Imacr;</code> </td> <td> U+0012A </td> <td> <span class=glyph title="">&Imacr;</span> </td> <tr id=entity-imacr><td> <code title="">imacr;</code> </td> <td> U+0012B </td> <td> <span class=glyph title="">&imacr;</span> </td> <tr id=entity-image><td> <code title="">image;</code> </td> <td> U+02111 </td> <td> <span class=glyph title="">&image;</span> </td> <tr id=entity-ImaginaryI><td> <code title="">ImaginaryI;</code> </td> <td> U+02148 </td> <td> <span class=glyph title="">&ii;</span> </td> <tr id=entity-imagline><td> <code title="">imagline;</code> </td> <td> U+02110 </td> <td> <span class=glyph title="">&imagline;</span> </td> <tr id=entity-imagpart><td> <code title="">imagpart;</code> </td> <td> U+02111 </td> <td> <span class=glyph title="">&image;</span> </td> <tr id=entity-imath><td> <code title="">imath;</code> </td> <td> U+00131 </td> <td> <span class=glyph title="">&inodot;</span> </td> <tr id=entity-imof><td> <code title="">imof;</code> </td> <td> U+022B7 </td> <td> <span class=glyph title="">&imof;</span> </td> <tr id=entity-imped><td> <code title="">imped;</code> </td> <td> U+001B5 </td> <td> <span class=glyph title="">&imped;</span> </td> <tr id=entity-Implies><td> <code title="">Implies;</code> </td> <td> U+021D2 </td> <td> <span class=glyph title="">&Implies;</span> </td> <tr id=entity-in><td> <code title="">in;</code> </td> <td> U+02208 </td> <td> <span class=glyph title="">&in;</span> </td> <tr id=entity-incare><td> <code title="">incare;</code> </td> <td> U+02105 </td> <td> <span class=glyph title="">&incare;</span> </td> <tr id=entity-infin><td> <code title="">infin;</code> </td> <td> U+0221E </td> <td> <span class=glyph title="">&infin;</span> </td> <tr id=entity-infintie><td> <code title="">infintie;</code> </td> <td> U+029DD </td> <td> <span class=glyph title="">&infintie;</span> </td> <tr id=entity-inodot><td> <code title="">inodot;</code> </td> <td> U+00131 </td> <td> <span class=glyph title="">&inodot;</span> </td> <tr id=entity-Int><td> <code title="">Int;</code> </td> <td> U+0222C </td> <td> <span class=glyph title="">&Int;</span> </td> <tr id=entity-int><td> <code title="">int;</code> </td> <td> U+0222B </td> <td> <span class=glyph title="">&int;</span> </td> <tr id=entity-intcal><td> <code title="">intcal;</code> </td> <td> U+022BA </td> <td> <span class=glyph title="">&intcal;</span> </td> <tr id=entity-integers><td> <code title="">integers;</code> </td> <td> U+02124 </td> <td> <span class=glyph title="">&integers;</span> </td> <tr id=entity-Integral><td> <code title="">Integral;</code> </td> <td> U+0222B </td> <td> <span class=glyph title="">&int;</span> </td> <tr id=entity-intercal><td> <code title="">intercal;</code> </td> <td> U+022BA </td> <td> <span class=glyph title="">&intcal;</span> </td> <tr id=entity-Intersection><td> <code title="">Intersection;</code> </td> <td> U+022C2 </td> <td> <span class=glyph title="">&bigcap;</span> </td> <tr id=entity-intlarhk><td> <code title="">intlarhk;</code> </td> <td> U+02A17 </td> <td> <span class=glyph title="">&intlarhk;</span> </td> <tr id=entity-intprod><td> <code title="">intprod;</code> </td> <td> U+02A3C </td> <td> <span class=glyph title="">&iprod;</span> </td> <tr id=entity-InvisibleComma><td> <code title="">InvisibleComma;</code> </td> <td> U+02063 </td> <td> <span class=glyph title="">&ic;</span> </td> <tr id=entity-InvisibleTimes><td> <code title="">InvisibleTimes;</code> </td> <td> U+02062 </td> <td> <span class=glyph title="">&it;</span> </td> <tr id=entity-IOcy><td> <code title="">IOcy;</code> </td> <td> U+00401 </td> <td> <span class=glyph title="">&IOcy;</span> </td> <tr id=entity-iocy><td> <code title="">iocy;</code> </td> <td> U+00451 </td> <td> <span class=glyph title="">&iocy;</span> </td> <tr id=entity-Iogon><td> <code title="">Iogon;</code> </td> <td> U+0012E </td> <td> <span class=glyph title="">&Iogon;</span> </td> <tr id=entity-iogon><td> <code title="">iogon;</code> </td> <td> U+0012F </td> <td> <span class=glyph title="">&iogon;</span> </td> <tr id=entity-Iopf><td> <code title="">Iopf;</code> </td> <td> U+1D540 </td> <td> <span class=glyph title="">&Iopf;</span> </td> <tr id=entity-iopf><td> <code title="">iopf;</code> </td> <td> U+1D55A </td> <td> <span class=glyph title="">&iopf;</span> </td> <tr id=entity-Iota><td> <code title="">Iota;</code> </td> <td> U+00399 </td> <td> <span class=glyph title="">&Iota;</span> </td> <tr id=entity-iota><td> <code title="">iota;</code> </td> <td> U+003B9 </td> <td> <span class=glyph title="">&iota;</span> </td> <tr id=entity-iprod><td> <code title="">iprod;</code> </td> <td> U+02A3C </td> <td> <span class=glyph title="">&iprod;</span> </td> <tr id=entity-iquest><td> <code title="">iquest;</code> </td> <td> U+000BF </td> <td> <span class=glyph title="">&iquest;</span> </td> <tr id=entity-iquest-legacy class=impl><td> <code title="">iquest</code> </td> <td> U+000BF </td> <td> <span title="">&iquest;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Iscr><td> <code title="">Iscr;</code> </td> <td> U+02110 </td> <td> <span class=glyph title="">&imagline;</span> </td> <tr id=entity-iscr><td> <code title="">iscr;</code> </td> <td> U+1D4BE </td> <td> <span class=glyph title="">&iscr;</span> </td> <tr id=entity-isin><td> <code title="">isin;</code> </td> <td> U+02208 </td> <td> <span class=glyph title="">&in;</span> </td> <tr id=entity-isindot><td> <code title="">isindot;</code> </td> <td> U+022F5 </td> <td> <span class=glyph title="">&isindot;</span> </td> <tr id=entity-isinE><td> <code title="">isinE;</code> </td> <td> U+022F9 </td> <td> <span class=glyph title="">&isinE;</span> </td> <tr id=entity-isins><td> <code title="">isins;</code> </td> <td> U+022F4 </td> <td> <span class=glyph title="">&isins;</span> </td> <tr id=entity-isinsv><td> <code title="">isinsv;</code> </td> <td> U+022F3 </td> <td> <span class=glyph title="">&isinsv;</span> </td> <tr id=entity-isinv><td> <code title="">isinv;</code> </td> <td> U+02208 </td> <td> <span class=glyph title="">&in;</span> </td> <tr id=entity-it><td> <code title="">it;</code> </td> <td> U+02062 </td> <td> <span class=glyph title="">&it;</span> </td> <tr id=entity-Itilde><td> <code title="">Itilde;</code> </td> <td> U+00128 </td> <td> <span class=glyph title="">&Itilde;</span> </td> <tr id=entity-itilde><td> <code title="">itilde;</code> </td> <td> U+00129 </td> <td> <span class=glyph title="">&itilde;</span> </td> <tr id=entity-Iukcy><td> <code title="">Iukcy;</code> </td> <td> U+00406 </td> <td> <span class=glyph title="">&Iukcy;</span> </td> <tr id=entity-iukcy><td> <code title="">iukcy;</code> </td> <td> U+00456 </td> <td> <span class=glyph title="">&iukcy;</span> </td> <tr id=entity-Iuml><td> <code title="">Iuml;</code> </td> <td> U+000CF </td> <td> <span class=glyph title="">&Iuml;</span> </td> <tr id=entity-Iuml-legacy class=impl><td> <code title="">Iuml</code> </td> <td> U+000CF </td> <td> <span title="">&Iuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-iuml><td> <code title="">iuml;</code> </td> <td> U+000EF </td> <td> <span class=glyph title="">&iuml;</span> </td> <tr id=entity-iuml-legacy class=impl><td> <code title="">iuml</code> </td> <td> U+000EF </td> <td> <span title="">&iuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Jcirc><td> <code title="">Jcirc;</code> </td> <td> U+00134 </td> <td> <span class=glyph title="">&Jcirc;</span> </td> <tr id=entity-jcirc><td> <code title="">jcirc;</code> </td> <td> U+00135 </td> <td> <span class=glyph title="">&jcirc;</span> </td> <tr id=entity-Jcy><td> <code title="">Jcy;</code> </td> <td> U+00419 </td> <td> <span class=glyph title="">&Jcy;</span> </td> <tr id=entity-jcy><td> <code title="">jcy;</code> </td> <td> U+00439 </td> <td> <span class=glyph title="">&jcy;</span> </td> <tr id=entity-Jfr><td> <code title="">Jfr;</code> </td> <td> U+1D50D </td> <td> <span class=glyph title="">&Jfr;</span> </td> <tr id=entity-jfr><td> <code title="">jfr;</code> </td> <td> U+1D527 </td> <td> <span class=glyph title="">&jfr;</span> </td> <tr id=entity-jmath><td> <code title="">jmath;</code> </td> <td> U+00237 </td> <td> <span class=glyph title="">&jmath;</span> </td> <tr id=entity-Jopf><td> <code title="">Jopf;</code> </td> <td> U+1D541 </td> <td> <span class=glyph title="">&Jopf;</span> </td> <tr id=entity-jopf><td> <code title="">jopf;</code> </td> <td> U+1D55B </td> <td> <span class=glyph title="">&jopf;</span> </td> <tr id=entity-Jscr><td> <code title="">Jscr;</code> </td> <td> U+1D4A5 </td> <td> <span class=glyph title="">&Jscr;</span> </td> <tr id=entity-jscr><td> <code title="">jscr;</code> </td> <td> U+1D4BF </td> <td> <span class=glyph title="">&jscr;</span> </td> <tr id=entity-Jsercy><td> <code title="">Jsercy;</code> </td> <td> U+00408 </td> <td> <span class=glyph title="">&Jsercy;</span> </td> <tr id=entity-jsercy><td> <code title="">jsercy;</code> </td> <td> U+00458 </td> <td> <span class=glyph title="">&jsercy;</span> </td> <tr id=entity-Jukcy><td> <code title="">Jukcy;</code> </td> <td> U+00404 </td> <td> <span class=glyph title="">&Jukcy;</span> </td> <tr id=entity-jukcy><td> <code title="">jukcy;</code> </td> <td> U+00454 </td> <td> <span class=glyph title="">&jukcy;</span> </td> <tr id=entity-Kappa><td> <code title="">Kappa;</code> </td> <td> U+0039A </td> <td> <span class=glyph title="">&Kappa;</span> </td> <tr id=entity-kappa><td> <code title="">kappa;</code> </td> <td> U+003BA </td> <td> <span class=glyph title="">&kappa;</span> </td> <tr id=entity-kappav><td> <code title="">kappav;</code> </td> <td> U+003F0 </td> <td> <span class=glyph title="">&kappav;</span> </td> <tr id=entity-Kcedil><td> <code title="">Kcedil;</code> </td> <td> U+00136 </td> <td> <span class=glyph title="">&Kcedil;</span> </td> <tr id=entity-kcedil><td> <code title="">kcedil;</code> </td> <td> U+00137 </td> <td> <span class=glyph title="">&kcedil;</span> </td> <tr id=entity-Kcy><td> <code title="">Kcy;</code> </td> <td> U+0041A </td> <td> <span class=glyph title="">&Kcy;</span> </td> <tr id=entity-kcy><td> <code title="">kcy;</code> </td> <td> U+0043A </td> <td> <span class=glyph title="">&kcy;</span> </td> <tr id=entity-Kfr><td> <code title="">Kfr;</code> </td> <td> U+1D50E </td> <td> <span class=glyph title="">&Kfr;</span> </td> <tr id=entity-kfr><td> <code title="">kfr;</code> </td> <td> U+1D528 </td> <td> <span class=glyph title="">&kfr;</span> </td> <tr id=entity-kgreen><td> <code title="">kgreen;</code> </td> <td> U+00138 </td> <td> <span class=glyph title="">&kgreen;</span> </td> <tr id=entity-KHcy><td> <code title="">KHcy;</code> </td> <td> U+00425 </td> <td> <span class=glyph title="">&KHcy;</span> </td> <tr id=entity-khcy><td> <code title="">khcy;</code> </td> <td> U+00445 </td> <td> <span class=glyph title="">&khcy;</span> </td> <tr id=entity-KJcy><td> <code title="">KJcy;</code> </td> <td> U+0040C </td> <td> <span class=glyph title="">&KJcy;</span> </td> <tr id=entity-kjcy><td> <code title="">kjcy;</code> </td> <td> U+0045C </td> <td> <span class=glyph title="">&kjcy;</span> </td> <tr id=entity-Kopf><td> <code title="">Kopf;</code> </td> <td> U+1D542 </td> <td> <span class=glyph title="">&Kopf;</span> </td> <tr id=entity-kopf><td> <code title="">kopf;</code> </td> <td> U+1D55C </td> <td> <span class=glyph title="">&kopf;</span> </td> <tr id=entity-Kscr><td> <code title="">Kscr;</code> </td> <td> U+1D4A6 </td> <td> <span class=glyph title="">&Kscr;</span> </td> <tr id=entity-kscr><td> <code title="">kscr;</code> </td> <td> U+1D4C0 </td> <td> <span class=glyph title="">&kscr;</span> </td> <tr id=entity-lAarr><td> <code title="">lAarr;</code> </td> <td> U+021DA </td> <td> <span class=glyph title="">&Lleftarrow;</span> </td> <tr id=entity-Lacute><td> <code title="">Lacute;</code> </td> <td> U+00139 </td> <td> <span class=glyph title="">&Lacute;</span> </td> <tr id=entity-lacute><td> <code title="">lacute;</code> </td> <td> U+0013A </td> <td> <span class=glyph title="">&lacute;</span> </td> <tr id=entity-laemptyv><td> <code title="">laemptyv;</code> </td> <td> U+029B4 </td> <td> <span class=glyph title="">&laemptyv;</span> </td> <tr id=entity-lagran><td> <code title="">lagran;</code> </td> <td> U+02112 </td> <td> <span class=glyph title="">&lagran;</span> </td> <tr id=entity-Lambda><td> <code title="">Lambda;</code> </td> <td> U+0039B </td> <td> <span class=glyph title="">&Lambda;</span> </td> <tr id=entity-lambda><td> <code title="">lambda;</code> </td> <td> U+003BB </td> <td> <span class=glyph title="">&lambda;</span> </td> <tr id=entity-Lang><td> <code title="">Lang;</code> </td> <td> U+027EA </td> <td> <span class=glyph title="">&Lang;</span> </td> <tr id=entity-lang><td> <code title="">lang;</code> </td> <td> U+027E8 </td> <td> <span class=glyph title="">&#x27E8;</span> </td> <tr id=entity-langd><td> <code title="">langd;</code> </td> <td> U+02991 </td> <td> <span class=glyph title="">&langd;</span> </td> <tr id=entity-langle><td> <code title="">langle;</code> </td> <td> U+027E8 </td> <td> <span class=glyph title="">&#x27E8;</span> </td> <tr id=entity-lap><td> <code title="">lap;</code> </td> <td> U+02A85 </td> <td> <span class=glyph title="">&lap;</span> </td> <tr id=entity-Laplacetrf><td> <code title="">Laplacetrf;</code> </td> <td> U+02112 </td> <td> <span class=glyph title="">&lagran;</span> </td> <tr id=entity-laquo><td> <code title="">laquo;</code> </td> <td> U+000AB </td> <td> <span class=glyph title="">&laquo;</span> </td> <tr id=entity-laquo-legacy class=impl><td> <code title="">laquo</code> </td> <td> U+000AB </td> <td> <span title="">&laquo;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Larr><td> <code title="">Larr;</code> </td> <td> U+0219E </td> <td> <span class=glyph title="">&twoheadleftarrow;</span> </td> <tr id=entity-lArr><td> <code title="">lArr;</code> </td> <td> U+021D0 </td> <td> <span class=glyph title="">&lArr;</span> </td> <tr id=entity-larr><td> <code title="">larr;</code> </td> <td> U+02190 </td> <td> <span class=glyph title="">&slarr;</span> </td> <tr id=entity-larrb><td> <code title="">larrb;</code> </td> <td> U+021E4 </td> <td> <span class=glyph title="">&larrb;</span> </td> <tr id=entity-larrbfs><td> <code title="">larrbfs;</code> </td> <td> U+0291F </td> <td> <span class=glyph title="">&larrbfs;</span> </td> <tr id=entity-larrfs><td> <code title="">larrfs;</code> </td> <td> U+0291D </td> <td> <span class=glyph title="">&larrfs;</span> </td> <tr id=entity-larrhk><td> <code title="">larrhk;</code> </td> <td> U+021A9 </td> <td> <span class=glyph title="">&hookleftarrow;</span> </td> <tr id=entity-larrlp><td> <code title="">larrlp;</code> </td> <td> U+021AB </td> <td> <span class=glyph title="">&looparrowleft;</span> </td> <tr id=entity-larrpl><td> <code title="">larrpl;</code> </td> <td> U+02939 </td> <td> <span class=glyph title="">&larrpl;</span> </td> <tr id=entity-larrsim><td> <code title="">larrsim;</code> </td> <td> U+02973 </td> <td> <span class=glyph title="">&larrsim;</span> </td> <tr id=entity-larrtl><td> <code title="">larrtl;</code> </td> <td> U+021A2 </td> <td> <span class=glyph title="">&leftarrowtail;</span> </td> <tr id=entity-lat><td> <code title="">lat;</code> </td> <td> U+02AAB </td> <td> <span class=glyph title="">&lat;</span> </td> <tr id=entity-lAtail><td> <code title="">lAtail;</code> </td> <td> U+0291B </td> <td> <span class=glyph title="">&lAtail;</span> </td> <tr id=entity-latail><td> <code title="">latail;</code> </td> <td> U+02919 </td> <td> <span class=glyph title="">&latail;</span> </td> <tr id=entity-late><td> <code title="">late;</code> </td> <td> U+02AAD </td> <td> <span class=glyph title="">&late;</span> </td> <tr id=entity-lates><td> <code title="">lates;</code> </td> <td> U+02AAD U+0FE00 </td> <td> <span class="glyph compound" title="">&late;&#xfe00;</span> </td> <tr id=entity-lBarr><td> <code title="">lBarr;</code> </td> <td> U+0290E </td> <td> <span class=glyph title="">&lBarr;</span> </td> <tr id=entity-lbarr><td> <code title="">lbarr;</code> </td> <td> U+0290C </td> <td> <span class=glyph title="">&lbarr;</span> </td> <tr id=entity-lbbrk><td> <code title="">lbbrk;</code> </td> <td> U+02772 </td> <td> <span class=glyph title="">&lbbrk;</span> </td> <tr id=entity-lbrace><td> <code title="">lbrace;</code> </td> <td> U+0007B </td> <td> <span class=glyph title="">{</span> </td> <tr id=entity-lbrack><td> <code title="">lbrack;</code> </td> <td> U+0005B </td> <td> <span class=glyph title="">[</span> </td> <tr id=entity-lbrke><td> <code title="">lbrke;</code> </td> <td> U+0298B </td> <td> <span class=glyph title="">&lbrke;</span> </td> <tr id=entity-lbrksld><td> <code title="">lbrksld;</code> </td> <td> U+0298F </td> <td> <span class=glyph title="">&lbrksld;</span> </td> <tr id=entity-lbrkslu><td> <code title="">lbrkslu;</code> </td> <td> U+0298D </td> <td> <span class=glyph title="">&lbrkslu;</span> </td> <tr id=entity-Lcaron><td> <code title="">Lcaron;</code> </td> <td> U+0013D </td> <td> <span class=glyph title="">&Lcaron;</span> </td> <tr id=entity-lcaron><td> <code title="">lcaron;</code> </td> <td> U+0013E </td> <td> <span class=glyph title="">&lcaron;</span> </td> <tr id=entity-Lcedil><td> <code title="">Lcedil;</code> </td> <td> U+0013B </td> <td> <span class=glyph title="">&Lcedil;</span> </td> <tr id=entity-lcedil><td> <code title="">lcedil;</code> </td> <td> U+0013C </td> <td> <span class=glyph title="">&lcedil;</span> </td> <tr id=entity-lceil><td> <code title="">lceil;</code> </td> <td> U+02308 </td> <td> <span class=glyph title="">&lceil;</span> </td> <tr id=entity-lcub><td> <code title="">lcub;</code> </td> <td> U+0007B </td> <td> <span class=glyph title="">{</span> </td> <tr id=entity-Lcy><td> <code title="">Lcy;</code> </td> <td> U+0041B </td> <td> <span class=glyph title="">&Lcy;</span> </td> <tr id=entity-lcy><td> <code title="">lcy;</code> </td> <td> U+0043B </td> <td> <span class=glyph title="">&lcy;</span> </td> <tr id=entity-ldca><td> <code title="">ldca;</code> </td> <td> U+02936 </td> <td> <span class=glyph title="">&ldca;</span> </td> <tr id=entity-ldquo><td> <code title="">ldquo;</code> </td> <td> U+0201C </td> <td> <span class=glyph title="">&ldquo;</span> </td> <tr id=entity-ldquor><td> <code title="">ldquor;</code> </td> <td> U+0201E </td> <td> <span class=glyph title="">&ldquor;</span> </td> <tr id=entity-ldrdhar><td> <code title="">ldrdhar;</code> </td> <td> U+02967 </td> <td> <span class=glyph title="">&ldrdhar;</span> </td> <tr id=entity-ldrushar><td> <code title="">ldrushar;</code> </td> <td> U+0294B </td> <td> <span class=glyph title="">&ldrushar;</span> </td> <tr id=entity-ldsh><td> <code title="">ldsh;</code> </td> <td> U+021B2 </td> <td> <span class=glyph title="">&ldsh;</span> </td> <tr id=entity-lE><td> <code title="">lE;</code> </td> <td> U+02266 </td> <td> <span class=glyph title="">&leqq;</span> </td> <tr id=entity-le><td> <code title="">le;</code> </td> <td> U+02264 </td> <td> <span class=glyph title="">&le;</span> </td> <tr id=entity-LeftAngleBracket><td> <code title="">LeftAngleBracket;</code> </td> <td> U+027E8 </td> <td> <span class=glyph title="">&#x27E8;</span> </td> <tr id=entity-LeftArrow><td> <code title="">LeftArrow;</code> </td> <td> U+02190 </td> <td> <span class=glyph title="">&slarr;</span> </td> <tr id=entity-Leftarrow><td> <code title="">Leftarrow;</code> </td> <td> U+021D0 </td> <td> <span class=glyph title="">&lArr;</span> </td> <tr id=entity-leftarrow><td> <code title="">leftarrow;</code> </td> <td> U+02190 </td> <td> <span class=glyph title="">&slarr;</span> </td> <tr id=entity-LeftArrowBar><td> <code title="">LeftArrowBar;</code> </td> <td> U+021E4 </td> <td> <span class=glyph title="">&larrb;</span> </td> <tr id=entity-LeftArrowRightArrow><td> <code title="">LeftArrowRightArrow;</code> </td> <td> U+021C6 </td> <td> <span class=glyph title="">&leftrightarrows;</span> </td> <tr id=entity-leftarrowtail><td> <code title="">leftarrowtail;</code> </td> <td> U+021A2 </td> <td> <span class=glyph title="">&leftarrowtail;</span> </td> <tr id=entity-LeftCeiling><td> <code title="">LeftCeiling;</code> </td> <td> U+02308 </td> <td> <span class=glyph title="">&lceil;</span> </td> <tr id=entity-LeftDoubleBracket><td> <code title="">LeftDoubleBracket;</code> </td> <td> U+027E6 </td> <td> <span class=glyph title="">&lobrk;</span> </td> <tr id=entity-LeftDownTeeVector><td> <code title="">LeftDownTeeVector;</code> </td> <td> U+02961 </td> <td> <span class=glyph title="">&LeftDownTeeVector;</span> </td> <tr id=entity-LeftDownVector><td> <code title="">LeftDownVector;</code> </td> <td> U+021C3 </td> <td> <span class=glyph title="">&downharpoonleft;</span> </td> <tr id=entity-LeftDownVectorBar><td> <code title="">LeftDownVectorBar;</code> </td> <td> U+02959 </td> <td> <span class=glyph title="">&LeftDownVectorBar;</span> </td> <tr id=entity-LeftFloor><td> <code title="">LeftFloor;</code> </td> <td> U+0230A </td> <td> <span class=glyph title="">&lfloor;</span> </td> <tr id=entity-leftharpoondown><td> <code title="">leftharpoondown;</code> </td> <td> U+021BD </td> <td> <span class=glyph title="">&leftharpoondown;</span> </td> <tr id=entity-leftharpoonup><td> <code title="">leftharpoonup;</code> </td> <td> U+021BC </td> <td> <span class=glyph title="">&lharu;</span> </td> <tr id=entity-leftleftarrows><td> <code title="">leftleftarrows;</code> </td> <td> U+021C7 </td> <td> <span class=glyph title="">&llarr;</span> </td> <tr id=entity-LeftRightArrow><td> <code title="">LeftRightArrow;</code> </td> <td> U+02194 </td> <td> <span class=glyph title="">&leftrightarrow;</span> </td> <tr id=entity-Leftrightarrow><td> <code title="">Leftrightarrow;</code> </td> <td> U+021D4 </td> <td> <span class=glyph title="">&iff;</span> </td> <tr id=entity-leftrightarrow><td> <code title="">leftrightarrow;</code> </td> <td> U+02194 </td> <td> <span class=glyph title="">&leftrightarrow;</span> </td> <tr id=entity-leftrightarrows><td> <code title="">leftrightarrows;</code> </td> <td> U+021C6 </td> <td> <span class=glyph title="">&leftrightarrows;</span> </td> <tr id=entity-leftrightharpoons><td> <code title="">leftrightharpoons;</code> </td> <td> U+021CB </td> <td> <span class=glyph title="">&leftrightharpoons;</span> </td> <tr id=entity-leftrightsquigarrow><td> <code title="">leftrightsquigarrow;</code> </td> <td> U+021AD </td> <td> <span class=glyph title="">&leftrightsquigarrow;</span> </td> <tr id=entity-LeftRightVector><td> <code title="">LeftRightVector;</code> </td> <td> U+0294E </td> <td> <span class=glyph title="">&LeftRightVector;</span> </td> <tr id=entity-LeftTee><td> <code title="">LeftTee;</code> </td> <td> U+022A3 </td> <td> <span class=glyph title="">&dashv;</span> </td> <tr id=entity-LeftTeeArrow><td> <code title="">LeftTeeArrow;</code> </td> <td> U+021A4 </td> <td> <span class=glyph title="">&mapstoleft;</span> </td> <tr id=entity-LeftTeeVector><td> <code title="">LeftTeeVector;</code> </td> <td> U+0295A </td> <td> <span class=glyph title="">&LeftTeeVector;</span> </td> <tr id=entity-leftthreetimes><td> <code title="">leftthreetimes;</code> </td> <td> U+022CB </td> <td> <span class=glyph title="">&lthree;</span> </td> <tr id=entity-LeftTriangle><td> <code title="">LeftTriangle;</code> </td> <td> U+022B2 </td> <td> <span class=glyph title="">&vartriangleleft;</span> </td> <tr id=entity-LeftTriangleBar><td> <code title="">LeftTriangleBar;</code> </td> <td> U+029CF </td> <td> <span class=glyph title="">&LeftTriangleBar;</span> </td> <tr id=entity-LeftTriangleEqual><td> <code title="">LeftTriangleEqual;</code> </td> <td> U+022B4 </td> <td> <span class=glyph title="">&ltrie;</span> </td> <tr id=entity-LeftUpDownVector><td> <code title="">LeftUpDownVector;</code> </td> <td> U+02951 </td> <td> <span class=glyph title="">&LeftUpDownVector;</span> </td> <tr id=entity-LeftUpTeeVector><td> <code title="">LeftUpTeeVector;</code> </td> <td> U+02960 </td> <td> <span class=glyph title="">&LeftUpTeeVector;</span> </td> <tr id=entity-LeftUpVector><td> <code title="">LeftUpVector;</code> </td> <td> U+021BF </td> <td> <span class=glyph title="">&upharpoonleft;</span> </td> <tr id=entity-LeftUpVectorBar><td> <code title="">LeftUpVectorBar;</code> </td> <td> U+02958 </td> <td> <span class=glyph title="">&LeftUpVectorBar;</span> </td> <tr id=entity-LeftVector><td> <code title="">LeftVector;</code> </td> <td> U+021BC </td> <td> <span class=glyph title="">&lharu;</span> </td> <tr id=entity-LeftVectorBar><td> <code title="">LeftVectorBar;</code> </td> <td> U+02952 </td> <td> <span class=glyph title="">&LeftVectorBar;</span> </td> <tr id=entity-lEg><td> <code title="">lEg;</code> </td> <td> U+02A8B </td> <td> <span class=glyph title="">&lesseqqgtr;</span> </td> <tr id=entity-leg><td> <code title="">leg;</code> </td> <td> U+022DA </td> <td> <span class=glyph title="">&lesseqgtr;</span> </td> <tr id=entity-leq><td> <code title="">leq;</code> </td> <td> U+02264 </td> <td> <span class=glyph title="">&le;</span> </td> <tr id=entity-leqq><td> <code title="">leqq;</code> </td> <td> U+02266 </td> <td> <span class=glyph title="">&leqq;</span> </td> <tr id=entity-leqslant><td> <code title="">leqslant;</code> </td> <td> U+02A7D </td> <td> <span class=glyph title="">&les;</span> </td> <tr id=entity-les><td> <code title="">les;</code> </td> <td> U+02A7D </td> <td> <span class=glyph title="">&les;</span> </td> <tr id=entity-lescc><td> <code title="">lescc;</code> </td> <td> U+02AA8 </td> <td> <span class=glyph title="">&lescc;</span> </td> <tr id=entity-lesdot><td> <code title="">lesdot;</code> </td> <td> U+02A7F </td> <td> <span class=glyph title="">&lesdot;</span> </td> <tr id=entity-lesdoto><td> <code title="">lesdoto;</code> </td> <td> U+02A81 </td> <td> <span class=glyph title="">&lesdoto;</span> </td> <tr id=entity-lesdotor><td> <code title="">lesdotor;</code> </td> <td> U+02A83 </td> <td> <span class=glyph title="">&lesdotor;</span> </td> <tr id=entity-lesg><td> <code title="">lesg;</code> </td> <td> U+022DA U+0FE00 </td> <td> <span class="glyph compound" title="">&lesseqgtr;&#xfe00;</span> </td> <tr id=entity-lesges><td> <code title="">lesges;</code> </td> <td> U+02A93 </td> <td> <span class=glyph title="">&lesges;</span> </td> <tr id=entity-lessapprox><td> <code title="">lessapprox;</code> </td> <td> U+02A85 </td> <td> <span class=glyph title="">&lap;</span> </td> <tr id=entity-lessdot><td> <code title="">lessdot;</code> </td> <td> U+022D6 </td> <td> <span class=glyph title="">&lessdot;</span> </td> <tr id=entity-lesseqgtr><td> <code title="">lesseqgtr;</code> </td> <td> U+022DA </td> <td> <span class=glyph title="">&lesseqgtr;</span> </td> <tr id=entity-lesseqqgtr><td> <code title="">lesseqqgtr;</code> </td> <td> U+02A8B </td> <td> <span class=glyph title="">&lesseqqgtr;</span> </td> <tr id=entity-LessEqualGreater><td> <code title="">LessEqualGreater;</code> </td> <td> U+022DA </td> <td> <span class=glyph title="">&lesseqgtr;</span> </td> <tr id=entity-LessFullEqual><td> <code title="">LessFullEqual;</code> </td> <td> U+02266 </td> <td> <span class=glyph title="">&leqq;</span> </td> <tr id=entity-LessGreater><td> <code title="">LessGreater;</code> </td> <td> U+02276 </td> <td> <span class=glyph title="">&lessgtr;</span> </td> <tr id=entity-lessgtr><td> <code title="">lessgtr;</code> </td> <td> U+02276 </td> <td> <span class=glyph title="">&lessgtr;</span> </td> <tr id=entity-LessLess><td> <code title="">LessLess;</code> </td> <td> U+02AA1 </td> <td> <span class=glyph title="">&LessLess;</span> </td> <tr id=entity-lesssim><td> <code title="">lesssim;</code> </td> <td> U+02272 </td> <td> <span class=glyph title="">&lesssim;</span> </td> <tr id=entity-LessSlantEqual><td> <code title="">LessSlantEqual;</code> </td> <td> U+02A7D </td> <td> <span class=glyph title="">&les;</span> </td> <tr id=entity-LessTilde><td> <code title="">LessTilde;</code> </td> <td> U+02272 </td> <td> <span class=glyph title="">&lesssim;</span> </td> <tr id=entity-lfisht><td> <code title="">lfisht;</code> </td> <td> U+0297C </td> <td> <span class=glyph title="">&lfisht;</span> </td> <tr id=entity-lfloor><td> <code title="">lfloor;</code> </td> <td> U+0230A </td> <td> <span class=glyph title="">&lfloor;</span> </td> <tr id=entity-Lfr><td> <code title="">Lfr;</code> </td> <td> U+1D50F </td> <td> <span class=glyph title="">&Lfr;</span> </td> <tr id=entity-lfr><td> <code title="">lfr;</code> </td> <td> U+1D529 </td> <td> <span class=glyph title="">&lfr;</span> </td> <tr id=entity-lg><td> <code title="">lg;</code> </td> <td> U+02276 </td> <td> <span class=glyph title="">&lessgtr;</span> </td> <tr id=entity-lgE><td> <code title="">lgE;</code> </td> <td> U+02A91 </td> <td> <span class=glyph title="">&lgE;</span> </td> <tr id=entity-lHar><td> <code title="">lHar;</code> </td> <td> U+02962 </td> <td> <span class=glyph title="">&lHar;</span> </td> <tr id=entity-lhard><td> <code title="">lhard;</code> </td> <td> U+021BD </td> <td> <span class=glyph title="">&leftharpoondown;</span> </td> <tr id=entity-lharu><td> <code title="">lharu;</code> </td> <td> U+021BC </td> <td> <span class=glyph title="">&lharu;</span> </td> <tr id=entity-lharul><td> <code title="">lharul;</code> </td> <td> U+0296A </td> <td> <span class=glyph title="">&lharul;</span> </td> <tr id=entity-lhblk><td> <code title="">lhblk;</code> </td> <td> U+02584 </td> <td> <span class=glyph title="">&lhblk;</span> </td> <tr id=entity-LJcy><td> <code title="">LJcy;</code> </td> <td> U+00409 </td> <td> <span class=glyph title="">&LJcy;</span> </td> <tr id=entity-ljcy><td> <code title="">ljcy;</code> </td> <td> U+00459 </td> <td> <span class=glyph title="">&ljcy;</span> </td> <tr id=entity-Ll><td> <code title="">Ll;</code> </td> <td> U+022D8 </td> <td> <span class=glyph title="">&Ll;</span> </td> <tr id=entity-ll><td> <code title="">ll;</code> </td> <td> U+0226A </td> <td> <span class=glyph title="">&ll;</span> </td> <tr id=entity-llarr><td> <code title="">llarr;</code> </td> <td> U+021C7 </td> <td> <span class=glyph title="">&llarr;</span> </td> <tr id=entity-llcorner><td> <code title="">llcorner;</code> </td> <td> U+0231E </td> <td> <span class=glyph title="">&dlcorn;</span> </td> <tr id=entity-Lleftarrow><td> <code title="">Lleftarrow;</code> </td> <td> U+021DA </td> <td> <span class=glyph title="">&Lleftarrow;</span> </td> <tr id=entity-llhard><td> <code title="">llhard;</code> </td> <td> U+0296B </td> <td> <span class=glyph title="">&llhard;</span> </td> <tr id=entity-lltri><td> <code title="">lltri;</code> </td> <td> U+025FA </td> <td> <span class=glyph title="">&lltri;</span> </td> <tr id=entity-Lmidot><td> <code title="">Lmidot;</code> </td> <td> U+0013F </td> <td> <span class=glyph title="">&Lmidot;</span> </td> <tr id=entity-lmidot><td> <code title="">lmidot;</code> </td> <td> U+00140 </td> <td> <span class=glyph title="">&lmidot;</span> </td> <tr id=entity-lmoust><td> <code title="">lmoust;</code> </td> <td> U+023B0 </td> <td> <span class=glyph title="">&lmoust;</span> </td> <tr id=entity-lmoustache><td> <code title="">lmoustache;</code> </td> <td> U+023B0 </td> <td> <span class=glyph title="">&lmoust;</span> </td> <tr id=entity-lnap><td> <code title="">lnap;</code> </td> <td> U+02A89 </td> <td> <span class=glyph title="">&lnapprox;</span> </td> <tr id=entity-lnapprox><td> <code title="">lnapprox;</code> </td> <td> U+02A89 </td> <td> <span class=glyph title="">&lnapprox;</span> </td> <tr id=entity-lnE><td> <code title="">lnE;</code> </td> <td> U+02268 </td> <td> <span class=glyph title="">&lneqq;</span> </td> <tr id=entity-lne><td> <code title="">lne;</code> </td> <td> U+02A87 </td> <td> <span class=glyph title="">&lne;</span> </td> <tr id=entity-lneq><td> <code title="">lneq;</code> </td> <td> U+02A87 </td> <td> <span class=glyph title="">&lne;</span> </td> <tr id=entity-lneqq><td> <code title="">lneqq;</code> </td> <td> U+02268 </td> <td> <span class=glyph title="">&lneqq;</span> </td> <tr id=entity-lnsim><td> <code title="">lnsim;</code> </td> <td> U+022E6 </td> <td> <span class=glyph title="">&lnsim;</span> </td> <tr id=entity-loang><td> <code title="">loang;</code> </td> <td> U+027EC </td> <td> <span class=glyph title="">&loang;</span> </td> <tr id=entity-loarr><td> <code title="">loarr;</code> </td> <td> U+021FD </td> <td> <span class=glyph title="">&loarr;</span> </td> <tr id=entity-lobrk><td> <code title="">lobrk;</code> </td> <td> U+027E6 </td> <td> <span class=glyph title="">&lobrk;</span> </td> <tr id=entity-LongLeftArrow><td> <code title="">LongLeftArrow;</code> </td> <td> U+027F5 </td> <td> <span class=glyph title="">&xlarr;</span> </td> <tr id=entity-Longleftarrow><td> <code title="">Longleftarrow;</code> </td> <td> U+027F8 </td> <td> <span class=glyph title="">&Longleftarrow;</span> </td> <tr id=entity-longleftarrow><td> <code title="">longleftarrow;</code> </td> <td> U+027F5 </td> <td> <span class=glyph title="">&xlarr;</span> </td> <tr id=entity-LongLeftRightArrow><td> <code title="">LongLeftRightArrow;</code> </td> <td> U+027F7 </td> <td> <span class=glyph title="">&xharr;</span> </td> <tr id=entity-Longleftrightarrow><td> <code title="">Longleftrightarrow;</code> </td> <td> U+027FA </td> <td> <span class=glyph title="">&DoubleLongLeftRightArrow;</span> </td> <tr id=entity-longleftrightarrow><td> <code title="">longleftrightarrow;</code> </td> <td> U+027F7 </td> <td> <span class=glyph title="">&xharr;</span> </td> <tr id=entity-longmapsto><td> <code title="">longmapsto;</code> </td> <td> U+027FC </td> <td> <span class=glyph title="">&xmap;</span> </td> <tr id=entity-LongRightArrow><td> <code title="">LongRightArrow;</code> </td> <td> U+027F6 </td> <td> <span class=glyph title="">&xrarr;</span> </td> <tr id=entity-Longrightarrow><td> <code title="">Longrightarrow;</code> </td> <td> U+027F9 </td> <td> <span class=glyph title="">&xrArr;</span> </td> <tr id=entity-longrightarrow><td> <code title="">longrightarrow;</code> </td> <td> U+027F6 </td> <td> <span class=glyph title="">&xrarr;</span> </td> <tr id=entity-looparrowleft><td> <code title="">looparrowleft;</code> </td> <td> U+021AB </td> <td> <span class=glyph title="">&looparrowleft;</span> </td> <tr id=entity-looparrowright><td> <code title="">looparrowright;</code> </td> <td> U+021AC </td> <td> <span class=glyph title="">&rarrlp;</span> </td> <tr id=entity-lopar><td> <code title="">lopar;</code> </td> <td> U+02985 </td> <td> <span class=glyph title="">&lopar;</span> </td> <tr id=entity-Lopf><td> <code title="">Lopf;</code> </td> <td> U+1D543 </td> <td> <span class=glyph title="">&Lopf;</span> </td> <tr id=entity-lopf><td> <code title="">lopf;</code> </td> <td> U+1D55D </td> <td> <span class=glyph title="">&lopf;</span> </td> <tr id=entity-loplus><td> <code title="">loplus;</code> </td> <td> U+02A2D </td> <td> <span class=glyph title="">&loplus;</span> </td> <tr id=entity-lotimes><td> <code title="">lotimes;</code> </td> <td> U+02A34 </td> <td> <span class=glyph title="">&lotimes;</span> </td> <tr id=entity-lowast><td> <code title="">lowast;</code> </td> <td> U+02217 </td> <td> <span class=glyph title="">&lowast;</span> </td> <tr id=entity-lowbar><td> <code title="">lowbar;</code> </td> <td> U+0005F </td> <td> <span class=glyph title="">_</span> </td> <tr id=entity-LowerLeftArrow><td> <code title="">LowerLeftArrow;</code> </td> <td> U+02199 </td> <td> <span class=glyph title="">&swarrow;</span> </td> <tr id=entity-LowerRightArrow><td> <code title="">LowerRightArrow;</code> </td> <td> U+02198 </td> <td> <span class=glyph title="">&searrow;</span> </td> <tr id=entity-loz><td> <code title="">loz;</code> </td> <td> U+025CA </td> <td> <span class=glyph title="">&lozenge;</span> </td> <tr id=entity-lozenge><td> <code title="">lozenge;</code> </td> <td> U+025CA </td> <td> <span class=glyph title="">&lozenge;</span> </td> <tr id=entity-lozf><td> <code title="">lozf;</code> </td> <td> U+029EB </td> <td> <span class=glyph title="">&lozf;</span> </td> <tr id=entity-lpar><td> <code title="">lpar;</code> </td> <td> U+00028 </td> <td> <span class=glyph title="">(</span> </td> <tr id=entity-lparlt><td> <code title="">lparlt;</code> </td> <td> U+02993 </td> <td> <span class=glyph title="">&lparlt;</span> </td> <tr id=entity-lrarr><td> <code title="">lrarr;</code> </td> <td> U+021C6 </td> <td> <span class=glyph title="">&leftrightarrows;</span> </td> <tr id=entity-lrcorner><td> <code title="">lrcorner;</code> </td> <td> U+0231F </td> <td> <span class=glyph title="">&drcorn;</span> </td> <tr id=entity-lrhar><td> <code title="">lrhar;</code> </td> <td> U+021CB </td> <td> <span class=glyph title="">&leftrightharpoons;</span> </td> <tr id=entity-lrhard><td> <code title="">lrhard;</code> </td> <td> U+0296D </td> <td> <span class=glyph title="">&lrhard;</span> </td> <tr id=entity-lrm><td> <code title="">lrm;</code> </td> <td> U+0200E </td> <td> <span class=glyph title="">&lrm;</span> </td> <tr id=entity-lrtri><td> <code title="">lrtri;</code> </td> <td> U+022BF </td> <td> <span class=glyph title="">&lrtri;</span> </td> <tr id=entity-lsaquo><td> <code title="">lsaquo;</code> </td> <td> U+02039 </td> <td> <span class=glyph title="">&lsaquo;</span> </td> <tr id=entity-Lscr><td> <code title="">Lscr;</code> </td> <td> U+02112 </td> <td> <span class=glyph title="">&lagran;</span> </td> <tr id=entity-lscr><td> <code title="">lscr;</code> </td> <td> U+1D4C1 </td> <td> <span class=glyph title="">&lscr;</span> </td> <tr id=entity-Lsh><td> <code title="">Lsh;</code> </td> <td> U+021B0 </td> <td> <span class=glyph title="">&lsh;</span> </td> <tr id=entity-lsh><td> <code title="">lsh;</code> </td> <td> U+021B0 </td> <td> <span class=glyph title="">&lsh;</span> </td> <tr id=entity-lsim><td> <code title="">lsim;</code> </td> <td> U+02272 </td> <td> <span class=glyph title="">&lesssim;</span> </td> <tr id=entity-lsime><td> <code title="">lsime;</code> </td> <td> U+02A8D </td> <td> <span class=glyph title="">&lsime;</span> </td> <tr id=entity-lsimg><td> <code title="">lsimg;</code> </td> <td> U+02A8F </td> <td> <span class=glyph title="">&lsimg;</span> </td> <tr id=entity-lsqb><td> <code title="">lsqb;</code> </td> <td> U+0005B </td> <td> <span class=glyph title="">[</span> </td> <tr id=entity-lsquo><td> <code title="">lsquo;</code> </td> <td> U+02018 </td> <td> <span class=glyph title="">&lsquo;</span> </td> <tr id=entity-lsquor><td> <code title="">lsquor;</code> </td> <td> U+0201A </td> <td> <span class=glyph title="">&sbquo;</span> </td> <tr id=entity-Lstrok><td> <code title="">Lstrok;</code> </td> <td> U+00141 </td> <td> <span class=glyph title="">&Lstrok;</span> </td> <tr id=entity-lstrok><td> <code title="">lstrok;</code> </td> <td> U+00142 </td> <td> <span class=glyph title="">&lstrok;</span> </td> <tr id=entity-LT><td> <code title="">LT;</code> </td> <td> U+0003C </td> <td> <span class=glyph title="">&lt;</span> </td> <tr id=entity-LT-legacy class=impl><td> <code title="">LT</code> </td> <td> U+0003C </td> <td> <span title="">&lt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Lt><td> <code title="">Lt;</code> </td> <td> U+0226A </td> <td> <span class=glyph title="">&ll;</span> </td> <tr id=entity-lt><td> <code title="">lt;</code> </td> <td> U+0003C </td> <td> <span class=glyph title="">&lt;</span> </td> <tr id=entity-lt-legacy class=impl><td> <code title="">lt</code> </td> <td> U+0003C </td> <td> <span title="">&lt;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ltcc><td> <code title="">ltcc;</code> </td> <td> U+02AA6 </td> <td> <span class=glyph title="">&ltcc;</span> </td> <tr id=entity-ltcir><td> <code title="">ltcir;</code> </td> <td> U+02A79 </td> <td> <span class=glyph title="">&ltcir;</span> </td> <tr id=entity-ltdot><td> <code title="">ltdot;</code> </td> <td> U+022D6 </td> <td> <span class=glyph title="">&lessdot;</span> </td> <tr id=entity-lthree><td> <code title="">lthree;</code> </td> <td> U+022CB </td> <td> <span class=glyph title="">&lthree;</span> </td> <tr id=entity-ltimes><td> <code title="">ltimes;</code> </td> <td> U+022C9 </td> <td> <span class=glyph title="">&ltimes;</span> </td> <tr id=entity-ltlarr><td> <code title="">ltlarr;</code> </td> <td> U+02976 </td> <td> <span class=glyph title="">&ltlarr;</span> </td> <tr id=entity-ltquest><td> <code title="">ltquest;</code> </td> <td> U+02A7B </td> <td> <span class=glyph title="">&ltquest;</span> </td> <tr id=entity-ltri><td> <code title="">ltri;</code> </td> <td> U+025C3 </td> <td> <span class=glyph title="">&triangleleft;</span> </td> <tr id=entity-ltrie><td> <code title="">ltrie;</code> </td> <td> U+022B4 </td> <td> <span class=glyph title="">&ltrie;</span> </td> <tr id=entity-ltrif><td> <code title="">ltrif;</code> </td> <td> U+025C2 </td> <td> <span class=glyph title="">&blacktriangleleft;</span> </td> <tr id=entity-ltrPar><td> <code title="">ltrPar;</code> </td> <td> U+02996 </td> <td> <span class=glyph title="">&ltrPar;</span> </td> <tr id=entity-lurdshar><td> <code title="">lurdshar;</code> </td> <td> U+0294A </td> <td> <span class=glyph title="">&lurdshar;</span> </td> <tr id=entity-luruhar><td> <code title="">luruhar;</code> </td> <td> U+02966 </td> <td> <span class=glyph title="">&luruhar;</span> </td> <tr id=entity-lvertneqq><td> <code title="">lvertneqq;</code> </td> <td> U+02268 U+0FE00 </td> <td> <span class="glyph compound" title="">&lneqq;&#xfe00;</span> </td> <tr id=entity-lvnE><td> <code title="">lvnE;</code> </td> <td> U+02268 U+0FE00 </td> <td> <span class="glyph compound" title="">&lneqq;&#xfe00;</span> </td> <tr id=entity-macr><td> <code title="">macr;</code> </td> <td> U+000AF </td> <td> <span class=glyph title="">&strns;</span> </td> <tr id=entity-macr-legacy class=impl><td> <code title="">macr</code> </td> <td> U+000AF </td> <td> <span title="">&strns;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-male><td> <code title="">male;</code> </td> <td> U+02642 </td> <td> <span class=glyph title="">&male;</span> </td> <tr id=entity-malt><td> <code title="">malt;</code> </td> <td> U+02720 </td> <td> <span class=glyph title="">&malt;</span> </td> <tr id=entity-maltese><td> <code title="">maltese;</code> </td> <td> U+02720 </td> <td> <span class=glyph title="">&malt;</span> </td> <tr id=entity-Map><td> <code title="">Map;</code> </td> <td> U+02905 </td> <td> <span class=glyph title="">&Map;</span> </td> <tr id=entity-map><td> <code title="">map;</code> </td> <td> U+021A6 </td> <td> <span class=glyph title="">&mapsto;</span> </td> <tr id=entity-mapsto><td> <code title="">mapsto;</code> </td> <td> U+021A6 </td> <td> <span class=glyph title="">&mapsto;</span> </td> <tr id=entity-mapstodown><td> <code title="">mapstodown;</code> </td> <td> U+021A7 </td> <td> <span class=glyph title="">&mapstodown;</span> </td> <tr id=entity-mapstoleft><td> <code title="">mapstoleft;</code> </td> <td> U+021A4 </td> <td> <span class=glyph title="">&mapstoleft;</span> </td> <tr id=entity-mapstoup><td> <code title="">mapstoup;</code> </td> <td> U+021A5 </td> <td> <span class=glyph title="">&mapstoup;</span> </td> <tr id=entity-marker><td> <code title="">marker;</code> </td> <td> U+025AE </td> <td> <span class=glyph title="">&marker;</span> </td> <tr id=entity-mcomma><td> <code title="">mcomma;</code> </td> <td> U+02A29 </td> <td> <span class=glyph title="">&mcomma;</span> </td> <tr id=entity-Mcy><td> <code title="">Mcy;</code> </td> <td> U+0041C </td> <td> <span class=glyph title="">&Mcy;</span> </td> <tr id=entity-mcy><td> <code title="">mcy;</code> </td> <td> U+0043C </td> <td> <span class=glyph title="">&mcy;</span> </td> <tr id=entity-mdash><td> <code title="">mdash;</code> </td> <td> U+02014 </td> <td> <span class=glyph title="">&mdash;</span> </td> <tr id=entity-mDDot><td> <code title="">mDDot;</code> </td> <td> U+0223A </td> <td> <span class=glyph title="">&mDDot;</span> </td> <tr id=entity-measuredangle><td> <code title="">measuredangle;</code> </td> <td> U+02221 </td> <td> <span class=glyph title="">&angmsd;</span> </td> <tr id=entity-MediumSpace><td> <code title="">MediumSpace;</code> </td> <td> U+0205F </td> <td> <span class=glyph title="">&MediumSpace;</span> </td> <tr id=entity-Mellintrf><td> <code title="">Mellintrf;</code> </td> <td> U+02133 </td> <td> <span class=glyph title="">&phmmat;</span> </td> <tr id=entity-Mfr><td> <code title="">Mfr;</code> </td> <td> U+1D510 </td> <td> <span class=glyph title="">&Mfr;</span> </td> <tr id=entity-mfr><td> <code title="">mfr;</code> </td> <td> U+1D52A </td> <td> <span class=glyph title="">&mfr;</span> </td> <tr id=entity-mho><td> <code title="">mho;</code> </td> <td> U+02127 </td> <td> <span class=glyph title="">&mho;</span> </td> <tr id=entity-micro><td> <code title="">micro;</code> </td> <td> U+000B5 </td> <td> <span class=glyph title="">&micro;</span> </td> <tr id=entity-micro-legacy class=impl><td> <code title="">micro</code> </td> <td> U+000B5 </td> <td> <span title="">&micro;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-mid><td> <code title="">mid;</code> </td> <td> U+02223 </td> <td> <span class=glyph title="">&mid;</span> </td> <tr id=entity-midast><td> <code title="">midast;</code> </td> <td> U+0002A </td> <td> <span class=glyph title="">*</span> </td> <tr id=entity-midcir><td> <code title="">midcir;</code> </td> <td> U+02AF0 </td> <td> <span class=glyph title="">&midcir;</span> </td> <tr id=entity-middot><td> <code title="">middot;</code> </td> <td> U+000B7 </td> <td> <span class=glyph title="">&middot;</span> </td> <tr id=entity-middot-legacy class=impl><td> <code title="">middot</code> </td> <td> U+000B7 </td> <td> <span title="">&middot;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-minus><td> <code title="">minus;</code> </td> <td> U+02212 </td> <td> <span class=glyph title="">&minus;</span> </td> <tr id=entity-minusb><td> <code title="">minusb;</code> </td> <td> U+0229F </td> <td> <span class=glyph title="">&minusb;</span> </td> <tr id=entity-minusd><td> <code title="">minusd;</code> </td> <td> U+02238 </td> <td> <span class=glyph title="">&dotminus;</span> </td> <tr id=entity-minusdu><td> <code title="">minusdu;</code> </td> <td> U+02A2A </td> <td> <span class=glyph title="">&minusdu;</span> </td> <tr id=entity-MinusPlus><td> <code title="">MinusPlus;</code> </td> <td> U+02213 </td> <td> <span class=glyph title="">&mp;</span> </td> <tr id=entity-mlcp><td> <code title="">mlcp;</code> </td> <td> U+02ADB </td> <td> <span class=glyph title="">&mlcp;</span> </td> <tr id=entity-mldr><td> <code title="">mldr;</code> </td> <td> U+02026 </td> <td> <span class=glyph title="">&mldr;</span> </td> <tr id=entity-mnplus><td> <code title="">mnplus;</code> </td> <td> U+02213 </td> <td> <span class=glyph title="">&mp;</span> </td> <tr id=entity-models><td> <code title="">models;</code> </td> <td> U+022A7 </td> <td> <span class=glyph title="">&models;</span> </td> <tr id=entity-Mopf><td> <code title="">Mopf;</code> </td> <td> U+1D544 </td> <td> <span class=glyph title="">&Mopf;</span> </td> <tr id=entity-mopf><td> <code title="">mopf;</code> </td> <td> U+1D55E </td> <td> <span class=glyph title="">&mopf;</span> </td> <tr id=entity-mp><td> <code title="">mp;</code> </td> <td> U+02213 </td> <td> <span class=glyph title="">&mp;</span> </td> <tr id=entity-Mscr><td> <code title="">Mscr;</code> </td> <td> U+02133 </td> <td> <span class=glyph title="">&phmmat;</span> </td> <tr id=entity-mscr><td> <code title="">mscr;</code> </td> <td> U+1D4C2 </td> <td> <span class=glyph title="">&mscr;</span> </td> <tr id=entity-mstpos><td> <code title="">mstpos;</code> </td> <td> U+0223E </td> <td> <span class=glyph title="">&ac;</span> </td> <tr id=entity-Mu><td> <code title="">Mu;</code> </td> <td> U+0039C </td> <td> <span class=glyph title="">&Mu;</span> </td> <tr id=entity-mu><td> <code title="">mu;</code> </td> <td> U+003BC </td> <td> <span class=glyph title="">&mu;</span> </td> <tr id=entity-multimap><td> <code title="">multimap;</code> </td> <td> U+022B8 </td> <td> <span class=glyph title="">&multimap;</span> </td> <tr id=entity-mumap><td> <code title="">mumap;</code> </td> <td> U+022B8 </td> <td> <span class=glyph title="">&multimap;</span> </td> <tr id=entity-nabla><td> <code title="">nabla;</code> </td> <td> U+02207 </td> <td> <span class=glyph title="">&nabla;</span> </td> <tr id=entity-Nacute><td> <code title="">Nacute;</code> </td> <td> U+00143 </td> <td> <span class=glyph title="">&Nacute;</span> </td> <tr id=entity-nacute><td> <code title="">nacute;</code> </td> <td> U+00144 </td> <td> <span class=glyph title="">&nacute;</span> </td> <tr id=entity-nang><td> <code title="">nang;</code> </td> <td> U+02220 U+020D2 </td> <td> <span class="glyph compound" title="">&angle;&#x20d2;</span> </td> <tr id=entity-nap><td> <code title="">nap;</code> </td> <td> U+02249 </td> <td> <span class=glyph title="">&nap;</span> </td> <tr id=entity-napE><td> <code title="">napE;</code> </td> <td> U+02A70 U+00338 </td> <td> <span class="glyph compound" title="">&apE;&#x338;</span> </td> <tr id=entity-napid><td> <code title="">napid;</code> </td> <td> U+0224B U+00338 </td> <td> <span class="glyph compound" title="">&apid;&#x338;</span> </td> <tr id=entity-napos><td> <code title="">napos;</code> </td> <td> U+00149 </td> <td> <span class=glyph title="">&napos;</span> </td> <tr id=entity-napprox><td> <code title="">napprox;</code> </td> <td> U+02249 </td> <td> <span class=glyph title="">&nap;</span> </td> <tr id=entity-natur><td> <code title="">natur;</code> </td> <td> U+0266E </td> <td> <span class=glyph title="">&natural;</span> </td> <tr id=entity-natural><td> <code title="">natural;</code> </td> <td> U+0266E </td> <td> <span class=glyph title="">&natural;</span> </td> <tr id=entity-naturals><td> <code title="">naturals;</code> </td> <td> U+02115 </td> <td> <span class=glyph title="">&naturals;</span> </td> <tr id=entity-nbsp><td> <code title="">nbsp;</code> </td> <td> U+000A0 </td> <td> <span class=glyph title="">&nbsp;</span> </td> <tr id=entity-nbsp-legacy class=impl><td> <code title="">nbsp</code> </td> <td> U+000A0 </td> <td> <span title="">&nbsp;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-nbump><td> <code title="">nbump;</code> </td> <td> U+0224E U+00338 </td> <td> <span class="glyph compound" title="">&bump;&#x338;</span> </td> <tr id=entity-nbumpe><td> <code title="">nbumpe;</code> </td> <td> U+0224F U+00338 </td> <td> <span class="glyph compound" title="">&bumpeq;&#x338;</span> </td> <tr id=entity-ncap><td> <code title="">ncap;</code> </td> <td> U+02A43 </td> <td> <span class=glyph title="">&ncap;</span> </td> <tr id=entity-Ncaron><td> <code title="">Ncaron;</code> </td> <td> U+00147 </td> <td> <span class=glyph title="">&Ncaron;</span> </td> <tr id=entity-ncaron><td> <code title="">ncaron;</code> </td> <td> U+00148 </td> <td> <span class=glyph title="">&ncaron;</span> </td> <tr id=entity-Ncedil><td> <code title="">Ncedil;</code> </td> <td> U+00145 </td> <td> <span class=glyph title="">&Ncedil;</span> </td> <tr id=entity-ncedil><td> <code title="">ncedil;</code> </td> <td> U+00146 </td> <td> <span class=glyph title="">&ncedil;</span> </td> <tr id=entity-ncong><td> <code title="">ncong;</code> </td> <td> U+02247 </td> <td> <span class=glyph title="">&ncong;</span> </td> <tr id=entity-ncongdot><td> <code title="">ncongdot;</code> </td> <td> U+02A6D U+00338 </td> <td> <span class="glyph compound" title="">&congdot;&#x338;</span> </td> <tr id=entity-ncup><td> <code title="">ncup;</code> </td> <td> U+02A42 </td> <td> <span class=glyph title="">&ncup;</span> </td> <tr id=entity-Ncy><td> <code title="">Ncy;</code> </td> <td> U+0041D </td> <td> <span class=glyph title="">&Ncy;</span> </td> <tr id=entity-ncy><td> <code title="">ncy;</code> </td> <td> U+0043D </td> <td> <span class=glyph title="">&ncy;</span> </td> <tr id=entity-ndash><td> <code title="">ndash;</code> </td> <td> U+02013 </td> <td> <span class=glyph title="">&ndash;</span> </td> <tr id=entity-ne><td> <code title="">ne;</code> </td> <td> U+02260 </td> <td> <span class=glyph title="">&ne;</span> </td> <tr id=entity-nearhk><td> <code title="">nearhk;</code> </td> <td> U+02924 </td> <td> <span class=glyph title="">&nearhk;</span> </td> <tr id=entity-neArr><td> <code title="">neArr;</code> </td> <td> U+021D7 </td> <td> <span class=glyph title="">&neArr;</span> </td> <tr id=entity-nearr><td> <code title="">nearr;</code> </td> <td> U+02197 </td> <td> <span class=glyph title="">&nearrow;</span> </td> <tr id=entity-nearrow><td> <code title="">nearrow;</code> </td> <td> U+02197 </td> <td> <span class=glyph title="">&nearrow;</span> </td> <tr id=entity-nedot><td> <code title="">nedot;</code> </td> <td> U+02250 U+00338 </td> <td> <span class="glyph compound" title="">&esdot;&#x338;</span> </td> <tr id=entity-NegativeMediumSpace><td> <code title="">NegativeMediumSpace;</code> </td> <td> U+0200B </td> <td> <span class=glyph title="">&NegativeThickSpace;</span> </td> <tr id=entity-NegativeThickSpace><td> <code title="">NegativeThickSpace;</code> </td> <td> U+0200B </td> <td> <span class=glyph title="">&NegativeThickSpace;</span> </td> <tr id=entity-NegativeThinSpace><td> <code title="">NegativeThinSpace;</code> </td> <td> U+0200B </td> <td> <span class=glyph title="">&NegativeThickSpace;</span> </td> <tr id=entity-NegativeVeryThinSpace><td> <code title="">NegativeVeryThinSpace;</code> </td> <td> U+0200B </td> <td> <span class=glyph title="">&NegativeThickSpace;</span> </td> <tr id=entity-nequiv><td> <code title="">nequiv;</code> </td> <td> U+02262 </td> <td> <span class=glyph title="">&nequiv;</span> </td> <tr id=entity-nesear><td> <code title="">nesear;</code> </td> <td> U+02928 </td> <td> <span class=glyph title="">&toea;</span> </td> <tr id=entity-nesim><td> <code title="">nesim;</code> </td> <td> U+02242 U+00338 </td> <td> <span class="glyph compound" title="">&esim;&#x338;</span> </td> <tr id=entity-NestedGreaterGreater><td> <code title="">NestedGreaterGreater;</code> </td> <td> U+0226B </td> <td> <span class=glyph title="">&gg;</span> </td> <tr id=entity-NestedLessLess><td> <code title="">NestedLessLess;</code> </td> <td> U+0226A </td> <td> <span class=glyph title="">&ll;</span> </td> <tr id=entity-NewLine><td> <code title="">NewLine;</code> </td> <td> U+0000A </td> <td> <span class="glyph control" title="">&#x240a;</span> </td> <tr id=entity-nexist><td> <code title="">nexist;</code> </td> <td> U+02204 </td> <td> <span class=glyph title="">&nexists;</span> </td> <tr id=entity-nexists><td> <code title="">nexists;</code> </td> <td> U+02204 </td> <td> <span class=glyph title="">&nexists;</span> </td> <tr id=entity-Nfr><td> <code title="">Nfr;</code> </td> <td> U+1D511 </td> <td> <span class=glyph title="">&Nfr;</span> </td> <tr id=entity-nfr><td> <code title="">nfr;</code> </td> <td> U+1D52B </td> <td> <span class=glyph title="">&nfr;</span> </td> <tr id=entity-ngE><td> <code title="">ngE;</code> </td> <td> U+02267 U+00338 </td> <td> <span class="glyph compound" title="">&geqq;&#x338;</span> </td> <tr id=entity-nge><td> <code title="">nge;</code> </td> <td> U+02271 </td> <td> <span class=glyph title="">&ngeq;</span> </td> <tr id=entity-ngeq><td> <code title="">ngeq;</code> </td> <td> U+02271 </td> <td> <span class=glyph title="">&ngeq;</span> </td> <tr id=entity-ngeqq><td> <code title="">ngeqq;</code> </td> <td> U+02267 U+00338 </td> <td> <span class="glyph compound" title="">&geqq;&#x338;</span> </td> <tr id=entity-ngeqslant><td> <code title="">ngeqslant;</code> </td> <td> U+02A7E U+00338 </td> <td> <span class="glyph compound" title="">&ges;&#x338;</span> </td> <tr id=entity-nges><td> <code title="">nges;</code> </td> <td> U+02A7E U+00338 </td> <td> <span class="glyph compound" title="">&ges;&#x338;</span> </td> <tr id=entity-nGg><td> <code title="">nGg;</code> </td> <td> U+022D9 U+00338 </td> <td> <span class="glyph compound" title="">&ggg;&#x338;</span> </td> <tr id=entity-ngsim><td> <code title="">ngsim;</code> </td> <td> U+02275 </td> <td> <span class=glyph title="">&ngsim;</span> </td> <tr id=entity-nGt><td> <code title="">nGt;</code> </td> <td> U+0226B U+020D2 </td> <td> <span class="glyph compound" title="">&gg;&#x20d2;</span> </td> <tr id=entity-ngt><td> <code title="">ngt;</code> </td> <td> U+0226F </td> <td> <span class=glyph title="">&ngt;</span> </td> <tr id=entity-ngtr><td> <code title="">ngtr;</code> </td> <td> U+0226F </td> <td> <span class=glyph title="">&ngt;</span> </td> <tr id=entity-nGtv><td> <code title="">nGtv;</code> </td> <td> U+0226B U+00338 </td> <td> <span class="glyph compound" title="">&gg;&#x338;</span> </td> <tr id=entity-nhArr><td> <code title="">nhArr;</code> </td> <td> U+021CE </td> <td> <span class=glyph title="">&nhArr;</span> </td> <tr id=entity-nharr><td> <code title="">nharr;</code> </td> <td> U+021AE </td> <td> <span class=glyph title="">&nharr;</span> </td> <tr id=entity-nhpar><td> <code title="">nhpar;</code> </td> <td> U+02AF2 </td> <td> <span class=glyph title="">&nhpar;</span> </td> <tr id=entity-ni><td> <code title="">ni;</code> </td> <td> U+0220B </td> <td> <span class=glyph title="">&niv;</span> </td> <tr id=entity-nis><td> <code title="">nis;</code> </td> <td> U+022FC </td> <td> <span class=glyph title="">&nis;</span> </td> <tr id=entity-nisd><td> <code title="">nisd;</code> </td> <td> U+022FA </td> <td> <span class=glyph title="">&nisd;</span> </td> <tr id=entity-niv><td> <code title="">niv;</code> </td> <td> U+0220B </td> <td> <span class=glyph title="">&niv;</span> </td> <tr id=entity-NJcy><td> <code title="">NJcy;</code> </td> <td> U+0040A </td> <td> <span class=glyph title="">&NJcy;</span> </td> <tr id=entity-njcy><td> <code title="">njcy;</code> </td> <td> U+0045A </td> <td> <span class=glyph title="">&njcy;</span> </td> <tr id=entity-nlArr><td> <code title="">nlArr;</code> </td> <td> U+021CD </td> <td> <span class=glyph title="">&nlArr;</span> </td> <tr id=entity-nlarr><td> <code title="">nlarr;</code> </td> <td> U+0219A </td> <td> <span class=glyph title="">&nlarr;</span> </td> <tr id=entity-nldr><td> <code title="">nldr;</code> </td> <td> U+02025 </td> <td> <span class=glyph title="">&nldr;</span> </td> <tr id=entity-nlE><td> <code title="">nlE;</code> </td> <td> U+02266 U+00338 </td> <td> <span class="glyph compound" title="">&leqq;&#x338;</span> </td> <tr id=entity-nle><td> <code title="">nle;</code> </td> <td> U+02270 </td> <td> <span class=glyph title="">&nle;</span> </td> <tr id=entity-nLeftarrow><td> <code title="">nLeftarrow;</code> </td> <td> U+021CD </td> <td> <span class=glyph title="">&nlArr;</span> </td> <tr id=entity-nleftarrow><td> <code title="">nleftarrow;</code> </td> <td> U+0219A </td> <td> <span class=glyph title="">&nlarr;</span> </td> <tr id=entity-nLeftrightarrow><td> <code title="">nLeftrightarrow;</code> </td> <td> U+021CE </td> <td> <span class=glyph title="">&nhArr;</span> </td> <tr id=entity-nleftrightarrow><td> <code title="">nleftrightarrow;</code> </td> <td> U+021AE </td> <td> <span class=glyph title="">&nharr;</span> </td> <tr id=entity-nleq><td> <code title="">nleq;</code> </td> <td> U+02270 </td> <td> <span class=glyph title="">&nle;</span> </td> <tr id=entity-nleqq><td> <code title="">nleqq;</code> </td> <td> U+02266 U+00338 </td> <td> <span class="glyph compound" title="">&leqq;&#x338;</span> </td> <tr id=entity-nleqslant><td> <code title="">nleqslant;</code> </td> <td> U+02A7D U+00338 </td> <td> <span class="glyph compound" title="">&les;&#x338;</span> </td> <tr id=entity-nles><td> <code title="">nles;</code> </td> <td> U+02A7D U+00338 </td> <td> <span class="glyph compound" title="">&les;&#x338;</span> </td> <tr id=entity-nless><td> <code title="">nless;</code> </td> <td> U+0226E </td> <td> <span class=glyph title="">&nless;</span> </td> <tr id=entity-nLl><td> <code title="">nLl;</code> </td> <td> U+022D8 U+00338 </td> <td> <span class="glyph compound" title="">&Ll;&#x338;</span> </td> <tr id=entity-nlsim><td> <code title="">nlsim;</code> </td> <td> U+02274 </td> <td> <span class=glyph title="">&nlsim;</span> </td> <tr id=entity-nLt><td> <code title="">nLt;</code> </td> <td> U+0226A U+020D2 </td> <td> <span class="glyph compound" title="">&ll;&#x20d2;</span> </td> <tr id=entity-nlt><td> <code title="">nlt;</code> </td> <td> U+0226E </td> <td> <span class=glyph title="">&nless;</span> </td> <tr id=entity-nltri><td> <code title="">nltri;</code> </td> <td> U+022EA </td> <td> <span class=glyph title="">&nltri;</span> </td> <tr id=entity-nltrie><td> <code title="">nltrie;</code> </td> <td> U+022EC </td> <td> <span class=glyph title="">&nltrie;</span> </td> <tr id=entity-nLtv><td> <code title="">nLtv;</code> </td> <td> U+0226A U+00338 </td> <td> <span class="glyph compound" title="">&ll;&#x338;</span> </td> <tr id=entity-nmid><td> <code title="">nmid;</code> </td> <td> U+02224 </td> <td> <span class=glyph title="">&nmid;</span> </td> <tr id=entity-NoBreak><td> <code title="">NoBreak;</code> </td> <td> U+02060 </td> <td> <span class=glyph title="">&NoBreak;</span> </td> <tr id=entity-NonBreakingSpace><td> <code title="">NonBreakingSpace;</code> </td> <td> U+000A0 </td> <td> <span class=glyph title="">&nbsp;</span> </td> <tr id=entity-Nopf><td> <code title="">Nopf;</code> </td> <td> U+02115 </td> <td> <span class=glyph title="">&naturals;</span> </td> <tr id=entity-nopf><td> <code title="">nopf;</code> </td> <td> U+1D55F </td> <td> <span class=glyph title="">&nopf;</span> </td> <tr id=entity-Not><td> <code title="">Not;</code> </td> <td> U+02AEC </td> <td> <span class=glyph title="">&Not;</span> </td> <tr id=entity-not><td> <code title="">not;</code> </td> <td> U+000AC </td> <td> <span class=glyph title="">&not;</span> </td> <tr id=entity-not-legacy class=impl><td> <code title="">not</code> </td> <td> U+000AC </td> <td> <span title="">&not;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-NotCongruent><td> <code title="">NotCongruent;</code> </td> <td> U+02262 </td> <td> <span class=glyph title="">&nequiv;</span> </td> <tr id=entity-NotCupCap><td> <code title="">NotCupCap;</code> </td> <td> U+0226D </td> <td> <span class=glyph title="">&NotCupCap;</span> </td> <tr id=entity-NotDoubleVerticalBar><td> <code title="">NotDoubleVerticalBar;</code> </td> <td> U+02226 </td> <td> <span class=glyph title="">&nspar;</span> </td> <tr id=entity-NotElement><td> <code title="">NotElement;</code> </td> <td> U+02209 </td> <td> <span class=glyph title="">&notinva;</span> </td> <tr id=entity-NotEqual><td> <code title="">NotEqual;</code> </td> <td> U+02260 </td> <td> <span class=glyph title="">&ne;</span> </td> <tr id=entity-NotEqualTilde><td> <code title="">NotEqualTilde;</code> </td> <td> U+02242 U+00338 </td> <td> <span class="glyph compound" title="">&esim;&#x338;</span> </td> <tr id=entity-NotExists><td> <code title="">NotExists;</code> </td> <td> U+02204 </td> <td> <span class=glyph title="">&nexists;</span> </td> <tr id=entity-NotGreater><td> <code title="">NotGreater;</code> </td> <td> U+0226F </td> <td> <span class=glyph title="">&ngt;</span> </td> <tr id=entity-NotGreaterEqual><td> <code title="">NotGreaterEqual;</code> </td> <td> U+02271 </td> <td> <span class=glyph title="">&ngeq;</span> </td> <tr id=entity-NotGreaterFullEqual><td> <code title="">NotGreaterFullEqual;</code> </td> <td> U+02267 U+00338 </td> <td> <span class="glyph compound" title="">&geqq;&#x338;</span> </td> <tr id=entity-NotGreaterGreater><td> <code title="">NotGreaterGreater;</code> </td> <td> U+0226B U+00338 </td> <td> <span class="glyph compound" title="">&gg;&#x338;</span> </td> <tr id=entity-NotGreaterLess><td> <code title="">NotGreaterLess;</code> </td> <td> U+02279 </td> <td> <span class=glyph title="">&ntgl;</span> </td> <tr id=entity-NotGreaterSlantEqual><td> <code title="">NotGreaterSlantEqual;</code> </td> <td> U+02A7E U+00338 </td> <td> <span class="glyph compound" title="">&ges;&#x338;</span> </td> <tr id=entity-NotGreaterTilde><td> <code title="">NotGreaterTilde;</code> </td> <td> U+02275 </td> <td> <span class=glyph title="">&ngsim;</span> </td> <tr id=entity-NotHumpDownHump><td> <code title="">NotHumpDownHump;</code> </td> <td> U+0224E U+00338 </td> <td> <span class="glyph compound" title="">&bump;&#x338;</span> </td> <tr id=entity-NotHumpEqual><td> <code title="">NotHumpEqual;</code> </td> <td> U+0224F U+00338 </td> <td> <span class="glyph compound" title="">&bumpeq;&#x338;</span> </td> <tr id=entity-notin><td> <code title="">notin;</code> </td> <td> U+02209 </td> <td> <span class=glyph title="">&notinva;</span> </td> <tr id=entity-notindot><td> <code title="">notindot;</code> </td> <td> U+022F5 U+00338 </td> <td> <span class="glyph compound" title="">&isindot;&#x338;</span> </td> <tr id=entity-notinE><td> <code title="">notinE;</code> </td> <td> U+022F9 U+00338 </td> <td> <span class="glyph compound" title="">&isinE;&#x338;</span> </td> <tr id=entity-notinva><td> <code title="">notinva;</code> </td> <td> U+02209 </td> <td> <span class=glyph title="">&notinva;</span> </td> <tr id=entity-notinvb><td> <code title="">notinvb;</code> </td> <td> U+022F7 </td> <td> <span class=glyph title="">&notinvb;</span> </td> <tr id=entity-notinvc><td> <code title="">notinvc;</code> </td> <td> U+022F6 </td> <td> <span class=glyph title="">&notinvc;</span> </td> <tr id=entity-NotLeftTriangle><td> <code title="">NotLeftTriangle;</code> </td> <td> U+022EA </td> <td> <span class=glyph title="">&nltri;</span> </td> <tr id=entity-NotLeftTriangleBar><td> <code title="">NotLeftTriangleBar;</code> </td> <td> U+029CF U+00338 </td> <td> <span class="glyph compound" title="">&LeftTriangleBar;&#x338;</span> </td> <tr id=entity-NotLeftTriangleEqual><td> <code title="">NotLeftTriangleEqual;</code> </td> <td> U+022EC </td> <td> <span class=glyph title="">&nltrie;</span> </td> <tr id=entity-NotLess><td> <code title="">NotLess;</code> </td> <td> U+0226E </td> <td> <span class=glyph title="">&nless;</span> </td> <tr id=entity-NotLessEqual><td> <code title="">NotLessEqual;</code> </td> <td> U+02270 </td> <td> <span class=glyph title="">&nle;</span> </td> <tr id=entity-NotLessGreater><td> <code title="">NotLessGreater;</code> </td> <td> U+02278 </td> <td> <span class=glyph title="">&ntlg;</span> </td> <tr id=entity-NotLessLess><td> <code title="">NotLessLess;</code> </td> <td> U+0226A U+00338 </td> <td> <span class="glyph compound" title="">&ll;&#x338;</span> </td> <tr id=entity-NotLessSlantEqual><td> <code title="">NotLessSlantEqual;</code> </td> <td> U+02A7D U+00338 </td> <td> <span class="glyph compound" title="">&les;&#x338;</span> </td> <tr id=entity-NotLessTilde><td> <code title="">NotLessTilde;</code> </td> <td> U+02274 </td> <td> <span class=glyph title="">&nlsim;</span> </td> <tr id=entity-NotNestedGreaterGreater><td> <code title="">NotNestedGreaterGreater;</code> </td> <td> U+02AA2 U+00338 </td> <td> <span class="glyph compound" title="">&GreaterGreater;&#x338;</span> </td> <tr id=entity-NotNestedLessLess><td> <code title="">NotNestedLessLess;</code> </td> <td> U+02AA1 U+00338 </td> <td> <span class="glyph compound" title="">&LessLess;&#x338;</span> </td> <tr id=entity-notni><td> <code title="">notni;</code> </td> <td> U+0220C </td> <td> <span class=glyph title="">&notni;</span> </td> <tr id=entity-notniva><td> <code title="">notniva;</code> </td> <td> U+0220C </td> <td> <span class=glyph title="">&notni;</span> </td> <tr id=entity-notnivb><td> <code title="">notnivb;</code> </td> <td> U+022FE </td> <td> <span class=glyph title="">&notnivb;</span> </td> <tr id=entity-notnivc><td> <code title="">notnivc;</code> </td> <td> U+022FD </td> <td> <span class=glyph title="">&notnivc;</span> </td> <tr id=entity-NotPrecedes><td> <code title="">NotPrecedes;</code> </td> <td> U+02280 </td> <td> <span class=glyph title="">&nprec;</span> </td> <tr id=entity-NotPrecedesEqual><td> <code title="">NotPrecedesEqual;</code> </td> <td> U+02AAF U+00338 </td> <td> <span class="glyph compound" title="">&pre;&#x338;</span> </td> <tr id=entity-NotPrecedesSlantEqual><td> <code title="">NotPrecedesSlantEqual;</code> </td> <td> U+022E0 </td> <td> <span class=glyph title="">&nprcue;</span> </td> <tr id=entity-NotReverseElement><td> <code title="">NotReverseElement;</code> </td> <td> U+0220C </td> <td> <span class=glyph title="">&notni;</span> </td> <tr id=entity-NotRightTriangle><td> <code title="">NotRightTriangle;</code> </td> <td> U+022EB </td> <td> <span class=glyph title="">&ntriangleright;</span> </td> <tr id=entity-NotRightTriangleBar><td> <code title="">NotRightTriangleBar;</code> </td> <td> U+029D0 U+00338 </td> <td> <span class="glyph compound" title="">&RightTriangleBar;&#x338;</span> </td> <tr id=entity-NotRightTriangleEqual><td> <code title="">NotRightTriangleEqual;</code> </td> <td> U+022ED </td> <td> <span class=glyph title="">&nrtrie;</span> </td> <tr id=entity-NotSquareSubset><td> <code title="">NotSquareSubset;</code> </td> <td> U+0228F U+00338 </td> <td> <span class="glyph compound" title="">&sqsub;&#x338;</span> </td> <tr id=entity-NotSquareSubsetEqual><td> <code title="">NotSquareSubsetEqual;</code> </td> <td> U+022E2 </td> <td> <span class=glyph title="">&nsqsube;</span> </td> <tr id=entity-NotSquareSuperset><td> <code title="">NotSquareSuperset;</code> </td> <td> U+02290 U+00338 </td> <td> <span class="glyph compound" title="">&sqsupset;&#x338;</span> </td> <tr id=entity-NotSquareSupersetEqual><td> <code title="">NotSquareSupersetEqual;</code> </td> <td> U+022E3 </td> <td> <span class=glyph title="">&nsqsupe;</span> </td> <tr id=entity-NotSubset><td> <code title="">NotSubset;</code> </td> <td> U+02282 U+020D2 </td> <td> <span class="glyph compound" title="">&sub;&#x20d2;</span> </td> <tr id=entity-NotSubsetEqual><td> <code title="">NotSubsetEqual;</code> </td> <td> U+02288 </td> <td> <span class=glyph title="">&nsube;</span> </td> <tr id=entity-NotSucceeds><td> <code title="">NotSucceeds;</code> </td> <td> U+02281 </td> <td> <span class=glyph title="">&nsc;</span> </td> <tr id=entity-NotSucceedsEqual><td> <code title="">NotSucceedsEqual;</code> </td> <td> U+02AB0 U+00338 </td> <td> <span class="glyph compound" title="">&succeq;&#x338;</span> </td> <tr id=entity-NotSucceedsSlantEqual><td> <code title="">NotSucceedsSlantEqual;</code> </td> <td> U+022E1 </td> <td> <span class=glyph title="">&nsccue;</span> </td> <tr id=entity-NotSucceedsTilde><td> <code title="">NotSucceedsTilde;</code> </td> <td> U+0227F U+00338 </td> <td> <span class="glyph compound" title="">&scsim;&#x338;</span> </td> <tr id=entity-NotSuperset><td> <code title="">NotSuperset;</code> </td> <td> U+02283 U+020D2 </td> <td> <span class="glyph compound" title="">&sup;&#x20d2;</span> </td> <tr id=entity-NotSupersetEqual><td> <code title="">NotSupersetEqual;</code> </td> <td> U+02289 </td> <td> <span class=glyph title="">&nsupseteq;</span> </td> <tr id=entity-NotTilde><td> <code title="">NotTilde;</code> </td> <td> U+02241 </td> <td> <span class=glyph title="">&nsim;</span> </td> <tr id=entity-NotTildeEqual><td> <code title="">NotTildeEqual;</code> </td> <td> U+02244 </td> <td> <span class=glyph title="">&nsimeq;</span> </td> <tr id=entity-NotTildeFullEqual><td> <code title="">NotTildeFullEqual;</code> </td> <td> U+02247 </td> <td> <span class=glyph title="">&ncong;</span> </td> <tr id=entity-NotTildeTilde><td> <code title="">NotTildeTilde;</code> </td> <td> U+02249 </td> <td> <span class=glyph title="">&nap;</span> </td> <tr id=entity-NotVerticalBar><td> <code title="">NotVerticalBar;</code> </td> <td> U+02224 </td> <td> <span class=glyph title="">&nmid;</span> </td> <tr id=entity-npar><td> <code title="">npar;</code> </td> <td> U+02226 </td> <td> <span class=glyph title="">&nspar;</span> </td> <tr id=entity-nparallel><td> <code title="">nparallel;</code> </td> <td> U+02226 </td> <td> <span class=glyph title="">&nspar;</span> </td> <tr id=entity-nparsl><td> <code title="">nparsl;</code> </td> <td> U+02AFD U+020E5 </td> <td> <span class="glyph compound" title="">&parsl;&#x20e5;</span> </td> <tr id=entity-npart><td> <code title="">npart;</code> </td> <td> U+02202 U+00338 </td> <td> <span class="glyph compound" title="">&part;&#x338;</span> </td> <tr id=entity-npolint><td> <code title="">npolint;</code> </td> <td> U+02A14 </td> <td> <span class=glyph title="">&npolint;</span> </td> <tr id=entity-npr><td> <code title="">npr;</code> </td> <td> U+02280 </td> <td> <span class=glyph title="">&nprec;</span> </td> <tr id=entity-nprcue><td> <code title="">nprcue;</code> </td> <td> U+022E0 </td> <td> <span class=glyph title="">&nprcue;</span> </td> <tr id=entity-npre><td> <code title="">npre;</code> </td> <td> U+02AAF U+00338 </td> <td> <span class="glyph compound" title="">&pre;&#x338;</span> </td> <tr id=entity-nprec><td> <code title="">nprec;</code> </td> <td> U+02280 </td> <td> <span class=glyph title="">&nprec;</span> </td> <tr id=entity-npreceq><td> <code title="">npreceq;</code> </td> <td> U+02AAF U+00338 </td> <td> <span class="glyph compound" title="">&pre;&#x338;</span> </td> <tr id=entity-nrArr><td> <code title="">nrArr;</code> </td> <td> U+021CF </td> <td> <span class=glyph title="">&nrArr;</span> </td> <tr id=entity-nrarr><td> <code title="">nrarr;</code> </td> <td> U+0219B </td> <td> <span class=glyph title="">&nrarr;</span> </td> <tr id=entity-nrarrc><td> <code title="">nrarrc;</code> </td> <td> U+02933 U+00338 </td> <td> <span class="glyph compound" title="">&rarrc;&#x338;</span> </td> <tr id=entity-nrarrw><td> <code title="">nrarrw;</code> </td> <td> U+0219D U+00338 </td> <td> <span class="glyph compound" title="">&rightsquigarrow;&#x338;</span> </td> <tr id=entity-nRightarrow><td> <code title="">nRightarrow;</code> </td> <td> U+021CF </td> <td> <span class=glyph title="">&nrArr;</span> </td> <tr id=entity-nrightarrow><td> <code title="">nrightarrow;</code> </td> <td> U+0219B </td> <td> <span class=glyph title="">&nrarr;</span> </td> <tr id=entity-nrtri><td> <code title="">nrtri;</code> </td> <td> U+022EB </td> <td> <span class=glyph title="">&ntriangleright;</span> </td> <tr id=entity-nrtrie><td> <code title="">nrtrie;</code> </td> <td> U+022ED </td> <td> <span class=glyph title="">&nrtrie;</span> </td> <tr id=entity-nsc><td> <code title="">nsc;</code> </td> <td> U+02281 </td> <td> <span class=glyph title="">&nsc;</span> </td> <tr id=entity-nsccue><td> <code title="">nsccue;</code> </td> <td> U+022E1 </td> <td> <span class=glyph title="">&nsccue;</span> </td> <tr id=entity-nsce><td> <code title="">nsce;</code> </td> <td> U+02AB0 U+00338 </td> <td> <span class="glyph compound" title="">&succeq;&#x338;</span> </td> <tr id=entity-Nscr><td> <code title="">Nscr;</code> </td> <td> U+1D4A9 </td> <td> <span class=glyph title="">&Nscr;</span> </td> <tr id=entity-nscr><td> <code title="">nscr;</code> </td> <td> U+1D4C3 </td> <td> <span class=glyph title="">&nscr;</span> </td> <tr id=entity-nshortmid><td> <code title="">nshortmid;</code> </td> <td> U+02224 </td> <td> <span class=glyph title="">&nmid;</span> </td> <tr id=entity-nshortparallel><td> <code title="">nshortparallel;</code> </td> <td> U+02226 </td> <td> <span class=glyph title="">&nspar;</span> </td> <tr id=entity-nsim><td> <code title="">nsim;</code> </td> <td> U+02241 </td> <td> <span class=glyph title="">&nsim;</span> </td> <tr id=entity-nsime><td> <code title="">nsime;</code> </td> <td> U+02244 </td> <td> <span class=glyph title="">&nsimeq;</span> </td> <tr id=entity-nsimeq><td> <code title="">nsimeq;</code> </td> <td> U+02244 </td> <td> <span class=glyph title="">&nsimeq;</span> </td> <tr id=entity-nsmid><td> <code title="">nsmid;</code> </td> <td> U+02224 </td> <td> <span class=glyph title="">&nmid;</span> </td> <tr id=entity-nspar><td> <code title="">nspar;</code> </td> <td> U+02226 </td> <td> <span class=glyph title="">&nspar;</span> </td> <tr id=entity-nsqsube><td> <code title="">nsqsube;</code> </td> <td> U+022E2 </td> <td> <span class=glyph title="">&nsqsube;</span> </td> <tr id=entity-nsqsupe><td> <code title="">nsqsupe;</code> </td> <td> U+022E3 </td> <td> <span class=glyph title="">&nsqsupe;</span> </td> <tr id=entity-nsub><td> <code title="">nsub;</code> </td> <td> U+02284 </td> <td> <span class=glyph title="">&nsub;</span> </td> <tr id=entity-nsubE><td> <code title="">nsubE;</code> </td> <td> U+02AC5 U+00338 </td> <td> <span class="glyph compound" title="">&subseteqq;&#x338;</span> </td> <tr id=entity-nsube><td> <code title="">nsube;</code> </td> <td> U+02288 </td> <td> <span class=glyph title="">&nsube;</span> </td> <tr id=entity-nsubset><td> <code title="">nsubset;</code> </td> <td> U+02282 U+020D2 </td> <td> <span class="glyph compound" title="">&sub;&#x20d2;</span> </td> <tr id=entity-nsubseteq><td> <code title="">nsubseteq;</code> </td> <td> U+02288 </td> <td> <span class=glyph title="">&nsube;</span> </td> <tr id=entity-nsubseteqq><td> <code title="">nsubseteqq;</code> </td> <td> U+02AC5 U+00338 </td> <td> <span class="glyph compound" title="">&subseteqq;&#x338;</span> </td> <tr id=entity-nsucc><td> <code title="">nsucc;</code> </td> <td> U+02281 </td> <td> <span class=glyph title="">&nsc;</span> </td> <tr id=entity-nsucceq><td> <code title="">nsucceq;</code> </td> <td> U+02AB0 U+00338 </td> <td> <span class="glyph compound" title="">&succeq;&#x338;</span> </td> <tr id=entity-nsup><td> <code title="">nsup;</code> </td> <td> U+02285 </td> <td> <span class=glyph title="">&nsup;</span> </td> <tr id=entity-nsupE><td> <code title="">nsupE;</code> </td> <td> U+02AC6 U+00338 </td> <td> <span class="glyph compound" title="">&supseteqq;&#x338;</span> </td> <tr id=entity-nsupe><td> <code title="">nsupe;</code> </td> <td> U+02289 </td> <td> <span class=glyph title="">&nsupseteq;</span> </td> <tr id=entity-nsupset><td> <code title="">nsupset;</code> </td> <td> U+02283 U+020D2 </td> <td> <span class="glyph compound" title="">&sup;&#x20d2;</span> </td> <tr id=entity-nsupseteq><td> <code title="">nsupseteq;</code> </td> <td> U+02289 </td> <td> <span class=glyph title="">&nsupseteq;</span> </td> <tr id=entity-nsupseteqq><td> <code title="">nsupseteqq;</code> </td> <td> U+02AC6 U+00338 </td> <td> <span class="glyph compound" title="">&supseteqq;&#x338;</span> </td> <tr id=entity-ntgl><td> <code title="">ntgl;</code> </td> <td> U+02279 </td> <td> <span class=glyph title="">&ntgl;</span> </td> <tr id=entity-Ntilde><td> <code title="">Ntilde;</code> </td> <td> U+000D1 </td> <td> <span class=glyph title="">&Ntilde;</span> </td> <tr id=entity-Ntilde-legacy class=impl><td> <code title="">Ntilde</code> </td> <td> U+000D1 </td> <td> <span title="">&Ntilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ntilde><td> <code title="">ntilde;</code> </td> <td> U+000F1 </td> <td> <span class=glyph title="">&ntilde;</span> </td> <tr id=entity-ntilde-legacy class=impl><td> <code title="">ntilde</code> </td> <td> U+000F1 </td> <td> <span title="">&ntilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ntlg><td> <code title="">ntlg;</code> </td> <td> U+02278 </td> <td> <span class=glyph title="">&ntlg;</span> </td> <tr id=entity-ntriangleleft><td> <code title="">ntriangleleft;</code> </td> <td> U+022EA </td> <td> <span class=glyph title="">&nltri;</span> </td> <tr id=entity-ntrianglelefteq><td> <code title="">ntrianglelefteq;</code> </td> <td> U+022EC </td> <td> <span class=glyph title="">&nltrie;</span> </td> <tr id=entity-ntriangleright><td> <code title="">ntriangleright;</code> </td> <td> U+022EB </td> <td> <span class=glyph title="">&ntriangleright;</span> </td> <tr id=entity-ntrianglerighteq><td> <code title="">ntrianglerighteq;</code> </td> <td> U+022ED </td> <td> <span class=glyph title="">&nrtrie;</span> </td> <tr id=entity-Nu><td> <code title="">Nu;</code> </td> <td> U+0039D </td> <td> <span class=glyph title="">&Nu;</span> </td> <tr id=entity-nu><td> <code title="">nu;</code> </td> <td> U+003BD </td> <td> <span class=glyph title="">&nu;</span> </td> <tr id=entity-num><td> <code title="">num;</code> </td> <td> U+00023 </td> <td> <span class=glyph title="">#</span> </td> <tr id=entity-numero><td> <code title="">numero;</code> </td> <td> U+02116 </td> <td> <span class=glyph title="">&numero;</span> </td> <tr id=entity-numsp><td> <code title="">numsp;</code> </td> <td> U+02007 </td> <td> <span class=glyph title="">&numsp;</span> </td> <tr id=entity-nvap><td> <code title="">nvap;</code> </td> <td> U+0224D U+020D2 </td> <td> <span class="glyph compound" title="">&asympeq;&#x20d2;</span> </td> <tr id=entity-nVDash><td> <code title="">nVDash;</code> </td> <td> U+022AF </td> <td> <span class=glyph title="">&nVDash;</span> </td> <tr id=entity-nVdash><td> <code title="">nVdash;</code> </td> <td> U+022AE </td> <td> <span class=glyph title="">&nVdash;</span> </td> <tr id=entity-nvDash><td> <code title="">nvDash;</code> </td> <td> U+022AD </td> <td> <span class=glyph title="">&nvDash;</span> </td> <tr id=entity-nvdash><td> <code title="">nvdash;</code> </td> <td> U+022AC </td> <td> <span class=glyph title="">&nvdash;</span> </td> <tr id=entity-nvge><td> <code title="">nvge;</code> </td> <td> U+02265 U+020D2 </td> <td> <span class="glyph compound" title="">&ge;&#x20d2;</span> </td> <tr id=entity-nvgt><td> <code title="">nvgt;</code> </td> <td> U+0003E U+020D2 </td> <td> <span class="glyph compound" title="">&gt;&#x20d2;</span> </td> <tr id=entity-nvHarr><td> <code title="">nvHarr;</code> </td> <td> U+02904 </td> <td> <span class=glyph title="">&nvHarr;</span> </td> <tr id=entity-nvinfin><td> <code title="">nvinfin;</code> </td> <td> U+029DE </td> <td> <span class=glyph title="">&nvinfin;</span> </td> <tr id=entity-nvlArr><td> <code title="">nvlArr;</code> </td> <td> U+02902 </td> <td> <span class=glyph title="">&nvlArr;</span> </td> <tr id=entity-nvle><td> <code title="">nvle;</code> </td> <td> U+02264 U+020D2 </td> <td> <span class="glyph compound" title="">&le;&#x20d2;</span> </td> <tr id=entity-nvlt><td> <code title="">nvlt;</code> </td> <td> U+0003C U+020D2 </td> <td> <span class="glyph compound" title="">&lt;&#x20d2;</span> </td> <tr id=entity-nvltrie><td> <code title="">nvltrie;</code> </td> <td> U+022B4 U+020D2 </td> <td> <span class="glyph compound" title="">&ltrie;&#x20d2;</span> </td> <tr id=entity-nvrArr><td> <code title="">nvrArr;</code> </td> <td> U+02903 </td> <td> <span class=glyph title="">&nvrArr;</span> </td> <tr id=entity-nvrtrie><td> <code title="">nvrtrie;</code> </td> <td> U+022B5 U+020D2 </td> <td> <span class="glyph compound" title="">&rtrie;&#x20d2;</span> </td> <tr id=entity-nvsim><td> <code title="">nvsim;</code> </td> <td> U+0223C U+020D2 </td> <td> <span class="glyph compound" title="">&sim;&#x20d2;</span> </td> <tr id=entity-nwarhk><td> <code title="">nwarhk;</code> </td> <td> U+02923 </td> <td> <span class=glyph title="">&nwarhk;</span> </td> <tr id=entity-nwArr><td> <code title="">nwArr;</code> </td> <td> U+021D6 </td> <td> <span class=glyph title="">&nwArr;</span> </td> <tr id=entity-nwarr><td> <code title="">nwarr;</code> </td> <td> U+02196 </td> <td> <span class=glyph title="">&nwarrow;</span> </td> <tr id=entity-nwarrow><td> <code title="">nwarrow;</code> </td> <td> U+02196 </td> <td> <span class=glyph title="">&nwarrow;</span> </td> <tr id=entity-nwnear><td> <code title="">nwnear;</code> </td> <td> U+02927 </td> <td> <span class=glyph title="">&nwnear;</span> </td> <tr id=entity-Oacute><td> <code title="">Oacute;</code> </td> <td> U+000D3 </td> <td> <span class=glyph title="">&Oacute;</span> </td> <tr id=entity-Oacute-legacy class=impl><td> <code title="">Oacute</code> </td> <td> U+000D3 </td> <td> <span title="">&Oacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-oacute><td> <code title="">oacute;</code> </td> <td> U+000F3 </td> <td> <span class=glyph title="">&oacute;</span> </td> <tr id=entity-oacute-legacy class=impl><td> <code title="">oacute</code> </td> <td> U+000F3 </td> <td> <span title="">&oacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-oast><td> <code title="">oast;</code> </td> <td> U+0229B </td> <td> <span class=glyph title="">&oast;</span> </td> <tr id=entity-ocir><td> <code title="">ocir;</code> </td> <td> U+0229A </td> <td> <span class=glyph title="">&ocir;</span> </td> <tr id=entity-Ocirc><td> <code title="">Ocirc;</code> </td> <td> U+000D4 </td> <td> <span class=glyph title="">&Ocirc;</span> </td> <tr id=entity-Ocirc-legacy class=impl><td> <code title="">Ocirc</code> </td> <td> U+000D4 </td> <td> <span title="">&Ocirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ocirc><td> <code title="">ocirc;</code> </td> <td> U+000F4 </td> <td> <span class=glyph title="">&ocirc;</span> </td> <tr id=entity-ocirc-legacy class=impl><td> <code title="">ocirc</code> </td> <td> U+000F4 </td> <td> <span title="">&ocirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Ocy><td> <code title="">Ocy;</code> </td> <td> U+0041E </td> <td> <span class=glyph title="">&Ocy;</span> </td> <tr id=entity-ocy><td> <code title="">ocy;</code> </td> <td> U+0043E </td> <td> <span class=glyph title="">&ocy;</span> </td> <tr id=entity-odash><td> <code title="">odash;</code> </td> <td> U+0229D </td> <td> <span class=glyph title="">&circleddash;</span> </td> <tr id=entity-Odblac><td> <code title="">Odblac;</code> </td> <td> U+00150 </td> <td> <span class=glyph title="">&Odblac;</span> </td> <tr id=entity-odblac><td> <code title="">odblac;</code> </td> <td> U+00151 </td> <td> <span class=glyph title="">&odblac;</span> </td> <tr id=entity-odiv><td> <code title="">odiv;</code> </td> <td> U+02A38 </td> <td> <span class=glyph title="">&odiv;</span> </td> <tr id=entity-odot><td> <code title="">odot;</code> </td> <td> U+02299 </td> <td> <span class=glyph title="">&odot;</span> </td> <tr id=entity-odsold><td> <code title="">odsold;</code> </td> <td> U+029BC </td> <td> <span class=glyph title="">&odsold;</span> </td> <tr id=entity-OElig><td> <code title="">OElig;</code> </td> <td> U+00152 </td> <td> <span class=glyph title="">&OElig;</span> </td> <tr id=entity-oelig><td> <code title="">oelig;</code> </td> <td> U+00153 </td> <td> <span class=glyph title="">&oelig;</span> </td> <tr id=entity-ofcir><td> <code title="">ofcir;</code> </td> <td> U+029BF </td> <td> <span class=glyph title="">&ofcir;</span> </td> <tr id=entity-Ofr><td> <code title="">Ofr;</code> </td> <td> U+1D512 </td> <td> <span class=glyph title="">&Ofr;</span> </td> <tr id=entity-ofr><td> <code title="">ofr;</code> </td> <td> U+1D52C </td> <td> <span class=glyph title="">&ofr;</span> </td> <tr id=entity-ogon><td> <code title="">ogon;</code> </td> <td> U+002DB </td> <td> <span class=glyph title="">&ogon;</span> </td> <tr id=entity-Ograve><td> <code title="">Ograve;</code> </td> <td> U+000D2 </td> <td> <span class=glyph title="">&Ograve;</span> </td> <tr id=entity-Ograve-legacy class=impl><td> <code title="">Ograve</code> </td> <td> U+000D2 </td> <td> <span title="">&Ograve;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ograve><td> <code title="">ograve;</code> </td> <td> U+000F2 </td> <td> <span class=glyph title="">&ograve;</span> </td> <tr id=entity-ograve-legacy class=impl><td> <code title="">ograve</code> </td> <td> U+000F2 </td> <td> <span title="">&ograve;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ogt><td> <code title="">ogt;</code> </td> <td> U+029C1 </td> <td> <span class=glyph title="">&ogt;</span> </td> <tr id=entity-ohbar><td> <code title="">ohbar;</code> </td> <td> U+029B5 </td> <td> <span class=glyph title="">&ohbar;</span> </td> <tr id=entity-ohm><td> <code title="">ohm;</code> </td> <td> U+003A9 </td> <td> <span class=glyph title="">&ohm;</span> </td> <tr id=entity-oint><td> <code title="">oint;</code> </td> <td> U+0222E </td> <td> <span class=glyph title="">&conint;</span> </td> <tr id=entity-olarr><td> <code title="">olarr;</code> </td> <td> U+021BA </td> <td> <span class=glyph title="">&olarr;</span> </td> <tr id=entity-olcir><td> <code title="">olcir;</code> </td> <td> U+029BE </td> <td> <span class=glyph title="">&olcir;</span> </td> <tr id=entity-olcross><td> <code title="">olcross;</code> </td> <td> U+029BB </td> <td> <span class=glyph title="">&olcross;</span> </td> <tr id=entity-oline><td> <code title="">oline;</code> </td> <td> U+0203E </td> <td> <span class=glyph title="">&oline;</span> </td> <tr id=entity-olt><td> <code title="">olt;</code> </td> <td> U+029C0 </td> <td> <span class=glyph title="">&olt;</span> </td> <tr id=entity-Omacr><td> <code title="">Omacr;</code> </td> <td> U+0014C </td> <td> <span class=glyph title="">&Omacr;</span> </td> <tr id=entity-omacr><td> <code title="">omacr;</code> </td> <td> U+0014D </td> <td> <span class=glyph title="">&omacr;</span> </td> <tr id=entity-Omega><td> <code title="">Omega;</code> </td> <td> U+003A9 </td> <td> <span class=glyph title="">&ohm;</span> </td> <tr id=entity-omega><td> <code title="">omega;</code> </td> <td> U+003C9 </td> <td> <span class=glyph title="">&omega;</span> </td> <tr id=entity-Omicron><td> <code title="">Omicron;</code> </td> <td> U+0039F </td> <td> <span class=glyph title="">&Omicron;</span> </td> <tr id=entity-omicron><td> <code title="">omicron;</code> </td> <td> U+003BF </td> <td> <span class=glyph title="">&omicron;</span> </td> <tr id=entity-omid><td> <code title="">omid;</code> </td> <td> U+029B6 </td> <td> <span class=glyph title="">&omid;</span> </td> <tr id=entity-ominus><td> <code title="">ominus;</code> </td> <td> U+02296 </td> <td> <span class=glyph title="">&ominus;</span> </td> <tr id=entity-Oopf><td> <code title="">Oopf;</code> </td> <td> U+1D546 </td> <td> <span class=glyph title="">&Oopf;</span> </td> <tr id=entity-oopf><td> <code title="">oopf;</code> </td> <td> U+1D560 </td> <td> <span class=glyph title="">&oopf;</span> </td> <tr id=entity-opar><td> <code title="">opar;</code> </td> <td> U+029B7 </td> <td> <span class=glyph title="">&opar;</span> </td> <tr id=entity-OpenCurlyDoubleQuote><td> <code title="">OpenCurlyDoubleQuote;</code> </td> <td> U+0201C </td> <td> <span class=glyph title="">&ldquo;</span> </td> <tr id=entity-OpenCurlyQuote><td> <code title="">OpenCurlyQuote;</code> </td> <td> U+02018 </td> <td> <span class=glyph title="">&lsquo;</span> </td> <tr id=entity-operp><td> <code title="">operp;</code> </td> <td> U+029B9 </td> <td> <span class=glyph title="">&operp;</span> </td> <tr id=entity-oplus><td> <code title="">oplus;</code> </td> <td> U+02295 </td> <td> <span class=glyph title="">&oplus;</span> </td> <tr id=entity-Or><td> <code title="">Or;</code> </td> <td> U+02A54 </td> <td> <span class=glyph title="">&Or;</span> </td> <tr id=entity-or><td> <code title="">or;</code> </td> <td> U+02228 </td> <td> <span class=glyph title="">&vee;</span> </td> <tr id=entity-orarr><td> <code title="">orarr;</code> </td> <td> U+021BB </td> <td> <span class=glyph title="">&orarr;</span> </td> <tr id=entity-ord><td> <code title="">ord;</code> </td> <td> U+02A5D </td> <td> <span class=glyph title="">&ord;</span> </td> <tr id=entity-order><td> <code title="">order;</code> </td> <td> U+02134 </td> <td> <span class=glyph title="">&oscr;</span> </td> <tr id=entity-orderof><td> <code title="">orderof;</code> </td> <td> U+02134 </td> <td> <span class=glyph title="">&oscr;</span> </td> <tr id=entity-ordf><td> <code title="">ordf;</code> </td> <td> U+000AA </td> <td> <span class=glyph title="">&ordf;</span> </td> <tr id=entity-ordf-legacy class=impl><td> <code title="">ordf</code> </td> <td> U+000AA </td> <td> <span title="">&ordf;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ordm><td> <code title="">ordm;</code> </td> <td> U+000BA </td> <td> <span class=glyph title="">&ordm;</span> </td> <tr id=entity-ordm-legacy class=impl><td> <code title="">ordm</code> </td> <td> U+000BA </td> <td> <span title="">&ordm;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-origof><td> <code title="">origof;</code> </td> <td> U+022B6 </td> <td> <span class=glyph title="">&origof;</span> </td> <tr id=entity-oror><td> <code title="">oror;</code> </td> <td> U+02A56 </td> <td> <span class=glyph title="">&oror;</span> </td> <tr id=entity-orslope><td> <code title="">orslope;</code> </td> <td> U+02A57 </td> <td> <span class=glyph title="">&orslope;</span> </td> <tr id=entity-orv><td> <code title="">orv;</code> </td> <td> U+02A5B </td> <td> <span class=glyph title="">&orv;</span> </td> <tr id=entity-oS><td> <code title="">oS;</code> </td> <td> U+024C8 </td> <td> <span class=glyph title="">&oS;</span> </td> <tr id=entity-Oscr><td> <code title="">Oscr;</code> </td> <td> U+1D4AA </td> <td> <span class=glyph title="">&Oscr;</span> </td> <tr id=entity-oscr><td> <code title="">oscr;</code> </td> <td> U+02134 </td> <td> <span class=glyph title="">&oscr;</span> </td> <tr id=entity-Oslash><td> <code title="">Oslash;</code> </td> <td> U+000D8 </td> <td> <span class=glyph title="">&Oslash;</span> </td> <tr id=entity-Oslash-legacy class=impl><td> <code title="">Oslash</code> </td> <td> U+000D8 </td> <td> <span title="">&Oslash;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-oslash><td> <code title="">oslash;</code> </td> <td> U+000F8 </td> <td> <span class=glyph title="">&oslash;</span> </td> <tr id=entity-oslash-legacy class=impl><td> <code title="">oslash</code> </td> <td> U+000F8 </td> <td> <span title="">&oslash;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-osol><td> <code title="">osol;</code> </td> <td> U+02298 </td> <td> <span class=glyph title="">&osol;</span> </td> <tr id=entity-Otilde><td> <code title="">Otilde;</code> </td> <td> U+000D5 </td> <td> <span class=glyph title="">&Otilde;</span> </td> <tr id=entity-Otilde-legacy class=impl><td> <code title="">Otilde</code> </td> <td> U+000D5 </td> <td> <span title="">&Otilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-otilde><td> <code title="">otilde;</code> </td> <td> U+000F5 </td> <td> <span class=glyph title="">&otilde;</span> </td> <tr id=entity-otilde-legacy class=impl><td> <code title="">otilde</code> </td> <td> U+000F5 </td> <td> <span title="">&otilde;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Otimes><td> <code title="">Otimes;</code> </td> <td> U+02A37 </td> <td> <span class=glyph title="">&Otimes;</span> </td> <tr id=entity-otimes><td> <code title="">otimes;</code> </td> <td> U+02297 </td> <td> <span class=glyph title="">&otimes;</span> </td> <tr id=entity-otimesas><td> <code title="">otimesas;</code> </td> <td> U+02A36 </td> <td> <span class=glyph title="">&otimesas;</span> </td> <tr id=entity-Ouml><td> <code title="">Ouml;</code> </td> <td> U+000D6 </td> <td> <span class=glyph title="">&Ouml;</span> </td> <tr id=entity-Ouml-legacy class=impl><td> <code title="">Ouml</code> </td> <td> U+000D6 </td> <td> <span title="">&Ouml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ouml><td> <code title="">ouml;</code> </td> <td> U+000F6 </td> <td> <span class=glyph title="">&ouml;</span> </td> <tr id=entity-ouml-legacy class=impl><td> <code title="">ouml</code> </td> <td> U+000F6 </td> <td> <span title="">&ouml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ovbar><td> <code title="">ovbar;</code> </td> <td> U+0233D </td> <td> <span class=glyph title="">&ovbar;</span> </td> <tr id=entity-OverBar><td> <code title="">OverBar;</code> </td> <td> U+0203E </td> <td> <span class=glyph title="">&oline;</span> </td> <tr id=entity-OverBrace><td> <code title="">OverBrace;</code> </td> <td> U+023DE </td> <td> <span class=glyph title="">&OverBrace;</span> </td> <tr id=entity-OverBracket><td> <code title="">OverBracket;</code> </td> <td> U+023B4 </td> <td> <span class=glyph title="">&tbrk;</span> </td> <tr id=entity-OverParenthesis><td> <code title="">OverParenthesis;</code> </td> <td> U+023DC </td> <td> <span class=glyph title="">&OverParenthesis;</span> </td> <tr id=entity-par><td> <code title="">par;</code> </td> <td> U+02225 </td> <td> <span class=glyph title="">&spar;</span> </td> <tr id=entity-para><td> <code title="">para;</code> </td> <td> U+000B6 </td> <td> <span class=glyph title="">&para;</span> </td> <tr id=entity-para-legacy class=impl><td> <code title="">para</code> </td> <td> U+000B6 </td> <td> <span title="">&para;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-parallel><td> <code title="">parallel;</code> </td> <td> U+02225 </td> <td> <span class=glyph title="">&spar;</span> </td> <tr id=entity-parsim><td> <code title="">parsim;</code> </td> <td> U+02AF3 </td> <td> <span class=glyph title="">&parsim;</span> </td> <tr id=entity-parsl><td> <code title="">parsl;</code> </td> <td> U+02AFD </td> <td> <span class=glyph title="">&parsl;</span> </td> <tr id=entity-part><td> <code title="">part;</code> </td> <td> U+02202 </td> <td> <span class=glyph title="">&part;</span> </td> <tr id=entity-PartialD><td> <code title="">PartialD;</code> </td> <td> U+02202 </td> <td> <span class=glyph title="">&part;</span> </td> <tr id=entity-Pcy><td> <code title="">Pcy;</code> </td> <td> U+0041F </td> <td> <span class=glyph title="">&Pcy;</span> </td> <tr id=entity-pcy><td> <code title="">pcy;</code> </td> <td> U+0043F </td> <td> <span class=glyph title="">&pcy;</span> </td> <tr id=entity-percnt><td> <code title="">percnt;</code> </td> <td> U+00025 </td> <td> <span class=glyph title="">%</span> </td> <tr id=entity-period><td> <code title="">period;</code> </td> <td> U+0002E </td> <td> <span class=glyph title="">.</span> </td> <tr id=entity-permil><td> <code title="">permil;</code> </td> <td> U+02030 </td> <td> <span class=glyph title="">&permil;</span> </td> <tr id=entity-perp><td> <code title="">perp;</code> </td> <td> U+022A5 </td> <td> <span class=glyph title="">&bottom;</span> </td> <tr id=entity-pertenk><td> <code title="">pertenk;</code> </td> <td> U+02031 </td> <td> <span class=glyph title="">&pertenk;</span> </td> <tr id=entity-Pfr><td> <code title="">Pfr;</code> </td> <td> U+1D513 </td> <td> <span class=glyph title="">&Pfr;</span> </td> <tr id=entity-pfr><td> <code title="">pfr;</code> </td> <td> U+1D52D </td> <td> <span class=glyph title="">&pfr;</span> </td> <tr id=entity-Phi><td> <code title="">Phi;</code> </td> <td> U+003A6 </td> <td> <span class=glyph title="">&Phi;</span> </td> <tr id=entity-phi><td> <code title="">phi;</code> </td> <td> U+003C6 </td> <td> <span class=glyph title="">&phi;</span> </td> <tr id=entity-phiv><td> <code title="">phiv;</code> </td> <td> U+003D5 </td> <td> <span class=glyph title="">&phiv;</span> </td> <tr id=entity-phmmat><td> <code title="">phmmat;</code> </td> <td> U+02133 </td> <td> <span class=glyph title="">&phmmat;</span> </td> <tr id=entity-phone><td> <code title="">phone;</code> </td> <td> U+0260E </td> <td> <span class=glyph title="">&phone;</span> </td> <tr id=entity-Pi><td> <code title="">Pi;</code> </td> <td> U+003A0 </td> <td> <span class=glyph title="">&Pi;</span> </td> <tr id=entity-pi><td> <code title="">pi;</code> </td> <td> U+003C0 </td> <td> <span class=glyph title="">&pi;</span> </td> <tr id=entity-pitchfork><td> <code title="">pitchfork;</code> </td> <td> U+022D4 </td> <td> <span class=glyph title="">&fork;</span> </td> <tr id=entity-piv><td> <code title="">piv;</code> </td> <td> U+003D6 </td> <td> <span class=glyph title="">&varpi;</span> </td> <tr id=entity-planck><td> <code title="">planck;</code> </td> <td> U+0210F </td> <td> <span class=glyph title="">&hslash;</span> </td> <tr id=entity-planckh><td> <code title="">planckh;</code> </td> <td> U+0210E </td> <td> <span class=glyph title="">&planckh;</span> </td> <tr id=entity-plankv><td> <code title="">plankv;</code> </td> <td> U+0210F </td> <td> <span class=glyph title="">&hslash;</span> </td> <tr id=entity-plus><td> <code title="">plus;</code> </td> <td> U+0002B </td> <td> <span class=glyph title="">+</span> </td> <tr id=entity-plusacir><td> <code title="">plusacir;</code> </td> <td> U+02A23 </td> <td> <span class=glyph title="">&plusacir;</span> </td> <tr id=entity-plusb><td> <code title="">plusb;</code> </td> <td> U+0229E </td> <td> <span class=glyph title="">&boxplus;</span> </td> <tr id=entity-pluscir><td> <code title="">pluscir;</code> </td> <td> U+02A22 </td> <td> <span class=glyph title="">&pluscir;</span> </td> <tr id=entity-plusdo><td> <code title="">plusdo;</code> </td> <td> U+02214 </td> <td> <span class=glyph title="">&dotplus;</span> </td> <tr id=entity-plusdu><td> <code title="">plusdu;</code> </td> <td> U+02A25 </td> <td> <span class=glyph title="">&plusdu;</span> </td> <tr id=entity-pluse><td> <code title="">pluse;</code> </td> <td> U+02A72 </td> <td> <span class=glyph title="">&pluse;</span> </td> <tr id=entity-PlusMinus><td> <code title="">PlusMinus;</code> </td> <td> U+000B1 </td> <td> <span class=glyph title="">&plusmn;</span> </td> <tr id=entity-plusmn><td> <code title="">plusmn;</code> </td> <td> U+000B1 </td> <td> <span class=glyph title="">&plusmn;</span> </td> <tr id=entity-plusmn-legacy class=impl><td> <code title="">plusmn</code> </td> <td> U+000B1 </td> <td> <span title="">&plusmn;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-plussim><td> <code title="">plussim;</code> </td> <td> U+02A26 </td> <td> <span class=glyph title="">&plussim;</span> </td> <tr id=entity-plustwo><td> <code title="">plustwo;</code> </td> <td> U+02A27 </td> <td> <span class=glyph title="">&plustwo;</span> </td> <tr id=entity-pm><td> <code title="">pm;</code> </td> <td> U+000B1 </td> <td> <span class=glyph title="">&plusmn;</span> </td> <tr id=entity-Poincareplane><td> <code title="">Poincareplane;</code> </td> <td> U+0210C </td> <td> <span class=glyph title="">&Hfr;</span> </td> <tr id=entity-pointint><td> <code title="">pointint;</code> </td> <td> U+02A15 </td> <td> <span class=glyph title="">&pointint;</span> </td> <tr id=entity-Popf><td> <code title="">Popf;</code> </td> <td> U+02119 </td> <td> <span class=glyph title="">&primes;</span> </td> <tr id=entity-popf><td> <code title="">popf;</code> </td> <td> U+1D561 </td> <td> <span class=glyph title="">&popf;</span> </td> <tr id=entity-pound><td> <code title="">pound;</code> </td> <td> U+000A3 </td> <td> <span class=glyph title="">&pound;</span> </td> <tr id=entity-pound-legacy class=impl><td> <code title="">pound</code> </td> <td> U+000A3 </td> <td> <span title="">&pound;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Pr><td> <code title="">Pr;</code> </td> <td> U+02ABB </td> <td> <span class=glyph title="">&Pr;</span> </td> <tr id=entity-pr><td> <code title="">pr;</code> </td> <td> U+0227A </td> <td> <span class=glyph title="">&pr;</span> </td> <tr id=entity-prap><td> <code title="">prap;</code> </td> <td> U+02AB7 </td> <td> <span class=glyph title="">&prap;</span> </td> <tr id=entity-prcue><td> <code title="">prcue;</code> </td> <td> U+0227C </td> <td> <span class=glyph title="">&preccurlyeq;</span> </td> <tr id=entity-prE><td> <code title="">prE;</code> </td> <td> U+02AB3 </td> <td> <span class=glyph title="">&prE;</span> </td> <tr id=entity-pre><td> <code title="">pre;</code> </td> <td> U+02AAF </td> <td> <span class=glyph title="">&pre;</span> </td> <tr id=entity-prec><td> <code title="">prec;</code> </td> <td> U+0227A </td> <td> <span class=glyph title="">&pr;</span> </td> <tr id=entity-precapprox><td> <code title="">precapprox;</code> </td> <td> U+02AB7 </td> <td> <span class=glyph title="">&prap;</span> </td> <tr id=entity-preccurlyeq><td> <code title="">preccurlyeq;</code> </td> <td> U+0227C </td> <td> <span class=glyph title="">&preccurlyeq;</span> </td> <tr id=entity-Precedes><td> <code title="">Precedes;</code> </td> <td> U+0227A </td> <td> <span class=glyph title="">&pr;</span> </td> <tr id=entity-PrecedesEqual><td> <code title="">PrecedesEqual;</code> </td> <td> U+02AAF </td> <td> <span class=glyph title="">&pre;</span> </td> <tr id=entity-PrecedesSlantEqual><td> <code title="">PrecedesSlantEqual;</code> </td> <td> U+0227C </td> <td> <span class=glyph title="">&preccurlyeq;</span> </td> <tr id=entity-PrecedesTilde><td> <code title="">PrecedesTilde;</code> </td> <td> U+0227E </td> <td> <span class=glyph title="">&prsim;</span> </td> <tr id=entity-preceq><td> <code title="">preceq;</code> </td> <td> U+02AAF </td> <td> <span class=glyph title="">&pre;</span> </td> <tr id=entity-precnapprox><td> <code title="">precnapprox;</code> </td> <td> U+02AB9 </td> <td> <span class=glyph title="">&prnap;</span> </td> <tr id=entity-precneqq><td> <code title="">precneqq;</code> </td> <td> U+02AB5 </td> <td> <span class=glyph title="">&precneqq;</span> </td> <tr id=entity-precnsim><td> <code title="">precnsim;</code> </td> <td> U+022E8 </td> <td> <span class=glyph title="">&prnsim;</span> </td> <tr id=entity-precsim><td> <code title="">precsim;</code> </td> <td> U+0227E </td> <td> <span class=glyph title="">&prsim;</span> </td> <tr id=entity-Prime><td> <code title="">Prime;</code> </td> <td> U+02033 </td> <td> <span class=glyph title="">&Prime;</span> </td> <tr id=entity-prime><td> <code title="">prime;</code> </td> <td> U+02032 </td> <td> <span class=glyph title="">&prime;</span> </td> <tr id=entity-primes><td> <code title="">primes;</code> </td> <td> U+02119 </td> <td> <span class=glyph title="">&primes;</span> </td> <tr id=entity-prnap><td> <code title="">prnap;</code> </td> <td> U+02AB9 </td> <td> <span class=glyph title="">&prnap;</span> </td> <tr id=entity-prnE><td> <code title="">prnE;</code> </td> <td> U+02AB5 </td> <td> <span class=glyph title="">&precneqq;</span> </td> <tr id=entity-prnsim><td> <code title="">prnsim;</code> </td> <td> U+022E8 </td> <td> <span class=glyph title="">&prnsim;</span> </td> <tr id=entity-prod><td> <code title="">prod;</code> </td> <td> U+0220F </td> <td> <span class=glyph title="">&prod;</span> </td> <tr id=entity-Product><td> <code title="">Product;</code> </td> <td> U+0220F </td> <td> <span class=glyph title="">&prod;</span> </td> <tr id=entity-profalar><td> <code title="">profalar;</code> </td> <td> U+0232E </td> <td> <span class=glyph title="">&profalar;</span> </td> <tr id=entity-profline><td> <code title="">profline;</code> </td> <td> U+02312 </td> <td> <span class=glyph title="">&profline;</span> </td> <tr id=entity-profsurf><td> <code title="">profsurf;</code> </td> <td> U+02313 </td> <td> <span class=glyph title="">&profsurf;</span> </td> <tr id=entity-prop><td> <code title="">prop;</code> </td> <td> U+0221D </td> <td> <span class=glyph title="">&propto;</span> </td> <tr id=entity-Proportion><td> <code title="">Proportion;</code> </td> <td> U+02237 </td> <td> <span class=glyph title="">&Colon;</span> </td> <tr id=entity-Proportional><td> <code title="">Proportional;</code> </td> <td> U+0221D </td> <td> <span class=glyph title="">&propto;</span> </td> <tr id=entity-propto><td> <code title="">propto;</code> </td> <td> U+0221D </td> <td> <span class=glyph title="">&propto;</span> </td> <tr id=entity-prsim><td> <code title="">prsim;</code> </td> <td> U+0227E </td> <td> <span class=glyph title="">&prsim;</span> </td> <tr id=entity-prurel><td> <code title="">prurel;</code> </td> <td> U+022B0 </td> <td> <span class=glyph title="">&prurel;</span> </td> <tr id=entity-Pscr><td> <code title="">Pscr;</code> </td> <td> U+1D4AB </td> <td> <span class=glyph title="">&Pscr;</span> </td> <tr id=entity-pscr><td> <code title="">pscr;</code> </td> <td> U+1D4C5 </td> <td> <span class=glyph title="">&pscr;</span> </td> <tr id=entity-Psi><td> <code title="">Psi;</code> </td> <td> U+003A8 </td> <td> <span class=glyph title="">&Psi;</span> </td> <tr id=entity-psi><td> <code title="">psi;</code> </td> <td> U+003C8 </td> <td> <span class=glyph title="">&psi;</span> </td> <tr id=entity-puncsp><td> <code title="">puncsp;</code> </td> <td> U+02008 </td> <td> <span class=glyph title="">&puncsp;</span> </td> <tr id=entity-Qfr><td> <code title="">Qfr;</code> </td> <td> U+1D514 </td> <td> <span class=glyph title="">&Qfr;</span> </td> <tr id=entity-qfr><td> <code title="">qfr;</code> </td> <td> U+1D52E </td> <td> <span class=glyph title="">&qfr;</span> </td> <tr id=entity-qint><td> <code title="">qint;</code> </td> <td> U+02A0C </td> <td> <span class=glyph title="">&iiiint;</span> </td> <tr id=entity-Qopf><td> <code title="">Qopf;</code> </td> <td> U+0211A </td> <td> <span class=glyph title="">&rationals;</span> </td> <tr id=entity-qopf><td> <code title="">qopf;</code> </td> <td> U+1D562 </td> <td> <span class=glyph title="">&qopf;</span> </td> <tr id=entity-qprime><td> <code title="">qprime;</code> </td> <td> U+02057 </td> <td> <span class=glyph title="">&qprime;</span> </td> <tr id=entity-Qscr><td> <code title="">Qscr;</code> </td> <td> U+1D4AC </td> <td> <span class=glyph title="">&Qscr;</span> </td> <tr id=entity-qscr><td> <code title="">qscr;</code> </td> <td> U+1D4C6 </td> <td> <span class=glyph title="">&qscr;</span> </td> <tr id=entity-quaternions><td> <code title="">quaternions;</code> </td> <td> U+0210D </td> <td> <span class=glyph title="">&quaternions;</span> </td> <tr id=entity-quatint><td> <code title="">quatint;</code> </td> <td> U+02A16 </td> <td> <span class=glyph title="">&quatint;</span> </td> <tr id=entity-quest><td> <code title="">quest;</code> </td> <td> U+0003F </td> <td> <span class=glyph title="">?</span> </td> <tr id=entity-questeq><td> <code title="">questeq;</code> </td> <td> U+0225F </td> <td> <span class=glyph title="">&questeq;</span> </td> <tr id=entity-QUOT><td> <code title="">QUOT;</code> </td> <td> U+00022 </td> <td> <span class=glyph title="">"</span> </td> <tr id=entity-QUOT-legacy class=impl><td> <code title="">QUOT</code> </td> <td> U+00022 </td> <td> <span title="">"</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-quot><td> <code title="">quot;</code> </td> <td> U+00022 </td> <td> <span class=glyph title="">"</span> </td> <tr id=entity-quot-legacy class=impl><td> <code title="">quot</code> </td> <td> U+00022 </td> <td> <span title="">"</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-rAarr><td> <code title="">rAarr;</code> </td> <td> U+021DB </td> <td> <span class=glyph title="">&rAarr;</span> </td> <tr id=entity-race><td> <code title="">race;</code> </td> <td> U+0223D U+00331 </td> <td> <span class="glyph compound" title="">&backsim;&#x331;</span> </td> <tr id=entity-Racute><td> <code title="">Racute;</code> </td> <td> U+00154 </td> <td> <span class=glyph title="">&Racute;</span> </td> <tr id=entity-racute><td> <code title="">racute;</code> </td> <td> U+00155 </td> <td> <span class=glyph title="">&racute;</span> </td> <tr id=entity-radic><td> <code title="">radic;</code> </td> <td> U+0221A </td> <td> <span class=glyph title="">&radic;</span> </td> <tr id=entity-raemptyv><td> <code title="">raemptyv;</code> </td> <td> U+029B3 </td> <td> <span class=glyph title="">&raemptyv;</span> </td> <tr id=entity-Rang><td> <code title="">Rang;</code> </td> <td> U+027EB </td> <td> <span class=glyph title="">&Rang;</span> </td> <tr id=entity-rang><td> <code title="">rang;</code> </td> <td> U+027E9 </td> <td> <span class=glyph title="">&#x27E9;</span> </td> <tr id=entity-rangd><td> <code title="">rangd;</code> </td> <td> U+02992 </td> <td> <span class=glyph title="">&rangd;</span> </td> <tr id=entity-range><td> <code title="">range;</code> </td> <td> U+029A5 </td> <td> <span class=glyph title="">&range;</span> </td> <tr id=entity-rangle><td> <code title="">rangle;</code> </td> <td> U+027E9 </td> <td> <span class=glyph title="">&#x27E9;</span> </td> <tr id=entity-raquo><td> <code title="">raquo;</code> </td> <td> U+000BB </td> <td> <span class=glyph title="">&raquo;</span> </td> <tr id=entity-raquo-legacy class=impl><td> <code title="">raquo</code> </td> <td> U+000BB </td> <td> <span title="">&raquo;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Rarr><td> <code title="">Rarr;</code> </td> <td> U+021A0 </td> <td> <span class=glyph title="">&twoheadrightarrow;</span> </td> <tr id=entity-rArr><td> <code title="">rArr;</code> </td> <td> U+021D2 </td> <td> <span class=glyph title="">&Implies;</span> </td> <tr id=entity-rarr><td> <code title="">rarr;</code> </td> <td> U+02192 </td> <td> <span class=glyph title="">&srarr;</span> </td> <tr id=entity-rarrap><td> <code title="">rarrap;</code> </td> <td> U+02975 </td> <td> <span class=glyph title="">&rarrap;</span> </td> <tr id=entity-rarrb><td> <code title="">rarrb;</code> </td> <td> U+021E5 </td> <td> <span class=glyph title="">&rarrb;</span> </td> <tr id=entity-rarrbfs><td> <code title="">rarrbfs;</code> </td> <td> U+02920 </td> <td> <span class=glyph title="">&rarrbfs;</span> </td> <tr id=entity-rarrc><td> <code title="">rarrc;</code> </td> <td> U+02933 </td> <td> <span class=glyph title="">&rarrc;</span> </td> <tr id=entity-rarrfs><td> <code title="">rarrfs;</code> </td> <td> U+0291E </td> <td> <span class=glyph title="">&rarrfs;</span> </td> <tr id=entity-rarrhk><td> <code title="">rarrhk;</code> </td> <td> U+021AA </td> <td> <span class=glyph title="">&hookrightarrow;</span> </td> <tr id=entity-rarrlp><td> <code title="">rarrlp;</code> </td> <td> U+021AC </td> <td> <span class=glyph title="">&rarrlp;</span> </td> <tr id=entity-rarrpl><td> <code title="">rarrpl;</code> </td> <td> U+02945 </td> <td> <span class=glyph title="">&rarrpl;</span> </td> <tr id=entity-rarrsim><td> <code title="">rarrsim;</code> </td> <td> U+02974 </td> <td> <span class=glyph title="">&rarrsim;</span> </td> <tr id=entity-Rarrtl><td> <code title="">Rarrtl;</code> </td> <td> U+02916 </td> <td> <span class=glyph title="">&Rarrtl;</span> </td> <tr id=entity-rarrtl><td> <code title="">rarrtl;</code> </td> <td> U+021A3 </td> <td> <span class=glyph title="">&rightarrowtail;</span> </td> <tr id=entity-rarrw><td> <code title="">rarrw;</code> </td> <td> U+0219D </td> <td> <span class=glyph title="">&rightsquigarrow;</span> </td> <tr id=entity-rAtail><td> <code title="">rAtail;</code> </td> <td> U+0291C </td> <td> <span class=glyph title="">&rAtail;</span> </td> <tr id=entity-ratail><td> <code title="">ratail;</code> </td> <td> U+0291A </td> <td> <span class=glyph title="">&ratail;</span> </td> <tr id=entity-ratio><td> <code title="">ratio;</code> </td> <td> U+02236 </td> <td> <span class=glyph title="">&ratio;</span> </td> <tr id=entity-rationals><td> <code title="">rationals;</code> </td> <td> U+0211A </td> <td> <span class=glyph title="">&rationals;</span> </td> <tr id=entity-RBarr><td> <code title="">RBarr;</code> </td> <td> U+02910 </td> <td> <span class=glyph title="">&drbkarow;</span> </td> <tr id=entity-rBarr><td> <code title="">rBarr;</code> </td> <td> U+0290F </td> <td> <span class=glyph title="">&dbkarow;</span> </td> <tr id=entity-rbarr><td> <code title="">rbarr;</code> </td> <td> U+0290D </td> <td> <span class=glyph title="">&rbarr;</span> </td> <tr id=entity-rbbrk><td> <code title="">rbbrk;</code> </td> <td> U+02773 </td> <td> <span class=glyph title="">&rbbrk;</span> </td> <tr id=entity-rbrace><td> <code title="">rbrace;</code> </td> <td> U+0007D </td> <td> <span class=glyph title="">}</span> </td> <tr id=entity-rbrack><td> <code title="">rbrack;</code> </td> <td> U+0005D </td> <td> <span class=glyph title="">]</span> </td> <tr id=entity-rbrke><td> <code title="">rbrke;</code> </td> <td> U+0298C </td> <td> <span class=glyph title="">&rbrke;</span> </td> <tr id=entity-rbrksld><td> <code title="">rbrksld;</code> </td> <td> U+0298E </td> <td> <span class=glyph title="">&rbrksld;</span> </td> <tr id=entity-rbrkslu><td> <code title="">rbrkslu;</code> </td> <td> U+02990 </td> <td> <span class=glyph title="">&rbrkslu;</span> </td> <tr id=entity-Rcaron><td> <code title="">Rcaron;</code> </td> <td> U+00158 </td> <td> <span class=glyph title="">&Rcaron;</span> </td> <tr id=entity-rcaron><td> <code title="">rcaron;</code> </td> <td> U+00159 </td> <td> <span class=glyph title="">&rcaron;</span> </td> <tr id=entity-Rcedil><td> <code title="">Rcedil;</code> </td> <td> U+00156 </td> <td> <span class=glyph title="">&Rcedil;</span> </td> <tr id=entity-rcedil><td> <code title="">rcedil;</code> </td> <td> U+00157 </td> <td> <span class=glyph title="">&rcedil;</span> </td> <tr id=entity-rceil><td> <code title="">rceil;</code> </td> <td> U+02309 </td> <td> <span class=glyph title="">&rceil;</span> </td> <tr id=entity-rcub><td> <code title="">rcub;</code> </td> <td> U+0007D </td> <td> <span class=glyph title="">}</span> </td> <tr id=entity-Rcy><td> <code title="">Rcy;</code> </td> <td> U+00420 </td> <td> <span class=glyph title="">&Rcy;</span> </td> <tr id=entity-rcy><td> <code title="">rcy;</code> </td> <td> U+00440 </td> <td> <span class=glyph title="">&rcy;</span> </td> <tr id=entity-rdca><td> <code title="">rdca;</code> </td> <td> U+02937 </td> <td> <span class=glyph title="">&rdca;</span> </td> <tr id=entity-rdldhar><td> <code title="">rdldhar;</code> </td> <td> U+02969 </td> <td> <span class=glyph title="">&rdldhar;</span> </td> <tr id=entity-rdquo><td> <code title="">rdquo;</code> </td> <td> U+0201D </td> <td> <span class=glyph title="">&rdquo;</span> </td> <tr id=entity-rdquor><td> <code title="">rdquor;</code> </td> <td> U+0201D </td> <td> <span class=glyph title="">&rdquo;</span> </td> <tr id=entity-rdsh><td> <code title="">rdsh;</code> </td> <td> U+021B3 </td> <td> <span class=glyph title="">&rdsh;</span> </td> <tr id=entity-Re><td> <code title="">Re;</code> </td> <td> U+0211C </td> <td> <span class=glyph title="">&realpart;</span> </td> <tr id=entity-real><td> <code title="">real;</code> </td> <td> U+0211C </td> <td> <span class=glyph title="">&realpart;</span> </td> <tr id=entity-realine><td> <code title="">realine;</code> </td> <td> U+0211B </td> <td> <span class=glyph title="">&realine;</span> </td> <tr id=entity-realpart><td> <code title="">realpart;</code> </td> <td> U+0211C </td> <td> <span class=glyph title="">&realpart;</span> </td> <tr id=entity-reals><td> <code title="">reals;</code> </td> <td> U+0211D </td> <td> <span class=glyph title="">&reals;</span> </td> <tr id=entity-rect><td> <code title="">rect;</code> </td> <td> U+025AD </td> <td> <span class=glyph title="">&rect;</span> </td> <tr id=entity-REG><td> <code title="">REG;</code> </td> <td> U+000AE </td> <td> <span class=glyph title="">&reg;</span> </td> <tr id=entity-REG-legacy class=impl><td> <code title="">REG</code> </td> <td> U+000AE </td> <td> <span title="">&reg;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-reg><td> <code title="">reg;</code> </td> <td> U+000AE </td> <td> <span class=glyph title="">&reg;</span> </td> <tr id=entity-reg-legacy class=impl><td> <code title="">reg</code> </td> <td> U+000AE </td> <td> <span title="">&reg;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ReverseElement><td> <code title="">ReverseElement;</code> </td> <td> U+0220B </td> <td> <span class=glyph title="">&niv;</span> </td> <tr id=entity-ReverseEquilibrium><td> <code title="">ReverseEquilibrium;</code> </td> <td> U+021CB </td> <td> <span class=glyph title="">&leftrightharpoons;</span> </td> <tr id=entity-ReverseUpEquilibrium><td> <code title="">ReverseUpEquilibrium;</code> </td> <td> U+0296F </td> <td> <span class=glyph title="">&duhar;</span> </td> <tr id=entity-rfisht><td> <code title="">rfisht;</code> </td> <td> U+0297D </td> <td> <span class=glyph title="">&rfisht;</span> </td> <tr id=entity-rfloor><td> <code title="">rfloor;</code> </td> <td> U+0230B </td> <td> <span class=glyph title="">&rfloor;</span> </td> <tr id=entity-Rfr><td> <code title="">Rfr;</code> </td> <td> U+0211C </td> <td> <span class=glyph title="">&realpart;</span> </td> <tr id=entity-rfr><td> <code title="">rfr;</code> </td> <td> U+1D52F </td> <td> <span class=glyph title="">&rfr;</span> </td> <tr id=entity-rHar><td> <code title="">rHar;</code> </td> <td> U+02964 </td> <td> <span class=glyph title="">&rHar;</span> </td> <tr id=entity-rhard><td> <code title="">rhard;</code> </td> <td> U+021C1 </td> <td> <span class=glyph title="">&rhard;</span> </td> <tr id=entity-rharu><td> <code title="">rharu;</code> </td> <td> U+021C0 </td> <td> <span class=glyph title="">&rharu;</span> </td> <tr id=entity-rharul><td> <code title="">rharul;</code> </td> <td> U+0296C </td> <td> <span class=glyph title="">&rharul;</span> </td> <tr id=entity-Rho><td> <code title="">Rho;</code> </td> <td> U+003A1 </td> <td> <span class=glyph title="">&Rho;</span> </td> <tr id=entity-rho><td> <code title="">rho;</code> </td> <td> U+003C1 </td> <td> <span class=glyph title="">&rho;</span> </td> <tr id=entity-rhov><td> <code title="">rhov;</code> </td> <td> U+003F1 </td> <td> <span class=glyph title="">&rhov;</span> </td> <tr id=entity-RightAngleBracket><td> <code title="">RightAngleBracket;</code> </td> <td> U+027E9 </td> <td> <span class=glyph title="">&#x27E9;</span> </td> <tr id=entity-RightArrow><td> <code title="">RightArrow;</code> </td> <td> U+02192 </td> <td> <span class=glyph title="">&srarr;</span> </td> <tr id=entity-Rightarrow><td> <code title="">Rightarrow;</code> </td> <td> U+021D2 </td> <td> <span class=glyph title="">&Implies;</span> </td> <tr id=entity-rightarrow><td> <code title="">rightarrow;</code> </td> <td> U+02192 </td> <td> <span class=glyph title="">&srarr;</span> </td> <tr id=entity-RightArrowBar><td> <code title="">RightArrowBar;</code> </td> <td> U+021E5 </td> <td> <span class=glyph title="">&rarrb;</span> </td> <tr id=entity-RightArrowLeftArrow><td> <code title="">RightArrowLeftArrow;</code> </td> <td> U+021C4 </td> <td> <span class=glyph title="">&rlarr;</span> </td> <tr id=entity-rightarrowtail><td> <code title="">rightarrowtail;</code> </td> <td> U+021A3 </td> <td> <span class=glyph title="">&rightarrowtail;</span> </td> <tr id=entity-RightCeiling><td> <code title="">RightCeiling;</code> </td> <td> U+02309 </td> <td> <span class=glyph title="">&rceil;</span> </td> <tr id=entity-RightDoubleBracket><td> <code title="">RightDoubleBracket;</code> </td> <td> U+027E7 </td> <td> <span class=glyph title="">&robrk;</span> </td> <tr id=entity-RightDownTeeVector><td> <code title="">RightDownTeeVector;</code> </td> <td> U+0295D </td> <td> <span class=glyph title="">&RightDownTeeVector;</span> </td> <tr id=entity-RightDownVector><td> <code title="">RightDownVector;</code> </td> <td> U+021C2 </td> <td> <span class=glyph title="">&dharr;</span> </td> <tr id=entity-RightDownVectorBar><td> <code title="">RightDownVectorBar;</code> </td> <td> U+02955 </td> <td> <span class=glyph title="">&RightDownVectorBar;</span> </td> <tr id=entity-RightFloor><td> <code title="">RightFloor;</code> </td> <td> U+0230B </td> <td> <span class=glyph title="">&rfloor;</span> </td> <tr id=entity-rightharpoondown><td> <code title="">rightharpoondown;</code> </td> <td> U+021C1 </td> <td> <span class=glyph title="">&rhard;</span> </td> <tr id=entity-rightharpoonup><td> <code title="">rightharpoonup;</code> </td> <td> U+021C0 </td> <td> <span class=glyph title="">&rharu;</span> </td> <tr id=entity-rightleftarrows><td> <code title="">rightleftarrows;</code> </td> <td> U+021C4 </td> <td> <span class=glyph title="">&rlarr;</span> </td> <tr id=entity-rightleftharpoons><td> <code title="">rightleftharpoons;</code> </td> <td> U+021CC </td> <td> <span class=glyph title="">&rlhar;</span> </td> <tr id=entity-rightrightarrows><td> <code title="">rightrightarrows;</code> </td> <td> U+021C9 </td> <td> <span class=glyph title="">&rightrightarrows;</span> </td> <tr id=entity-rightsquigarrow><td> <code title="">rightsquigarrow;</code> </td> <td> U+0219D </td> <td> <span class=glyph title="">&rightsquigarrow;</span> </td> <tr id=entity-RightTee><td> <code title="">RightTee;</code> </td> <td> U+022A2 </td> <td> <span class=glyph title="">&vdash;</span> </td> <tr id=entity-RightTeeArrow><td> <code title="">RightTeeArrow;</code> </td> <td> U+021A6 </td> <td> <span class=glyph title="">&mapsto;</span> </td> <tr id=entity-RightTeeVector><td> <code title="">RightTeeVector;</code> </td> <td> U+0295B </td> <td> <span class=glyph title="">&RightTeeVector;</span> </td> <tr id=entity-rightthreetimes><td> <code title="">rightthreetimes;</code> </td> <td> U+022CC </td> <td> <span class=glyph title="">&rightthreetimes;</span> </td> <tr id=entity-RightTriangle><td> <code title="">RightTriangle;</code> </td> <td> U+022B3 </td> <td> <span class=glyph title="">&vartriangleright;</span> </td> <tr id=entity-RightTriangleBar><td> <code title="">RightTriangleBar;</code> </td> <td> U+029D0 </td> <td> <span class=glyph title="">&RightTriangleBar;</span> </td> <tr id=entity-RightTriangleEqual><td> <code title="">RightTriangleEqual;</code> </td> <td> U+022B5 </td> <td> <span class=glyph title="">&rtrie;</span> </td> <tr id=entity-RightUpDownVector><td> <code title="">RightUpDownVector;</code> </td> <td> U+0294F </td> <td> <span class=glyph title="">&RightUpDownVector;</span> </td> <tr id=entity-RightUpTeeVector><td> <code title="">RightUpTeeVector;</code> </td> <td> U+0295C </td> <td> <span class=glyph title="">&RightUpTeeVector;</span> </td> <tr id=entity-RightUpVector><td> <code title="">RightUpVector;</code> </td> <td> U+021BE </td> <td> <span class=glyph title="">&upharpoonright;</span> </td> <tr id=entity-RightUpVectorBar><td> <code title="">RightUpVectorBar;</code> </td> <td> U+02954 </td> <td> <span class=glyph title="">&RightUpVectorBar;</span> </td> <tr id=entity-RightVector><td> <code title="">RightVector;</code> </td> <td> U+021C0 </td> <td> <span class=glyph title="">&rharu;</span> </td> <tr id=entity-RightVectorBar><td> <code title="">RightVectorBar;</code> </td> <td> U+02953 </td> <td> <span class=glyph title="">&RightVectorBar;</span> </td> <tr id=entity-ring><td> <code title="">ring;</code> </td> <td> U+002DA </td> <td> <span class=glyph title="">&ring;</span> </td> <tr id=entity-risingdotseq><td> <code title="">risingdotseq;</code> </td> <td> U+02253 </td> <td> <span class=glyph title="">&risingdotseq;</span> </td> <tr id=entity-rlarr><td> <code title="">rlarr;</code> </td> <td> U+021C4 </td> <td> <span class=glyph title="">&rlarr;</span> </td> <tr id=entity-rlhar><td> <code title="">rlhar;</code> </td> <td> U+021CC </td> <td> <span class=glyph title="">&rlhar;</span> </td> <tr id=entity-rlm><td> <code title="">rlm;</code> </td> <td> U+0200F </td> <td> <span class=glyph title="">&rlm;</span> </td> <tr id=entity-rmoust><td> <code title="">rmoust;</code> </td> <td> U+023B1 </td> <td> <span class=glyph title="">&rmoustache;</span> </td> <tr id=entity-rmoustache><td> <code title="">rmoustache;</code> </td> <td> U+023B1 </td> <td> <span class=glyph title="">&rmoustache;</span> </td> <tr id=entity-rnmid><td> <code title="">rnmid;</code> </td> <td> U+02AEE </td> <td> <span class=glyph title="">&rnmid;</span> </td> <tr id=entity-roang><td> <code title="">roang;</code> </td> <td> U+027ED </td> <td> <span class=glyph title="">&roang;</span> </td> <tr id=entity-roarr><td> <code title="">roarr;</code> </td> <td> U+021FE </td> <td> <span class=glyph title="">&roarr;</span> </td> <tr id=entity-robrk><td> <code title="">robrk;</code> </td> <td> U+027E7 </td> <td> <span class=glyph title="">&robrk;</span> </td> <tr id=entity-ropar><td> <code title="">ropar;</code> </td> <td> U+02986 </td> <td> <span class=glyph title="">&ropar;</span> </td> <tr id=entity-Ropf><td> <code title="">Ropf;</code> </td> <td> U+0211D </td> <td> <span class=glyph title="">&reals;</span> </td> <tr id=entity-ropf><td> <code title="">ropf;</code> </td> <td> U+1D563 </td> <td> <span class=glyph title="">&ropf;</span> </td> <tr id=entity-roplus><td> <code title="">roplus;</code> </td> <td> U+02A2E </td> <td> <span class=glyph title="">&roplus;</span> </td> <tr id=entity-rotimes><td> <code title="">rotimes;</code> </td> <td> U+02A35 </td> <td> <span class=glyph title="">&rotimes;</span> </td> <tr id=entity-RoundImplies><td> <code title="">RoundImplies;</code> </td> <td> U+02970 </td> <td> <span class=glyph title="">&RoundImplies;</span> </td> <tr id=entity-rpar><td> <code title="">rpar;</code> </td> <td> U+00029 </td> <td> <span class=glyph title="">)</span> </td> <tr id=entity-rpargt><td> <code title="">rpargt;</code> </td> <td> U+02994 </td> <td> <span class=glyph title="">&rpargt;</span> </td> <tr id=entity-rppolint><td> <code title="">rppolint;</code> </td> <td> U+02A12 </td> <td> <span class=glyph title="">&rppolint;</span> </td> <tr id=entity-rrarr><td> <code title="">rrarr;</code> </td> <td> U+021C9 </td> <td> <span class=glyph title="">&rightrightarrows;</span> </td> <tr id=entity-Rrightarrow><td> <code title="">Rrightarrow;</code> </td> <td> U+021DB </td> <td> <span class=glyph title="">&rAarr;</span> </td> <tr id=entity-rsaquo><td> <code title="">rsaquo;</code> </td> <td> U+0203A </td> <td> <span class=glyph title="">&rsaquo;</span> </td> <tr id=entity-Rscr><td> <code title="">Rscr;</code> </td> <td> U+0211B </td> <td> <span class=glyph title="">&realine;</span> </td> <tr id=entity-rscr><td> <code title="">rscr;</code> </td> <td> U+1D4C7 </td> <td> <span class=glyph title="">&rscr;</span> </td> <tr id=entity-Rsh><td> <code title="">Rsh;</code> </td> <td> U+021B1 </td> <td> <span class=glyph title="">&rsh;</span> </td> <tr id=entity-rsh><td> <code title="">rsh;</code> </td> <td> U+021B1 </td> <td> <span class=glyph title="">&rsh;</span> </td> <tr id=entity-rsqb><td> <code title="">rsqb;</code> </td> <td> U+0005D </td> <td> <span class=glyph title="">]</span> </td> <tr id=entity-rsquo><td> <code title="">rsquo;</code> </td> <td> U+02019 </td> <td> <span class=glyph title="">&rsquor;</span> </td> <tr id=entity-rsquor><td> <code title="">rsquor;</code> </td> <td> U+02019 </td> <td> <span class=glyph title="">&rsquor;</span> </td> <tr id=entity-rthree><td> <code title="">rthree;</code> </td> <td> U+022CC </td> <td> <span class=glyph title="">&rightthreetimes;</span> </td> <tr id=entity-rtimes><td> <code title="">rtimes;</code> </td> <td> U+022CA </td> <td> <span class=glyph title="">&rtimes;</span> </td> <tr id=entity-rtri><td> <code title="">rtri;</code> </td> <td> U+025B9 </td> <td> <span class=glyph title="">&triangleright;</span> </td> <tr id=entity-rtrie><td> <code title="">rtrie;</code> </td> <td> U+022B5 </td> <td> <span class=glyph title="">&rtrie;</span> </td> <tr id=entity-rtrif><td> <code title="">rtrif;</code> </td> <td> U+025B8 </td> <td> <span class=glyph title="">&blacktriangleright;</span> </td> <tr id=entity-rtriltri><td> <code title="">rtriltri;</code> </td> <td> U+029CE </td> <td> <span class=glyph title="">&rtriltri;</span> </td> <tr id=entity-RuleDelayed><td> <code title="">RuleDelayed;</code> </td> <td> U+029F4 </td> <td> <span class=glyph title="">&RuleDelayed;</span> </td> <tr id=entity-ruluhar><td> <code title="">ruluhar;</code> </td> <td> U+02968 </td> <td> <span class=glyph title="">&ruluhar;</span> </td> <tr id=entity-rx><td> <code title="">rx;</code> </td> <td> U+0211E </td> <td> <span class=glyph title="">&rx;</span> </td> <tr id=entity-Sacute><td> <code title="">Sacute;</code> </td> <td> U+0015A </td> <td> <span class=glyph title="">&Sacute;</span> </td> <tr id=entity-sacute><td> <code title="">sacute;</code> </td> <td> U+0015B </td> <td> <span class=glyph title="">&sacute;</span> </td> <tr id=entity-sbquo><td> <code title="">sbquo;</code> </td> <td> U+0201A </td> <td> <span class=glyph title="">&sbquo;</span> </td> <tr id=entity-Sc><td> <code title="">Sc;</code> </td> <td> U+02ABC </td> <td> <span class=glyph title="">&Sc;</span> </td> <tr id=entity-sc><td> <code title="">sc;</code> </td> <td> U+0227B </td> <td> <span class=glyph title="">&succ;</span> </td> <tr id=entity-scap><td> <code title="">scap;</code> </td> <td> U+02AB8 </td> <td> <span class=glyph title="">&succapprox;</span> </td> <tr id=entity-Scaron><td> <code title="">Scaron;</code> </td> <td> U+00160 </td> <td> <span class=glyph title="">&Scaron;</span> </td> <tr id=entity-scaron><td> <code title="">scaron;</code> </td> <td> U+00161 </td> <td> <span class=glyph title="">&scaron;</span> </td> <tr id=entity-sccue><td> <code title="">sccue;</code> </td> <td> U+0227D </td> <td> <span class=glyph title="">&sccue;</span> </td> <tr id=entity-scE><td> <code title="">scE;</code> </td> <td> U+02AB4 </td> <td> <span class=glyph title="">&scE;</span> </td> <tr id=entity-sce><td> <code title="">sce;</code> </td> <td> U+02AB0 </td> <td> <span class=glyph title="">&succeq;</span> </td> <tr id=entity-Scedil><td> <code title="">Scedil;</code> </td> <td> U+0015E </td> <td> <span class=glyph title="">&Scedil;</span> </td> <tr id=entity-scedil><td> <code title="">scedil;</code> </td> <td> U+0015F </td> <td> <span class=glyph title="">&scedil;</span> </td> <tr id=entity-Scirc><td> <code title="">Scirc;</code> </td> <td> U+0015C </td> <td> <span class=glyph title="">&Scirc;</span> </td> <tr id=entity-scirc><td> <code title="">scirc;</code> </td> <td> U+0015D </td> <td> <span class=glyph title="">&scirc;</span> </td> <tr id=entity-scnap><td> <code title="">scnap;</code> </td> <td> U+02ABA </td> <td> <span class=glyph title="">&scnap;</span> </td> <tr id=entity-scnE><td> <code title="">scnE;</code> </td> <td> U+02AB6 </td> <td> <span class=glyph title="">&succneqq;</span> </td> <tr id=entity-scnsim><td> <code title="">scnsim;</code> </td> <td> U+022E9 </td> <td> <span class=glyph title="">&succnsim;</span> </td> <tr id=entity-scpolint><td> <code title="">scpolint;</code> </td> <td> U+02A13 </td> <td> <span class=glyph title="">&scpolint;</span> </td> <tr id=entity-scsim><td> <code title="">scsim;</code> </td> <td> U+0227F </td> <td> <span class=glyph title="">&scsim;</span> </td> <tr id=entity-Scy><td> <code title="">Scy;</code> </td> <td> U+00421 </td> <td> <span class=glyph title="">&Scy;</span> </td> <tr id=entity-scy><td> <code title="">scy;</code> </td> <td> U+00441 </td> <td> <span class=glyph title="">&scy;</span> </td> <tr id=entity-sdot><td> <code title="">sdot;</code> </td> <td> U+022C5 </td> <td> <span class=glyph title="">&sdot;</span> </td> <tr id=entity-sdotb><td> <code title="">sdotb;</code> </td> <td> U+022A1 </td> <td> <span class=glyph title="">&dotsquare;</span> </td> <tr id=entity-sdote><td> <code title="">sdote;</code> </td> <td> U+02A66 </td> <td> <span class=glyph title="">&sdote;</span> </td> <tr id=entity-searhk><td> <code title="">searhk;</code> </td> <td> U+02925 </td> <td> <span class=glyph title="">&hksearow;</span> </td> <tr id=entity-seArr><td> <code title="">seArr;</code> </td> <td> U+021D8 </td> <td> <span class=glyph title="">&seArr;</span> </td> <tr id=entity-searr><td> <code title="">searr;</code> </td> <td> U+02198 </td> <td> <span class=glyph title="">&searrow;</span> </td> <tr id=entity-searrow><td> <code title="">searrow;</code> </td> <td> U+02198 </td> <td> <span class=glyph title="">&searrow;</span> </td> <tr id=entity-sect><td> <code title="">sect;</code> </td> <td> U+000A7 </td> <td> <span class=glyph title="">&sect;</span> </td> <tr id=entity-sect-legacy class=impl><td> <code title="">sect</code> </td> <td> U+000A7 </td> <td> <span title="">&sect;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-semi><td> <code title="">semi;</code> </td> <td> U+0003B </td> <td> <span class=glyph title="">;</span> </td> <tr id=entity-seswar><td> <code title="">seswar;</code> </td> <td> U+02929 </td> <td> <span class=glyph title="">&tosa;</span> </td> <tr id=entity-setminus><td> <code title="">setminus;</code> </td> <td> U+02216 </td> <td> <span class=glyph title="">&smallsetminus;</span> </td> <tr id=entity-setmn><td> <code title="">setmn;</code> </td> <td> U+02216 </td> <td> <span class=glyph title="">&smallsetminus;</span> </td> <tr id=entity-sext><td> <code title="">sext;</code> </td> <td> U+02736 </td> <td> <span class=glyph title="">&sext;</span> </td> <tr id=entity-Sfr><td> <code title="">Sfr;</code> </td> <td> U+1D516 </td> <td> <span class=glyph title="">&Sfr;</span> </td> <tr id=entity-sfr><td> <code title="">sfr;</code> </td> <td> U+1D530 </td> <td> <span class=glyph title="">&sfr;</span> </td> <tr id=entity-sfrown><td> <code title="">sfrown;</code> </td> <td> U+02322 </td> <td> <span class=glyph title="">&frown;</span> </td> <tr id=entity-sharp><td> <code title="">sharp;</code> </td> <td> U+0266F </td> <td> <span class=glyph title="">&sharp;</span> </td> <tr id=entity-SHCHcy><td> <code title="">SHCHcy;</code> </td> <td> U+00429 </td> <td> <span class=glyph title="">&SHCHcy;</span> </td> <tr id=entity-shchcy><td> <code title="">shchcy;</code> </td> <td> U+00449 </td> <td> <span class=glyph title="">&shchcy;</span> </td> <tr id=entity-SHcy><td> <code title="">SHcy;</code> </td> <td> U+00428 </td> <td> <span class=glyph title="">&SHcy;</span> </td> <tr id=entity-shcy><td> <code title="">shcy;</code> </td> <td> U+00448 </td> <td> <span class=glyph title="">&shcy;</span> </td> <tr id=entity-ShortDownArrow><td> <code title="">ShortDownArrow;</code> </td> <td> U+02193 </td> <td> <span class=glyph title="">&downarrow;</span> </td> <tr id=entity-ShortLeftArrow><td> <code title="">ShortLeftArrow;</code> </td> <td> U+02190 </td> <td> <span class=glyph title="">&slarr;</span> </td> <tr id=entity-shortmid><td> <code title="">shortmid;</code> </td> <td> U+02223 </td> <td> <span class=glyph title="">&mid;</span> </td> <tr id=entity-shortparallel><td> <code title="">shortparallel;</code> </td> <td> U+02225 </td> <td> <span class=glyph title="">&spar;</span> </td> <tr id=entity-ShortRightArrow><td> <code title="">ShortRightArrow;</code> </td> <td> U+02192 </td> <td> <span class=glyph title="">&srarr;</span> </td> <tr id=entity-ShortUpArrow><td> <code title="">ShortUpArrow;</code> </td> <td> U+02191 </td> <td> <span class=glyph title="">&uparrow;</span> </td> <tr id=entity-shy><td> <code title="">shy;</code> </td> <td> U+000AD </td> <td> <span class=glyph title="">&shy;</span> </td> <tr id=entity-shy-legacy class=impl><td> <code title="">shy</code> </td> <td> U+000AD </td> <td> <span title="">&shy;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Sigma><td> <code title="">Sigma;</code> </td> <td> U+003A3 </td> <td> <span class=glyph title="">&Sigma;</span> </td> <tr id=entity-sigma><td> <code title="">sigma;</code> </td> <td> U+003C3 </td> <td> <span class=glyph title="">&sigma;</span> </td> <tr id=entity-sigmaf><td> <code title="">sigmaf;</code> </td> <td> U+003C2 </td> <td> <span class=glyph title="">&sigmav;</span> </td> <tr id=entity-sigmav><td> <code title="">sigmav;</code> </td> <td> U+003C2 </td> <td> <span class=glyph title="">&sigmav;</span> </td> <tr id=entity-sim><td> <code title="">sim;</code> </td> <td> U+0223C </td> <td> <span class=glyph title="">&sim;</span> </td> <tr id=entity-simdot><td> <code title="">simdot;</code> </td> <td> U+02A6A </td> <td> <span class=glyph title="">&simdot;</span> </td> <tr id=entity-sime><td> <code title="">sime;</code> </td> <td> U+02243 </td> <td> <span class=glyph title="">&simeq;</span> </td> <tr id=entity-simeq><td> <code title="">simeq;</code> </td> <td> U+02243 </td> <td> <span class=glyph title="">&simeq;</span> </td> <tr id=entity-simg><td> <code title="">simg;</code> </td> <td> U+02A9E </td> <td> <span class=glyph title="">&simg;</span> </td> <tr id=entity-simgE><td> <code title="">simgE;</code> </td> <td> U+02AA0 </td> <td> <span class=glyph title="">&simgE;</span> </td> <tr id=entity-siml><td> <code title="">siml;</code> </td> <td> U+02A9D </td> <td> <span class=glyph title="">&siml;</span> </td> <tr id=entity-simlE><td> <code title="">simlE;</code> </td> <td> U+02A9F </td> <td> <span class=glyph title="">&simlE;</span> </td> <tr id=entity-simne><td> <code title="">simne;</code> </td> <td> U+02246 </td> <td> <span class=glyph title="">&simne;</span> </td> <tr id=entity-simplus><td> <code title="">simplus;</code> </td> <td> U+02A24 </td> <td> <span class=glyph title="">&simplus;</span> </td> <tr id=entity-simrarr><td> <code title="">simrarr;</code> </td> <td> U+02972 </td> <td> <span class=glyph title="">&simrarr;</span> </td> <tr id=entity-slarr><td> <code title="">slarr;</code> </td> <td> U+02190 </td> <td> <span class=glyph title="">&slarr;</span> </td> <tr id=entity-SmallCircle><td> <code title="">SmallCircle;</code> </td> <td> U+02218 </td> <td> <span class=glyph title="">&compfn;</span> </td> <tr id=entity-smallsetminus><td> <code title="">smallsetminus;</code> </td> <td> U+02216 </td> <td> <span class=glyph title="">&smallsetminus;</span> </td> <tr id=entity-smashp><td> <code title="">smashp;</code> </td> <td> U+02A33 </td> <td> <span class=glyph title="">&smashp;</span> </td> <tr id=entity-smeparsl><td> <code title="">smeparsl;</code> </td> <td> U+029E4 </td> <td> <span class=glyph title="">&smeparsl;</span> </td> <tr id=entity-smid><td> <code title="">smid;</code> </td> <td> U+02223 </td> <td> <span class=glyph title="">&mid;</span> </td> <tr id=entity-smile><td> <code title="">smile;</code> </td> <td> U+02323 </td> <td> <span class=glyph title="">&smile;</span> </td> <tr id=entity-smt><td> <code title="">smt;</code> </td> <td> U+02AAA </td> <td> <span class=glyph title="">&smt;</span> </td> <tr id=entity-smte><td> <code title="">smte;</code> </td> <td> U+02AAC </td> <td> <span class=glyph title="">&smte;</span> </td> <tr id=entity-smtes><td> <code title="">smtes;</code> </td> <td> U+02AAC U+0FE00 </td> <td> <span class="glyph compound" title="">&smte;&#xfe00;</span> </td> <tr id=entity-SOFTcy><td> <code title="">SOFTcy;</code> </td> <td> U+0042C </td> <td> <span class=glyph title="">&SOFTcy;</span> </td> <tr id=entity-softcy><td> <code title="">softcy;</code> </td> <td> U+0044C </td> <td> <span class=glyph title="">&softcy;</span> </td> <tr id=entity-sol><td> <code title="">sol;</code> </td> <td> U+0002F </td> <td> <span class=glyph title="">/</span> </td> <tr id=entity-solb><td> <code title="">solb;</code> </td> <td> U+029C4 </td> <td> <span class=glyph title="">&solb;</span> </td> <tr id=entity-solbar><td> <code title="">solbar;</code> </td> <td> U+0233F </td> <td> <span class=glyph title="">&solbar;</span> </td> <tr id=entity-Sopf><td> <code title="">Sopf;</code> </td> <td> U+1D54A </td> <td> <span class=glyph title="">&Sopf;</span> </td> <tr id=entity-sopf><td> <code title="">sopf;</code> </td> <td> U+1D564 </td> <td> <span class=glyph title="">&sopf;</span> </td> <tr id=entity-spades><td> <code title="">spades;</code> </td> <td> U+02660 </td> <td> <span class=glyph title="">&spadesuit;</span> </td> <tr id=entity-spadesuit><td> <code title="">spadesuit;</code> </td> <td> U+02660 </td> <td> <span class=glyph title="">&spadesuit;</span> </td> <tr id=entity-spar><td> <code title="">spar;</code> </td> <td> U+02225 </td> <td> <span class=glyph title="">&spar;</span> </td> <tr id=entity-sqcap><td> <code title="">sqcap;</code> </td> <td> U+02293 </td> <td> <span class=glyph title="">&sqcap;</span> </td> <tr id=entity-sqcaps><td> <code title="">sqcaps;</code> </td> <td> U+02293 U+0FE00 </td> <td> <span class="glyph compound" title="">&sqcap;&#xfe00;</span> </td> <tr id=entity-sqcup><td> <code title="">sqcup;</code> </td> <td> U+02294 </td> <td> <span class=glyph title="">&sqcup;</span> </td> <tr id=entity-sqcups><td> <code title="">sqcups;</code> </td> <td> U+02294 U+0FE00 </td> <td> <span class="glyph compound" title="">&sqcup;&#xfe00;</span> </td> <tr id=entity-Sqrt><td> <code title="">Sqrt;</code> </td> <td> U+0221A </td> <td> <span class=glyph title="">&radic;</span> </td> <tr id=entity-sqsub><td> <code title="">sqsub;</code> </td> <td> U+0228F </td> <td> <span class=glyph title="">&sqsub;</span> </td> <tr id=entity-sqsube><td> <code title="">sqsube;</code> </td> <td> U+02291 </td> <td> <span class=glyph title="">&sqsubseteq;</span> </td> <tr id=entity-sqsubset><td> <code title="">sqsubset;</code> </td> <td> U+0228F </td> <td> <span class=glyph title="">&sqsub;</span> </td> <tr id=entity-sqsubseteq><td> <code title="">sqsubseteq;</code> </td> <td> U+02291 </td> <td> <span class=glyph title="">&sqsubseteq;</span> </td> <tr id=entity-sqsup><td> <code title="">sqsup;</code> </td> <td> U+02290 </td> <td> <span class=glyph title="">&sqsupset;</span> </td> <tr id=entity-sqsupe><td> <code title="">sqsupe;</code> </td> <td> U+02292 </td> <td> <span class=glyph title="">&sqsupe;</span> </td> <tr id=entity-sqsupset><td> <code title="">sqsupset;</code> </td> <td> U+02290 </td> <td> <span class=glyph title="">&sqsupset;</span> </td> <tr id=entity-sqsupseteq><td> <code title="">sqsupseteq;</code> </td> <td> U+02292 </td> <td> <span class=glyph title="">&sqsupe;</span> </td> <tr id=entity-squ><td> <code title="">squ;</code> </td> <td> U+025A1 </td> <td> <span class=glyph title="">&squ;</span> </td> <tr id=entity-Square><td> <code title="">Square;</code> </td> <td> U+025A1 </td> <td> <span class=glyph title="">&squ;</span> </td> <tr id=entity-square><td> <code title="">square;</code> </td> <td> U+025A1 </td> <td> <span class=glyph title="">&squ;</span> </td> <tr id=entity-SquareIntersection><td> <code title="">SquareIntersection;</code> </td> <td> U+02293 </td> <td> <span class=glyph title="">&sqcap;</span> </td> <tr id=entity-SquareSubset><td> <code title="">SquareSubset;</code> </td> <td> U+0228F </td> <td> <span class=glyph title="">&sqsub;</span> </td> <tr id=entity-SquareSubsetEqual><td> <code title="">SquareSubsetEqual;</code> </td> <td> U+02291 </td> <td> <span class=glyph title="">&sqsubseteq;</span> </td> <tr id=entity-SquareSuperset><td> <code title="">SquareSuperset;</code> </td> <td> U+02290 </td> <td> <span class=glyph title="">&sqsupset;</span> </td> <tr id=entity-SquareSupersetEqual><td> <code title="">SquareSupersetEqual;</code> </td> <td> U+02292 </td> <td> <span class=glyph title="">&sqsupe;</span> </td> <tr id=entity-SquareUnion><td> <code title="">SquareUnion;</code> </td> <td> U+02294 </td> <td> <span class=glyph title="">&sqcup;</span> </td> <tr id=entity-squarf><td> <code title="">squarf;</code> </td> <td> U+025AA </td> <td> <span class=glyph title="">&blacksquare;</span> </td> <tr id=entity-squf><td> <code title="">squf;</code> </td> <td> U+025AA </td> <td> <span class=glyph title="">&blacksquare;</span> </td> <tr id=entity-srarr><td> <code title="">srarr;</code> </td> <td> U+02192 </td> <td> <span class=glyph title="">&srarr;</span> </td> <tr id=entity-Sscr><td> <code title="">Sscr;</code> </td> <td> U+1D4AE </td> <td> <span class=glyph title="">&Sscr;</span> </td> <tr id=entity-sscr><td> <code title="">sscr;</code> </td> <td> U+1D4C8 </td> <td> <span class=glyph title="">&sscr;</span> </td> <tr id=entity-ssetmn><td> <code title="">ssetmn;</code> </td> <td> U+02216 </td> <td> <span class=glyph title="">&smallsetminus;</span> </td> <tr id=entity-ssmile><td> <code title="">ssmile;</code> </td> <td> U+02323 </td> <td> <span class=glyph title="">&smile;</span> </td> <tr id=entity-sstarf><td> <code title="">sstarf;</code> </td> <td> U+022C6 </td> <td> <span class=glyph title="">&sstarf;</span> </td> <tr id=entity-Star><td> <code title="">Star;</code> </td> <td> U+022C6 </td> <td> <span class=glyph title="">&sstarf;</span> </td> <tr id=entity-star><td> <code title="">star;</code> </td> <td> U+02606 </td> <td> <span class=glyph title="">&star;</span> </td> <tr id=entity-starf><td> <code title="">starf;</code> </td> <td> U+02605 </td> <td> <span class=glyph title="">&bigstar;</span> </td> <tr id=entity-straightepsilon><td> <code title="">straightepsilon;</code> </td> <td> U+003F5 </td> <td> <span class=glyph title="">&straightepsilon;</span> </td> <tr id=entity-straightphi><td> <code title="">straightphi;</code> </td> <td> U+003D5 </td> <td> <span class=glyph title="">&phiv;</span> </td> <tr id=entity-strns><td> <code title="">strns;</code> </td> <td> U+000AF </td> <td> <span class=glyph title="">&strns;</span> </td> <tr id=entity-Sub><td> <code title="">Sub;</code> </td> <td> U+022D0 </td> <td> <span class=glyph title="">&Sub;</span> </td> <tr id=entity-sub><td> <code title="">sub;</code> </td> <td> U+02282 </td> <td> <span class=glyph title="">&sub;</span> </td> <tr id=entity-subdot><td> <code title="">subdot;</code> </td> <td> U+02ABD </td> <td> <span class=glyph title="">&subdot;</span> </td> <tr id=entity-subE><td> <code title="">subE;</code> </td> <td> U+02AC5 </td> <td> <span class=glyph title="">&subseteqq;</span> </td> <tr id=entity-sube><td> <code title="">sube;</code> </td> <td> U+02286 </td> <td> <span class=glyph title="">&subseteq;</span> </td> <tr id=entity-subedot><td> <code title="">subedot;</code> </td> <td> U+02AC3 </td> <td> <span class=glyph title="">&subedot;</span> </td> <tr id=entity-submult><td> <code title="">submult;</code> </td> <td> U+02AC1 </td> <td> <span class=glyph title="">&submult;</span> </td> <tr id=entity-subnE><td> <code title="">subnE;</code> </td> <td> U+02ACB </td> <td> <span class=glyph title="">&subsetneqq;</span> </td> <tr id=entity-subne><td> <code title="">subne;</code> </td> <td> U+0228A </td> <td> <span class=glyph title="">&subsetneq;</span> </td> <tr id=entity-subplus><td> <code title="">subplus;</code> </td> <td> U+02ABF </td> <td> <span class=glyph title="">&subplus;</span> </td> <tr id=entity-subrarr><td> <code title="">subrarr;</code> </td> <td> U+02979 </td> <td> <span class=glyph title="">&subrarr;</span> </td> <tr id=entity-Subset><td> <code title="">Subset;</code> </td> <td> U+022D0 </td> <td> <span class=glyph title="">&Sub;</span> </td> <tr id=entity-subset><td> <code title="">subset;</code> </td> <td> U+02282 </td> <td> <span class=glyph title="">&sub;</span> </td> <tr id=entity-subseteq><td> <code title="">subseteq;</code> </td> <td> U+02286 </td> <td> <span class=glyph title="">&subseteq;</span> </td> <tr id=entity-subseteqq><td> <code title="">subseteqq;</code> </td> <td> U+02AC5 </td> <td> <span class=glyph title="">&subseteqq;</span> </td> <tr id=entity-SubsetEqual><td> <code title="">SubsetEqual;</code> </td> <td> U+02286 </td> <td> <span class=glyph title="">&subseteq;</span> </td> <tr id=entity-subsetneq><td> <code title="">subsetneq;</code> </td> <td> U+0228A </td> <td> <span class=glyph title="">&subsetneq;</span> </td> <tr id=entity-subsetneqq><td> <code title="">subsetneqq;</code> </td> <td> U+02ACB </td> <td> <span class=glyph title="">&subsetneqq;</span> </td> <tr id=entity-subsim><td> <code title="">subsim;</code> </td> <td> U+02AC7 </td> <td> <span class=glyph title="">&subsim;</span> </td> <tr id=entity-subsub><td> <code title="">subsub;</code> </td> <td> U+02AD5 </td> <td> <span class=glyph title="">&subsub;</span> </td> <tr id=entity-subsup><td> <code title="">subsup;</code> </td> <td> U+02AD3 </td> <td> <span class=glyph title="">&subsup;</span> </td> <tr id=entity-succ><td> <code title="">succ;</code> </td> <td> U+0227B </td> <td> <span class=glyph title="">&succ;</span> </td> <tr id=entity-succapprox><td> <code title="">succapprox;</code> </td> <td> U+02AB8 </td> <td> <span class=glyph title="">&succapprox;</span> </td> <tr id=entity-succcurlyeq><td> <code title="">succcurlyeq;</code> </td> <td> U+0227D </td> <td> <span class=glyph title="">&sccue;</span> </td> <tr id=entity-Succeeds><td> <code title="">Succeeds;</code> </td> <td> U+0227B </td> <td> <span class=glyph title="">&succ;</span> </td> <tr id=entity-SucceedsEqual><td> <code title="">SucceedsEqual;</code> </td> <td> U+02AB0 </td> <td> <span class=glyph title="">&succeq;</span> </td> <tr id=entity-SucceedsSlantEqual><td> <code title="">SucceedsSlantEqual;</code> </td> <td> U+0227D </td> <td> <span class=glyph title="">&sccue;</span> </td> <tr id=entity-SucceedsTilde><td> <code title="">SucceedsTilde;</code> </td> <td> U+0227F </td> <td> <span class=glyph title="">&scsim;</span> </td> <tr id=entity-succeq><td> <code title="">succeq;</code> </td> <td> U+02AB0 </td> <td> <span class=glyph title="">&succeq;</span> </td> <tr id=entity-succnapprox><td> <code title="">succnapprox;</code> </td> <td> U+02ABA </td> <td> <span class=glyph title="">&scnap;</span> </td> <tr id=entity-succneqq><td> <code title="">succneqq;</code> </td> <td> U+02AB6 </td> <td> <span class=glyph title="">&succneqq;</span> </td> <tr id=entity-succnsim><td> <code title="">succnsim;</code> </td> <td> U+022E9 </td> <td> <span class=glyph title="">&succnsim;</span> </td> <tr id=entity-succsim><td> <code title="">succsim;</code> </td> <td> U+0227F </td> <td> <span class=glyph title="">&scsim;</span> </td> <tr id=entity-SuchThat><td> <code title="">SuchThat;</code> </td> <td> U+0220B </td> <td> <span class=glyph title="">&niv;</span> </td> <tr id=entity-Sum><td> <code title="">Sum;</code> </td> <td> U+02211 </td> <td> <span class=glyph title="">&sum;</span> </td> <tr id=entity-sum><td> <code title="">sum;</code> </td> <td> U+02211 </td> <td> <span class=glyph title="">&sum;</span> </td> <tr id=entity-sung><td> <code title="">sung;</code> </td> <td> U+0266A </td> <td> <span class=glyph title="">&sung;</span> </td> <tr id=entity-Sup><td> <code title="">Sup;</code> </td> <td> U+022D1 </td> <td> <span class=glyph title="">&Supset;</span> </td> <tr id=entity-sup><td> <code title="">sup;</code> </td> <td> U+02283 </td> <td> <span class=glyph title="">&sup;</span> </td> <tr id=entity-sup1><td> <code title="">sup1;</code> </td> <td> U+000B9 </td> <td> <span class=glyph title="">&sup1;</span> </td> <tr id=entity-sup1-legacy class=impl><td> <code title="">sup1</code> </td> <td> U+000B9 </td> <td> <span title="">&sup1;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-sup2><td> <code title="">sup2;</code> </td> <td> U+000B2 </td> <td> <span class=glyph title="">&sup2;</span> </td> <tr id=entity-sup2-legacy class=impl><td> <code title="">sup2</code> </td> <td> U+000B2 </td> <td> <span title="">&sup2;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-sup3><td> <code title="">sup3;</code> </td> <td> U+000B3 </td> <td> <span class=glyph title="">&sup3;</span> </td> <tr id=entity-sup3-legacy class=impl><td> <code title="">sup3</code> </td> <td> U+000B3 </td> <td> <span title="">&sup3;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-supdot><td> <code title="">supdot;</code> </td> <td> U+02ABE </td> <td> <span class=glyph title="">&supdot;</span> </td> <tr id=entity-supdsub><td> <code title="">supdsub;</code> </td> <td> U+02AD8 </td> <td> <span class=glyph title="">&supdsub;</span> </td> <tr id=entity-supE><td> <code title="">supE;</code> </td> <td> U+02AC6 </td> <td> <span class=glyph title="">&supseteqq;</span> </td> <tr id=entity-supe><td> <code title="">supe;</code> </td> <td> U+02287 </td> <td> <span class=glyph title="">&supseteq;</span> </td> <tr id=entity-supedot><td> <code title="">supedot;</code> </td> <td> U+02AC4 </td> <td> <span class=glyph title="">&supedot;</span> </td> <tr id=entity-Superset><td> <code title="">Superset;</code> </td> <td> U+02283 </td> <td> <span class=glyph title="">&sup;</span> </td> <tr id=entity-SupersetEqual><td> <code title="">SupersetEqual;</code> </td> <td> U+02287 </td> <td> <span class=glyph title="">&supseteq;</span> </td> <tr id=entity-suphsol><td> <code title="">suphsol;</code> </td> <td> U+027C9 </td> <td> <span class=glyph title="">&suphsol;</span> </td> <tr id=entity-suphsub><td> <code title="">suphsub;</code> </td> <td> U+02AD7 </td> <td> <span class=glyph title="">&suphsub;</span> </td> <tr id=entity-suplarr><td> <code title="">suplarr;</code> </td> <td> U+0297B </td> <td> <span class=glyph title="">&suplarr;</span> </td> <tr id=entity-supmult><td> <code title="">supmult;</code> </td> <td> U+02AC2 </td> <td> <span class=glyph title="">&supmult;</span> </td> <tr id=entity-supnE><td> <code title="">supnE;</code> </td> <td> U+02ACC </td> <td> <span class=glyph title="">&supsetneqq;</span> </td> <tr id=entity-supne><td> <code title="">supne;</code> </td> <td> U+0228B </td> <td> <span class=glyph title="">&supsetneq;</span> </td> <tr id=entity-supplus><td> <code title="">supplus;</code> </td> <td> U+02AC0 </td> <td> <span class=glyph title="">&supplus;</span> </td> <tr id=entity-Supset><td> <code title="">Supset;</code> </td> <td> U+022D1 </td> <td> <span class=glyph title="">&Supset;</span> </td> <tr id=entity-supset><td> <code title="">supset;</code> </td> <td> U+02283 </td> <td> <span class=glyph title="">&sup;</span> </td> <tr id=entity-supseteq><td> <code title="">supseteq;</code> </td> <td> U+02287 </td> <td> <span class=glyph title="">&supseteq;</span> </td> <tr id=entity-supseteqq><td> <code title="">supseteqq;</code> </td> <td> U+02AC6 </td> <td> <span class=glyph title="">&supseteqq;</span> </td> <tr id=entity-supsetneq><td> <code title="">supsetneq;</code> </td> <td> U+0228B </td> <td> <span class=glyph title="">&supsetneq;</span> </td> <tr id=entity-supsetneqq><td> <code title="">supsetneqq;</code> </td> <td> U+02ACC </td> <td> <span class=glyph title="">&supsetneqq;</span> </td> <tr id=entity-supsim><td> <code title="">supsim;</code> </td> <td> U+02AC8 </td> <td> <span class=glyph title="">&supsim;</span> </td> <tr id=entity-supsub><td> <code title="">supsub;</code> </td> <td> U+02AD4 </td> <td> <span class=glyph title="">&supsub;</span> </td> <tr id=entity-supsup><td> <code title="">supsup;</code> </td> <td> U+02AD6 </td> <td> <span class=glyph title="">&supsup;</span> </td> <tr id=entity-swarhk><td> <code title="">swarhk;</code> </td> <td> U+02926 </td> <td> <span class=glyph title="">&hkswarow;</span> </td> <tr id=entity-swArr><td> <code title="">swArr;</code> </td> <td> U+021D9 </td> <td> <span class=glyph title="">&swArr;</span> </td> <tr id=entity-swarr><td> <code title="">swarr;</code> </td> <td> U+02199 </td> <td> <span class=glyph title="">&swarrow;</span> </td> <tr id=entity-swarrow><td> <code title="">swarrow;</code> </td> <td> U+02199 </td> <td> <span class=glyph title="">&swarrow;</span> </td> <tr id=entity-swnwar><td> <code title="">swnwar;</code> </td> <td> U+0292A </td> <td> <span class=glyph title="">&swnwar;</span> </td> <tr id=entity-szlig><td> <code title="">szlig;</code> </td> <td> U+000DF </td> <td> <span class=glyph title="">&szlig;</span> </td> <tr id=entity-szlig-legacy class=impl><td> <code title="">szlig</code> </td> <td> U+000DF </td> <td> <span title="">&szlig;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Tab><td> <code title="">Tab;</code> </td> <td> U+00009 </td> <td> <span class="glyph control" title="">&#x2409;</span> </td> <tr id=entity-target><td> <code title="">target;</code> </td> <td> U+02316 </td> <td> <span class=glyph title="">&target;</span> </td> <tr id=entity-Tau><td> <code title="">Tau;</code> </td> <td> U+003A4 </td> <td> <span class=glyph title="">&Tau;</span> </td> <tr id=entity-tau><td> <code title="">tau;</code> </td> <td> U+003C4 </td> <td> <span class=glyph title="">&tau;</span> </td> <tr id=entity-tbrk><td> <code title="">tbrk;</code> </td> <td> U+023B4 </td> <td> <span class=glyph title="">&tbrk;</span> </td> <tr id=entity-Tcaron><td> <code title="">Tcaron;</code> </td> <td> U+00164 </td> <td> <span class=glyph title="">&Tcaron;</span> </td> <tr id=entity-tcaron><td> <code title="">tcaron;</code> </td> <td> U+00165 </td> <td> <span class=glyph title="">&tcaron;</span> </td> <tr id=entity-Tcedil><td> <code title="">Tcedil;</code> </td> <td> U+00162 </td> <td> <span class=glyph title="">&Tcedil;</span> </td> <tr id=entity-tcedil><td> <code title="">tcedil;</code> </td> <td> U+00163 </td> <td> <span class=glyph title="">&tcedil;</span> </td> <tr id=entity-Tcy><td> <code title="">Tcy;</code> </td> <td> U+00422 </td> <td> <span class=glyph title="">&Tcy;</span> </td> <tr id=entity-tcy><td> <code title="">tcy;</code> </td> <td> U+00442 </td> <td> <span class=glyph title="">&tcy;</span> </td> <tr id=entity-tdot><td> <code title="">tdot;</code> </td> <td> U+020DB </td> <td> <span class="glyph composition" title="">&#x25cc;&tdot;</span> </td> <tr id=entity-telrec><td> <code title="">telrec;</code> </td> <td> U+02315 </td> <td> <span class=glyph title="">&telrec;</span> </td> <tr id=entity-Tfr><td> <code title="">Tfr;</code> </td> <td> U+1D517 </td> <td> <span class=glyph title="">&Tfr;</span> </td> <tr id=entity-tfr><td> <code title="">tfr;</code> </td> <td> U+1D531 </td> <td> <span class=glyph title="">&tfr;</span> </td> <tr id=entity-there4><td> <code title="">there4;</code> </td> <td> U+02234 </td> <td> <span class=glyph title="">&therefore;</span> </td> <tr id=entity-Therefore><td> <code title="">Therefore;</code> </td> <td> U+02234 </td> <td> <span class=glyph title="">&therefore;</span> </td> <tr id=entity-therefore><td> <code title="">therefore;</code> </td> <td> U+02234 </td> <td> <span class=glyph title="">&therefore;</span> </td> <tr id=entity-Theta><td> <code title="">Theta;</code> </td> <td> U+00398 </td> <td> <span class=glyph title="">&Theta;</span> </td> <tr id=entity-theta><td> <code title="">theta;</code> </td> <td> U+003B8 </td> <td> <span class=glyph title="">&theta;</span> </td> <tr id=entity-thetasym><td> <code title="">thetasym;</code> </td> <td> U+003D1 </td> <td> <span class=glyph title="">&thetav;</span> </td> <tr id=entity-thetav><td> <code title="">thetav;</code> </td> <td> U+003D1 </td> <td> <span class=glyph title="">&thetav;</span> </td> <tr id=entity-thickapprox><td> <code title="">thickapprox;</code> </td> <td> U+02248 </td> <td> <span class=glyph title="">&thkap;</span> </td> <tr id=entity-thicksim><td> <code title="">thicksim;</code> </td> <td> U+0223C </td> <td> <span class=glyph title="">&sim;</span> </td> <tr id=entity-ThickSpace><td> <code title="">ThickSpace;</code> </td> <td> U+0205F U+0200A </td> <td> <span class="glyph compound" title="">&MediumSpace;&hairsp;</span> </td> <tr id=entity-thinsp><td> <code title="">thinsp;</code> </td> <td> U+02009 </td> <td> <span class=glyph title="">&thinsp;</span> </td> <tr id=entity-ThinSpace><td> <code title="">ThinSpace;</code> </td> <td> U+02009 </td> <td> <span class=glyph title="">&thinsp;</span> </td> <tr id=entity-thkap><td> <code title="">thkap;</code> </td> <td> U+02248 </td> <td> <span class=glyph title="">&thkap;</span> </td> <tr id=entity-thksim><td> <code title="">thksim;</code> </td> <td> U+0223C </td> <td> <span class=glyph title="">&sim;</span> </td> <tr id=entity-THORN><td> <code title="">THORN;</code> </td> <td> U+000DE </td> <td> <span class=glyph title="">&THORN;</span> </td> <tr id=entity-THORN-legacy class=impl><td> <code title="">THORN</code> </td> <td> U+000DE </td> <td> <span title="">&THORN;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-thorn><td> <code title="">thorn;</code> </td> <td> U+000FE </td> <td> <span class=glyph title="">&thorn;</span> </td> <tr id=entity-thorn-legacy class=impl><td> <code title="">thorn</code> </td> <td> U+000FE </td> <td> <span title="">&thorn;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Tilde><td> <code title="">Tilde;</code> </td> <td> U+0223C </td> <td> <span class=glyph title="">&sim;</span> </td> <tr id=entity-tilde><td> <code title="">tilde;</code> </td> <td> U+002DC </td> <td> <span class=glyph title="">&tilde;</span> </td> <tr id=entity-TildeEqual><td> <code title="">TildeEqual;</code> </td> <td> U+02243 </td> <td> <span class=glyph title="">&simeq;</span> </td> <tr id=entity-TildeFullEqual><td> <code title="">TildeFullEqual;</code> </td> <td> U+02245 </td> <td> <span class=glyph title="">&cong;</span> </td> <tr id=entity-TildeTilde><td> <code title="">TildeTilde;</code> </td> <td> U+02248 </td> <td> <span class=glyph title="">&thkap;</span> </td> <tr id=entity-times><td> <code title="">times;</code> </td> <td> U+000D7 </td> <td> <span class=glyph title="">&times;</span> </td> <tr id=entity-times-legacy class=impl><td> <code title="">times</code> </td> <td> U+000D7 </td> <td> <span title="">&times;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-timesb><td> <code title="">timesb;</code> </td> <td> U+022A0 </td> <td> <span class=glyph title="">&timesb;</span> </td> <tr id=entity-timesbar><td> <code title="">timesbar;</code> </td> <td> U+02A31 </td> <td> <span class=glyph title="">&timesbar;</span> </td> <tr id=entity-timesd><td> <code title="">timesd;</code> </td> <td> U+02A30 </td> <td> <span class=glyph title="">&timesd;</span> </td> <tr id=entity-tint><td> <code title="">tint;</code> </td> <td> U+0222D </td> <td> <span class=glyph title="">&iiint;</span> </td> <tr id=entity-toea><td> <code title="">toea;</code> </td> <td> U+02928 </td> <td> <span class=glyph title="">&toea;</span> </td> <tr id=entity-top><td> <code title="">top;</code> </td> <td> U+022A4 </td> <td> <span class=glyph title="">&top;</span> </td> <tr id=entity-topbot><td> <code title="">topbot;</code> </td> <td> U+02336 </td> <td> <span class=glyph title="">&topbot;</span> </td> <tr id=entity-topcir><td> <code title="">topcir;</code> </td> <td> U+02AF1 </td> <td> <span class=glyph title="">&topcir;</span> </td> <tr id=entity-Topf><td> <code title="">Topf;</code> </td> <td> U+1D54B </td> <td> <span class=glyph title="">&Topf;</span> </td> <tr id=entity-topf><td> <code title="">topf;</code> </td> <td> U+1D565 </td> <td> <span class=glyph title="">&topf;</span> </td> <tr id=entity-topfork><td> <code title="">topfork;</code> </td> <td> U+02ADA </td> <td> <span class=glyph title="">&topfork;</span> </td> <tr id=entity-tosa><td> <code title="">tosa;</code> </td> <td> U+02929 </td> <td> <span class=glyph title="">&tosa;</span> </td> <tr id=entity-tprime><td> <code title="">tprime;</code> </td> <td> U+02034 </td> <td> <span class=glyph title="">&tprime;</span> </td> <tr id=entity-TRADE><td> <code title="">TRADE;</code> </td> <td> U+02122 </td> <td> <span class=glyph title="">&trade;</span> </td> <tr id=entity-trade><td> <code title="">trade;</code> </td> <td> U+02122 </td> <td> <span class=glyph title="">&trade;</span> </td> <tr id=entity-triangle><td> <code title="">triangle;</code> </td> <td> U+025B5 </td> <td> <span class=glyph title="">&triangle;</span> </td> <tr id=entity-triangledown><td> <code title="">triangledown;</code> </td> <td> U+025BF </td> <td> <span class=glyph title="">&triangledown;</span> </td> <tr id=entity-triangleleft><td> <code title="">triangleleft;</code> </td> <td> U+025C3 </td> <td> <span class=glyph title="">&triangleleft;</span> </td> <tr id=entity-trianglelefteq><td> <code title="">trianglelefteq;</code> </td> <td> U+022B4 </td> <td> <span class=glyph title="">&ltrie;</span> </td> <tr id=entity-triangleq><td> <code title="">triangleq;</code> </td> <td> U+0225C </td> <td> <span class=glyph title="">&triangleq;</span> </td> <tr id=entity-triangleright><td> <code title="">triangleright;</code> </td> <td> U+025B9 </td> <td> <span class=glyph title="">&triangleright;</span> </td> <tr id=entity-trianglerighteq><td> <code title="">trianglerighteq;</code> </td> <td> U+022B5 </td> <td> <span class=glyph title="">&rtrie;</span> </td> <tr id=entity-tridot><td> <code title="">tridot;</code> </td> <td> U+025EC </td> <td> <span class=glyph title="">&tridot;</span> </td> <tr id=entity-trie><td> <code title="">trie;</code> </td> <td> U+0225C </td> <td> <span class=glyph title="">&triangleq;</span> </td> <tr id=entity-triminus><td> <code title="">triminus;</code> </td> <td> U+02A3A </td> <td> <span class=glyph title="">&triminus;</span> </td> <tr id=entity-TripleDot><td> <code title="">TripleDot;</code> </td> <td> U+020DB </td> <td> <span class="glyph composition" title="">&#x25cc;&tdot;</span> </td> <tr id=entity-triplus><td> <code title="">triplus;</code> </td> <td> U+02A39 </td> <td> <span class=glyph title="">&triplus;</span> </td> <tr id=entity-trisb><td> <code title="">trisb;</code> </td> <td> U+029CD </td> <td> <span class=glyph title="">&trisb;</span> </td> <tr id=entity-tritime><td> <code title="">tritime;</code> </td> <td> U+02A3B </td> <td> <span class=glyph title="">&tritime;</span> </td> <tr id=entity-trpezium><td> <code title="">trpezium;</code> </td> <td> U+023E2 </td> <td> <span class=glyph title="">&trpezium;</span> </td> <tr id=entity-Tscr><td> <code title="">Tscr;</code> </td> <td> U+1D4AF </td> <td> <span class=glyph title="">&Tscr;</span> </td> <tr id=entity-tscr><td> <code title="">tscr;</code> </td> <td> U+1D4C9 </td> <td> <span class=glyph title="">&tscr;</span> </td> <tr id=entity-TScy><td> <code title="">TScy;</code> </td> <td> U+00426 </td> <td> <span class=glyph title="">&TScy;</span> </td> <tr id=entity-tscy><td> <code title="">tscy;</code> </td> <td> U+00446 </td> <td> <span class=glyph title="">&tscy;</span> </td> <tr id=entity-TSHcy><td> <code title="">TSHcy;</code> </td> <td> U+0040B </td> <td> <span class=glyph title="">&TSHcy;</span> </td> <tr id=entity-tshcy><td> <code title="">tshcy;</code> </td> <td> U+0045B </td> <td> <span class=glyph title="">&tshcy;</span> </td> <tr id=entity-Tstrok><td> <code title="">Tstrok;</code> </td> <td> U+00166 </td> <td> <span class=glyph title="">&Tstrok;</span> </td> <tr id=entity-tstrok><td> <code title="">tstrok;</code> </td> <td> U+00167 </td> <td> <span class=glyph title="">&tstrok;</span> </td> <tr id=entity-twixt><td> <code title="">twixt;</code> </td> <td> U+0226C </td> <td> <span class=glyph title="">&between;</span> </td> <tr id=entity-twoheadleftarrow><td> <code title="">twoheadleftarrow;</code> </td> <td> U+0219E </td> <td> <span class=glyph title="">&twoheadleftarrow;</span> </td> <tr id=entity-twoheadrightarrow><td> <code title="">twoheadrightarrow;</code> </td> <td> U+021A0 </td> <td> <span class=glyph title="">&twoheadrightarrow;</span> </td> <tr id=entity-Uacute><td> <code title="">Uacute;</code> </td> <td> U+000DA </td> <td> <span class=glyph title="">&Uacute;</span> </td> <tr id=entity-Uacute-legacy class=impl><td> <code title="">Uacute</code> </td> <td> U+000DA </td> <td> <span title="">&Uacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-uacute><td> <code title="">uacute;</code> </td> <td> U+000FA </td> <td> <span class=glyph title="">&uacute;</span> </td> <tr id=entity-uacute-legacy class=impl><td> <code title="">uacute</code> </td> <td> U+000FA </td> <td> <span title="">&uacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Uarr><td> <code title="">Uarr;</code> </td> <td> U+0219F </td> <td> <span class=glyph title="">&Uarr;</span> </td> <tr id=entity-uArr><td> <code title="">uArr;</code> </td> <td> U+021D1 </td> <td> <span class=glyph title="">&Uparrow;</span> </td> <tr id=entity-uarr><td> <code title="">uarr;</code> </td> <td> U+02191 </td> <td> <span class=glyph title="">&uparrow;</span> </td> <tr id=entity-Uarrocir><td> <code title="">Uarrocir;</code> </td> <td> U+02949 </td> <td> <span class=glyph title="">&Uarrocir;</span> </td> <tr id=entity-Ubrcy><td> <code title="">Ubrcy;</code> </td> <td> U+0040E </td> <td> <span class=glyph title="">&Ubrcy;</span> </td> <tr id=entity-ubrcy><td> <code title="">ubrcy;</code> </td> <td> U+0045E </td> <td> <span class=glyph title="">&ubrcy;</span> </td> <tr id=entity-Ubreve><td> <code title="">Ubreve;</code> </td> <td> U+0016C </td> <td> <span class=glyph title="">&Ubreve;</span> </td> <tr id=entity-ubreve><td> <code title="">ubreve;</code> </td> <td> U+0016D </td> <td> <span class=glyph title="">&ubreve;</span> </td> <tr id=entity-Ucirc><td> <code title="">Ucirc;</code> </td> <td> U+000DB </td> <td> <span class=glyph title="">&Ucirc;</span> </td> <tr id=entity-Ucirc-legacy class=impl><td> <code title="">Ucirc</code> </td> <td> U+000DB </td> <td> <span title="">&Ucirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ucirc><td> <code title="">ucirc;</code> </td> <td> U+000FB </td> <td> <span class=glyph title="">&ucirc;</span> </td> <tr id=entity-ucirc-legacy class=impl><td> <code title="">ucirc</code> </td> <td> U+000FB </td> <td> <span title="">&ucirc;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Ucy><td> <code title="">Ucy;</code> </td> <td> U+00423 </td> <td> <span class=glyph title="">&Ucy;</span> </td> <tr id=entity-ucy><td> <code title="">ucy;</code> </td> <td> U+00443 </td> <td> <span class=glyph title="">&ucy;</span> </td> <tr id=entity-udarr><td> <code title="">udarr;</code> </td> <td> U+021C5 </td> <td> <span class=glyph title="">&udarr;</span> </td> <tr id=entity-Udblac><td> <code title="">Udblac;</code> </td> <td> U+00170 </td> <td> <span class=glyph title="">&Udblac;</span> </td> <tr id=entity-udblac><td> <code title="">udblac;</code> </td> <td> U+00171 </td> <td> <span class=glyph title="">&udblac;</span> </td> <tr id=entity-udhar><td> <code title="">udhar;</code> </td> <td> U+0296E </td> <td> <span class=glyph title="">&udhar;</span> </td> <tr id=entity-ufisht><td> <code title="">ufisht;</code> </td> <td> U+0297E </td> <td> <span class=glyph title="">&ufisht;</span> </td> <tr id=entity-Ufr><td> <code title="">Ufr;</code> </td> <td> U+1D518 </td> <td> <span class=glyph title="">&Ufr;</span> </td> <tr id=entity-ufr><td> <code title="">ufr;</code> </td> <td> U+1D532 </td> <td> <span class=glyph title="">&ufr;</span> </td> <tr id=entity-Ugrave><td> <code title="">Ugrave;</code> </td> <td> U+000D9 </td> <td> <span class=glyph title="">&Ugrave;</span> </td> <tr id=entity-Ugrave-legacy class=impl><td> <code title="">Ugrave</code> </td> <td> U+000D9 </td> <td> <span title="">&Ugrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-ugrave><td> <code title="">ugrave;</code> </td> <td> U+000F9 </td> <td> <span class=glyph title="">&ugrave;</span> </td> <tr id=entity-ugrave-legacy class=impl><td> <code title="">ugrave</code> </td> <td> U+000F9 </td> <td> <span title="">&ugrave;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-uHar><td> <code title="">uHar;</code> </td> <td> U+02963 </td> <td> <span class=glyph title="">&uHar;</span> </td> <tr id=entity-uharl><td> <code title="">uharl;</code> </td> <td> U+021BF </td> <td> <span class=glyph title="">&upharpoonleft;</span> </td> <tr id=entity-uharr><td> <code title="">uharr;</code> </td> <td> U+021BE </td> <td> <span class=glyph title="">&upharpoonright;</span> </td> <tr id=entity-uhblk><td> <code title="">uhblk;</code> </td> <td> U+02580 </td> <td> <span class=glyph title="">&uhblk;</span> </td> <tr id=entity-ulcorn><td> <code title="">ulcorn;</code> </td> <td> U+0231C </td> <td> <span class=glyph title="">&ulcorn;</span> </td> <tr id=entity-ulcorner><td> <code title="">ulcorner;</code> </td> <td> U+0231C </td> <td> <span class=glyph title="">&ulcorn;</span> </td> <tr id=entity-ulcrop><td> <code title="">ulcrop;</code> </td> <td> U+0230F </td> <td> <span class=glyph title="">&ulcrop;</span> </td> <tr id=entity-ultri><td> <code title="">ultri;</code> </td> <td> U+025F8 </td> <td> <span class=glyph title="">&ultri;</span> </td> <tr id=entity-Umacr><td> <code title="">Umacr;</code> </td> <td> U+0016A </td> <td> <span class=glyph title="">&Umacr;</span> </td> <tr id=entity-umacr><td> <code title="">umacr;</code> </td> <td> U+0016B </td> <td> <span class=glyph title="">&umacr;</span> </td> <tr id=entity-uml><td> <code title="">uml;</code> </td> <td> U+000A8 </td> <td> <span class=glyph title="">&die;</span> </td> <tr id=entity-uml-legacy class=impl><td> <code title="">uml</code> </td> <td> U+000A8 </td> <td> <span title="">&die;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-UnderBar><td> <code title="">UnderBar;</code> </td> <td> U+0005F </td> <td> <span class=glyph title="">_</span> </td> <tr id=entity-UnderBrace><td> <code title="">UnderBrace;</code> </td> <td> U+023DF </td> <td> <span class=glyph title="">&UnderBrace;</span> </td> <tr id=entity-UnderBracket><td> <code title="">UnderBracket;</code> </td> <td> U+023B5 </td> <td> <span class=glyph title="">&bbrk;</span> </td> <tr id=entity-UnderParenthesis><td> <code title="">UnderParenthesis;</code> </td> <td> U+023DD </td> <td> <span class=glyph title="">&UnderParenthesis;</span> </td> <tr id=entity-Union><td> <code title="">Union;</code> </td> <td> U+022C3 </td> <td> <span class=glyph title="">&xcup;</span> </td> <tr id=entity-UnionPlus><td> <code title="">UnionPlus;</code> </td> <td> U+0228E </td> <td> <span class=glyph title="">&uplus;</span> </td> <tr id=entity-Uogon><td> <code title="">Uogon;</code> </td> <td> U+00172 </td> <td> <span class=glyph title="">&Uogon;</span> </td> <tr id=entity-uogon><td> <code title="">uogon;</code> </td> <td> U+00173 </td> <td> <span class=glyph title="">&uogon;</span> </td> <tr id=entity-Uopf><td> <code title="">Uopf;</code> </td> <td> U+1D54C </td> <td> <span class=glyph title="">&Uopf;</span> </td> <tr id=entity-uopf><td> <code title="">uopf;</code> </td> <td> U+1D566 </td> <td> <span class=glyph title="">&uopf;</span> </td> <tr id=entity-UpArrow><td> <code title="">UpArrow;</code> </td> <td> U+02191 </td> <td> <span class=glyph title="">&uparrow;</span> </td> <tr id=entity-Uparrow><td> <code title="">Uparrow;</code> </td> <td> U+021D1 </td> <td> <span class=glyph title="">&Uparrow;</span> </td> <tr id=entity-uparrow><td> <code title="">uparrow;</code> </td> <td> U+02191 </td> <td> <span class=glyph title="">&uparrow;</span> </td> <tr id=entity-UpArrowBar><td> <code title="">UpArrowBar;</code> </td> <td> U+02912 </td> <td> <span class=glyph title="">&UpArrowBar;</span> </td> <tr id=entity-UpArrowDownArrow><td> <code title="">UpArrowDownArrow;</code> </td> <td> U+021C5 </td> <td> <span class=glyph title="">&udarr;</span> </td> <tr id=entity-UpDownArrow><td> <code title="">UpDownArrow;</code> </td> <td> U+02195 </td> <td> <span class=glyph title="">&varr;</span> </td> <tr id=entity-Updownarrow><td> <code title="">Updownarrow;</code> </td> <td> U+021D5 </td> <td> <span class=glyph title="">&DoubleUpDownArrow;</span> </td> <tr id=entity-updownarrow><td> <code title="">updownarrow;</code> </td> <td> U+02195 </td> <td> <span class=glyph title="">&varr;</span> </td> <tr id=entity-UpEquilibrium><td> <code title="">UpEquilibrium;</code> </td> <td> U+0296E </td> <td> <span class=glyph title="">&udhar;</span> </td> <tr id=entity-upharpoonleft><td> <code title="">upharpoonleft;</code> </td> <td> U+021BF </td> <td> <span class=glyph title="">&upharpoonleft;</span> </td> <tr id=entity-upharpoonright><td> <code title="">upharpoonright;</code> </td> <td> U+021BE </td> <td> <span class=glyph title="">&upharpoonright;</span> </td> <tr id=entity-uplus><td> <code title="">uplus;</code> </td> <td> U+0228E </td> <td> <span class=glyph title="">&uplus;</span> </td> <tr id=entity-UpperLeftArrow><td> <code title="">UpperLeftArrow;</code> </td> <td> U+02196 </td> <td> <span class=glyph title="">&nwarrow;</span> </td> <tr id=entity-UpperRightArrow><td> <code title="">UpperRightArrow;</code> </td> <td> U+02197 </td> <td> <span class=glyph title="">&nearrow;</span> </td> <tr id=entity-Upsi><td> <code title="">Upsi;</code> </td> <td> U+003D2 </td> <td> <span class=glyph title="">&upsih;</span> </td> <tr id=entity-upsi><td> <code title="">upsi;</code> </td> <td> U+003C5 </td> <td> <span class=glyph title="">&upsilon;</span> </td> <tr id=entity-upsih><td> <code title="">upsih;</code> </td> <td> U+003D2 </td> <td> <span class=glyph title="">&upsih;</span> </td> <tr id=entity-Upsilon><td> <code title="">Upsilon;</code> </td> <td> U+003A5 </td> <td> <span class=glyph title="">&Upsilon;</span> </td> <tr id=entity-upsilon><td> <code title="">upsilon;</code> </td> <td> U+003C5 </td> <td> <span class=glyph title="">&upsilon;</span> </td> <tr id=entity-UpTee><td> <code title="">UpTee;</code> </td> <td> U+022A5 </td> <td> <span class=glyph title="">&bottom;</span> </td> <tr id=entity-UpTeeArrow><td> <code title="">UpTeeArrow;</code> </td> <td> U+021A5 </td> <td> <span class=glyph title="">&mapstoup;</span> </td> <tr id=entity-upuparrows><td> <code title="">upuparrows;</code> </td> <td> U+021C8 </td> <td> <span class=glyph title="">&uuarr;</span> </td> <tr id=entity-urcorn><td> <code title="">urcorn;</code> </td> <td> U+0231D </td> <td> <span class=glyph title="">&urcorn;</span> </td> <tr id=entity-urcorner><td> <code title="">urcorner;</code> </td> <td> U+0231D </td> <td> <span class=glyph title="">&urcorn;</span> </td> <tr id=entity-urcrop><td> <code title="">urcrop;</code> </td> <td> U+0230E </td> <td> <span class=glyph title="">&urcrop;</span> </td> <tr id=entity-Uring><td> <code title="">Uring;</code> </td> <td> U+0016E </td> <td> <span class=glyph title="">&Uring;</span> </td> <tr id=entity-uring><td> <code title="">uring;</code> </td> <td> U+0016F </td> <td> <span class=glyph title="">&uring;</span> </td> <tr id=entity-urtri><td> <code title="">urtri;</code> </td> <td> U+025F9 </td> <td> <span class=glyph title="">&urtri;</span> </td> <tr id=entity-Uscr><td> <code title="">Uscr;</code> </td> <td> U+1D4B0 </td> <td> <span class=glyph title="">&Uscr;</span> </td> <tr id=entity-uscr><td> <code title="">uscr;</code> </td> <td> U+1D4CA </td> <td> <span class=glyph title="">&uscr;</span> </td> <tr id=entity-utdot><td> <code title="">utdot;</code> </td> <td> U+022F0 </td> <td> <span class=glyph title="">&utdot;</span> </td> <tr id=entity-Utilde><td> <code title="">Utilde;</code> </td> <td> U+00168 </td> <td> <span class=glyph title="">&Utilde;</span> </td> <tr id=entity-utilde><td> <code title="">utilde;</code> </td> <td> U+00169 </td> <td> <span class=glyph title="">&utilde;</span> </td> <tr id=entity-utri><td> <code title="">utri;</code> </td> <td> U+025B5 </td> <td> <span class=glyph title="">&triangle;</span> </td> <tr id=entity-utrif><td> <code title="">utrif;</code> </td> <td> U+025B4 </td> <td> <span class=glyph title="">&utrif;</span> </td> <tr id=entity-uuarr><td> <code title="">uuarr;</code> </td> <td> U+021C8 </td> <td> <span class=glyph title="">&uuarr;</span> </td> <tr id=entity-Uuml><td> <code title="">Uuml;</code> </td> <td> U+000DC </td> <td> <span class=glyph title="">&Uuml;</span> </td> <tr id=entity-Uuml-legacy class=impl><td> <code title="">Uuml</code> </td> <td> U+000DC </td> <td> <span title="">&Uuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-uuml><td> <code title="">uuml;</code> </td> <td> U+000FC </td> <td> <span class=glyph title="">&uuml;</span> </td> <tr id=entity-uuml-legacy class=impl><td> <code title="">uuml</code> </td> <td> U+000FC </td> <td> <span title="">&uuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-uwangle><td> <code title="">uwangle;</code> </td> <td> U+029A7 </td> <td> <span class=glyph title="">&uwangle;</span> </td> <tr id=entity-vangrt><td> <code title="">vangrt;</code> </td> <td> U+0299C </td> <td> <span class=glyph title="">&vangrt;</span> </td> <tr id=entity-varepsilon><td> <code title="">varepsilon;</code> </td> <td> U+003F5 </td> <td> <span class=glyph title="">&straightepsilon;</span> </td> <tr id=entity-varkappa><td> <code title="">varkappa;</code> </td> <td> U+003F0 </td> <td> <span class=glyph title="">&kappav;</span> </td> <tr id=entity-varnothing><td> <code title="">varnothing;</code> </td> <td> U+02205 </td> <td> <span class=glyph title="">&emptyv;</span> </td> <tr id=entity-varphi><td> <code title="">varphi;</code> </td> <td> U+003D5 </td> <td> <span class=glyph title="">&phiv;</span> </td> <tr id=entity-varpi><td> <code title="">varpi;</code> </td> <td> U+003D6 </td> <td> <span class=glyph title="">&varpi;</span> </td> <tr id=entity-varpropto><td> <code title="">varpropto;</code> </td> <td> U+0221D </td> <td> <span class=glyph title="">&propto;</span> </td> <tr id=entity-vArr><td> <code title="">vArr;</code> </td> <td> U+021D5 </td> <td> <span class=glyph title="">&DoubleUpDownArrow;</span> </td> <tr id=entity-varr><td> <code title="">varr;</code> </td> <td> U+02195 </td> <td> <span class=glyph title="">&varr;</span> </td> <tr id=entity-varrho><td> <code title="">varrho;</code> </td> <td> U+003F1 </td> <td> <span class=glyph title="">&rhov;</span> </td> <tr id=entity-varsigma><td> <code title="">varsigma;</code> </td> <td> U+003C2 </td> <td> <span class=glyph title="">&sigmav;</span> </td> <tr id=entity-varsubsetneq><td> <code title="">varsubsetneq;</code> </td> <td> U+0228A U+0FE00 </td> <td> <span class="glyph compound" title="">&subsetneq;&#xfe00;</span> </td> <tr id=entity-varsubsetneqq><td> <code title="">varsubsetneqq;</code> </td> <td> U+02ACB U+0FE00 </td> <td> <span class="glyph compound" title="">&subsetneqq;&#xfe00;</span> </td> <tr id=entity-varsupsetneq><td> <code title="">varsupsetneq;</code> </td> <td> U+0228B U+0FE00 </td> <td> <span class="glyph compound" title="">&supsetneq;&#xfe00;</span> </td> <tr id=entity-varsupsetneqq><td> <code title="">varsupsetneqq;</code> </td> <td> U+02ACC U+0FE00 </td> <td> <span class="glyph compound" title="">&supsetneqq;&#xfe00;</span> </td> <tr id=entity-vartheta><td> <code title="">vartheta;</code> </td> <td> U+003D1 </td> <td> <span class=glyph title="">&thetav;</span> </td> <tr id=entity-vartriangleleft><td> <code title="">vartriangleleft;</code> </td> <td> U+022B2 </td> <td> <span class=glyph title="">&vartriangleleft;</span> </td> <tr id=entity-vartriangleright><td> <code title="">vartriangleright;</code> </td> <td> U+022B3 </td> <td> <span class=glyph title="">&vartriangleright;</span> </td> <tr id=entity-Vbar><td> <code title="">Vbar;</code> </td> <td> U+02AEB </td> <td> <span class=glyph title="">&Vbar;</span> </td> <tr id=entity-vBar><td> <code title="">vBar;</code> </td> <td> U+02AE8 </td> <td> <span class=glyph title="">&vBar;</span> </td> <tr id=entity-vBarv><td> <code title="">vBarv;</code> </td> <td> U+02AE9 </td> <td> <span class=glyph title="">&vBarv;</span> </td> <tr id=entity-Vcy><td> <code title="">Vcy;</code> </td> <td> U+00412 </td> <td> <span class=glyph title="">&Vcy;</span> </td> <tr id=entity-vcy><td> <code title="">vcy;</code> </td> <td> U+00432 </td> <td> <span class=glyph title="">&vcy;</span> </td> <tr id=entity-VDash><td> <code title="">VDash;</code> </td> <td> U+022AB </td> <td> <span class=glyph title="">&VDash;</span> </td> <tr id=entity-Vdash><td> <code title="">Vdash;</code> </td> <td> U+022A9 </td> <td> <span class=glyph title="">&Vdash;</span> </td> <tr id=entity-vDash><td> <code title="">vDash;</code> </td> <td> U+022A8 </td> <td> <span class=glyph title="">&vDash;</span> </td> <tr id=entity-vdash><td> <code title="">vdash;</code> </td> <td> U+022A2 </td> <td> <span class=glyph title="">&vdash;</span> </td> <tr id=entity-Vdashl><td> <code title="">Vdashl;</code> </td> <td> U+02AE6 </td> <td> <span class=glyph title="">&Vdashl;</span> </td> <tr id=entity-Vee><td> <code title="">Vee;</code> </td> <td> U+022C1 </td> <td> <span class=glyph title="">&bigvee;</span> </td> <tr id=entity-vee><td> <code title="">vee;</code> </td> <td> U+02228 </td> <td> <span class=glyph title="">&vee;</span> </td> <tr id=entity-veebar><td> <code title="">veebar;</code> </td> <td> U+022BB </td> <td> <span class=glyph title="">&veebar;</span> </td> <tr id=entity-veeeq><td> <code title="">veeeq;</code> </td> <td> U+0225A </td> <td> <span class=glyph title="">&veeeq;</span> </td> <tr id=entity-vellip><td> <code title="">vellip;</code> </td> <td> U+022EE </td> <td> <span class=glyph title="">&vellip;</span> </td> <tr id=entity-Verbar><td> <code title="">Verbar;</code> </td> <td> U+02016 </td> <td> <span class=glyph title="">&Vert;</span> </td> <tr id=entity-verbar><td> <code title="">verbar;</code> </td> <td> U+0007C </td> <td> <span class=glyph title="">|</span> </td> <tr id=entity-Vert><td> <code title="">Vert;</code> </td> <td> U+02016 </td> <td> <span class=glyph title="">&Vert;</span> </td> <tr id=entity-vert><td> <code title="">vert;</code> </td> <td> U+0007C </td> <td> <span class=glyph title="">|</span> </td> <tr id=entity-VerticalBar><td> <code title="">VerticalBar;</code> </td> <td> U+02223 </td> <td> <span class=glyph title="">&mid;</span> </td> <tr id=entity-VerticalLine><td> <code title="">VerticalLine;</code> </td> <td> U+0007C </td> <td> <span class=glyph title="">|</span> </td> <tr id=entity-VerticalSeparator><td> <code title="">VerticalSeparator;</code> </td> <td> U+02758 </td> <td> <span class=glyph title="">&VerticalSeparator;</span> </td> <tr id=entity-VerticalTilde><td> <code title="">VerticalTilde;</code> </td> <td> U+02240 </td> <td> <span class=glyph title="">&wreath;</span> </td> <tr id=entity-VeryThinSpace><td> <code title="">VeryThinSpace;</code> </td> <td> U+0200A </td> <td> <span class=glyph title="">&hairsp;</span> </td> <tr id=entity-Vfr><td> <code title="">Vfr;</code> </td> <td> U+1D519 </td> <td> <span class=glyph title="">&Vfr;</span> </td> <tr id=entity-vfr><td> <code title="">vfr;</code> </td> <td> U+1D533 </td> <td> <span class=glyph title="">&vfr;</span> </td> <tr id=entity-vltri><td> <code title="">vltri;</code> </td> <td> U+022B2 </td> <td> <span class=glyph title="">&vartriangleleft;</span> </td> <tr id=entity-vnsub><td> <code title="">vnsub;</code> </td> <td> U+02282 U+020D2 </td> <td> <span class="glyph compound" title="">&sub;&#x20d2;</span> </td> <tr id=entity-vnsup><td> <code title="">vnsup;</code> </td> <td> U+02283 U+020D2 </td> <td> <span class="glyph compound" title="">&sup;&#x20d2;</span> </td> <tr id=entity-Vopf><td> <code title="">Vopf;</code> </td> <td> U+1D54D </td> <td> <span class=glyph title="">&Vopf;</span> </td> <tr id=entity-vopf><td> <code title="">vopf;</code> </td> <td> U+1D567 </td> <td> <span class=glyph title="">&vopf;</span> </td> <tr id=entity-vprop><td> <code title="">vprop;</code> </td> <td> U+0221D </td> <td> <span class=glyph title="">&propto;</span> </td> <tr id=entity-vrtri><td> <code title="">vrtri;</code> </td> <td> U+022B3 </td> <td> <span class=glyph title="">&vartriangleright;</span> </td> <tr id=entity-Vscr><td> <code title="">Vscr;</code> </td> <td> U+1D4B1 </td> <td> <span class=glyph title="">&Vscr;</span> </td> <tr id=entity-vscr><td> <code title="">vscr;</code> </td> <td> U+1D4CB </td> <td> <span class=glyph title="">&vscr;</span> </td> <tr id=entity-vsubnE><td> <code title="">vsubnE;</code> </td> <td> U+02ACB U+0FE00 </td> <td> <span class="glyph compound" title="">&subsetneqq;&#xfe00;</span> </td> <tr id=entity-vsubne><td> <code title="">vsubne;</code> </td> <td> U+0228A U+0FE00 </td> <td> <span class="glyph compound" title="">&subsetneq;&#xfe00;</span> </td> <tr id=entity-vsupnE><td> <code title="">vsupnE;</code> </td> <td> U+02ACC U+0FE00 </td> <td> <span class="glyph compound" title="">&supsetneqq;&#xfe00;</span> </td> <tr id=entity-vsupne><td> <code title="">vsupne;</code> </td> <td> U+0228B U+0FE00 </td> <td> <span class="glyph compound" title="">&supsetneq;&#xfe00;</span> </td> <tr id=entity-Vvdash><td> <code title="">Vvdash;</code> </td> <td> U+022AA </td> <td> <span class=glyph title="">&Vvdash;</span> </td> <tr id=entity-vzigzag><td> <code title="">vzigzag;</code> </td> <td> U+0299A </td> <td> <span class=glyph title="">&vzigzag;</span> </td> <tr id=entity-Wcirc><td> <code title="">Wcirc;</code> </td> <td> U+00174 </td> <td> <span class=glyph title="">&Wcirc;</span> </td> <tr id=entity-wcirc><td> <code title="">wcirc;</code> </td> <td> U+00175 </td> <td> <span class=glyph title="">&wcirc;</span> </td> <tr id=entity-wedbar><td> <code title="">wedbar;</code> </td> <td> U+02A5F </td> <td> <span class=glyph title="">&wedbar;</span> </td> <tr id=entity-Wedge><td> <code title="">Wedge;</code> </td> <td> U+022C0 </td> <td> <span class=glyph title="">&xwedge;</span> </td> <tr id=entity-wedge><td> <code title="">wedge;</code> </td> <td> U+02227 </td> <td> <span class=glyph title="">&wedge;</span> </td> <tr id=entity-wedgeq><td> <code title="">wedgeq;</code> </td> <td> U+02259 </td> <td> <span class=glyph title="">&wedgeq;</span> </td> <tr id=entity-weierp><td> <code title="">weierp;</code> </td> <td> U+02118 </td> <td> <span class=glyph title="">&wp;</span> </td> <tr id=entity-Wfr><td> <code title="">Wfr;</code> </td> <td> U+1D51A </td> <td> <span class=glyph title="">&Wfr;</span> </td> <tr id=entity-wfr><td> <code title="">wfr;</code> </td> <td> U+1D534 </td> <td> <span class=glyph title="">&wfr;</span> </td> <tr id=entity-Wopf><td> <code title="">Wopf;</code> </td> <td> U+1D54E </td> <td> <span class=glyph title="">&Wopf;</span> </td> <tr id=entity-wopf><td> <code title="">wopf;</code> </td> <td> U+1D568 </td> <td> <span class=glyph title="">&wopf;</span> </td> <tr id=entity-wp><td> <code title="">wp;</code> </td> <td> U+02118 </td> <td> <span class=glyph title="">&wp;</span> </td> <tr id=entity-wr><td> <code title="">wr;</code> </td> <td> U+02240 </td> <td> <span class=glyph title="">&wreath;</span> </td> <tr id=entity-wreath><td> <code title="">wreath;</code> </td> <td> U+02240 </td> <td> <span class=glyph title="">&wreath;</span> </td> <tr id=entity-Wscr><td> <code title="">Wscr;</code> </td> <td> U+1D4B2 </td> <td> <span class=glyph title="">&Wscr;</span> </td> <tr id=entity-wscr><td> <code title="">wscr;</code> </td> <td> U+1D4CC </td> <td> <span class=glyph title="">&wscr;</span> </td> <tr id=entity-xcap><td> <code title="">xcap;</code> </td> <td> U+022C2 </td> <td> <span class=glyph title="">&bigcap;</span> </td> <tr id=entity-xcirc><td> <code title="">xcirc;</code> </td> <td> U+025EF </td> <td> <span class=glyph title="">&xcirc;</span> </td> <tr id=entity-xcup><td> <code title="">xcup;</code> </td> <td> U+022C3 </td> <td> <span class=glyph title="">&xcup;</span> </td> <tr id=entity-xdtri><td> <code title="">xdtri;</code> </td> <td> U+025BD </td> <td> <span class=glyph title="">&xdtri;</span> </td> <tr id=entity-Xfr><td> <code title="">Xfr;</code> </td> <td> U+1D51B </td> <td> <span class=glyph title="">&Xfr;</span> </td> <tr id=entity-xfr><td> <code title="">xfr;</code> </td> <td> U+1D535 </td> <td> <span class=glyph title="">&xfr;</span> </td> <tr id=entity-xhArr><td> <code title="">xhArr;</code> </td> <td> U+027FA </td> <td> <span class=glyph title="">&DoubleLongLeftRightArrow;</span> </td> <tr id=entity-xharr><td> <code title="">xharr;</code> </td> <td> U+027F7 </td> <td> <span class=glyph title="">&xharr;</span> </td> <tr id=entity-Xi><td> <code title="">Xi;</code> </td> <td> U+0039E </td> <td> <span class=glyph title="">&Xi;</span> </td> <tr id=entity-xi><td> <code title="">xi;</code> </td> <td> U+003BE </td> <td> <span class=glyph title="">&xi;</span> </td> <tr id=entity-xlArr><td> <code title="">xlArr;</code> </td> <td> U+027F8 </td> <td> <span class=glyph title="">&Longleftarrow;</span> </td> <tr id=entity-xlarr><td> <code title="">xlarr;</code> </td> <td> U+027F5 </td> <td> <span class=glyph title="">&xlarr;</span> </td> <tr id=entity-xmap><td> <code title="">xmap;</code> </td> <td> U+027FC </td> <td> <span class=glyph title="">&xmap;</span> </td> <tr id=entity-xnis><td> <code title="">xnis;</code> </td> <td> U+022FB </td> <td> <span class=glyph title="">&xnis;</span> </td> <tr id=entity-xodot><td> <code title="">xodot;</code> </td> <td> U+02A00 </td> <td> <span class=glyph title="">&bigodot;</span> </td> <tr id=entity-Xopf><td> <code title="">Xopf;</code> </td> <td> U+1D54F </td> <td> <span class=glyph title="">&Xopf;</span> </td> <tr id=entity-xopf><td> <code title="">xopf;</code> </td> <td> U+1D569 </td> <td> <span class=glyph title="">&xopf;</span> </td> <tr id=entity-xoplus><td> <code title="">xoplus;</code> </td> <td> U+02A01 </td> <td> <span class=glyph title="">&bigoplus;</span> </td> <tr id=entity-xotime><td> <code title="">xotime;</code> </td> <td> U+02A02 </td> <td> <span class=glyph title="">&xotime;</span> </td> <tr id=entity-xrArr><td> <code title="">xrArr;</code> </td> <td> U+027F9 </td> <td> <span class=glyph title="">&xrArr;</span> </td> <tr id=entity-xrarr><td> <code title="">xrarr;</code> </td> <td> U+027F6 </td> <td> <span class=glyph title="">&xrarr;</span> </td> <tr id=entity-Xscr><td> <code title="">Xscr;</code> </td> <td> U+1D4B3 </td> <td> <span class=glyph title="">&Xscr;</span> </td> <tr id=entity-xscr><td> <code title="">xscr;</code> </td> <td> U+1D4CD </td> <td> <span class=glyph title="">&xscr;</span> </td> <tr id=entity-xsqcup><td> <code title="">xsqcup;</code> </td> <td> U+02A06 </td> <td> <span class=glyph title="">&bigsqcup;</span> </td> <tr id=entity-xuplus><td> <code title="">xuplus;</code> </td> <td> U+02A04 </td> <td> <span class=glyph title="">&xuplus;</span> </td> <tr id=entity-xutri><td> <code title="">xutri;</code> </td> <td> U+025B3 </td> <td> <span class=glyph title="">&bigtriangleup;</span> </td> <tr id=entity-xvee><td> <code title="">xvee;</code> </td> <td> U+022C1 </td> <td> <span class=glyph title="">&bigvee;</span> </td> <tr id=entity-xwedge><td> <code title="">xwedge;</code> </td> <td> U+022C0 </td> <td> <span class=glyph title="">&xwedge;</span> </td> <tr id=entity-Yacute><td> <code title="">Yacute;</code> </td> <td> U+000DD </td> <td> <span class=glyph title="">&Yacute;</span> </td> <tr id=entity-Yacute-legacy class=impl><td> <code title="">Yacute</code> </td> <td> U+000DD </td> <td> <span title="">&Yacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-yacute><td> <code title="">yacute;</code> </td> <td> U+000FD </td> <td> <span class=glyph title="">&yacute;</span> </td> <tr id=entity-yacute-legacy class=impl><td> <code title="">yacute</code> </td> <td> U+000FD </td> <td> <span title="">&yacute;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-YAcy><td> <code title="">YAcy;</code> </td> <td> U+0042F </td> <td> <span class=glyph title="">&YAcy;</span> </td> <tr id=entity-yacy><td> <code title="">yacy;</code> </td> <td> U+0044F </td> <td> <span class=glyph title="">&yacy;</span> </td> <tr id=entity-Ycirc><td> <code title="">Ycirc;</code> </td> <td> U+00176 </td> <td> <span class=glyph title="">&Ycirc;</span> </td> <tr id=entity-ycirc><td> <code title="">ycirc;</code> </td> <td> U+00177 </td> <td> <span class=glyph title="">&ycirc;</span> </td> <tr id=entity-Ycy><td> <code title="">Ycy;</code> </td> <td> U+0042B </td> <td> <span class=glyph title="">&Ycy;</span> </td> <tr id=entity-ycy><td> <code title="">ycy;</code> </td> <td> U+0044B </td> <td> <span class=glyph title="">&ycy;</span> </td> <tr id=entity-yen><td> <code title="">yen;</code> </td> <td> U+000A5 </td> <td> <span class=glyph title="">&yen;</span> </td> <tr id=entity-yen-legacy class=impl><td> <code title="">yen</code> </td> <td> U+000A5 </td> <td> <span title="">&yen;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Yfr><td> <code title="">Yfr;</code> </td> <td> U+1D51C </td> <td> <span class=glyph title="">&Yfr;</span> </td> <tr id=entity-yfr><td> <code title="">yfr;</code> </td> <td> U+1D536 </td> <td> <span class=glyph title="">&yfr;</span> </td> <tr id=entity-YIcy><td> <code title="">YIcy;</code> </td> <td> U+00407 </td> <td> <span class=glyph title="">&YIcy;</span> </td> <tr id=entity-yicy><td> <code title="">yicy;</code> </td> <td> U+00457 </td> <td> <span class=glyph title="">&yicy;</span> </td> <tr id=entity-Yopf><td> <code title="">Yopf;</code> </td> <td> U+1D550 </td> <td> <span class=glyph title="">&Yopf;</span> </td> <tr id=entity-yopf><td> <code title="">yopf;</code> </td> <td> U+1D56A </td> <td> <span class=glyph title="">&yopf;</span> </td> <tr id=entity-Yscr><td> <code title="">Yscr;</code> </td> <td> U+1D4B4 </td> <td> <span class=glyph title="">&Yscr;</span> </td> <tr id=entity-yscr><td> <code title="">yscr;</code> </td> <td> U+1D4CE </td> <td> <span class=glyph title="">&yscr;</span> </td> <tr id=entity-YUcy><td> <code title="">YUcy;</code> </td> <td> U+0042E </td> <td> <span class=glyph title="">&YUcy;</span> </td> <tr id=entity-yucy><td> <code title="">yucy;</code> </td> <td> U+0044E </td> <td> <span class=glyph title="">&yucy;</span> </td> <tr id=entity-Yuml><td> <code title="">Yuml;</code> </td> <td> U+00178 </td> <td> <span class=glyph title="">&Yuml;</span> </td> <tr id=entity-yuml><td> <code title="">yuml;</code> </td> <td> U+000FF </td> <td> <span class=glyph title="">&yuml;</span> </td> <tr id=entity-yuml-legacy class=impl><td> <code title="">yuml</code> </td> <td> U+000FF </td> <td> <span title="">&yuml;</span> </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr id=entity-Zacute><td> <code title="">Zacute;</code> </td> <td> U+00179 </td> <td> <span class=glyph title="">&Zacute;</span> </td> <tr id=entity-zacute><td> <code title="">zacute;</code> </td> <td> U+0017A </td> <td> <span class=glyph title="">&zacute;</span> </td> <tr id=entity-Zcaron><td> <code title="">Zcaron;</code> </td> <td> U+0017D </td> <td> <span class=glyph title="">&Zcaron;</span> </td> <tr id=entity-zcaron><td> <code title="">zcaron;</code> </td> <td> U+0017E </td> <td> <span class=glyph title="">&zcaron;</span> </td> <tr id=entity-Zcy><td> <code title="">Zcy;</code> </td> <td> U+00417 </td> <td> <span class=glyph title="">&Zcy;</span> </td> <tr id=entity-zcy><td> <code title="">zcy;</code> </td> <td> U+00437 </td> <td> <span class=glyph title="">&zcy;</span> </td> <tr id=entity-Zdot><td> <code title="">Zdot;</code> </td> <td> U+0017B </td> <td> <span class=glyph title="">&Zdot;</span> </td> <tr id=entity-zdot><td> <code title="">zdot;</code> </td> <td> U+0017C </td> <td> <span class=glyph title="">&zdot;</span> </td> <tr id=entity-zeetrf><td> <code title="">zeetrf;</code> </td> <td> U+02128 </td> <td> <span class=glyph title="">&zeetrf;</span> </td> <tr id=entity-ZeroWidthSpace><td> <code title="">ZeroWidthSpace;</code> </td> <td> U+0200B </td> <td> <span class=glyph title="">&NegativeThickSpace;</span> </td> <tr id=entity-Zeta><td> <code title="">Zeta;</code> </td> <td> U+00396 </td> <td> <span class=glyph title="">&Zeta;</span> </td> <tr id=entity-zeta><td> <code title="">zeta;</code> </td> <td> U+003B6 </td> <td> <span class=glyph title="">&zeta;</span> </td> <tr id=entity-Zfr><td> <code title="">Zfr;</code> </td> <td> U+02128 </td> <td> <span class=glyph title="">&zeetrf;</span> </td> <tr id=entity-zfr><td> <code title="">zfr;</code> </td> <td> U+1D537 </td> <td> <span class=glyph title="">&zfr;</span> </td> <tr id=entity-ZHcy><td> <code title="">ZHcy;</code> </td> <td> U+00416 </td> <td> <span class=glyph title="">&ZHcy;</span> </td> <tr id=entity-zhcy><td> <code title="">zhcy;</code> </td> <td> U+00436 </td> <td> <span class=glyph title="">&zhcy;</span> </td> <tr id=entity-zigrarr><td> <code title="">zigrarr;</code> </td> <td> U+021DD </td> <td> <span class=glyph title="">&zigrarr;</span> </td> <tr id=entity-Zopf><td> <code title="">Zopf;</code> </td> <td> U+02124 </td> <td> <span class=glyph title="">&integers;</span> </td> <tr id=entity-zopf><td> <code title="">zopf;</code> </td> <td> U+1D56B </td> <td> <span class=glyph title="">&zopf;</span> </td> <tr id=entity-Zscr><td> <code title="">Zscr;</code> </td> <td> U+1D4B5 </td> <td> <span class=glyph title="">&Zscr;</span> </td> <tr id=entity-zscr><td> <code title="">zscr;</code> </td> <td> U+1D4CF </td> <td> <span class=glyph title="">&zscr;</span> </td> <tr id=entity-zwj><td> <code title="">zwj;</code> </td> <td> U+0200D </td> <td> <span class=glyph title="">&zwj;</span> </td> <tr id=entity-zwnj><td> <code title="">zwnj;</code> </td> <td> U+0200C </td> <td> <span class=glyph title="">&zwnj;</span> </td> </table><!--
   If we want to add character references, Almorca suggests:
   > I would add &sub1; (character U+2081), &sub2;
   > (character U+2082) and &sub3; (character U+2083). They
   > would are the equivalent to &sup1;, &sup2;, and &sup3;.
   See also: http://www.w3.org/2003/entities/
  --></div>

  <p>This data is also available <a href=entities.json>as a JSON
  file</a>.</p>

  <p><i>The glyphs displayed above are non-normative. Refer to the
  Unicode specifications for formal definitions of the characters
  listed above.</i></p>


  <h2 id=the-xhtml-syntax><span class=secno>13 </span><dfn id=xhtml>The XHTML syntax</dfn></h2>

  <p class=note>This section only describes the rules for XML
  resources. Rules for <code><a href=#text/html>text/html</a></code> resources are discussed
  in the section above entitled "<a href=#syntax>The HTML syntax</a>".</p>


  <div class=impl>

  <h3 id=writing-xhtml-documents><span class=secno>13.1 </span>Writing XHTML documents</h3>

  </div>

  <p>The syntax for using HTML with XML, whether in XHTML documents or
  embedded in other XML documents, is defined in the XML and
  Namespaces in XML specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>

  <p>This specification does not define any syntax-level requirements
  beyond those defined for XML proper.</p>

  <p>XML documents may contain a <code>DOCTYPE</code> if desired, but
  this is not required to conform to this specification. This
  specification does not define a public or system identifier, nor
  provide a formal DTD.</p>

  <p class=note>According to the XML specification, XML processors
  are not guaranteed to process the external DTD subset referenced in
  the DOCTYPE. This means, for example, that using <a href=http://www.w3.org/TR/xml/#dt-entref>entity references</a>
  for characters in XHTML documents is unsafe if they are defined in
  an external file (except for <code title="">&amp;lt;</code>, <code title="">&amp;gt;</code>, <code title="">&amp;amp;</code>, <code title="">&amp;quot;</code> and <code title="">&amp;apos;</code>).</p>


  <div class=impl>

  <h3 id=parsing-xhtml-documents><span class=secno>13.2 </span>Parsing XHTML documents</h3>

  <p>This section describes the relationship between XML and the DOM, with a particular emphasis on
  how this interacts with HTML.</p>

  <p>An <dfn id=xml-parser>XML parser</dfn>, for the purposes of this specification, is a construct that follows
  the rules given in the XML specification to map a string of bytes or characters into a
  <code><a href=#document>Document</a></code> object.</p>

  <p class=note>At the time of writing, no such rules actually exist.</p>

  <p>An <a href=#xml-parser>XML parser</a> is either associated with a <code><a href=#document>Document</a></code> object when it is
  created, or creates one implicitly.</p>

  <p>This <code><a href=#document>Document</a></code> must then be populated with DOM nodes that represent the tree
  structure of the input passed to the parser, as defined by the XML specification, the Namespaces
  in XML specification, and the DOM specification. DOM mutation events must not fire for the
  operations that the <a href=#xml-parser>XML parser</a> performs on the <code><a href=#document>Document</a></code>'s tree, but the
  user agent must act as if elements and attributes were individually appended and set respectively
  so as to trigger rules in this specification regarding what happens when an element is inserted
  into a document or has its attributes set, and the DOM specification's requirements regarding
  mutation observers mean that mutation observers <em>are</em> fired (unlike mutation events). <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsDOM>[DOM]</a> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>

  <p>Between the time an element's start tag is parsed and the time either the element's end tag is
  parsed or the parser detects a well-formedness error, the user agent must act as if the element
  was in a <a href=#stack-of-open-elements>stack of open elements</a>.</p>

  <p class=note>This is used by the <code><a href=#the-object-element>object</a></code> element to avoid instantiating plugins
  before the <code><a href=#the-param-element>param</a></code> element children have been parsed.</p>

  <p>This specification provides the following additional information that user agents should use
  when retrieving an external entity: the public identifiers given in the following list all
  correspond to <a href=data:application/xml-dtd;base64,PCFFTlRJVFkgVGFiICImI3g5OyI%2BPCFFTlRJVFkgTmV3TGluZSAiJiN4QTsiPjwhRU5USVRZIGV4Y2wgIiYjeDIxOyI%2BPCFFTlRJVFkgcXVvdCAiJiN4MjI7Ij48IUVOVElUWSBRVU9UICImI3gyMjsiPjwhRU5USVRZIG51bSAiJiN4MjM7Ij48IUVOVElUWSBkb2xsYXIgIiYjeDI0OyI%2BPCFFTlRJVFkgcGVyY250ICImI3gyNTsiPjwhRU5USVRZIGFtcCAiJiN4MjY7Ij48IUVOVElUWSBBTVAgIiYjeDI2OyI%2BPCFFTlRJVFkgYXBvcyAiJiN4Mjc7Ij48IUVOVElUWSBscGFyICImI3gyODsiPjwhRU5USVRZIHJwYXIgIiYjeDI5OyI%2BPCFFTlRJVFkgYXN0ICImI3gyQTsiPjwhRU5USVRZIG1pZGFzdCAiJiN4MkE7Ij48IUVOVElUWSBwbHVzICImI3gyQjsiPjwhRU5USVRZIGNvbW1hICImI3gyQzsiPjwhRU5USVRZIHBlcmlvZCAiJiN4MkU7Ij48IUVOVElUWSBzb2wgIiYjeDJGOyI%2BPCFFTlRJVFkgY29sb24gIiYjeDNBOyI%2BPCFFTlRJVFkgc2VtaSAiJiN4M0I7Ij48IUVOVElUWSBsdCAiJiN4M0M7Ij48IUVOVElUWSBMVCAiJiN4M0M7Ij48IUVOVElUWSBudmx0ICImI3gzQzsmI3gyMEQyOyI%2BPCFFTlRJVFkgZXF1YWxzICImI3gzRDsiPjwhRU5USVRZIGJuZSAiJiN4M0Q7JiN4MjBFNTsiPjwhRU5USVRZIGd0ICImI3gzRTsiPjwhRU5USVRZIEdUICImI3gzRTsiPjwhRU5USVRZIG52Z3QgIiYjeDNFOyYjeDIwRDI7Ij48IUVOVElUWSBxdWVzdCAiJiN4M0Y7Ij48IUVOVElUWSBjb21tYXQgIiYjeDQwOyI%2BPCFFTlRJVFkgbHNxYiAiJiN4NUI7Ij48IUVOVElUWSBsYnJhY2sgIiYjeDVCOyI%2BPCFFTlRJVFkgYnNvbCAiJiN4NUM7Ij48IUVOVElUWSByc3FiICImI3g1RDsiPjwhRU5USVRZIHJicmFjayAiJiN4NUQ7Ij48IUVOVElUWSBIYXQgIiYjeDVFOyI%2BPCFFTlRJVFkgbG93YmFyICImI3g1RjsiPjwhRU5USVRZIFVuZGVyQmFyICImI3g1RjsiPjwhRU5USVRZIGdyYXZlICImI3g2MDsiPjwhRU5USVRZIERpYWNyaXRpY2FsR3JhdmUgIiYjeDYwOyI%2BPCFFTlRJVFkgZmpsaWcgIiYjeDY2OyYjeDZBOyI%2BPCFFTlRJVFkgbGN1YiAiJiN4N0I7Ij48IUVOVElUWSBsYnJhY2UgIiYjeDdCOyI%2BPCFFTlRJVFkgdmVyYmFyICImI3g3QzsiPjwhRU5USVRZIHZlcnQgIiYjeDdDOyI%2BPCFFTlRJVFkgVmVydGljYWxMaW5lICImI3g3QzsiPjwhRU5USVRZIHJjdWIgIiYjeDdEOyI%2BPCFFTlRJVFkgcmJyYWNlICImI3g3RDsiPjwhRU5USVRZIG5ic3AgIiYjeEEwOyI%2BPCFFTlRJVFkgTm9uQnJlYWtpbmdTcGFjZSAiJiN4QTA7Ij48IUVOVElUWSBpZXhjbCAiJiN4QTE7Ij48IUVOVElUWSBjZW50ICImI3hBMjsiPjwhRU5USVRZIHBvdW5kICImI3hBMzsiPjwhRU5USVRZIGN1cnJlbiAiJiN4QTQ7Ij48IUVOVElUWSB5ZW4gIiYjeEE1OyI%2BPCFFTlRJVFkgYnJ2YmFyICImI3hBNjsiPjwhRU5USVRZIHNlY3QgIiYjeEE3OyI%2BPCFFTlRJVFkgRG90ICImI3hBODsiPjwhRU5USVRZIGRpZSAiJiN4QTg7Ij48IUVOVElUWSBEb3VibGVEb3QgIiYjeEE4OyI%2BPCFFTlRJVFkgdW1sICImI3hBODsiPjwhRU5USVRZIGNvcHkgIiYjeEE5OyI%2BPCFFTlRJVFkgQ09QWSAiJiN4QTk7Ij48IUVOVElUWSBvcmRmICImI3hBQTsiPjwhRU5USVRZIGxhcXVvICImI3hBQjsiPjwhRU5USVRZIG5vdCAiJiN4QUM7Ij48IUVOVElUWSBzaHkgIiYjeEFEOyI%2BPCFFTlRJVFkgcmVnICImI3hBRTsiPjwhRU5USVRZIGNpcmNsZWRSICImI3hBRTsiPjwhRU5USVRZIFJFRyAiJiN4QUU7Ij48IUVOVElUWSBtYWNyICImI3hBRjsiPjwhRU5USVRZIHN0cm5zICImI3hBRjsiPjwhRU5USVRZIGRlZyAiJiN4QjA7Ij48IUVOVElUWSBwbHVzbW4gIiYjeEIxOyI%2BPCFFTlRJVFkgcG0gIiYjeEIxOyI%2BPCFFTlRJVFkgUGx1c01pbnVzICImI3hCMTsiPjwhRU5USVRZIHN1cDIgIiYjeEIyOyI%2BPCFFTlRJVFkgc3VwMyAiJiN4QjM7Ij48IUVOVElUWSBhY3V0ZSAiJiN4QjQ7Ij48IUVOVElUWSBEaWFjcml0aWNhbEFjdXRlICImI3hCNDsiPjwhRU5USVRZIG1pY3JvICImI3hCNTsiPjwhRU5USVRZIHBhcmEgIiYjeEI2OyI%2BPCFFTlRJVFkgbWlkZG90ICImI3hCNzsiPjwhRU5USVRZIGNlbnRlcmRvdCAiJiN4Qjc7Ij48IUVOVElUWSBDZW50ZXJEb3QgIiYjeEI3OyI%2BPCFFTlRJVFkgY2VkaWwgIiYjeEI4OyI%2BPCFFTlRJVFkgQ2VkaWxsYSAiJiN4Qjg7Ij48IUVOVElUWSBzdXAxICImI3hCOTsiPjwhRU5USVRZIG9yZG0gIiYjeEJBOyI%2BPCFFTlRJVFkgcmFxdW8gIiYjeEJCOyI%2BPCFFTlRJVFkgZnJhYzE0ICImI3hCQzsiPjwhRU5USVRZIGZyYWMxMiAiJiN4QkQ7Ij48IUVOVElUWSBoYWxmICImI3hCRDsiPjwhRU5USVRZIGZyYWMzNCAiJiN4QkU7Ij48IUVOVElUWSBpcXVlc3QgIiYjeEJGOyI%2BPCFFTlRJVFkgQWdyYXZlICImI3hDMDsiPjwhRU5USVRZIEFhY3V0ZSAiJiN4QzE7Ij48IUVOVElUWSBBY2lyYyAiJiN4QzI7Ij48IUVOVElUWSBBdGlsZGUgIiYjeEMzOyI%2BPCFFTlRJVFkgQXVtbCAiJiN4QzQ7Ij48IUVOVElUWSBBcmluZyAiJiN4QzU7Ij48IUVOVElUWSBhbmdzdCAiJiN4QzU7Ij48IUVOVElUWSBBRWxpZyAiJiN4QzY7Ij48IUVOVElUWSBDY2VkaWwgIiYjeEM3OyI%2BPCFFTlRJVFkgRWdyYXZlICImI3hDODsiPjwhRU5USVRZIEVhY3V0ZSAiJiN4Qzk7Ij48IUVOVElUWSBFY2lyYyAiJiN4Q0E7Ij48IUVOVElUWSBFdW1sICImI3hDQjsiPjwhRU5USVRZIElncmF2ZSAiJiN4Q0M7Ij48IUVOVElUWSBJYWN1dGUgIiYjeENEOyI%2BPCFFTlRJVFkgSWNpcmMgIiYjeENFOyI%2BPCFFTlRJVFkgSXVtbCAiJiN4Q0Y7Ij48IUVOVElUWSBFVEggIiYjeEQwOyI%2BPCFFTlRJVFkgTnRpbGRlICImI3hEMTsiPjwhRU5USVRZIE9ncmF2ZSAiJiN4RDI7Ij48IUVOVElUWSBPYWN1dGUgIiYjeEQzOyI%2BPCFFTlRJVFkgT2NpcmMgIiYjeEQ0OyI%2BPCFFTlRJVFkgT3RpbGRlICImI3hENTsiPjwhRU5USVRZIE91bWwgIiYjeEQ2OyI%2BPCFFTlRJVFkgdGltZXMgIiYjeEQ3OyI%2BPCFFTlRJVFkgT3NsYXNoICImI3hEODsiPjwhRU5USVRZIFVncmF2ZSAiJiN4RDk7Ij48IUVOVElUWSBVYWN1dGUgIiYjeERBOyI%2BPCFFTlRJVFkgVWNpcmMgIiYjeERCOyI%2BPCFFTlRJVFkgVXVtbCAiJiN4REM7Ij48IUVOVElUWSBZYWN1dGUgIiYjeEREOyI%2BPCFFTlRJVFkgVEhPUk4gIiYjeERFOyI%2BPCFFTlRJVFkgc3psaWcgIiYjeERGOyI%2BPCFFTlRJVFkgYWdyYXZlICImI3hFMDsiPjwhRU5USVRZIGFhY3V0ZSAiJiN4RTE7Ij48IUVOVElUWSBhY2lyYyAiJiN4RTI7Ij48IUVOVElUWSBhdGlsZGUgIiYjeEUzOyI%2BPCFFTlRJVFkgYXVtbCAiJiN4RTQ7Ij48IUVOVElUWSBhcmluZyAiJiN4RTU7Ij48IUVOVElUWSBhZWxpZyAiJiN4RTY7Ij48IUVOVElUWSBjY2VkaWwgIiYjeEU3OyI%2BPCFFTlRJVFkgZWdyYXZlICImI3hFODsiPjwhRU5USVRZIGVhY3V0ZSAiJiN4RTk7Ij48IUVOVElUWSBlY2lyYyAiJiN4RUE7Ij48IUVOVElUWSBldW1sICImI3hFQjsiPjwhRU5USVRZIGlncmF2ZSAiJiN4RUM7Ij48IUVOVElUWSBpYWN1dGUgIiYjeEVEOyI%2BPCFFTlRJVFkgaWNpcmMgIiYjeEVFOyI%2BPCFFTlRJVFkgaXVtbCAiJiN4RUY7Ij48IUVOVElUWSBldGggIiYjeEYwOyI%2BPCFFTlRJVFkgbnRpbGRlICImI3hGMTsiPjwhRU5USVRZIG9ncmF2ZSAiJiN4RjI7Ij48IUVOVElUWSBvYWN1dGUgIiYjeEYzOyI%2BPCFFTlRJVFkgb2NpcmMgIiYjeEY0OyI%2BPCFFTlRJVFkgb3RpbGRlICImI3hGNTsiPjwhRU5USVRZIG91bWwgIiYjeEY2OyI%2BPCFFTlRJVFkgZGl2aWRlICImI3hGNzsiPjwhRU5USVRZIGRpdiAiJiN4Rjc7Ij48IUVOVElUWSBvc2xhc2ggIiYjeEY4OyI%2BPCFFTlRJVFkgdWdyYXZlICImI3hGOTsiPjwhRU5USVRZIHVhY3V0ZSAiJiN4RkE7Ij48IUVOVElUWSB1Y2lyYyAiJiN4RkI7Ij48IUVOVElUWSB1dW1sICImI3hGQzsiPjwhRU5USVRZIHlhY3V0ZSAiJiN4RkQ7Ij48IUVOVElUWSB0aG9ybiAiJiN4RkU7Ij48IUVOVElUWSB5dW1sICImI3hGRjsiPjwhRU5USVRZIEFtYWNyICImI3gxMDA7Ij48IUVOVElUWSBhbWFjciAiJiN4MTAxOyI%2BPCFFTlRJVFkgQWJyZXZlICImI3gxMDI7Ij48IUVOVElUWSBhYnJldmUgIiYjeDEwMzsiPjwhRU5USVRZIEFvZ29uICImI3gxMDQ7Ij48IUVOVElUWSBhb2dvbiAiJiN4MTA1OyI%2BPCFFTlRJVFkgQ2FjdXRlICImI3gxMDY7Ij48IUVOVElUWSBjYWN1dGUgIiYjeDEwNzsiPjwhRU5USVRZIENjaXJjICImI3gxMDg7Ij48IUVOVElUWSBjY2lyYyAiJiN4MTA5OyI%2BPCFFTlRJVFkgQ2RvdCAiJiN4MTBBOyI%2BPCFFTlRJVFkgY2RvdCAiJiN4MTBCOyI%2BPCFFTlRJVFkgQ2Nhcm9uICImI3gxMEM7Ij48IUVOVElUWSBjY2Fyb24gIiYjeDEwRDsiPjwhRU5USVRZIERjYXJvbiAiJiN4MTBFOyI%2BPCFFTlRJVFkgZGNhcm9uICImI3gxMEY7Ij48IUVOVElUWSBEc3Ryb2sgIiYjeDExMDsiPjwhRU5USVRZIGRzdHJvayAiJiN4MTExOyI%2BPCFFTlRJVFkgRW1hY3IgIiYjeDExMjsiPjwhRU5USVRZIGVtYWNyICImI3gxMTM7Ij48IUVOVElUWSBFZG90ICImI3gxMTY7Ij48IUVOVElUWSBlZG90ICImI3gxMTc7Ij48IUVOVElUWSBFb2dvbiAiJiN4MTE4OyI%2BPCFFTlRJVFkgZW9nb24gIiYjeDExOTsiPjwhRU5USVRZIEVjYXJvbiAiJiN4MTFBOyI%2BPCFFTlRJVFkgZWNhcm9uICImI3gxMUI7Ij48IUVOVElUWSBHY2lyYyAiJiN4MTFDOyI%2BPCFFTlRJVFkgZ2NpcmMgIiYjeDExRDsiPjwhRU5USVRZIEdicmV2ZSAiJiN4MTFFOyI%2BPCFFTlRJVFkgZ2JyZXZlICImI3gxMUY7Ij48IUVOVElUWSBHZG90ICImI3gxMjA7Ij48IUVOVElUWSBnZG90ICImI3gxMjE7Ij48IUVOVElUWSBHY2VkaWwgIiYjeDEyMjsiPjwhRU5USVRZIEhjaXJjICImI3gxMjQ7Ij48IUVOVElUWSBoY2lyYyAiJiN4MTI1OyI%2BPCFFTlRJVFkgSHN0cm9rICImI3gxMjY7Ij48IUVOVElUWSBoc3Ryb2sgIiYjeDEyNzsiPjwhRU5USVRZIEl0aWxkZSAiJiN4MTI4OyI%2BPCFFTlRJVFkgaXRpbGRlICImI3gxMjk7Ij48IUVOVElUWSBJbWFjciAiJiN4MTJBOyI%2BPCFFTlRJVFkgaW1hY3IgIiYjeDEyQjsiPjwhRU5USVRZIElvZ29uICImI3gxMkU7Ij48IUVOVElUWSBpb2dvbiAiJiN4MTJGOyI%2BPCFFTlRJVFkgSWRvdCAiJiN4MTMwOyI%2BPCFFTlRJVFkgaW1hdGggIiYjeDEzMTsiPjwhRU5USVRZIGlub2RvdCAiJiN4MTMxOyI%2BPCFFTlRJVFkgSUpsaWcgIiYjeDEzMjsiPjwhRU5USVRZIGlqbGlnICImI3gxMzM7Ij48IUVOVElUWSBKY2lyYyAiJiN4MTM0OyI%2BPCFFTlRJVFkgamNpcmMgIiYjeDEzNTsiPjwhRU5USVRZIEtjZWRpbCAiJiN4MTM2OyI%2BPCFFTlRJVFkga2NlZGlsICImI3gxMzc7Ij48IUVOVElUWSBrZ3JlZW4gIiYjeDEzODsiPjwhRU5USVRZIExhY3V0ZSAiJiN4MTM5OyI%2BPCFFTlRJVFkgbGFjdXRlICImI3gxM0E7Ij48IUVOVElUWSBMY2VkaWwgIiYjeDEzQjsiPjwhRU5USVRZIGxjZWRpbCAiJiN4MTNDOyI%2BPCFFTlRJVFkgTGNhcm9uICImI3gxM0Q7Ij48IUVOVElUWSBsY2Fyb24gIiYjeDEzRTsiPjwhRU5USVRZIExtaWRvdCAiJiN4MTNGOyI%2BPCFFTlRJVFkgbG1pZG90ICImI3gxNDA7Ij48IUVOVElUWSBMc3Ryb2sgIiYjeDE0MTsiPjwhRU5USVRZIGxzdHJvayAiJiN4MTQyOyI%2BPCFFTlRJVFkgTmFjdXRlICImI3gxNDM7Ij48IUVOVElUWSBuYWN1dGUgIiYjeDE0NDsiPjwhRU5USVRZIE5jZWRpbCAiJiN4MTQ1OyI%2BPCFFTlRJVFkgbmNlZGlsICImI3gxNDY7Ij48IUVOVElUWSBOY2Fyb24gIiYjeDE0NzsiPjwhRU5USVRZIG5jYXJvbiAiJiN4MTQ4OyI%2BPCFFTlRJVFkgbmFwb3MgIiYjeDE0OTsiPjwhRU5USVRZIEVORyAiJiN4MTRBOyI%2BPCFFTlRJVFkgZW5nICImI3gxNEI7Ij48IUVOVElUWSBPbWFjciAiJiN4MTRDOyI%2BPCFFTlRJVFkgb21hY3IgIiYjeDE0RDsiPjwhRU5USVRZIE9kYmxhYyAiJiN4MTUwOyI%2BPCFFTlRJVFkgb2RibGFjICImI3gxNTE7Ij48IUVOVElUWSBPRWxpZyAiJiN4MTUyOyI%2BPCFFTlRJVFkgb2VsaWcgIiYjeDE1MzsiPjwhRU5USVRZIFJhY3V0ZSAiJiN4MTU0OyI%2BPCFFTlRJVFkgcmFjdXRlICImI3gxNTU7Ij48IUVOVElUWSBSY2VkaWwgIiYjeDE1NjsiPjwhRU5USVRZIHJjZWRpbCAiJiN4MTU3OyI%2BPCFFTlRJVFkgUmNhcm9uICImI3gxNTg7Ij48IUVOVElUWSByY2Fyb24gIiYjeDE1OTsiPjwhRU5USVRZIFNhY3V0ZSAiJiN4MTVBOyI%2BPCFFTlRJVFkgc2FjdXRlICImI3gxNUI7Ij48IUVOVElUWSBTY2lyYyAiJiN4MTVDOyI%2BPCFFTlRJVFkgc2NpcmMgIiYjeDE1RDsiPjwhRU5USVRZIFNjZWRpbCAiJiN4MTVFOyI%2BPCFFTlRJVFkgc2NlZGlsICImI3gxNUY7Ij48IUVOVElUWSBTY2Fyb24gIiYjeDE2MDsiPjwhRU5USVRZIHNjYXJvbiAiJiN4MTYxOyI%2BPCFFTlRJVFkgVGNlZGlsICImI3gxNjI7Ij48IUVOVElUWSB0Y2VkaWwgIiYjeDE2MzsiPjwhRU5USVRZIFRjYXJvbiAiJiN4MTY0OyI%2BPCFFTlRJVFkgdGNhcm9uICImI3gxNjU7Ij48IUVOVElUWSBUc3Ryb2sgIiYjeDE2NjsiPjwhRU5USVRZIHRzdHJvayAiJiN4MTY3OyI%2BPCFFTlRJVFkgVXRpbGRlICImI3gxNjg7Ij48IUVOVElUWSB1dGlsZGUgIiYjeDE2OTsiPjwhRU5USVRZIFVtYWNyICImI3gxNkE7Ij48IUVOVElUWSB1bWFjciAiJiN4MTZCOyI%2BPCFFTlRJVFkgVWJyZXZlICImI3gxNkM7Ij48IUVOVElUWSB1YnJldmUgIiYjeDE2RDsiPjwhRU5USVRZIFVyaW5nICImI3gxNkU7Ij48IUVOVElUWSB1cmluZyAiJiN4MTZGOyI%2BPCFFTlRJVFkgVWRibGFjICImI3gxNzA7Ij48IUVOVElUWSB1ZGJsYWMgIiYjeDE3MTsiPjwhRU5USVRZIFVvZ29uICImI3gxNzI7Ij48IUVOVElUWSB1b2dvbiAiJiN4MTczOyI%2BPCFFTlRJVFkgV2NpcmMgIiYjeDE3NDsiPjwhRU5USVRZIHdjaXJjICImI3gxNzU7Ij48IUVOVElUWSBZY2lyYyAiJiN4MTc2OyI%2BPCFFTlRJVFkgeWNpcmMgIiYjeDE3NzsiPjwhRU5USVRZIFl1bWwgIiYjeDE3ODsiPjwhRU5USVRZIFphY3V0ZSAiJiN4MTc5OyI%2BPCFFTlRJVFkgemFjdXRlICImI3gxN0E7Ij48IUVOVElUWSBaZG90ICImI3gxN0I7Ij48IUVOVElUWSB6ZG90ICImI3gxN0M7Ij48IUVOVElUWSBaY2Fyb24gIiYjeDE3RDsiPjwhRU5USVRZIHpjYXJvbiAiJiN4MTdFOyI%2BPCFFTlRJVFkgZm5vZiAiJiN4MTkyOyI%2BPCFFTlRJVFkgaW1wZWQgIiYjeDFCNTsiPjwhRU5USVRZIGdhY3V0ZSAiJiN4MUY1OyI%2BPCFFTlRJVFkgam1hdGggIiYjeDIzNzsiPjwhRU5USVRZIGNpcmMgIiYjeDJDNjsiPjwhRU5USVRZIGNhcm9uICImI3gyQzc7Ij48IUVOVElUWSBIYWNlayAiJiN4MkM3OyI%2BPCFFTlRJVFkgYnJldmUgIiYjeDJEODsiPjwhRU5USVRZIEJyZXZlICImI3gyRDg7Ij48IUVOVElUWSBkb3QgIiYjeDJEOTsiPjwhRU5USVRZIERpYWNyaXRpY2FsRG90ICImI3gyRDk7Ij48IUVOVElUWSByaW5nICImI3gyREE7Ij48IUVOVElUWSBvZ29uICImI3gyREI7Ij48IUVOVElUWSB0aWxkZSAiJiN4MkRDOyI%2BPCFFTlRJVFkgRGlhY3JpdGljYWxUaWxkZSAiJiN4MkRDOyI%2BPCFFTlRJVFkgZGJsYWMgIiYjeDJERDsiPjwhRU5USVRZIERpYWNyaXRpY2FsRG91YmxlQWN1dGUgIiYjeDJERDsiPjwhRU5USVRZIERvd25CcmV2ZSAiJiN4MzExOyI%2BPCFFTlRJVFkgQWxwaGEgIiYjeDM5MTsiPjwhRU5USVRZIEJldGEgIiYjeDM5MjsiPjwhRU5USVRZIEdhbW1hICImI3gzOTM7Ij48IUVOVElUWSBEZWx0YSAiJiN4Mzk0OyI%2BPCFFTlRJVFkgRXBzaWxvbiAiJiN4Mzk1OyI%2BPCFFTlRJVFkgWmV0YSAiJiN4Mzk2OyI%2BPCFFTlRJVFkgRXRhICImI3gzOTc7Ij48IUVOVElUWSBUaGV0YSAiJiN4Mzk4OyI%2BPCFFTlRJVFkgSW90YSAiJiN4Mzk5OyI%2BPCFFTlRJVFkgS2FwcGEgIiYjeDM5QTsiPjwhRU5USVRZIExhbWJkYSAiJiN4MzlCOyI%2BPCFFTlRJVFkgTXUgIiYjeDM5QzsiPjwhRU5USVRZIE51ICImI3gzOUQ7Ij48IUVOVElUWSBYaSAiJiN4MzlFOyI%2BPCFFTlRJVFkgT21pY3JvbiAiJiN4MzlGOyI%2BPCFFTlRJVFkgUGkgIiYjeDNBMDsiPjwhRU5USVRZIFJobyAiJiN4M0ExOyI%2BPCFFTlRJVFkgU2lnbWEgIiYjeDNBMzsiPjwhRU5USVRZIFRhdSAiJiN4M0E0OyI%2BPCFFTlRJVFkgVXBzaWxvbiAiJiN4M0E1OyI%2BPCFFTlRJVFkgUGhpICImI3gzQTY7Ij48IUVOVElUWSBDaGkgIiYjeDNBNzsiPjwhRU5USVRZIFBzaSAiJiN4M0E4OyI%2BPCFFTlRJVFkgT21lZ2EgIiYjeDNBOTsiPjwhRU5USVRZIG9obSAiJiN4M0E5OyI%2BPCFFTlRJVFkgYWxwaGEgIiYjeDNCMTsiPjwhRU5USVRZIGJldGEgIiYjeDNCMjsiPjwhRU5USVRZIGdhbW1hICImI3gzQjM7Ij48IUVOVElUWSBkZWx0YSAiJiN4M0I0OyI%2BPCFFTlRJVFkgZXBzaSAiJiN4M0I1OyI%2BPCFFTlRJVFkgZXBzaWxvbiAiJiN4M0I1OyI%2BPCFFTlRJVFkgemV0YSAiJiN4M0I2OyI%2BPCFFTlRJVFkgZXRhICImI3gzQjc7Ij48IUVOVElUWSB0aGV0YSAiJiN4M0I4OyI%2BPCFFTlRJVFkgaW90YSAiJiN4M0I5OyI%2BPCFFTlRJVFkga2FwcGEgIiYjeDNCQTsiPjwhRU5USVRZIGxhbWJkYSAiJiN4M0JCOyI%2BPCFFTlRJVFkgbXUgIiYjeDNCQzsiPjwhRU5USVRZIG51ICImI3gzQkQ7Ij48IUVOVElUWSB4aSAiJiN4M0JFOyI%2BPCFFTlRJVFkgb21pY3JvbiAiJiN4M0JGOyI%2BPCFFTlRJVFkgcGkgIiYjeDNDMDsiPjwhRU5USVRZIHJobyAiJiN4M0MxOyI%2BPCFFTlRJVFkgc2lnbWF2ICImI3gzQzI7Ij48IUVOVElUWSB2YXJzaWdtYSAiJiN4M0MyOyI%2BPCFFTlRJVFkgc2lnbWFmICImI3gzQzI7Ij48IUVOVElUWSBzaWdtYSAiJiN4M0MzOyI%2BPCFFTlRJVFkgdGF1ICImI3gzQzQ7Ij48IUVOVElUWSB1cHNpICImI3gzQzU7Ij48IUVOVElUWSB1cHNpbG9uICImI3gzQzU7Ij48IUVOVElUWSBwaGkgIiYjeDNDNjsiPjwhRU5USVRZIGNoaSAiJiN4M0M3OyI%2BPCFFTlRJVFkgcHNpICImI3gzQzg7Ij48IUVOVElUWSBvbWVnYSAiJiN4M0M5OyI%2BPCFFTlRJVFkgdGhldGF2ICImI3gzRDE7Ij48IUVOVElUWSB2YXJ0aGV0YSAiJiN4M0QxOyI%2BPCFFTlRJVFkgdGhldGFzeW0gIiYjeDNEMTsiPjwhRU5USVRZIFVwc2kgIiYjeDNEMjsiPjwhRU5USVRZIHVwc2loICImI3gzRDI7Ij48IUVOVElUWSBzdHJhaWdodHBoaSAiJiN4M0Q1OyI%2BPCFFTlRJVFkgcGhpdiAiJiN4M0Q1OyI%2BPCFFTlRJVFkgdmFycGhpICImI3gzRDU7Ij48IUVOVElUWSBwaXYgIiYjeDNENjsiPjwhRU5USVRZIHZhcnBpICImI3gzRDY7Ij48IUVOVElUWSBHYW1tYWQgIiYjeDNEQzsiPjwhRU5USVRZIGdhbW1hZCAiJiN4M0REOyI%2BPCFFTlRJVFkgZGlnYW1tYSAiJiN4M0REOyI%2BPCFFTlRJVFkga2FwcGF2ICImI3gzRjA7Ij48IUVOVElUWSB2YXJrYXBwYSAiJiN4M0YwOyI%2BPCFFTlRJVFkgcmhvdiAiJiN4M0YxOyI%2BPCFFTlRJVFkgdmFycmhvICImI3gzRjE7Ij48IUVOVElUWSBlcHNpdiAiJiN4M0Y1OyI%2BPCFFTlRJVFkgc3RyYWlnaHRlcHNpbG9uICImI3gzRjU7Ij48IUVOVElUWSB2YXJlcHNpbG9uICImI3gzRjU7Ij48IUVOVElUWSBiZXBzaSAiJiN4M0Y2OyI%2BPCFFTlRJVFkgYmFja2Vwc2lsb24gIiYjeDNGNjsiPjwhRU5USVRZIElPY3kgIiYjeDQwMTsiPjwhRU5USVRZIERKY3kgIiYjeDQwMjsiPjwhRU5USVRZIEdKY3kgIiYjeDQwMzsiPjwhRU5USVRZIEp1a2N5ICImI3g0MDQ7Ij48IUVOVElUWSBEU2N5ICImI3g0MDU7Ij48IUVOVElUWSBJdWtjeSAiJiN4NDA2OyI%2BPCFFTlRJVFkgWUljeSAiJiN4NDA3OyI%2BPCFFTlRJVFkgSnNlcmN5ICImI3g0MDg7Ij48IUVOVElUWSBMSmN5ICImI3g0MDk7Ij48IUVOVElUWSBOSmN5ICImI3g0MEE7Ij48IUVOVElUWSBUU0hjeSAiJiN4NDBCOyI%2BPCFFTlRJVFkgS0pjeSAiJiN4NDBDOyI%2BPCFFTlRJVFkgVWJyY3kgIiYjeDQwRTsiPjwhRU5USVRZIERaY3kgIiYjeDQwRjsiPjwhRU5USVRZIEFjeSAiJiN4NDEwOyI%2BPCFFTlRJVFkgQmN5ICImI3g0MTE7Ij48IUVOVElUWSBWY3kgIiYjeDQxMjsiPjwhRU5USVRZIEdjeSAiJiN4NDEzOyI%2BPCFFTlRJVFkgRGN5ICImI3g0MTQ7Ij48IUVOVElUWSBJRWN5ICImI3g0MTU7Ij48IUVOVElUWSBaSGN5ICImI3g0MTY7Ij48IUVOVElUWSBaY3kgIiYjeDQxNzsiPjwhRU5USVRZIEljeSAiJiN4NDE4OyI%2BPCFFTlRJVFkgSmN5ICImI3g0MTk7Ij48IUVOVElUWSBLY3kgIiYjeDQxQTsiPjwhRU5USVRZIExjeSAiJiN4NDFCOyI%2BPCFFTlRJVFkgTWN5ICImI3g0MUM7Ij48IUVOVElUWSBOY3kgIiYjeDQxRDsiPjwhRU5USVRZIE9jeSAiJiN4NDFFOyI%2BPCFFTlRJVFkgUGN5ICImI3g0MUY7Ij48IUVOVElUWSBSY3kgIiYjeDQyMDsiPjwhRU5USVRZIFNjeSAiJiN4NDIxOyI%2BPCFFTlRJVFkgVGN5ICImI3g0MjI7Ij48IUVOVElUWSBVY3kgIiYjeDQyMzsiPjwhRU5USVRZIEZjeSAiJiN4NDI0OyI%2BPCFFTlRJVFkgS0hjeSAiJiN4NDI1OyI%2BPCFFTlRJVFkgVFNjeSAiJiN4NDI2OyI%2BPCFFTlRJVFkgQ0hjeSAiJiN4NDI3OyI%2BPCFFTlRJVFkgU0hjeSAiJiN4NDI4OyI%2BPCFFTlRJVFkgU0hDSGN5ICImI3g0Mjk7Ij48IUVOVElUWSBIQVJEY3kgIiYjeDQyQTsiPjwhRU5USVRZIFljeSAiJiN4NDJCOyI%2BPCFFTlRJVFkgU09GVGN5ICImI3g0MkM7Ij48IUVOVElUWSBFY3kgIiYjeDQyRDsiPjwhRU5USVRZIFlVY3kgIiYjeDQyRTsiPjwhRU5USVRZIFlBY3kgIiYjeDQyRjsiPjwhRU5USVRZIGFjeSAiJiN4NDMwOyI%2BPCFFTlRJVFkgYmN5ICImI3g0MzE7Ij48IUVOVElUWSB2Y3kgIiYjeDQzMjsiPjwhRU5USVRZIGdjeSAiJiN4NDMzOyI%2BPCFFTlRJVFkgZGN5ICImI3g0MzQ7Ij48IUVOVElUWSBpZWN5ICImI3g0MzU7Ij48IUVOVElUWSB6aGN5ICImI3g0MzY7Ij48IUVOVElUWSB6Y3kgIiYjeDQzNzsiPjwhRU5USVRZIGljeSAiJiN4NDM4OyI%2BPCFFTlRJVFkgamN5ICImI3g0Mzk7Ij48IUVOVElUWSBrY3kgIiYjeDQzQTsiPjwhRU5USVRZIGxjeSAiJiN4NDNCOyI%2BPCFFTlRJVFkgbWN5ICImI3g0M0M7Ij48IUVOVElUWSBuY3kgIiYjeDQzRDsiPjwhRU5USVRZIG9jeSAiJiN4NDNFOyI%2BPCFFTlRJVFkgcGN5ICImI3g0M0Y7Ij48IUVOVElUWSByY3kgIiYjeDQ0MDsiPjwhRU5USVRZIHNjeSAiJiN4NDQxOyI%2BPCFFTlRJVFkgdGN5ICImI3g0NDI7Ij48IUVOVElUWSB1Y3kgIiYjeDQ0MzsiPjwhRU5USVRZIGZjeSAiJiN4NDQ0OyI%2BPCFFTlRJVFkga2hjeSAiJiN4NDQ1OyI%2BPCFFTlRJVFkgdHNjeSAiJiN4NDQ2OyI%2BPCFFTlRJVFkgY2hjeSAiJiN4NDQ3OyI%2BPCFFTlRJVFkgc2hjeSAiJiN4NDQ4OyI%2BPCFFTlRJVFkgc2hjaGN5ICImI3g0NDk7Ij48IUVOVElUWSBoYXJkY3kgIiYjeDQ0QTsiPjwhRU5USVRZIHljeSAiJiN4NDRCOyI%2BPCFFTlRJVFkgc29mdGN5ICImI3g0NEM7Ij48IUVOVElUWSBlY3kgIiYjeDQ0RDsiPjwhRU5USVRZIHl1Y3kgIiYjeDQ0RTsiPjwhRU5USVRZIHlhY3kgIiYjeDQ0RjsiPjwhRU5USVRZIGlvY3kgIiYjeDQ1MTsiPjwhRU5USVRZIGRqY3kgIiYjeDQ1MjsiPjwhRU5USVRZIGdqY3kgIiYjeDQ1MzsiPjwhRU5USVRZIGp1a2N5ICImI3g0NTQ7Ij48IUVOVElUWSBkc2N5ICImI3g0NTU7Ij48IUVOVElUWSBpdWtjeSAiJiN4NDU2OyI%2BPCFFTlRJVFkgeWljeSAiJiN4NDU3OyI%2BPCFFTlRJVFkganNlcmN5ICImI3g0NTg7Ij48IUVOVElUWSBsamN5ICImI3g0NTk7Ij48IUVOVElUWSBuamN5ICImI3g0NUE7Ij48IUVOVElUWSB0c2hjeSAiJiN4NDVCOyI%2BPCFFTlRJVFkga2pjeSAiJiN4NDVDOyI%2BPCFFTlRJVFkgdWJyY3kgIiYjeDQ1RTsiPjwhRU5USVRZIGR6Y3kgIiYjeDQ1RjsiPjwhRU5USVRZIGVuc3AgIiYjeDIwMDI7Ij48IUVOVElUWSBlbXNwICImI3gyMDAzOyI%2BPCFFTlRJVFkgZW1zcDEzICImI3gyMDA0OyI%2BPCFFTlRJVFkgZW1zcDE0ICImI3gyMDA1OyI%2BPCFFTlRJVFkgbnVtc3AgIiYjeDIwMDc7Ij48IUVOVElUWSBwdW5jc3AgIiYjeDIwMDg7Ij48IUVOVElUWSB0aGluc3AgIiYjeDIwMDk7Ij48IUVOVElUWSBUaGluU3BhY2UgIiYjeDIwMDk7Ij48IUVOVElUWSBoYWlyc3AgIiYjeDIwMEE7Ij48IUVOVElUWSBWZXJ5VGhpblNwYWNlICImI3gyMDBBOyI%2BPCFFTlRJVFkgWmVyb1dpZHRoU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZVZlcnlUaGluU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZVRoaW5TcGFjZSAiJiN4MjAwQjsiPjwhRU5USVRZIE5lZ2F0aXZlTWVkaXVtU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZVRoaWNrU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSB6d25qICImI3gyMDBDOyI%2BPCFFTlRJVFkgendqICImI3gyMDBEOyI%2BPCFFTlRJVFkgbHJtICImI3gyMDBFOyI%2BPCFFTlRJVFkgcmxtICImI3gyMDBGOyI%2BPCFFTlRJVFkgaHlwaGVuICImI3gyMDEwOyI%2BPCFFTlRJVFkgZGFzaCAiJiN4MjAxMDsiPjwhRU5USVRZIG5kYXNoICImI3gyMDEzOyI%2BPCFFTlRJVFkgbWRhc2ggIiYjeDIwMTQ7Ij48IUVOVElUWSBob3JiYXIgIiYjeDIwMTU7Ij48IUVOVElUWSBWZXJiYXIgIiYjeDIwMTY7Ij48IUVOVElUWSBWZXJ0ICImI3gyMDE2OyI%2BPCFFTlRJVFkgbHNxdW8gIiYjeDIwMTg7Ij48IUVOVElUWSBPcGVuQ3VybHlRdW90ZSAiJiN4MjAxODsiPjwhRU5USVRZIHJzcXVvICImI3gyMDE5OyI%2BPCFFTlRJVFkgcnNxdW9yICImI3gyMDE5OyI%2BPCFFTlRJVFkgQ2xvc2VDdXJseVF1b3RlICImI3gyMDE5OyI%2BPCFFTlRJVFkgbHNxdW9yICImI3gyMDFBOyI%2BPCFFTlRJVFkgc2JxdW8gIiYjeDIwMUE7Ij48IUVOVElUWSBsZHF1byAiJiN4MjAxQzsiPjwhRU5USVRZIE9wZW5DdXJseURvdWJsZVF1b3RlICImI3gyMDFDOyI%2BPCFFTlRJVFkgcmRxdW8gIiYjeDIwMUQ7Ij48IUVOVElUWSByZHF1b3IgIiYjeDIwMUQ7Ij48IUVOVElUWSBDbG9zZUN1cmx5RG91YmxlUXVvdGUgIiYjeDIwMUQ7Ij48IUVOVElUWSBsZHF1b3IgIiYjeDIwMUU7Ij48IUVOVElUWSBiZHF1byAiJiN4MjAxRTsiPjwhRU5USVRZIGRhZ2dlciAiJiN4MjAyMDsiPjwhRU5USVRZIERhZ2dlciAiJiN4MjAyMTsiPjwhRU5USVRZIGRkYWdnZXIgIiYjeDIwMjE7Ij48IUVOVElUWSBidWxsICImI3gyMDIyOyI%2BPCFFTlRJVFkgYnVsbGV0ICImI3gyMDIyOyI%2BPCFFTlRJVFkgbmxkciAiJiN4MjAyNTsiPjwhRU5USVRZIGhlbGxpcCAiJiN4MjAyNjsiPjwhRU5USVRZIG1sZHIgIiYjeDIwMjY7Ij48IUVOVElUWSBwZXJtaWwgIiYjeDIwMzA7Ij48IUVOVElUWSBwZXJ0ZW5rICImI3gyMDMxOyI%2BPCFFTlRJVFkgcHJpbWUgIiYjeDIwMzI7Ij48IUVOVElUWSBQcmltZSAiJiN4MjAzMzsiPjwhRU5USVRZIHRwcmltZSAiJiN4MjAzNDsiPjwhRU5USVRZIGJwcmltZSAiJiN4MjAzNTsiPjwhRU5USVRZIGJhY2twcmltZSAiJiN4MjAzNTsiPjwhRU5USVRZIGxzYXF1byAiJiN4MjAzOTsiPjwhRU5USVRZIHJzYXF1byAiJiN4MjAzQTsiPjwhRU5USVRZIG9saW5lICImI3gyMDNFOyI%2BPCFFTlRJVFkgT3ZlckJhciAiJiN4MjAzRTsiPjwhRU5USVRZIGNhcmV0ICImI3gyMDQxOyI%2BPCFFTlRJVFkgaHlidWxsICImI3gyMDQzOyI%2BPCFFTlRJVFkgZnJhc2wgIiYjeDIwNDQ7Ij48IUVOVElUWSBic2VtaSAiJiN4MjA0RjsiPjwhRU5USVRZIHFwcmltZSAiJiN4MjA1NzsiPjwhRU5USVRZIE1lZGl1bVNwYWNlICImI3gyMDVGOyI%2BPCFFTlRJVFkgVGhpY2tTcGFjZSAiJiN4MjA1RjsmI3gyMDBBOyI%2BPCFFTlRJVFkgTm9CcmVhayAiJiN4MjA2MDsiPjwhRU5USVRZIEFwcGx5RnVuY3Rpb24gIiYjeDIwNjE7Ij48IUVOVElUWSBhZiAiJiN4MjA2MTsiPjwhRU5USVRZIEludmlzaWJsZVRpbWVzICImI3gyMDYyOyI%2BPCFFTlRJVFkgaXQgIiYjeDIwNjI7Ij48IUVOVElUWSBJbnZpc2libGVDb21tYSAiJiN4MjA2MzsiPjwhRU5USVRZIGljICImI3gyMDYzOyI%2BPCFFTlRJVFkgZXVybyAiJiN4MjBBQzsiPjwhRU5USVRZIHRkb3QgIiYjeDIwREI7Ij48IUVOVElUWSBUcmlwbGVEb3QgIiYjeDIwREI7Ij48IUVOVElUWSBEb3REb3QgIiYjeDIwREM7Ij48IUVOVElUWSBDb3BmICImI3gyMTAyOyI%2BPCFFTlRJVFkgY29tcGxleGVzICImI3gyMTAyOyI%2BPCFFTlRJVFkgaW5jYXJlICImI3gyMTA1OyI%2BPCFFTlRJVFkgZ3NjciAiJiN4MjEwQTsiPjwhRU5USVRZIGhhbWlsdCAiJiN4MjEwQjsiPjwhRU5USVRZIEhpbGJlcnRTcGFjZSAiJiN4MjEwQjsiPjwhRU5USVRZIEhzY3IgIiYjeDIxMEI7Ij48IUVOVElUWSBIZnIgIiYjeDIxMEM7Ij48IUVOVElUWSBQb2luY2FyZXBsYW5lICImI3gyMTBDOyI%2BPCFFTlRJVFkgcXVhdGVybmlvbnMgIiYjeDIxMEQ7Ij48IUVOVElUWSBIb3BmICImI3gyMTBEOyI%2BPCFFTlRJVFkgcGxhbmNraCAiJiN4MjEwRTsiPjwhRU5USVRZIHBsYW5jayAiJiN4MjEwRjsiPjwhRU5USVRZIGhiYXIgIiYjeDIxMEY7Ij48IUVOVElUWSBwbGFua3YgIiYjeDIxMEY7Ij48IUVOVElUWSBoc2xhc2ggIiYjeDIxMEY7Ij48IUVOVElUWSBJc2NyICImI3gyMTEwOyI%2BPCFFTlRJVFkgaW1hZ2xpbmUgIiYjeDIxMTA7Ij48IUVOVElUWSBpbWFnZSAiJiN4MjExMTsiPjwhRU5USVRZIEltICImI3gyMTExOyI%2BPCFFTlRJVFkgaW1hZ3BhcnQgIiYjeDIxMTE7Ij48IUVOVElUWSBJZnIgIiYjeDIxMTE7Ij48IUVOVElUWSBMc2NyICImI3gyMTEyOyI%2BPCFFTlRJVFkgbGFncmFuICImI3gyMTEyOyI%2BPCFFTlRJVFkgTGFwbGFjZXRyZiAiJiN4MjExMjsiPjwhRU5USVRZIGVsbCAiJiN4MjExMzsiPjwhRU5USVRZIE5vcGYgIiYjeDIxMTU7Ij48IUVOVElUWSBuYXR1cmFscyAiJiN4MjExNTsiPjwhRU5USVRZIG51bWVybyAiJiN4MjExNjsiPjwhRU5USVRZIGNvcHlzciAiJiN4MjExNzsiPjwhRU5USVRZIHdlaWVycCAiJiN4MjExODsiPjwhRU5USVRZIHdwICImI3gyMTE4OyI%2BPCFFTlRJVFkgUG9wZiAiJiN4MjExOTsiPjwhRU5USVRZIHByaW1lcyAiJiN4MjExOTsiPjwhRU5USVRZIHJhdGlvbmFscyAiJiN4MjExQTsiPjwhRU5USVRZIFFvcGYgIiYjeDIxMUE7Ij48IUVOVElUWSBSc2NyICImI3gyMTFCOyI%2BPCFFTlRJVFkgcmVhbGluZSAiJiN4MjExQjsiPjwhRU5USVRZIHJlYWwgIiYjeDIxMUM7Ij48IUVOVElUWSBSZSAiJiN4MjExQzsiPjwhRU5USVRZIHJlYWxwYXJ0ICImI3gyMTFDOyI%2BPCFFTlRJVFkgUmZyICImI3gyMTFDOyI%2BPCFFTlRJVFkgcmVhbHMgIiYjeDIxMUQ7Ij48IUVOVElUWSBSb3BmICImI3gyMTFEOyI%2BPCFFTlRJVFkgcnggIiYjeDIxMUU7Ij48IUVOVElUWSB0cmFkZSAiJiN4MjEyMjsiPjwhRU5USVRZIFRSQURFICImI3gyMTIyOyI%2BPCFFTlRJVFkgaW50ZWdlcnMgIiYjeDIxMjQ7Ij48IUVOVElUWSBab3BmICImI3gyMTI0OyI%2BPCFFTlRJVFkgbWhvICImI3gyMTI3OyI%2BPCFFTlRJVFkgWmZyICImI3gyMTI4OyI%2BPCFFTlRJVFkgemVldHJmICImI3gyMTI4OyI%2BPCFFTlRJVFkgaWlvdGEgIiYjeDIxMjk7Ij48IUVOVElUWSBiZXJub3UgIiYjeDIxMkM7Ij48IUVOVElUWSBCZXJub3VsbGlzICImI3gyMTJDOyI%2BPCFFTlRJVFkgQnNjciAiJiN4MjEyQzsiPjwhRU5USVRZIENmciAiJiN4MjEyRDsiPjwhRU5USVRZIENheWxleXMgIiYjeDIxMkQ7Ij48IUVOVElUWSBlc2NyICImI3gyMTJGOyI%2BPCFFTlRJVFkgRXNjciAiJiN4MjEzMDsiPjwhRU5USVRZIGV4cGVjdGF0aW9uICImI3gyMTMwOyI%2BPCFFTlRJVFkgRnNjciAiJiN4MjEzMTsiPjwhRU5USVRZIEZvdXJpZXJ0cmYgIiYjeDIxMzE7Ij48IUVOVElUWSBwaG1tYXQgIiYjeDIxMzM7Ij48IUVOVElUWSBNZWxsaW50cmYgIiYjeDIxMzM7Ij48IUVOVElUWSBNc2NyICImI3gyMTMzOyI%2BPCFFTlRJVFkgb3JkZXIgIiYjeDIxMzQ7Ij48IUVOVElUWSBvcmRlcm9mICImI3gyMTM0OyI%2BPCFFTlRJVFkgb3NjciAiJiN4MjEzNDsiPjwhRU5USVRZIGFsZWZzeW0gIiYjeDIxMzU7Ij48IUVOVElUWSBhbGVwaCAiJiN4MjEzNTsiPjwhRU5USVRZIGJldGggIiYjeDIxMzY7Ij48IUVOVElUWSBnaW1lbCAiJiN4MjEzNzsiPjwhRU5USVRZIGRhbGV0aCAiJiN4MjEzODsiPjwhRU5USVRZIENhcGl0YWxEaWZmZXJlbnRpYWxEICImI3gyMTQ1OyI%2BPCFFTlRJVFkgREQgIiYjeDIxNDU7Ij48IUVOVElUWSBEaWZmZXJlbnRpYWxEICImI3gyMTQ2OyI%2BPCFFTlRJVFkgZGQgIiYjeDIxNDY7Ij48IUVOVElUWSBFeHBvbmVudGlhbEUgIiYjeDIxNDc7Ij48IUVOVElUWSBleHBvbmVudGlhbGUgIiYjeDIxNDc7Ij48IUVOVElUWSBlZSAiJiN4MjE0NzsiPjwhRU5USVRZIEltYWdpbmFyeUkgIiYjeDIxNDg7Ij48IUVOVElUWSBpaSAiJiN4MjE0ODsiPjwhRU5USVRZIGZyYWMxMyAiJiN4MjE1MzsiPjwhRU5USVRZIGZyYWMyMyAiJiN4MjE1NDsiPjwhRU5USVRZIGZyYWMxNSAiJiN4MjE1NTsiPjwhRU5USVRZIGZyYWMyNSAiJiN4MjE1NjsiPjwhRU5USVRZIGZyYWMzNSAiJiN4MjE1NzsiPjwhRU5USVRZIGZyYWM0NSAiJiN4MjE1ODsiPjwhRU5USVRZIGZyYWMxNiAiJiN4MjE1OTsiPjwhRU5USVRZIGZyYWM1NiAiJiN4MjE1QTsiPjwhRU5USVRZIGZyYWMxOCAiJiN4MjE1QjsiPjwhRU5USVRZIGZyYWMzOCAiJiN4MjE1QzsiPjwhRU5USVRZIGZyYWM1OCAiJiN4MjE1RDsiPjwhRU5USVRZIGZyYWM3OCAiJiN4MjE1RTsiPjwhRU5USVRZIGxhcnIgIiYjeDIxOTA7Ij48IUVOVElUWSBsZWZ0YXJyb3cgIiYjeDIxOTA7Ij48IUVOVElUWSBMZWZ0QXJyb3cgIiYjeDIxOTA7Ij48IUVOVElUWSBzbGFyciAiJiN4MjE5MDsiPjwhRU5USVRZIFNob3J0TGVmdEFycm93ICImI3gyMTkwOyI%2BPCFFTlRJVFkgdWFyciAiJiN4MjE5MTsiPjwhRU5USVRZIHVwYXJyb3cgIiYjeDIxOTE7Ij48IUVOVElUWSBVcEFycm93ICImI3gyMTkxOyI%2BPCFFTlRJVFkgU2hvcnRVcEFycm93ICImI3gyMTkxOyI%2BPCFFTlRJVFkgcmFyciAiJiN4MjE5MjsiPjwhRU5USVRZIHJpZ2h0YXJyb3cgIiYjeDIxOTI7Ij48IUVOVElUWSBSaWdodEFycm93ICImI3gyMTkyOyI%2BPCFFTlRJVFkgc3JhcnIgIiYjeDIxOTI7Ij48IUVOVElUWSBTaG9ydFJpZ2h0QXJyb3cgIiYjeDIxOTI7Ij48IUVOVElUWSBkYXJyICImI3gyMTkzOyI%2BPCFFTlRJVFkgZG93bmFycm93ICImI3gyMTkzOyI%2BPCFFTlRJVFkgRG93bkFycm93ICImI3gyMTkzOyI%2BPCFFTlRJVFkgU2hvcnREb3duQXJyb3cgIiYjeDIxOTM7Ij48IUVOVElUWSBoYXJyICImI3gyMTk0OyI%2BPCFFTlRJVFkgbGVmdHJpZ2h0YXJyb3cgIiYjeDIxOTQ7Ij48IUVOVElUWSBMZWZ0UmlnaHRBcnJvdyAiJiN4MjE5NDsiPjwhRU5USVRZIHZhcnIgIiYjeDIxOTU7Ij48IUVOVElUWSB1cGRvd25hcnJvdyAiJiN4MjE5NTsiPjwhRU5USVRZIFVwRG93bkFycm93ICImI3gyMTk1OyI%2BPCFFTlRJVFkgbndhcnIgIiYjeDIxOTY7Ij48IUVOVElUWSBVcHBlckxlZnRBcnJvdyAiJiN4MjE5NjsiPjwhRU5USVRZIG53YXJyb3cgIiYjeDIxOTY7Ij48IUVOVElUWSBuZWFyciAiJiN4MjE5NzsiPjwhRU5USVRZIFVwcGVyUmlnaHRBcnJvdyAiJiN4MjE5NzsiPjwhRU5USVRZIG5lYXJyb3cgIiYjeDIxOTc7Ij48IUVOVElUWSBzZWFyciAiJiN4MjE5ODsiPjwhRU5USVRZIHNlYXJyb3cgIiYjeDIxOTg7Ij48IUVOVElUWSBMb3dlclJpZ2h0QXJyb3cgIiYjeDIxOTg7Ij48IUVOVElUWSBzd2FyciAiJiN4MjE5OTsiPjwhRU5USVRZIHN3YXJyb3cgIiYjeDIxOTk7Ij48IUVOVElUWSBMb3dlckxlZnRBcnJvdyAiJiN4MjE5OTsiPjwhRU5USVRZIG5sYXJyICImI3gyMTlBOyI%2BPCFFTlRJVFkgbmxlZnRhcnJvdyAiJiN4MjE5QTsiPjwhRU5USVRZIG5yYXJyICImI3gyMTlCOyI%2BPCFFTlRJVFkgbnJpZ2h0YXJyb3cgIiYjeDIxOUI7Ij48IUVOVElUWSByYXJydyAiJiN4MjE5RDsiPjwhRU5USVRZIHJpZ2h0c3F1aWdhcnJvdyAiJiN4MjE5RDsiPjwhRU5USVRZIG5yYXJydyAiJiN4MjE5RDsmI3gzMzg7Ij48IUVOVElUWSBMYXJyICImI3gyMTlFOyI%2BPCFFTlRJVFkgdHdvaGVhZGxlZnRhcnJvdyAiJiN4MjE5RTsiPjwhRU5USVRZIFVhcnIgIiYjeDIxOUY7Ij48IUVOVElUWSBSYXJyICImI3gyMUEwOyI%2BPCFFTlRJVFkgdHdvaGVhZHJpZ2h0YXJyb3cgIiYjeDIxQTA7Ij48IUVOVElUWSBEYXJyICImI3gyMUExOyI%2BPCFFTlRJVFkgbGFycnRsICImI3gyMUEyOyI%2BPCFFTlRJVFkgbGVmdGFycm93dGFpbCAiJiN4MjFBMjsiPjwhRU5USVRZIHJhcnJ0bCAiJiN4MjFBMzsiPjwhRU5USVRZIHJpZ2h0YXJyb3d0YWlsICImI3gyMUEzOyI%2BPCFFTlRJVFkgTGVmdFRlZUFycm93ICImI3gyMUE0OyI%2BPCFFTlRJVFkgbWFwc3RvbGVmdCAiJiN4MjFBNDsiPjwhRU5USVRZIFVwVGVlQXJyb3cgIiYjeDIxQTU7Ij48IUVOVElUWSBtYXBzdG91cCAiJiN4MjFBNTsiPjwhRU5USVRZIG1hcCAiJiN4MjFBNjsiPjwhRU5USVRZIFJpZ2h0VGVlQXJyb3cgIiYjeDIxQTY7Ij48IUVOVElUWSBtYXBzdG8gIiYjeDIxQTY7Ij48IUVOVElUWSBEb3duVGVlQXJyb3cgIiYjeDIxQTc7Ij48IUVOVElUWSBtYXBzdG9kb3duICImI3gyMUE3OyI%2BPCFFTlRJVFkgbGFycmhrICImI3gyMUE5OyI%2BPCFFTlRJVFkgaG9va2xlZnRhcnJvdyAiJiN4MjFBOTsiPjwhRU5USVRZIHJhcnJoayAiJiN4MjFBQTsiPjwhRU5USVRZIGhvb2tyaWdodGFycm93ICImI3gyMUFBOyI%2BPCFFTlRJVFkgbGFycmxwICImI3gyMUFCOyI%2BPCFFTlRJVFkgbG9vcGFycm93bGVmdCAiJiN4MjFBQjsiPjwhRU5USVRZIHJhcnJscCAiJiN4MjFBQzsiPjwhRU5USVRZIGxvb3BhcnJvd3JpZ2h0ICImI3gyMUFDOyI%2BPCFFTlRJVFkgaGFycncgIiYjeDIxQUQ7Ij48IUVOVElUWSBsZWZ0cmlnaHRzcXVpZ2Fycm93ICImI3gyMUFEOyI%2BPCFFTlRJVFkgbmhhcnIgIiYjeDIxQUU7Ij48IUVOVElUWSBubGVmdHJpZ2h0YXJyb3cgIiYjeDIxQUU7Ij48IUVOVElUWSBsc2ggIiYjeDIxQjA7Ij48IUVOVElUWSBMc2ggIiYjeDIxQjA7Ij48IUVOVElUWSByc2ggIiYjeDIxQjE7Ij48IUVOVElUWSBSc2ggIiYjeDIxQjE7Ij48IUVOVElUWSBsZHNoICImI3gyMUIyOyI%2BPCFFTlRJVFkgcmRzaCAiJiN4MjFCMzsiPjwhRU5USVRZIGNyYXJyICImI3gyMUI1OyI%2BPCFFTlRJVFkgY3VsYXJyICImI3gyMUI2OyI%2BPCFFTlRJVFkgY3VydmVhcnJvd2xlZnQgIiYjeDIxQjY7Ij48IUVOVElUWSBjdXJhcnIgIiYjeDIxQjc7Ij48IUVOVElUWSBjdXJ2ZWFycm93cmlnaHQgIiYjeDIxQjc7Ij48IUVOVElUWSBvbGFyciAiJiN4MjFCQTsiPjwhRU5USVRZIGNpcmNsZWFycm93bGVmdCAiJiN4MjFCQTsiPjwhRU5USVRZIG9yYXJyICImI3gyMUJCOyI%2BPCFFTlRJVFkgY2lyY2xlYXJyb3dyaWdodCAiJiN4MjFCQjsiPjwhRU5USVRZIGxoYXJ1ICImI3gyMUJDOyI%2BPCFFTlRJVFkgTGVmdFZlY3RvciAiJiN4MjFCQzsiPjwhRU5USVRZIGxlZnRoYXJwb29udXAgIiYjeDIxQkM7Ij48IUVOVElUWSBsaGFyZCAiJiN4MjFCRDsiPjwhRU5USVRZIGxlZnRoYXJwb29uZG93biAiJiN4MjFCRDsiPjwhRU5USVRZIERvd25MZWZ0VmVjdG9yICImI3gyMUJEOyI%2BPCFFTlRJVFkgdWhhcnIgIiYjeDIxQkU7Ij48IUVOVElUWSB1cGhhcnBvb25yaWdodCAiJiN4MjFCRTsiPjwhRU5USVRZIFJpZ2h0VXBWZWN0b3IgIiYjeDIxQkU7Ij48IUVOVElUWSB1aGFybCAiJiN4MjFCRjsiPjwhRU5USVRZIHVwaGFycG9vbmxlZnQgIiYjeDIxQkY7Ij48IUVOVElUWSBMZWZ0VXBWZWN0b3IgIiYjeDIxQkY7Ij48IUVOVElUWSByaGFydSAiJiN4MjFDMDsiPjwhRU5USVRZIFJpZ2h0VmVjdG9yICImI3gyMUMwOyI%2BPCFFTlRJVFkgcmlnaHRoYXJwb29udXAgIiYjeDIxQzA7Ij48IUVOVElUWSByaGFyZCAiJiN4MjFDMTsiPjwhRU5USVRZIHJpZ2h0aGFycG9vbmRvd24gIiYjeDIxQzE7Ij48IUVOVElUWSBEb3duUmlnaHRWZWN0b3IgIiYjeDIxQzE7Ij48IUVOVElUWSBkaGFyciAiJiN4MjFDMjsiPjwhRU5USVRZIFJpZ2h0RG93blZlY3RvciAiJiN4MjFDMjsiPjwhRU5USVRZIGRvd25oYXJwb29ucmlnaHQgIiYjeDIxQzI7Ij48IUVOVElUWSBkaGFybCAiJiN4MjFDMzsiPjwhRU5USVRZIExlZnREb3duVmVjdG9yICImI3gyMUMzOyI%2BPCFFTlRJVFkgZG93bmhhcnBvb25sZWZ0ICImI3gyMUMzOyI%2BPCFFTlRJVFkgcmxhcnIgIiYjeDIxQzQ7Ij48IUVOVElUWSByaWdodGxlZnRhcnJvd3MgIiYjeDIxQzQ7Ij48IUVOVElUWSBSaWdodEFycm93TGVmdEFycm93ICImI3gyMUM0OyI%2BPCFFTlRJVFkgdWRhcnIgIiYjeDIxQzU7Ij48IUVOVElUWSBVcEFycm93RG93bkFycm93ICImI3gyMUM1OyI%2BPCFFTlRJVFkgbHJhcnIgIiYjeDIxQzY7Ij48IUVOVElUWSBsZWZ0cmlnaHRhcnJvd3MgIiYjeDIxQzY7Ij48IUVOVElUWSBMZWZ0QXJyb3dSaWdodEFycm93ICImI3gyMUM2OyI%2BPCFFTlRJVFkgbGxhcnIgIiYjeDIxQzc7Ij48IUVOVElUWSBsZWZ0bGVmdGFycm93cyAiJiN4MjFDNzsiPjwhRU5USVRZIHV1YXJyICImI3gyMUM4OyI%2BPCFFTlRJVFkgdXB1cGFycm93cyAiJiN4MjFDODsiPjwhRU5USVRZIHJyYXJyICImI3gyMUM5OyI%2BPCFFTlRJVFkgcmlnaHRyaWdodGFycm93cyAiJiN4MjFDOTsiPjwhRU5USVRZIGRkYXJyICImI3gyMUNBOyI%2BPCFFTlRJVFkgZG93bmRvd25hcnJvd3MgIiYjeDIxQ0E7Ij48IUVOVElUWSBscmhhciAiJiN4MjFDQjsiPjwhRU5USVRZIFJldmVyc2VFcXVpbGlicml1bSAiJiN4MjFDQjsiPjwhRU5USVRZIGxlZnRyaWdodGhhcnBvb25zICImI3gyMUNCOyI%2BPCFFTlRJVFkgcmxoYXIgIiYjeDIxQ0M7Ij48IUVOVElUWSByaWdodGxlZnRoYXJwb29ucyAiJiN4MjFDQzsiPjwhRU5USVRZIEVxdWlsaWJyaXVtICImI3gyMUNDOyI%2BPCFFTlRJVFkgbmxBcnIgIiYjeDIxQ0Q7Ij48IUVOVElUWSBuTGVmdGFycm93ICImI3gyMUNEOyI%2BPCFFTlRJVFkgbmhBcnIgIiYjeDIxQ0U7Ij48IUVOVElUWSBuTGVmdHJpZ2h0YXJyb3cgIiYjeDIxQ0U7Ij48IUVOVElUWSBuckFyciAiJiN4MjFDRjsiPjwhRU5USVRZIG5SaWdodGFycm93ICImI3gyMUNGOyI%2BPCFFTlRJVFkgbEFyciAiJiN4MjFEMDsiPjwhRU5USVRZIExlZnRhcnJvdyAiJiN4MjFEMDsiPjwhRU5USVRZIERvdWJsZUxlZnRBcnJvdyAiJiN4MjFEMDsiPjwhRU5USVRZIHVBcnIgIiYjeDIxRDE7Ij48IUVOVElUWSBVcGFycm93ICImI3gyMUQxOyI%2BPCFFTlRJVFkgRG91YmxlVXBBcnJvdyAiJiN4MjFEMTsiPjwhRU5USVRZIHJBcnIgIiYjeDIxRDI7Ij48IUVOVElUWSBSaWdodGFycm93ICImI3gyMUQyOyI%2BPCFFTlRJVFkgSW1wbGllcyAiJiN4MjFEMjsiPjwhRU5USVRZIERvdWJsZVJpZ2h0QXJyb3cgIiYjeDIxRDI7Ij48IUVOVElUWSBkQXJyICImI3gyMUQzOyI%2BPCFFTlRJVFkgRG93bmFycm93ICImI3gyMUQzOyI%2BPCFFTlRJVFkgRG91YmxlRG93bkFycm93ICImI3gyMUQzOyI%2BPCFFTlRJVFkgaEFyciAiJiN4MjFENDsiPjwhRU5USVRZIExlZnRyaWdodGFycm93ICImI3gyMUQ0OyI%2BPCFFTlRJVFkgRG91YmxlTGVmdFJpZ2h0QXJyb3cgIiYjeDIxRDQ7Ij48IUVOVElUWSBpZmYgIiYjeDIxRDQ7Ij48IUVOVElUWSB2QXJyICImI3gyMUQ1OyI%2BPCFFTlRJVFkgVXBkb3duYXJyb3cgIiYjeDIxRDU7Ij48IUVOVElUWSBEb3VibGVVcERvd25BcnJvdyAiJiN4MjFENTsiPjwhRU5USVRZIG53QXJyICImI3gyMUQ2OyI%2BPCFFTlRJVFkgbmVBcnIgIiYjeDIxRDc7Ij48IUVOVElUWSBzZUFyciAiJiN4MjFEODsiPjwhRU5USVRZIHN3QXJyICImI3gyMUQ5OyI%2BPCFFTlRJVFkgbEFhcnIgIiYjeDIxREE7Ij48IUVOVElUWSBMbGVmdGFycm93ICImI3gyMURBOyI%2BPCFFTlRJVFkgckFhcnIgIiYjeDIxREI7Ij48IUVOVElUWSBScmlnaHRhcnJvdyAiJiN4MjFEQjsiPjwhRU5USVRZIHppZ3JhcnIgIiYjeDIxREQ7Ij48IUVOVElUWSBsYXJyYiAiJiN4MjFFNDsiPjwhRU5USVRZIExlZnRBcnJvd0JhciAiJiN4MjFFNDsiPjwhRU5USVRZIHJhcnJiICImI3gyMUU1OyI%2BPCFFTlRJVFkgUmlnaHRBcnJvd0JhciAiJiN4MjFFNTsiPjwhRU5USVRZIGR1YXJyICImI3gyMUY1OyI%2BPCFFTlRJVFkgRG93bkFycm93VXBBcnJvdyAiJiN4MjFGNTsiPjwhRU5USVRZIGxvYXJyICImI3gyMUZEOyI%2BPCFFTlRJVFkgcm9hcnIgIiYjeDIxRkU7Ij48IUVOVElUWSBob2FyciAiJiN4MjFGRjsiPjwhRU5USVRZIGZvcmFsbCAiJiN4MjIwMDsiPjwhRU5USVRZIEZvckFsbCAiJiN4MjIwMDsiPjwhRU5USVRZIGNvbXAgIiYjeDIyMDE7Ij48IUVOVElUWSBjb21wbGVtZW50ICImI3gyMjAxOyI%2BPCFFTlRJVFkgcGFydCAiJiN4MjIwMjsiPjwhRU5USVRZIFBhcnRpYWxEICImI3gyMjAyOyI%2BPCFFTlRJVFkgbnBhcnQgIiYjeDIyMDI7JiN4MzM4OyI%2BPCFFTlRJVFkgZXhpc3QgIiYjeDIyMDM7Ij48IUVOVElUWSBFeGlzdHMgIiYjeDIyMDM7Ij48IUVOVElUWSBuZXhpc3QgIiYjeDIyMDQ7Ij48IUVOVElUWSBOb3RFeGlzdHMgIiYjeDIyMDQ7Ij48IUVOVElUWSBuZXhpc3RzICImI3gyMjA0OyI%2BPCFFTlRJVFkgZW1wdHkgIiYjeDIyMDU7Ij48IUVOVElUWSBlbXB0eXNldCAiJiN4MjIwNTsiPjwhRU5USVRZIGVtcHR5diAiJiN4MjIwNTsiPjwhRU5USVRZIHZhcm5vdGhpbmcgIiYjeDIyMDU7Ij48IUVOVElUWSBuYWJsYSAiJiN4MjIwNzsiPjwhRU5USVRZIERlbCAiJiN4MjIwNzsiPjwhRU5USVRZIGlzaW4gIiYjeDIyMDg7Ij48IUVOVElUWSBpc2ludiAiJiN4MjIwODsiPjwhRU5USVRZIEVsZW1lbnQgIiYjeDIyMDg7Ij48IUVOVElUWSBpbiAiJiN4MjIwODsiPjwhRU5USVRZIG5vdGluICImI3gyMjA5OyI%2BPCFFTlRJVFkgTm90RWxlbWVudCAiJiN4MjIwOTsiPjwhRU5USVRZIG5vdGludmEgIiYjeDIyMDk7Ij48IUVOVElUWSBuaXYgIiYjeDIyMEI7Ij48IUVOVElUWSBSZXZlcnNlRWxlbWVudCAiJiN4MjIwQjsiPjwhRU5USVRZIG5pICImI3gyMjBCOyI%2BPCFFTlRJVFkgU3VjaFRoYXQgIiYjeDIyMEI7Ij48IUVOVElUWSBub3RuaSAiJiN4MjIwQzsiPjwhRU5USVRZIG5vdG5pdmEgIiYjeDIyMEM7Ij48IUVOVElUWSBOb3RSZXZlcnNlRWxlbWVudCAiJiN4MjIwQzsiPjwhRU5USVRZIHByb2QgIiYjeDIyMEY7Ij48IUVOVElUWSBQcm9kdWN0ICImI3gyMjBGOyI%2BPCFFTlRJVFkgY29wcm9kICImI3gyMjEwOyI%2BPCFFTlRJVFkgQ29wcm9kdWN0ICImI3gyMjEwOyI%2BPCFFTlRJVFkgc3VtICImI3gyMjExOyI%2BPCFFTlRJVFkgU3VtICImI3gyMjExOyI%2BPCFFTlRJVFkgbWludXMgIiYjeDIyMTI7Ij48IUVOVElUWSBtbnBsdXMgIiYjeDIyMTM7Ij48IUVOVElUWSBtcCAiJiN4MjIxMzsiPjwhRU5USVRZIE1pbnVzUGx1cyAiJiN4MjIxMzsiPjwhRU5USVRZIHBsdXNkbyAiJiN4MjIxNDsiPjwhRU5USVRZIGRvdHBsdXMgIiYjeDIyMTQ7Ij48IUVOVElUWSBzZXRtbiAiJiN4MjIxNjsiPjwhRU5USVRZIHNldG1pbnVzICImI3gyMjE2OyI%2BPCFFTlRJVFkgQmFja3NsYXNoICImI3gyMjE2OyI%2BPCFFTlRJVFkgc3NldG1uICImI3gyMjE2OyI%2BPCFFTlRJVFkgc21hbGxzZXRtaW51cyAiJiN4MjIxNjsiPjwhRU5USVRZIGxvd2FzdCAiJiN4MjIxNzsiPjwhRU5USVRZIGNvbXBmbiAiJiN4MjIxODsiPjwhRU5USVRZIFNtYWxsQ2lyY2xlICImI3gyMjE4OyI%2BPCFFTlRJVFkgcmFkaWMgIiYjeDIyMUE7Ij48IUVOVElUWSBTcXJ0ICImI3gyMjFBOyI%2BPCFFTlRJVFkgcHJvcCAiJiN4MjIxRDsiPjwhRU5USVRZIHByb3B0byAiJiN4MjIxRDsiPjwhRU5USVRZIFByb3BvcnRpb25hbCAiJiN4MjIxRDsiPjwhRU5USVRZIHZwcm9wICImI3gyMjFEOyI%2BPCFFTlRJVFkgdmFycHJvcHRvICImI3gyMjFEOyI%2BPCFFTlRJVFkgaW5maW4gIiYjeDIyMUU7Ij48IUVOVElUWSBhbmdydCAiJiN4MjIxRjsiPjwhRU5USVRZIGFuZyAiJiN4MjIyMDsiPjwhRU5USVRZIGFuZ2xlICImI3gyMjIwOyI%2BPCFFTlRJVFkgbmFuZyAiJiN4MjIyMDsmI3gyMEQyOyI%2BPCFFTlRJVFkgYW5nbXNkICImI3gyMjIxOyI%2BPCFFTlRJVFkgbWVhc3VyZWRhbmdsZSAiJiN4MjIyMTsiPjwhRU5USVRZIGFuZ3NwaCAiJiN4MjIyMjsiPjwhRU5USVRZIG1pZCAiJiN4MjIyMzsiPjwhRU5USVRZIFZlcnRpY2FsQmFyICImI3gyMjIzOyI%2BPCFFTlRJVFkgc21pZCAiJiN4MjIyMzsiPjwhRU5USVRZIHNob3J0bWlkICImI3gyMjIzOyI%2BPCFFTlRJVFkgbm1pZCAiJiN4MjIyNDsiPjwhRU5USVRZIE5vdFZlcnRpY2FsQmFyICImI3gyMjI0OyI%2BPCFFTlRJVFkgbnNtaWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBuc2hvcnRtaWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBwYXIgIiYjeDIyMjU7Ij48IUVOVElUWSBwYXJhbGxlbCAiJiN4MjIyNTsiPjwhRU5USVRZIERvdWJsZVZlcnRpY2FsQmFyICImI3gyMjI1OyI%2BPCFFTlRJVFkgc3BhciAiJiN4MjIyNTsiPjwhRU5USVRZIHNob3J0cGFyYWxsZWwgIiYjeDIyMjU7Ij48IUVOVElUWSBucGFyICImI3gyMjI2OyI%2BPCFFTlRJVFkgbnBhcmFsbGVsICImI3gyMjI2OyI%2BPCFFTlRJVFkgTm90RG91YmxlVmVydGljYWxCYXIgIiYjeDIyMjY7Ij48IUVOVElUWSBuc3BhciAiJiN4MjIyNjsiPjwhRU5USVRZIG5zaG9ydHBhcmFsbGVsICImI3gyMjI2OyI%2BPCFFTlRJVFkgYW5kICImI3gyMjI3OyI%2BPCFFTlRJVFkgd2VkZ2UgIiYjeDIyMjc7Ij48IUVOVElUWSBvciAiJiN4MjIyODsiPjwhRU5USVRZIHZlZSAiJiN4MjIyODsiPjwhRU5USVRZIGNhcCAiJiN4MjIyOTsiPjwhRU5USVRZIGNhcHMgIiYjeDIyMjk7JiN4RkUwMDsiPjwhRU5USVRZIGN1cCAiJiN4MjIyQTsiPjwhRU5USVRZIGN1cHMgIiYjeDIyMkE7JiN4RkUwMDsiPjwhRU5USVRZIGludCAiJiN4MjIyQjsiPjwhRU5USVRZIEludGVncmFsICImI3gyMjJCOyI%2BPCFFTlRJVFkgSW50ICImI3gyMjJDOyI%2BPCFFTlRJVFkgdGludCAiJiN4MjIyRDsiPjwhRU5USVRZIGlpaW50ICImI3gyMjJEOyI%2BPCFFTlRJVFkgY29uaW50ICImI3gyMjJFOyI%2BPCFFTlRJVFkgb2ludCAiJiN4MjIyRTsiPjwhRU5USVRZIENvbnRvdXJJbnRlZ3JhbCAiJiN4MjIyRTsiPjwhRU5USVRZIENvbmludCAiJiN4MjIyRjsiPjwhRU5USVRZIERvdWJsZUNvbnRvdXJJbnRlZ3JhbCAiJiN4MjIyRjsiPjwhRU5USVRZIENjb25pbnQgIiYjeDIyMzA7Ij48IUVOVElUWSBjd2ludCAiJiN4MjIzMTsiPjwhRU5USVRZIGN3Y29uaW50ICImI3gyMjMyOyI%2BPCFFTlRJVFkgQ2xvY2t3aXNlQ29udG91ckludGVncmFsICImI3gyMjMyOyI%2BPCFFTlRJVFkgYXdjb25pbnQgIiYjeDIyMzM7Ij48IUVOVElUWSBDb3VudGVyQ2xvY2t3aXNlQ29udG91ckludGVncmFsICImI3gyMjMzOyI%2BPCFFTlRJVFkgdGhlcmU0ICImI3gyMjM0OyI%2BPCFFTlRJVFkgdGhlcmVmb3JlICImI3gyMjM0OyI%2BPCFFTlRJVFkgVGhlcmVmb3JlICImI3gyMjM0OyI%2BPCFFTlRJVFkgYmVjYXVzICImI3gyMjM1OyI%2BPCFFTlRJVFkgYmVjYXVzZSAiJiN4MjIzNTsiPjwhRU5USVRZIEJlY2F1c2UgIiYjeDIyMzU7Ij48IUVOVElUWSByYXRpbyAiJiN4MjIzNjsiPjwhRU5USVRZIENvbG9uICImI3gyMjM3OyI%2BPCFFTlRJVFkgUHJvcG9ydGlvbiAiJiN4MjIzNzsiPjwhRU5USVRZIG1pbnVzZCAiJiN4MjIzODsiPjwhRU5USVRZIGRvdG1pbnVzICImI3gyMjM4OyI%2BPCFFTlRJVFkgbUREb3QgIiYjeDIyM0E7Ij48IUVOVElUWSBob210aHQgIiYjeDIyM0I7Ij48IUVOVElUWSBzaW0gIiYjeDIyM0M7Ij48IUVOVElUWSBUaWxkZSAiJiN4MjIzQzsiPjwhRU5USVRZIHRoa3NpbSAiJiN4MjIzQzsiPjwhRU5USVRZIHRoaWNrc2ltICImI3gyMjNDOyI%2BPCFFTlRJVFkgbnZzaW0gIiYjeDIyM0M7JiN4MjBEMjsiPjwhRU5USVRZIGJzaW0gIiYjeDIyM0Q7Ij48IUVOVElUWSBiYWNrc2ltICImI3gyMjNEOyI%2BPCFFTlRJVFkgcmFjZSAiJiN4MjIzRDsmI3gzMzE7Ij48IUVOVElUWSBhYyAiJiN4MjIzRTsiPjwhRU5USVRZIG1zdHBvcyAiJiN4MjIzRTsiPjwhRU5USVRZIGFjRSAiJiN4MjIzRTsmI3gzMzM7Ij48IUVOVElUWSBhY2QgIiYjeDIyM0Y7Ij48IUVOVElUWSB3cmVhdGggIiYjeDIyNDA7Ij48IUVOVElUWSBWZXJ0aWNhbFRpbGRlICImI3gyMjQwOyI%2BPCFFTlRJVFkgd3IgIiYjeDIyNDA7Ij48IUVOVElUWSBuc2ltICImI3gyMjQxOyI%2BPCFFTlRJVFkgTm90VGlsZGUgIiYjeDIyNDE7Ij48IUVOVElUWSBlc2ltICImI3gyMjQyOyI%2BPCFFTlRJVFkgRXF1YWxUaWxkZSAiJiN4MjI0MjsiPjwhRU5USVRZIGVxc2ltICImI3gyMjQyOyI%2BPCFFTlRJVFkgTm90RXF1YWxUaWxkZSAiJiN4MjI0MjsmI3gzMzg7Ij48IUVOVElUWSBuZXNpbSAiJiN4MjI0MjsmI3gzMzg7Ij48IUVOVElUWSBzaW1lICImI3gyMjQzOyI%2BPCFFTlRJVFkgVGlsZGVFcXVhbCAiJiN4MjI0MzsiPjwhRU5USVRZIHNpbWVxICImI3gyMjQzOyI%2BPCFFTlRJVFkgbnNpbWUgIiYjeDIyNDQ7Ij48IUVOVElUWSBuc2ltZXEgIiYjeDIyNDQ7Ij48IUVOVElUWSBOb3RUaWxkZUVxdWFsICImI3gyMjQ0OyI%2BPCFFTlRJVFkgY29uZyAiJiN4MjI0NTsiPjwhRU5USVRZIFRpbGRlRnVsbEVxdWFsICImI3gyMjQ1OyI%2BPCFFTlRJVFkgc2ltbmUgIiYjeDIyNDY7Ij48IUVOVElUWSBuY29uZyAiJiN4MjI0NzsiPjwhRU5USVRZIE5vdFRpbGRlRnVsbEVxdWFsICImI3gyMjQ3OyI%2BPCFFTlRJVFkgYXN5bXAgIiYjeDIyNDg7Ij48IUVOVElUWSBhcCAiJiN4MjI0ODsiPjwhRU5USVRZIFRpbGRlVGlsZGUgIiYjeDIyNDg7Ij48IUVOVElUWSBhcHByb3ggIiYjeDIyNDg7Ij48IUVOVElUWSB0aGthcCAiJiN4MjI0ODsiPjwhRU5USVRZIHRoaWNrYXBwcm94ICImI3gyMjQ4OyI%2BPCFFTlRJVFkgbmFwICImI3gyMjQ5OyI%2BPCFFTlRJVFkgTm90VGlsZGVUaWxkZSAiJiN4MjI0OTsiPjwhRU5USVRZIG5hcHByb3ggIiYjeDIyNDk7Ij48IUVOVElUWSBhcGUgIiYjeDIyNEE7Ij48IUVOVElUWSBhcHByb3hlcSAiJiN4MjI0QTsiPjwhRU5USVRZIGFwaWQgIiYjeDIyNEI7Ij48IUVOVElUWSBuYXBpZCAiJiN4MjI0QjsmI3gzMzg7Ij48IUVOVElUWSBiY29uZyAiJiN4MjI0QzsiPjwhRU5USVRZIGJhY2tjb25nICImI3gyMjRDOyI%2BPCFFTlRJVFkgYXN5bXBlcSAiJiN4MjI0RDsiPjwhRU5USVRZIEN1cENhcCAiJiN4MjI0RDsiPjwhRU5USVRZIG52YXAgIiYjeDIyNEQ7JiN4MjBEMjsiPjwhRU5USVRZIGJ1bXAgIiYjeDIyNEU7Ij48IUVOVElUWSBIdW1wRG93bkh1bXAgIiYjeDIyNEU7Ij48IUVOVElUWSBCdW1wZXEgIiYjeDIyNEU7Ij48IUVOVElUWSBOb3RIdW1wRG93bkh1bXAgIiYjeDIyNEU7JiN4MzM4OyI%2BPCFFTlRJVFkgbmJ1bXAgIiYjeDIyNEU7JiN4MzM4OyI%2BPCFFTlRJVFkgYnVtcGUgIiYjeDIyNEY7Ij48IUVOVElUWSBIdW1wRXF1YWwgIiYjeDIyNEY7Ij48IUVOVElUWSBidW1wZXEgIiYjeDIyNEY7Ij48IUVOVElUWSBuYnVtcGUgIiYjeDIyNEY7JiN4MzM4OyI%2BPCFFTlRJVFkgTm90SHVtcEVxdWFsICImI3gyMjRGOyYjeDMzODsiPjwhRU5USVRZIGVzZG90ICImI3gyMjUwOyI%2BPCFFTlRJVFkgRG90RXF1YWwgIiYjeDIyNTA7Ij48IUVOVElUWSBkb3RlcSAiJiN4MjI1MDsiPjwhRU5USVRZIG5lZG90ICImI3gyMjUwOyYjeDMzODsiPjwhRU5USVRZIGVEb3QgIiYjeDIyNTE7Ij48IUVOVElUWSBkb3RlcWRvdCAiJiN4MjI1MTsiPjwhRU5USVRZIGVmRG90ICImI3gyMjUyOyI%2BPCFFTlRJVFkgZmFsbGluZ2RvdHNlcSAiJiN4MjI1MjsiPjwhRU5USVRZIGVyRG90ICImI3gyMjUzOyI%2BPCFFTlRJVFkgcmlzaW5nZG90c2VxICImI3gyMjUzOyI%2BPCFFTlRJVFkgY29sb25lICImI3gyMjU0OyI%2BPCFFTlRJVFkgY29sb25lcSAiJiN4MjI1NDsiPjwhRU5USVRZIEFzc2lnbiAiJiN4MjI1NDsiPjwhRU5USVRZIGVjb2xvbiAiJiN4MjI1NTsiPjwhRU5USVRZIGVxY29sb24gIiYjeDIyNTU7Ij48IUVOVElUWSBlY2lyICImI3gyMjU2OyI%2BPCFFTlRJVFkgZXFjaXJjICImI3gyMjU2OyI%2BPCFFTlRJVFkgY2lyZSAiJiN4MjI1NzsiPjwhRU5USVRZIGNpcmNlcSAiJiN4MjI1NzsiPjwhRU5USVRZIHdlZGdlcSAiJiN4MjI1OTsiPjwhRU5USVRZIHZlZWVxICImI3gyMjVBOyI%2BPCFFTlRJVFkgdHJpZSAiJiN4MjI1QzsiPjwhRU5USVRZIHRyaWFuZ2xlcSAiJiN4MjI1QzsiPjwhRU5USVRZIGVxdWVzdCAiJiN4MjI1RjsiPjwhRU5USVRZIHF1ZXN0ZXEgIiYjeDIyNUY7Ij48IUVOVElUWSBuZSAiJiN4MjI2MDsiPjwhRU5USVRZIE5vdEVxdWFsICImI3gyMjYwOyI%2BPCFFTlRJVFkgZXF1aXYgIiYjeDIyNjE7Ij48IUVOVElUWSBDb25ncnVlbnQgIiYjeDIyNjE7Ij48IUVOVElUWSBibmVxdWl2ICImI3gyMjYxOyYjeDIwRTU7Ij48IUVOVElUWSBuZXF1aXYgIiYjeDIyNjI7Ij48IUVOVElUWSBOb3RDb25ncnVlbnQgIiYjeDIyNjI7Ij48IUVOVElUWSBsZSAiJiN4MjI2NDsiPjwhRU5USVRZIGxlcSAiJiN4MjI2NDsiPjwhRU5USVRZIG52bGUgIiYjeDIyNjQ7JiN4MjBEMjsiPjwhRU5USVRZIGdlICImI3gyMjY1OyI%2BPCFFTlRJVFkgR3JlYXRlckVxdWFsICImI3gyMjY1OyI%2BPCFFTlRJVFkgZ2VxICImI3gyMjY1OyI%2BPCFFTlRJVFkgbnZnZSAiJiN4MjI2NTsmI3gyMEQyOyI%2BPCFFTlRJVFkgbEUgIiYjeDIyNjY7Ij48IUVOVElUWSBMZXNzRnVsbEVxdWFsICImI3gyMjY2OyI%2BPCFFTlRJVFkgbGVxcSAiJiN4MjI2NjsiPjwhRU5USVRZIG5sRSAiJiN4MjI2NjsmI3gzMzg7Ij48IUVOVElUWSBubGVxcSAiJiN4MjI2NjsmI3gzMzg7Ij48IUVOVElUWSBnRSAiJiN4MjI2NzsiPjwhRU5USVRZIEdyZWF0ZXJGdWxsRXF1YWwgIiYjeDIyNjc7Ij48IUVOVElUWSBnZXFxICImI3gyMjY3OyI%2BPCFFTlRJVFkgbmdFICImI3gyMjY3OyYjeDMzODsiPjwhRU5USVRZIG5nZXFxICImI3gyMjY3OyYjeDMzODsiPjwhRU5USVRZIE5vdEdyZWF0ZXJGdWxsRXF1YWwgIiYjeDIyNjc7JiN4MzM4OyI%2BPCFFTlRJVFkgbG5FICImI3gyMjY4OyI%2BPCFFTlRJVFkgbG5lcXEgIiYjeDIyNjg7Ij48IUVOVElUWSBsdm5FICImI3gyMjY4OyYjeEZFMDA7Ij48IUVOVElUWSBsdmVydG5lcXEgIiYjeDIyNjg7JiN4RkUwMDsiPjwhRU5USVRZIGduRSAiJiN4MjI2OTsiPjwhRU5USVRZIGduZXFxICImI3gyMjY5OyI%2BPCFFTlRJVFkgZ3ZuRSAiJiN4MjI2OTsmI3hGRTAwOyI%2BPCFFTlRJVFkgZ3ZlcnRuZXFxICImI3gyMjY5OyYjeEZFMDA7Ij48IUVOVElUWSBMdCAiJiN4MjI2QTsiPjwhRU5USVRZIE5lc3RlZExlc3NMZXNzICImI3gyMjZBOyI%2BPCFFTlRJVFkgbGwgIiYjeDIyNkE7Ij48IUVOVElUWSBuTHR2ICImI3gyMjZBOyYjeDMzODsiPjwhRU5USVRZIE5vdExlc3NMZXNzICImI3gyMjZBOyYjeDMzODsiPjwhRU5USVRZIG5MdCAiJiN4MjI2QTsmI3gyMEQyOyI%2BPCFFTlRJVFkgR3QgIiYjeDIyNkI7Ij48IUVOVElUWSBOZXN0ZWRHcmVhdGVyR3JlYXRlciAiJiN4MjI2QjsiPjwhRU5USVRZIGdnICImI3gyMjZCOyI%2BPCFFTlRJVFkgbkd0diAiJiN4MjI2QjsmI3gzMzg7Ij48IUVOVElUWSBOb3RHcmVhdGVyR3JlYXRlciAiJiN4MjI2QjsmI3gzMzg7Ij48IUVOVElUWSBuR3QgIiYjeDIyNkI7JiN4MjBEMjsiPjwhRU5USVRZIHR3aXh0ICImI3gyMjZDOyI%2BPCFFTlRJVFkgYmV0d2VlbiAiJiN4MjI2QzsiPjwhRU5USVRZIE5vdEN1cENhcCAiJiN4MjI2RDsiPjwhRU5USVRZIG5sdCAiJiN4MjI2RTsiPjwhRU5USVRZIE5vdExlc3MgIiYjeDIyNkU7Ij48IUVOVElUWSBubGVzcyAiJiN4MjI2RTsiPjwhRU5USVRZIG5ndCAiJiN4MjI2RjsiPjwhRU5USVRZIE5vdEdyZWF0ZXIgIiYjeDIyNkY7Ij48IUVOVElUWSBuZ3RyICImI3gyMjZGOyI%2BPCFFTlRJVFkgbmxlICImI3gyMjcwOyI%2BPCFFTlRJVFkgTm90TGVzc0VxdWFsICImI3gyMjcwOyI%2BPCFFTlRJVFkgbmxlcSAiJiN4MjI3MDsiPjwhRU5USVRZIG5nZSAiJiN4MjI3MTsiPjwhRU5USVRZIE5vdEdyZWF0ZXJFcXVhbCAiJiN4MjI3MTsiPjwhRU5USVRZIG5nZXEgIiYjeDIyNzE7Ij48IUVOVElUWSBsc2ltICImI3gyMjcyOyI%2BPCFFTlRJVFkgTGVzc1RpbGRlICImI3gyMjcyOyI%2BPCFFTlRJVFkgbGVzc3NpbSAiJiN4MjI3MjsiPjwhRU5USVRZIGdzaW0gIiYjeDIyNzM7Ij48IUVOVElUWSBndHJzaW0gIiYjeDIyNzM7Ij48IUVOVElUWSBHcmVhdGVyVGlsZGUgIiYjeDIyNzM7Ij48IUVOVElUWSBubHNpbSAiJiN4MjI3NDsiPjwhRU5USVRZIE5vdExlc3NUaWxkZSAiJiN4MjI3NDsiPjwhRU5USVRZIG5nc2ltICImI3gyMjc1OyI%2BPCFFTlRJVFkgTm90R3JlYXRlclRpbGRlICImI3gyMjc1OyI%2BPCFFTlRJVFkgbGcgIiYjeDIyNzY7Ij48IUVOVElUWSBsZXNzZ3RyICImI3gyMjc2OyI%2BPCFFTlRJVFkgTGVzc0dyZWF0ZXIgIiYjeDIyNzY7Ij48IUVOVElUWSBnbCAiJiN4MjI3NzsiPjwhRU5USVRZIGd0cmxlc3MgIiYjeDIyNzc7Ij48IUVOVElUWSBHcmVhdGVyTGVzcyAiJiN4MjI3NzsiPjwhRU5USVRZIG50bGcgIiYjeDIyNzg7Ij48IUVOVElUWSBOb3RMZXNzR3JlYXRlciAiJiN4MjI3ODsiPjwhRU5USVRZIG50Z2wgIiYjeDIyNzk7Ij48IUVOVElUWSBOb3RHcmVhdGVyTGVzcyAiJiN4MjI3OTsiPjwhRU5USVRZIHByICImI3gyMjdBOyI%2BPCFFTlRJVFkgUHJlY2VkZXMgIiYjeDIyN0E7Ij48IUVOVElUWSBwcmVjICImI3gyMjdBOyI%2BPCFFTlRJVFkgc2MgIiYjeDIyN0I7Ij48IUVOVElUWSBTdWNjZWVkcyAiJiN4MjI3QjsiPjwhRU5USVRZIHN1Y2MgIiYjeDIyN0I7Ij48IUVOVElUWSBwcmN1ZSAiJiN4MjI3QzsiPjwhRU5USVRZIFByZWNlZGVzU2xhbnRFcXVhbCAiJiN4MjI3QzsiPjwhRU5USVRZIHByZWNjdXJseWVxICImI3gyMjdDOyI%2BPCFFTlRJVFkgc2NjdWUgIiYjeDIyN0Q7Ij48IUVOVElUWSBTdWNjZWVkc1NsYW50RXF1YWwgIiYjeDIyN0Q7Ij48IUVOVElUWSBzdWNjY3VybHllcSAiJiN4MjI3RDsiPjwhRU5USVRZIHByc2ltICImI3gyMjdFOyI%2BPCFFTlRJVFkgcHJlY3NpbSAiJiN4MjI3RTsiPjwhRU5USVRZIFByZWNlZGVzVGlsZGUgIiYjeDIyN0U7Ij48IUVOVElUWSBzY3NpbSAiJiN4MjI3RjsiPjwhRU5USVRZIHN1Y2NzaW0gIiYjeDIyN0Y7Ij48IUVOVElUWSBTdWNjZWVkc1RpbGRlICImI3gyMjdGOyI%2BPCFFTlRJVFkgTm90U3VjY2VlZHNUaWxkZSAiJiN4MjI3RjsmI3gzMzg7Ij48IUVOVElUWSBucHIgIiYjeDIyODA7Ij48IUVOVElUWSBucHJlYyAiJiN4MjI4MDsiPjwhRU5USVRZIE5vdFByZWNlZGVzICImI3gyMjgwOyI%2BPCFFTlRJVFkgbnNjICImI3gyMjgxOyI%2BPCFFTlRJVFkgbnN1Y2MgIiYjeDIyODE7Ij48IUVOVElUWSBOb3RTdWNjZWVkcyAiJiN4MjI4MTsiPjwhRU5USVRZIHN1YiAiJiN4MjI4MjsiPjwhRU5USVRZIHN1YnNldCAiJiN4MjI4MjsiPjwhRU5USVRZIHZuc3ViICImI3gyMjgyOyYjeDIwRDI7Ij48IUVOVElUWSBuc3Vic2V0ICImI3gyMjgyOyYjeDIwRDI7Ij48IUVOVElUWSBOb3RTdWJzZXQgIiYjeDIyODI7JiN4MjBEMjsiPjwhRU5USVRZIHN1cCAiJiN4MjI4MzsiPjwhRU5USVRZIHN1cHNldCAiJiN4MjI4MzsiPjwhRU5USVRZIFN1cGVyc2V0ICImI3gyMjgzOyI%2BPCFFTlRJVFkgdm5zdXAgIiYjeDIyODM7JiN4MjBEMjsiPjwhRU5USVRZIG5zdXBzZXQgIiYjeDIyODM7JiN4MjBEMjsiPjwhRU5USVRZIE5vdFN1cGVyc2V0ICImI3gyMjgzOyYjeDIwRDI7Ij48IUVOVElUWSBuc3ViICImI3gyMjg0OyI%2BPCFFTlRJVFkgbnN1cCAiJiN4MjI4NTsiPjwhRU5USVRZIHN1YmUgIiYjeDIyODY7Ij48IUVOVElUWSBTdWJzZXRFcXVhbCAiJiN4MjI4NjsiPjwhRU5USVRZIHN1YnNldGVxICImI3gyMjg2OyI%2BPCFFTlRJVFkgc3VwZSAiJiN4MjI4NzsiPjwhRU5USVRZIHN1cHNldGVxICImI3gyMjg3OyI%2BPCFFTlRJVFkgU3VwZXJzZXRFcXVhbCAiJiN4MjI4NzsiPjwhRU5USVRZIG5zdWJlICImI3gyMjg4OyI%2BPCFFTlRJVFkgbnN1YnNldGVxICImI3gyMjg4OyI%2BPCFFTlRJVFkgTm90U3Vic2V0RXF1YWwgIiYjeDIyODg7Ij48IUVOVElUWSBuc3VwZSAiJiN4MjI4OTsiPjwhRU5USVRZIG5zdXBzZXRlcSAiJiN4MjI4OTsiPjwhRU5USVRZIE5vdFN1cGVyc2V0RXF1YWwgIiYjeDIyODk7Ij48IUVOVElUWSBzdWJuZSAiJiN4MjI4QTsiPjwhRU5USVRZIHN1YnNldG5lcSAiJiN4MjI4QTsiPjwhRU5USVRZIHZzdWJuZSAiJiN4MjI4QTsmI3hGRTAwOyI%2BPCFFTlRJVFkgdmFyc3Vic2V0bmVxICImI3gyMjhBOyYjeEZFMDA7Ij48IUVOVElUWSBzdXBuZSAiJiN4MjI4QjsiPjwhRU5USVRZIHN1cHNldG5lcSAiJiN4MjI4QjsiPjwhRU5USVRZIHZzdXBuZSAiJiN4MjI4QjsmI3hGRTAwOyI%2BPCFFTlRJVFkgdmFyc3Vwc2V0bmVxICImI3gyMjhCOyYjeEZFMDA7Ij48IUVOVElUWSBjdXBkb3QgIiYjeDIyOEQ7Ij48IUVOVElUWSB1cGx1cyAiJiN4MjI4RTsiPjwhRU5USVRZIFVuaW9uUGx1cyAiJiN4MjI4RTsiPjwhRU5USVRZIHNxc3ViICImI3gyMjhGOyI%2BPCFFTlRJVFkgU3F1YXJlU3Vic2V0ICImI3gyMjhGOyI%2BPCFFTlRJVFkgc3FzdWJzZXQgIiYjeDIyOEY7Ij48IUVOVElUWSBOb3RTcXVhcmVTdWJzZXQgIiYjeDIyOEY7JiN4MzM4OyI%2BPCFFTlRJVFkgc3FzdXAgIiYjeDIyOTA7Ij48IUVOVElUWSBTcXVhcmVTdXBlcnNldCAiJiN4MjI5MDsiPjwhRU5USVRZIHNxc3Vwc2V0ICImI3gyMjkwOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3VwZXJzZXQgIiYjeDIyOTA7JiN4MzM4OyI%2BPCFFTlRJVFkgc3FzdWJlICImI3gyMjkxOyI%2BPCFFTlRJVFkgU3F1YXJlU3Vic2V0RXF1YWwgIiYjeDIyOTE7Ij48IUVOVElUWSBzcXN1YnNldGVxICImI3gyMjkxOyI%2BPCFFTlRJVFkgc3FzdXBlICImI3gyMjkyOyI%2BPCFFTlRJVFkgU3F1YXJlU3VwZXJzZXRFcXVhbCAiJiN4MjI5MjsiPjwhRU5USVRZIHNxc3Vwc2V0ZXEgIiYjeDIyOTI7Ij48IUVOVElUWSBzcWNhcCAiJiN4MjI5MzsiPjwhRU5USVRZIFNxdWFyZUludGVyc2VjdGlvbiAiJiN4MjI5MzsiPjwhRU5USVRZIHNxY2FwcyAiJiN4MjI5MzsmI3hGRTAwOyI%2BPCFFTlRJVFkgc3FjdXAgIiYjeDIyOTQ7Ij48IUVOVElUWSBTcXVhcmVVbmlvbiAiJiN4MjI5NDsiPjwhRU5USVRZIHNxY3VwcyAiJiN4MjI5NDsmI3hGRTAwOyI%2BPCFFTlRJVFkgb3BsdXMgIiYjeDIyOTU7Ij48IUVOVElUWSBDaXJjbGVQbHVzICImI3gyMjk1OyI%2BPCFFTlRJVFkgb21pbnVzICImI3gyMjk2OyI%2BPCFFTlRJVFkgQ2lyY2xlTWludXMgIiYjeDIyOTY7Ij48IUVOVElUWSBvdGltZXMgIiYjeDIyOTc7Ij48IUVOVElUWSBDaXJjbGVUaW1lcyAiJiN4MjI5NzsiPjwhRU5USVRZIG9zb2wgIiYjeDIyOTg7Ij48IUVOVElUWSBvZG90ICImI3gyMjk5OyI%2BPCFFTlRJVFkgQ2lyY2xlRG90ICImI3gyMjk5OyI%2BPCFFTlRJVFkgb2NpciAiJiN4MjI5QTsiPjwhRU5USVRZIGNpcmNsZWRjaXJjICImI3gyMjlBOyI%2BPCFFTlRJVFkgb2FzdCAiJiN4MjI5QjsiPjwhRU5USVRZIGNpcmNsZWRhc3QgIiYjeDIyOUI7Ij48IUVOVElUWSBvZGFzaCAiJiN4MjI5RDsiPjwhRU5USVRZIGNpcmNsZWRkYXNoICImI3gyMjlEOyI%2BPCFFTlRJVFkgcGx1c2IgIiYjeDIyOUU7Ij48IUVOVElUWSBib3hwbHVzICImI3gyMjlFOyI%2BPCFFTlRJVFkgbWludXNiICImI3gyMjlGOyI%2BPCFFTlRJVFkgYm94bWludXMgIiYjeDIyOUY7Ij48IUVOVElUWSB0aW1lc2IgIiYjeDIyQTA7Ij48IUVOVElUWSBib3h0aW1lcyAiJiN4MjJBMDsiPjwhRU5USVRZIHNkb3RiICImI3gyMkExOyI%2BPCFFTlRJVFkgZG90c3F1YXJlICImI3gyMkExOyI%2BPCFFTlRJVFkgdmRhc2ggIiYjeDIyQTI7Ij48IUVOVElUWSBSaWdodFRlZSAiJiN4MjJBMjsiPjwhRU5USVRZIGRhc2h2ICImI3gyMkEzOyI%2BPCFFTlRJVFkgTGVmdFRlZSAiJiN4MjJBMzsiPjwhRU5USVRZIHRvcCAiJiN4MjJBNDsiPjwhRU5USVRZIERvd25UZWUgIiYjeDIyQTQ7Ij48IUVOVElUWSBib3R0b20gIiYjeDIyQTU7Ij48IUVOVElUWSBib3QgIiYjeDIyQTU7Ij48IUVOVElUWSBwZXJwICImI3gyMkE1OyI%2BPCFFTlRJVFkgVXBUZWUgIiYjeDIyQTU7Ij48IUVOVElUWSBtb2RlbHMgIiYjeDIyQTc7Ij48IUVOVElUWSB2RGFzaCAiJiN4MjJBODsiPjwhRU5USVRZIERvdWJsZVJpZ2h0VGVlICImI3gyMkE4OyI%2BPCFFTlRJVFkgVmRhc2ggIiYjeDIyQTk7Ij48IUVOVElUWSBWdmRhc2ggIiYjeDIyQUE7Ij48IUVOVElUWSBWRGFzaCAiJiN4MjJBQjsiPjwhRU5USVRZIG52ZGFzaCAiJiN4MjJBQzsiPjwhRU5USVRZIG52RGFzaCAiJiN4MjJBRDsiPjwhRU5USVRZIG5WZGFzaCAiJiN4MjJBRTsiPjwhRU5USVRZIG5WRGFzaCAiJiN4MjJBRjsiPjwhRU5USVRZIHBydXJlbCAiJiN4MjJCMDsiPjwhRU5USVRZIHZsdHJpICImI3gyMkIyOyI%2BPCFFTlRJVFkgdmFydHJpYW5nbGVsZWZ0ICImI3gyMkIyOyI%2BPCFFTlRJVFkgTGVmdFRyaWFuZ2xlICImI3gyMkIyOyI%2BPCFFTlRJVFkgdnJ0cmkgIiYjeDIyQjM7Ij48IUVOVElUWSB2YXJ0cmlhbmdsZXJpZ2h0ICImI3gyMkIzOyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZSAiJiN4MjJCMzsiPjwhRU5USVRZIGx0cmllICImI3gyMkI0OyI%2BPCFFTlRJVFkgdHJpYW5nbGVsZWZ0ZXEgIiYjeDIyQjQ7Ij48IUVOVElUWSBMZWZ0VHJpYW5nbGVFcXVhbCAiJiN4MjJCNDsiPjwhRU5USVRZIG52bHRyaWUgIiYjeDIyQjQ7JiN4MjBEMjsiPjwhRU5USVRZIHJ0cmllICImI3gyMkI1OyI%2BPCFFTlRJVFkgdHJpYW5nbGVyaWdodGVxICImI3gyMkI1OyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZUVxdWFsICImI3gyMkI1OyI%2BPCFFTlRJVFkgbnZydHJpZSAiJiN4MjJCNTsmI3gyMEQyOyI%2BPCFFTlRJVFkgb3JpZ29mICImI3gyMkI2OyI%2BPCFFTlRJVFkgaW1vZiAiJiN4MjJCNzsiPjwhRU5USVRZIG11bWFwICImI3gyMkI4OyI%2BPCFFTlRJVFkgbXVsdGltYXAgIiYjeDIyQjg7Ij48IUVOVElUWSBoZXJjb24gIiYjeDIyQjk7Ij48IUVOVElUWSBpbnRjYWwgIiYjeDIyQkE7Ij48IUVOVElUWSBpbnRlcmNhbCAiJiN4MjJCQTsiPjwhRU5USVRZIHZlZWJhciAiJiN4MjJCQjsiPjwhRU5USVRZIGJhcnZlZSAiJiN4MjJCRDsiPjwhRU5USVRZIGFuZ3J0dmIgIiYjeDIyQkU7Ij48IUVOVElUWSBscnRyaSAiJiN4MjJCRjsiPjwhRU5USVRZIHh3ZWRnZSAiJiN4MjJDMDsiPjwhRU5USVRZIFdlZGdlICImI3gyMkMwOyI%2BPCFFTlRJVFkgYmlnd2VkZ2UgIiYjeDIyQzA7Ij48IUVOVElUWSB4dmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgVmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgYmlndmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgeGNhcCAiJiN4MjJDMjsiPjwhRU5USVRZIEludGVyc2VjdGlvbiAiJiN4MjJDMjsiPjwhRU5USVRZIGJpZ2NhcCAiJiN4MjJDMjsiPjwhRU5USVRZIHhjdXAgIiYjeDIyQzM7Ij48IUVOVElUWSBVbmlvbiAiJiN4MjJDMzsiPjwhRU5USVRZIGJpZ2N1cCAiJiN4MjJDMzsiPjwhRU5USVRZIGRpYW0gIiYjeDIyQzQ7Ij48IUVOVElUWSBkaWFtb25kICImI3gyMkM0OyI%2BPCFFTlRJVFkgRGlhbW9uZCAiJiN4MjJDNDsiPjwhRU5USVRZIHNkb3QgIiYjeDIyQzU7Ij48IUVOVElUWSBzc3RhcmYgIiYjeDIyQzY7Ij48IUVOVElUWSBTdGFyICImI3gyMkM2OyI%2BPCFFTlRJVFkgZGl2b254ICImI3gyMkM3OyI%2BPCFFTlRJVFkgZGl2aWRlb250aW1lcyAiJiN4MjJDNzsiPjwhRU5USVRZIGJvd3RpZSAiJiN4MjJDODsiPjwhRU5USVRZIGx0aW1lcyAiJiN4MjJDOTsiPjwhRU5USVRZIHJ0aW1lcyAiJiN4MjJDQTsiPjwhRU5USVRZIGx0aHJlZSAiJiN4MjJDQjsiPjwhRU5USVRZIGxlZnR0aHJlZXRpbWVzICImI3gyMkNCOyI%2BPCFFTlRJVFkgcnRocmVlICImI3gyMkNDOyI%2BPCFFTlRJVFkgcmlnaHR0aHJlZXRpbWVzICImI3gyMkNDOyI%2BPCFFTlRJVFkgYnNpbWUgIiYjeDIyQ0Q7Ij48IUVOVElUWSBiYWNrc2ltZXEgIiYjeDIyQ0Q7Ij48IUVOVElUWSBjdXZlZSAiJiN4MjJDRTsiPjwhRU5USVRZIGN1cmx5dmVlICImI3gyMkNFOyI%2BPCFFTlRJVFkgY3V3ZWQgIiYjeDIyQ0Y7Ij48IUVOVElUWSBjdXJseXdlZGdlICImI3gyMkNGOyI%2BPCFFTlRJVFkgU3ViICImI3gyMkQwOyI%2BPCFFTlRJVFkgU3Vic2V0ICImI3gyMkQwOyI%2BPCFFTlRJVFkgU3VwICImI3gyMkQxOyI%2BPCFFTlRJVFkgU3Vwc2V0ICImI3gyMkQxOyI%2BPCFFTlRJVFkgQ2FwICImI3gyMkQyOyI%2BPCFFTlRJVFkgQ3VwICImI3gyMkQzOyI%2BPCFFTlRJVFkgZm9yayAiJiN4MjJENDsiPjwhRU5USVRZIHBpdGNoZm9yayAiJiN4MjJENDsiPjwhRU5USVRZIGVwYXIgIiYjeDIyRDU7Ij48IUVOVElUWSBsdGRvdCAiJiN4MjJENjsiPjwhRU5USVRZIGxlc3Nkb3QgIiYjeDIyRDY7Ij48IUVOVElUWSBndGRvdCAiJiN4MjJENzsiPjwhRU5USVRZIGd0cmRvdCAiJiN4MjJENzsiPjwhRU5USVRZIExsICImI3gyMkQ4OyI%2BPCFFTlRJVFkgbkxsICImI3gyMkQ4OyYjeDMzODsiPjwhRU5USVRZIEdnICImI3gyMkQ5OyI%2BPCFFTlRJVFkgZ2dnICImI3gyMkQ5OyI%2BPCFFTlRJVFkgbkdnICImI3gyMkQ5OyYjeDMzODsiPjwhRU5USVRZIGxlZyAiJiN4MjJEQTsiPjwhRU5USVRZIExlc3NFcXVhbEdyZWF0ZXIgIiYjeDIyREE7Ij48IUVOVElUWSBsZXNzZXFndHIgIiYjeDIyREE7Ij48IUVOVElUWSBsZXNnICImI3gyMkRBOyYjeEZFMDA7Ij48IUVOVElUWSBnZWwgIiYjeDIyREI7Ij48IUVOVElUWSBndHJlcWxlc3MgIiYjeDIyREI7Ij48IUVOVElUWSBHcmVhdGVyRXF1YWxMZXNzICImI3gyMkRCOyI%2BPCFFTlRJVFkgZ2VzbCAiJiN4MjJEQjsmI3hGRTAwOyI%2BPCFFTlRJVFkgY3VlcHIgIiYjeDIyREU7Ij48IUVOVElUWSBjdXJseWVxcHJlYyAiJiN4MjJERTsiPjwhRU5USVRZIGN1ZXNjICImI3gyMkRGOyI%2BPCFFTlRJVFkgY3VybHllcXN1Y2MgIiYjeDIyREY7Ij48IUVOVElUWSBucHJjdWUgIiYjeDIyRTA7Ij48IUVOVElUWSBOb3RQcmVjZWRlc1NsYW50RXF1YWwgIiYjeDIyRTA7Ij48IUVOVElUWSBuc2NjdWUgIiYjeDIyRTE7Ij48IUVOVElUWSBOb3RTdWNjZWVkc1NsYW50RXF1YWwgIiYjeDIyRTE7Ij48IUVOVElUWSBuc3FzdWJlICImI3gyMkUyOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3Vic2V0RXF1YWwgIiYjeDIyRTI7Ij48IUVOVElUWSBuc3FzdXBlICImI3gyMkUzOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3VwZXJzZXRFcXVhbCAiJiN4MjJFMzsiPjwhRU5USVRZIGxuc2ltICImI3gyMkU2OyI%2BPCFFTlRJVFkgZ25zaW0gIiYjeDIyRTc7Ij48IUVOVElUWSBwcm5zaW0gIiYjeDIyRTg7Ij48IUVOVElUWSBwcmVjbnNpbSAiJiN4MjJFODsiPjwhRU5USVRZIHNjbnNpbSAiJiN4MjJFOTsiPjwhRU5USVRZIHN1Y2Nuc2ltICImI3gyMkU5OyI%2BPCFFTlRJVFkgbmx0cmkgIiYjeDIyRUE7Ij48IUVOVElUWSBudHJpYW5nbGVsZWZ0ICImI3gyMkVBOyI%2BPCFFTlRJVFkgTm90TGVmdFRyaWFuZ2xlICImI3gyMkVBOyI%2BPCFFTlRJVFkgbnJ0cmkgIiYjeDIyRUI7Ij48IUVOVElUWSBudHJpYW5nbGVyaWdodCAiJiN4MjJFQjsiPjwhRU5USVRZIE5vdFJpZ2h0VHJpYW5nbGUgIiYjeDIyRUI7Ij48IUVOVElUWSBubHRyaWUgIiYjeDIyRUM7Ij48IUVOVElUWSBudHJpYW5nbGVsZWZ0ZXEgIiYjeDIyRUM7Ij48IUVOVElUWSBOb3RMZWZ0VHJpYW5nbGVFcXVhbCAiJiN4MjJFQzsiPjwhRU5USVRZIG5ydHJpZSAiJiN4MjJFRDsiPjwhRU5USVRZIG50cmlhbmdsZXJpZ2h0ZXEgIiYjeDIyRUQ7Ij48IUVOVElUWSBOb3RSaWdodFRyaWFuZ2xlRXF1YWwgIiYjeDIyRUQ7Ij48IUVOVElUWSB2ZWxsaXAgIiYjeDIyRUU7Ij48IUVOVElUWSBjdGRvdCAiJiN4MjJFRjsiPjwhRU5USVRZIHV0ZG90ICImI3gyMkYwOyI%2BPCFFTlRJVFkgZHRkb3QgIiYjeDIyRjE7Ij48IUVOVElUWSBkaXNpbiAiJiN4MjJGMjsiPjwhRU5USVRZIGlzaW5zdiAiJiN4MjJGMzsiPjwhRU5USVRZIGlzaW5zICImI3gyMkY0OyI%2BPCFFTlRJVFkgaXNpbmRvdCAiJiN4MjJGNTsiPjwhRU5USVRZIG5vdGluZG90ICImI3gyMkY1OyYjeDMzODsiPjwhRU5USVRZIG5vdGludmMgIiYjeDIyRjY7Ij48IUVOVElUWSBub3RpbnZiICImI3gyMkY3OyI%2BPCFFTlRJVFkgaXNpbkUgIiYjeDIyRjk7Ij48IUVOVElUWSBub3RpbkUgIiYjeDIyRjk7JiN4MzM4OyI%2BPCFFTlRJVFkgbmlzZCAiJiN4MjJGQTsiPjwhRU5USVRZIHhuaXMgIiYjeDIyRkI7Ij48IUVOVElUWSBuaXMgIiYjeDIyRkM7Ij48IUVOVElUWSBub3RuaXZjICImI3gyMkZEOyI%2BPCFFTlRJVFkgbm90bml2YiAiJiN4MjJGRTsiPjwhRU5USVRZIGJhcndlZCAiJiN4MjMwNTsiPjwhRU5USVRZIGJhcndlZGdlICImI3gyMzA1OyI%2BPCFFTlRJVFkgQmFyd2VkICImI3gyMzA2OyI%2BPCFFTlRJVFkgZG91YmxlYmFyd2VkZ2UgIiYjeDIzMDY7Ij48IUVOVElUWSBsY2VpbCAiJiN4MjMwODsiPjwhRU5USVRZIExlZnRDZWlsaW5nICImI3gyMzA4OyI%2BPCFFTlRJVFkgcmNlaWwgIiYjeDIzMDk7Ij48IUVOVElUWSBSaWdodENlaWxpbmcgIiYjeDIzMDk7Ij48IUVOVElUWSBsZmxvb3IgIiYjeDIzMEE7Ij48IUVOVElUWSBMZWZ0Rmxvb3IgIiYjeDIzMEE7Ij48IUVOVElUWSByZmxvb3IgIiYjeDIzMEI7Ij48IUVOVElUWSBSaWdodEZsb29yICImI3gyMzBCOyI%2BPCFFTlRJVFkgZHJjcm9wICImI3gyMzBDOyI%2BPCFFTlRJVFkgZGxjcm9wICImI3gyMzBEOyI%2BPCFFTlRJVFkgdXJjcm9wICImI3gyMzBFOyI%2BPCFFTlRJVFkgdWxjcm9wICImI3gyMzBGOyI%2BPCFFTlRJVFkgYm5vdCAiJiN4MjMxMDsiPjwhRU5USVRZIHByb2ZsaW5lICImI3gyMzEyOyI%2BPCFFTlRJVFkgcHJvZnN1cmYgIiYjeDIzMTM7Ij48IUVOVElUWSB0ZWxyZWMgIiYjeDIzMTU7Ij48IUVOVElUWSB0YXJnZXQgIiYjeDIzMTY7Ij48IUVOVElUWSB1bGNvcm4gIiYjeDIzMUM7Ij48IUVOVElUWSB1bGNvcm5lciAiJiN4MjMxQzsiPjwhRU5USVRZIHVyY29ybiAiJiN4MjMxRDsiPjwhRU5USVRZIHVyY29ybmVyICImI3gyMzFEOyI%2BPCFFTlRJVFkgZGxjb3JuICImI3gyMzFFOyI%2BPCFFTlRJVFkgbGxjb3JuZXIgIiYjeDIzMUU7Ij48IUVOVElUWSBkcmNvcm4gIiYjeDIzMUY7Ij48IUVOVElUWSBscmNvcm5lciAiJiN4MjMxRjsiPjwhRU5USVRZIGZyb3duICImI3gyMzIyOyI%2BPCFFTlRJVFkgc2Zyb3duICImI3gyMzIyOyI%2BPCFFTlRJVFkgc21pbGUgIiYjeDIzMjM7Ij48IUVOVElUWSBzc21pbGUgIiYjeDIzMjM7Ij48IUVOVElUWSBjeWxjdHkgIiYjeDIzMkQ7Ij48IUVOVElUWSBwcm9mYWxhciAiJiN4MjMyRTsiPjwhRU5USVRZIHRvcGJvdCAiJiN4MjMzNjsiPjwhRU5USVRZIG92YmFyICImI3gyMzNEOyI%2BPCFFTlRJVFkgc29sYmFyICImI3gyMzNGOyI%2BPCFFTlRJVFkgYW5nemFyciAiJiN4MjM3QzsiPjwhRU5USVRZIGxtb3VzdCAiJiN4MjNCMDsiPjwhRU5USVRZIGxtb3VzdGFjaGUgIiYjeDIzQjA7Ij48IUVOVElUWSBybW91c3QgIiYjeDIzQjE7Ij48IUVOVElUWSBybW91c3RhY2hlICImI3gyM0IxOyI%2BPCFFTlRJVFkgdGJyayAiJiN4MjNCNDsiPjwhRU5USVRZIE92ZXJCcmFja2V0ICImI3gyM0I0OyI%2BPCFFTlRJVFkgYmJyayAiJiN4MjNCNTsiPjwhRU5USVRZIFVuZGVyQnJhY2tldCAiJiN4MjNCNTsiPjwhRU5USVRZIGJicmt0YnJrICImI3gyM0I2OyI%2BPCFFTlRJVFkgT3ZlclBhcmVudGhlc2lzICImI3gyM0RDOyI%2BPCFFTlRJVFkgVW5kZXJQYXJlbnRoZXNpcyAiJiN4MjNERDsiPjwhRU5USVRZIE92ZXJCcmFjZSAiJiN4MjNERTsiPjwhRU5USVRZIFVuZGVyQnJhY2UgIiYjeDIzREY7Ij48IUVOVElUWSB0cnBleml1bSAiJiN4MjNFMjsiPjwhRU5USVRZIGVsaW50ZXJzICImI3gyM0U3OyI%2BPCFFTlRJVFkgYmxhbmsgIiYjeDI0MjM7Ij48IUVOVElUWSBvUyAiJiN4MjRDODsiPjwhRU5USVRZIGNpcmNsZWRTICImI3gyNEM4OyI%2BPCFFTlRJVFkgYm94aCAiJiN4MjUwMDsiPjwhRU5USVRZIEhvcml6b250YWxMaW5lICImI3gyNTAwOyI%2BPCFFTlRJVFkgYm94diAiJiN4MjUwMjsiPjwhRU5USVRZIGJveGRyICImI3gyNTBDOyI%2BPCFFTlRJVFkgYm94ZGwgIiYjeDI1MTA7Ij48IUVOVElUWSBib3h1ciAiJiN4MjUxNDsiPjwhRU5USVRZIGJveHVsICImI3gyNTE4OyI%2BPCFFTlRJVFkgYm94dnIgIiYjeDI1MUM7Ij48IUVOVElUWSBib3h2bCAiJiN4MjUyNDsiPjwhRU5USVRZIGJveGhkICImI3gyNTJDOyI%2BPCFFTlRJVFkgYm94aHUgIiYjeDI1MzQ7Ij48IUVOVElUWSBib3h2aCAiJiN4MjUzQzsiPjwhRU5USVRZIGJveEggIiYjeDI1NTA7Ij48IUVOVElUWSBib3hWICImI3gyNTUxOyI%2BPCFFTlRJVFkgYm94ZFIgIiYjeDI1NTI7Ij48IUVOVElUWSBib3hEciAiJiN4MjU1MzsiPjwhRU5USVRZIGJveERSICImI3gyNTU0OyI%2BPCFFTlRJVFkgYm94ZEwgIiYjeDI1NTU7Ij48IUVOVElUWSBib3hEbCAiJiN4MjU1NjsiPjwhRU5USVRZIGJveERMICImI3gyNTU3OyI%2BPCFFTlRJVFkgYm94dVIgIiYjeDI1NTg7Ij48IUVOVElUWSBib3hVciAiJiN4MjU1OTsiPjwhRU5USVRZIGJveFVSICImI3gyNTVBOyI%2BPCFFTlRJVFkgYm94dUwgIiYjeDI1NUI7Ij48IUVOVElUWSBib3hVbCAiJiN4MjU1QzsiPjwhRU5USVRZIGJveFVMICImI3gyNTVEOyI%2BPCFFTlRJVFkgYm94dlIgIiYjeDI1NUU7Ij48IUVOVElUWSBib3hWciAiJiN4MjU1RjsiPjwhRU5USVRZIGJveFZSICImI3gyNTYwOyI%2BPCFFTlRJVFkgYm94dkwgIiYjeDI1NjE7Ij48IUVOVElUWSBib3hWbCAiJiN4MjU2MjsiPjwhRU5USVRZIGJveFZMICImI3gyNTYzOyI%2BPCFFTlRJVFkgYm94SGQgIiYjeDI1NjQ7Ij48IUVOVElUWSBib3hoRCAiJiN4MjU2NTsiPjwhRU5USVRZIGJveEhEICImI3gyNTY2OyI%2BPCFFTlRJVFkgYm94SHUgIiYjeDI1Njc7Ij48IUVOVElUWSBib3hoVSAiJiN4MjU2ODsiPjwhRU5USVRZIGJveEhVICImI3gyNTY5OyI%2BPCFFTlRJVFkgYm94dkggIiYjeDI1NkE7Ij48IUVOVElUWSBib3hWaCAiJiN4MjU2QjsiPjwhRU5USVRZIGJveFZIICImI3gyNTZDOyI%2BPCFFTlRJVFkgdWhibGsgIiYjeDI1ODA7Ij48IUVOVElUWSBsaGJsayAiJiN4MjU4NDsiPjwhRU5USVRZIGJsb2NrICImI3gyNTg4OyI%2BPCFFTlRJVFkgYmxrMTQgIiYjeDI1OTE7Ij48IUVOVElUWSBibGsxMiAiJiN4MjU5MjsiPjwhRU5USVRZIGJsazM0ICImI3gyNTkzOyI%2BPCFFTlRJVFkgc3F1ICImI3gyNUExOyI%2BPCFFTlRJVFkgc3F1YXJlICImI3gyNUExOyI%2BPCFFTlRJVFkgU3F1YXJlICImI3gyNUExOyI%2BPCFFTlRJVFkgc3F1ZiAiJiN4MjVBQTsiPjwhRU5USVRZIHNxdWFyZiAiJiN4MjVBQTsiPjwhRU5USVRZIGJsYWNrc3F1YXJlICImI3gyNUFBOyI%2BPCFFTlRJVFkgRmlsbGVkVmVyeVNtYWxsU3F1YXJlICImI3gyNUFBOyI%2BPCFFTlRJVFkgRW1wdHlWZXJ5U21hbGxTcXVhcmUgIiYjeDI1QUI7Ij48IUVOVElUWSByZWN0ICImI3gyNUFEOyI%2BPCFFTlRJVFkgbWFya2VyICImI3gyNUFFOyI%2BPCFFTlRJVFkgZmx0bnMgIiYjeDI1QjE7Ij48IUVOVElUWSB4dXRyaSAiJiN4MjVCMzsiPjwhRU5USVRZIGJpZ3RyaWFuZ2xldXAgIiYjeDI1QjM7Ij48IUVOVElUWSB1dHJpZiAiJiN4MjVCNDsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGUgIiYjeDI1QjQ7Ij48IUVOVElUWSB1dHJpICImI3gyNUI1OyI%2BPCFFTlRJVFkgdHJpYW5nbGUgIiYjeDI1QjU7Ij48IUVOVElUWSBydHJpZiAiJiN4MjVCODsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVyaWdodCAiJiN4MjVCODsiPjwhRU5USVRZIHJ0cmkgIiYjeDI1Qjk7Ij48IUVOVElUWSB0cmlhbmdsZXJpZ2h0ICImI3gyNUI5OyI%2BPCFFTlRJVFkgeGR0cmkgIiYjeDI1QkQ7Ij48IUVOVElUWSBiaWd0cmlhbmdsZWRvd24gIiYjeDI1QkQ7Ij48IUVOVElUWSBkdHJpZiAiJiN4MjVCRTsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVkb3duICImI3gyNUJFOyI%2BPCFFTlRJVFkgZHRyaSAiJiN4MjVCRjsiPjwhRU5USVRZIHRyaWFuZ2xlZG93biAiJiN4MjVCRjsiPjwhRU5USVRZIGx0cmlmICImI3gyNUMyOyI%2BPCFFTlRJVFkgYmxhY2t0cmlhbmdsZWxlZnQgIiYjeDI1QzI7Ij48IUVOVElUWSBsdHJpICImI3gyNUMzOyI%2BPCFFTlRJVFkgdHJpYW5nbGVsZWZ0ICImI3gyNUMzOyI%2BPCFFTlRJVFkgbG96ICImI3gyNUNBOyI%2BPCFFTlRJVFkgbG96ZW5nZSAiJiN4MjVDQTsiPjwhRU5USVRZIGNpciAiJiN4MjVDQjsiPjwhRU5USVRZIHRyaWRvdCAiJiN4MjVFQzsiPjwhRU5USVRZIHhjaXJjICImI3gyNUVGOyI%2BPCFFTlRJVFkgYmlnY2lyYyAiJiN4MjVFRjsiPjwhRU5USVRZIHVsdHJpICImI3gyNUY4OyI%2BPCFFTlRJVFkgdXJ0cmkgIiYjeDI1Rjk7Ij48IUVOVElUWSBsbHRyaSAiJiN4MjVGQTsiPjwhRU5USVRZIEVtcHR5U21hbGxTcXVhcmUgIiYjeDI1RkI7Ij48IUVOVElUWSBGaWxsZWRTbWFsbFNxdWFyZSAiJiN4MjVGQzsiPjwhRU5USVRZIHN0YXJmICImI3gyNjA1OyI%2BPCFFTlRJVFkgYmlnc3RhciAiJiN4MjYwNTsiPjwhRU5USVRZIHN0YXIgIiYjeDI2MDY7Ij48IUVOVElUWSBwaG9uZSAiJiN4MjYwRTsiPjwhRU5USVRZIGZlbWFsZSAiJiN4MjY0MDsiPjwhRU5USVRZIG1hbGUgIiYjeDI2NDI7Ij48IUVOVElUWSBzcGFkZXMgIiYjeDI2NjA7Ij48IUVOVElUWSBzcGFkZXN1aXQgIiYjeDI2NjA7Ij48IUVOVElUWSBjbHVicyAiJiN4MjY2MzsiPjwhRU5USVRZIGNsdWJzdWl0ICImI3gyNjYzOyI%2BPCFFTlRJVFkgaGVhcnRzICImI3gyNjY1OyI%2BPCFFTlRJVFkgaGVhcnRzdWl0ICImI3gyNjY1OyI%2BPCFFTlRJVFkgZGlhbXMgIiYjeDI2NjY7Ij48IUVOVElUWSBkaWFtb25kc3VpdCAiJiN4MjY2NjsiPjwhRU5USVRZIHN1bmcgIiYjeDI2NkE7Ij48IUVOVElUWSBmbGF0ICImI3gyNjZEOyI%2BPCFFTlRJVFkgbmF0dXIgIiYjeDI2NkU7Ij48IUVOVElUWSBuYXR1cmFsICImI3gyNjZFOyI%2BPCFFTlRJVFkgc2hhcnAgIiYjeDI2NkY7Ij48IUVOVElUWSBjaGVjayAiJiN4MjcxMzsiPjwhRU5USVRZIGNoZWNrbWFyayAiJiN4MjcxMzsiPjwhRU5USVRZIGNyb3NzICImI3gyNzE3OyI%2BPCFFTlRJVFkgbWFsdCAiJiN4MjcyMDsiPjwhRU5USVRZIG1hbHRlc2UgIiYjeDI3MjA7Ij48IUVOVElUWSBzZXh0ICImI3gyNzM2OyI%2BPCFFTlRJVFkgVmVydGljYWxTZXBhcmF0b3IgIiYjeDI3NTg7Ij48IUVOVElUWSBsYmJyayAiJiN4Mjc3MjsiPjwhRU5USVRZIHJiYnJrICImI3gyNzczOyI%2BPCFFTlRJVFkgYnNvbGhzdWIgIiYjeDI3Qzg7Ij48IUVOVElUWSBzdXBoc29sICImI3gyN0M5OyI%2BPCFFTlRJVFkgbG9icmsgIiYjeDI3RTY7Ij48IUVOVElUWSBMZWZ0RG91YmxlQnJhY2tldCAiJiN4MjdFNjsiPjwhRU5USVRZIHJvYnJrICImI3gyN0U3OyI%2BPCFFTlRJVFkgUmlnaHREb3VibGVCcmFja2V0ICImI3gyN0U3OyI%2BPCFFTlRJVFkgbGFuZyAiJiN4MjdFODsiPjwhRU5USVRZIExlZnRBbmdsZUJyYWNrZXQgIiYjeDI3RTg7Ij48IUVOVElUWSBsYW5nbGUgIiYjeDI3RTg7Ij48IUVOVElUWSByYW5nICImI3gyN0U5OyI%2BPCFFTlRJVFkgUmlnaHRBbmdsZUJyYWNrZXQgIiYjeDI3RTk7Ij48IUVOVElUWSByYW5nbGUgIiYjeDI3RTk7Ij48IUVOVElUWSBMYW5nICImI3gyN0VBOyI%2BPCFFTlRJVFkgUmFuZyAiJiN4MjdFQjsiPjwhRU5USVRZIGxvYW5nICImI3gyN0VDOyI%2BPCFFTlRJVFkgcm9hbmcgIiYjeDI3RUQ7Ij48IUVOVElUWSB4bGFyciAiJiN4MjdGNTsiPjwhRU5USVRZIGxvbmdsZWZ0YXJyb3cgIiYjeDI3RjU7Ij48IUVOVElUWSBMb25nTGVmdEFycm93ICImI3gyN0Y1OyI%2BPCFFTlRJVFkgeHJhcnIgIiYjeDI3RjY7Ij48IUVOVElUWSBsb25ncmlnaHRhcnJvdyAiJiN4MjdGNjsiPjwhRU5USVRZIExvbmdSaWdodEFycm93ICImI3gyN0Y2OyI%2BPCFFTlRJVFkgeGhhcnIgIiYjeDI3Rjc7Ij48IUVOVElUWSBsb25nbGVmdHJpZ2h0YXJyb3cgIiYjeDI3Rjc7Ij48IUVOVElUWSBMb25nTGVmdFJpZ2h0QXJyb3cgIiYjeDI3Rjc7Ij48IUVOVElUWSB4bEFyciAiJiN4MjdGODsiPjwhRU5USVRZIExvbmdsZWZ0YXJyb3cgIiYjeDI3Rjg7Ij48IUVOVElUWSBEb3VibGVMb25nTGVmdEFycm93ICImI3gyN0Y4OyI%2BPCFFTlRJVFkgeHJBcnIgIiYjeDI3Rjk7Ij48IUVOVElUWSBMb25ncmlnaHRhcnJvdyAiJiN4MjdGOTsiPjwhRU5USVRZIERvdWJsZUxvbmdSaWdodEFycm93ICImI3gyN0Y5OyI%2BPCFFTlRJVFkgeGhBcnIgIiYjeDI3RkE7Ij48IUVOVElUWSBMb25nbGVmdHJpZ2h0YXJyb3cgIiYjeDI3RkE7Ij48IUVOVElUWSBEb3VibGVMb25nTGVmdFJpZ2h0QXJyb3cgIiYjeDI3RkE7Ij48IUVOVElUWSB4bWFwICImI3gyN0ZDOyI%2BPCFFTlRJVFkgbG9uZ21hcHN0byAiJiN4MjdGQzsiPjwhRU5USVRZIGR6aWdyYXJyICImI3gyN0ZGOyI%2BPCFFTlRJVFkgbnZsQXJyICImI3gyOTAyOyI%2BPCFFTlRJVFkgbnZyQXJyICImI3gyOTAzOyI%2BPCFFTlRJVFkgbnZIYXJyICImI3gyOTA0OyI%2BPCFFTlRJVFkgTWFwICImI3gyOTA1OyI%2BPCFFTlRJVFkgbGJhcnIgIiYjeDI5MEM7Ij48IUVOVElUWSByYmFyciAiJiN4MjkwRDsiPjwhRU5USVRZIGJrYXJvdyAiJiN4MjkwRDsiPjwhRU5USVRZIGxCYXJyICImI3gyOTBFOyI%2BPCFFTlRJVFkgckJhcnIgIiYjeDI5MEY7Ij48IUVOVElUWSBkYmthcm93ICImI3gyOTBGOyI%2BPCFFTlRJVFkgUkJhcnIgIiYjeDI5MTA7Ij48IUVOVElUWSBkcmJrYXJvdyAiJiN4MjkxMDsiPjwhRU5USVRZIEREb3RyYWhkICImI3gyOTExOyI%2BPCFFTlRJVFkgVXBBcnJvd0JhciAiJiN4MjkxMjsiPjwhRU5USVRZIERvd25BcnJvd0JhciAiJiN4MjkxMzsiPjwhRU5USVRZIFJhcnJ0bCAiJiN4MjkxNjsiPjwhRU5USVRZIGxhdGFpbCAiJiN4MjkxOTsiPjwhRU5USVRZIHJhdGFpbCAiJiN4MjkxQTsiPjwhRU5USVRZIGxBdGFpbCAiJiN4MjkxQjsiPjwhRU5USVRZIHJBdGFpbCAiJiN4MjkxQzsiPjwhRU5USVRZIGxhcnJmcyAiJiN4MjkxRDsiPjwhRU5USVRZIHJhcnJmcyAiJiN4MjkxRTsiPjwhRU5USVRZIGxhcnJiZnMgIiYjeDI5MUY7Ij48IUVOVElUWSByYXJyYmZzICImI3gyOTIwOyI%2BPCFFTlRJVFkgbndhcmhrICImI3gyOTIzOyI%2BPCFFTlRJVFkgbmVhcmhrICImI3gyOTI0OyI%2BPCFFTlRJVFkgc2VhcmhrICImI3gyOTI1OyI%2BPCFFTlRJVFkgaGtzZWFyb3cgIiYjeDI5MjU7Ij48IUVOVElUWSBzd2FyaGsgIiYjeDI5MjY7Ij48IUVOVElUWSBoa3N3YXJvdyAiJiN4MjkyNjsiPjwhRU5USVRZIG53bmVhciAiJiN4MjkyNzsiPjwhRU5USVRZIG5lc2VhciAiJiN4MjkyODsiPjwhRU5USVRZIHRvZWEgIiYjeDI5Mjg7Ij48IUVOVElUWSBzZXN3YXIgIiYjeDI5Mjk7Ij48IUVOVElUWSB0b3NhICImI3gyOTI5OyI%2BPCFFTlRJVFkgc3dud2FyICImI3gyOTJBOyI%2BPCFFTlRJVFkgcmFycmMgIiYjeDI5MzM7Ij48IUVOVElUWSBucmFycmMgIiYjeDI5MzM7JiN4MzM4OyI%2BPCFFTlRJVFkgY3VkYXJyciAiJiN4MjkzNTsiPjwhRU5USVRZIGxkY2EgIiYjeDI5MzY7Ij48IUVOVElUWSByZGNhICImI3gyOTM3OyI%2BPCFFTlRJVFkgY3VkYXJybCAiJiN4MjkzODsiPjwhRU5USVRZIGxhcnJwbCAiJiN4MjkzOTsiPjwhRU5USVRZIGN1cmFycm0gIiYjeDI5M0M7Ij48IUVOVElUWSBjdWxhcnJwICImI3gyOTNEOyI%2BPCFFTlRJVFkgcmFycnBsICImI3gyOTQ1OyI%2BPCFFTlRJVFkgaGFycmNpciAiJiN4Mjk0ODsiPjwhRU5USVRZIFVhcnJvY2lyICImI3gyOTQ5OyI%2BPCFFTlRJVFkgbHVyZHNoYXIgIiYjeDI5NEE7Ij48IUVOVElUWSBsZHJ1c2hhciAiJiN4Mjk0QjsiPjwhRU5USVRZIExlZnRSaWdodFZlY3RvciAiJiN4Mjk0RTsiPjwhRU5USVRZIFJpZ2h0VXBEb3duVmVjdG9yICImI3gyOTRGOyI%2BPCFFTlRJVFkgRG93bkxlZnRSaWdodFZlY3RvciAiJiN4Mjk1MDsiPjwhRU5USVRZIExlZnRVcERvd25WZWN0b3IgIiYjeDI5NTE7Ij48IUVOVElUWSBMZWZ0VmVjdG9yQmFyICImI3gyOTUyOyI%2BPCFFTlRJVFkgUmlnaHRWZWN0b3JCYXIgIiYjeDI5NTM7Ij48IUVOVElUWSBSaWdodFVwVmVjdG9yQmFyICImI3gyOTU0OyI%2BPCFFTlRJVFkgUmlnaHREb3duVmVjdG9yQmFyICImI3gyOTU1OyI%2BPCFFTlRJVFkgRG93bkxlZnRWZWN0b3JCYXIgIiYjeDI5NTY7Ij48IUVOVElUWSBEb3duUmlnaHRWZWN0b3JCYXIgIiYjeDI5NTc7Ij48IUVOVElUWSBMZWZ0VXBWZWN0b3JCYXIgIiYjeDI5NTg7Ij48IUVOVElUWSBMZWZ0RG93blZlY3RvckJhciAiJiN4Mjk1OTsiPjwhRU5USVRZIExlZnRUZWVWZWN0b3IgIiYjeDI5NUE7Ij48IUVOVElUWSBSaWdodFRlZVZlY3RvciAiJiN4Mjk1QjsiPjwhRU5USVRZIFJpZ2h0VXBUZWVWZWN0b3IgIiYjeDI5NUM7Ij48IUVOVElUWSBSaWdodERvd25UZWVWZWN0b3IgIiYjeDI5NUQ7Ij48IUVOVElUWSBEb3duTGVmdFRlZVZlY3RvciAiJiN4Mjk1RTsiPjwhRU5USVRZIERvd25SaWdodFRlZVZlY3RvciAiJiN4Mjk1RjsiPjwhRU5USVRZIExlZnRVcFRlZVZlY3RvciAiJiN4Mjk2MDsiPjwhRU5USVRZIExlZnREb3duVGVlVmVjdG9yICImI3gyOTYxOyI%2BPCFFTlRJVFkgbEhhciAiJiN4Mjk2MjsiPjwhRU5USVRZIHVIYXIgIiYjeDI5NjM7Ij48IUVOVElUWSBySGFyICImI3gyOTY0OyI%2BPCFFTlRJVFkgZEhhciAiJiN4Mjk2NTsiPjwhRU5USVRZIGx1cnVoYXIgIiYjeDI5NjY7Ij48IUVOVElUWSBsZHJkaGFyICImI3gyOTY3OyI%2BPCFFTlRJVFkgcnVsdWhhciAiJiN4Mjk2ODsiPjwhRU5USVRZIHJkbGRoYXIgIiYjeDI5Njk7Ij48IUVOVElUWSBsaGFydWwgIiYjeDI5NkE7Ij48IUVOVElUWSBsbGhhcmQgIiYjeDI5NkI7Ij48IUVOVElUWSByaGFydWwgIiYjeDI5NkM7Ij48IUVOVElUWSBscmhhcmQgIiYjeDI5NkQ7Ij48IUVOVElUWSB1ZGhhciAiJiN4Mjk2RTsiPjwhRU5USVRZIFVwRXF1aWxpYnJpdW0gIiYjeDI5NkU7Ij48IUVOVElUWSBkdWhhciAiJiN4Mjk2RjsiPjwhRU5USVRZIFJldmVyc2VVcEVxdWlsaWJyaXVtICImI3gyOTZGOyI%2BPCFFTlRJVFkgUm91bmRJbXBsaWVzICImI3gyOTcwOyI%2BPCFFTlRJVFkgZXJhcnIgIiYjeDI5NzE7Ij48IUVOVElUWSBzaW1yYXJyICImI3gyOTcyOyI%2BPCFFTlRJVFkgbGFycnNpbSAiJiN4Mjk3MzsiPjwhRU5USVRZIHJhcnJzaW0gIiYjeDI5NzQ7Ij48IUVOVElUWSByYXJyYXAgIiYjeDI5NzU7Ij48IUVOVElUWSBsdGxhcnIgIiYjeDI5NzY7Ij48IUVOVElUWSBndHJhcnIgIiYjeDI5Nzg7Ij48IUVOVElUWSBzdWJyYXJyICImI3gyOTc5OyI%2BPCFFTlRJVFkgc3VwbGFyciAiJiN4Mjk3QjsiPjwhRU5USVRZIGxmaXNodCAiJiN4Mjk3QzsiPjwhRU5USVRZIHJmaXNodCAiJiN4Mjk3RDsiPjwhRU5USVRZIHVmaXNodCAiJiN4Mjk3RTsiPjwhRU5USVRZIGRmaXNodCAiJiN4Mjk3RjsiPjwhRU5USVRZIGxvcGFyICImI3gyOTg1OyI%2BPCFFTlRJVFkgcm9wYXIgIiYjeDI5ODY7Ij48IUVOVElUWSBsYnJrZSAiJiN4Mjk4QjsiPjwhRU5USVRZIHJicmtlICImI3gyOThDOyI%2BPCFFTlRJVFkgbGJya3NsdSAiJiN4Mjk4RDsiPjwhRU5USVRZIHJicmtzbGQgIiYjeDI5OEU7Ij48IUVOVElUWSBsYnJrc2xkICImI3gyOThGOyI%2BPCFFTlRJVFkgcmJya3NsdSAiJiN4Mjk5MDsiPjwhRU5USVRZIGxhbmdkICImI3gyOTkxOyI%2BPCFFTlRJVFkgcmFuZ2QgIiYjeDI5OTI7Ij48IUVOVElUWSBscGFybHQgIiYjeDI5OTM7Ij48IUVOVElUWSBycGFyZ3QgIiYjeDI5OTQ7Ij48IUVOVElUWSBndGxQYXIgIiYjeDI5OTU7Ij48IUVOVElUWSBsdHJQYXIgIiYjeDI5OTY7Ij48IUVOVElUWSB2emlnemFnICImI3gyOTlBOyI%2BPCFFTlRJVFkgdmFuZ3J0ICImI3gyOTlDOyI%2BPCFFTlRJVFkgYW5ncnR2YmQgIiYjeDI5OUQ7Ij48IUVOVElUWSBhbmdlICImI3gyOUE0OyI%2BPCFFTlRJVFkgcmFuZ2UgIiYjeDI5QTU7Ij48IUVOVElUWSBkd2FuZ2xlICImI3gyOUE2OyI%2BPCFFTlRJVFkgdXdhbmdsZSAiJiN4MjlBNzsiPjwhRU5USVRZIGFuZ21zZGFhICImI3gyOUE4OyI%2BPCFFTlRJVFkgYW5nbXNkYWIgIiYjeDI5QTk7Ij48IUVOVElUWSBhbmdtc2RhYyAiJiN4MjlBQTsiPjwhRU5USVRZIGFuZ21zZGFkICImI3gyOUFCOyI%2BPCFFTlRJVFkgYW5nbXNkYWUgIiYjeDI5QUM7Ij48IUVOVElUWSBhbmdtc2RhZiAiJiN4MjlBRDsiPjwhRU5USVRZIGFuZ21zZGFnICImI3gyOUFFOyI%2BPCFFTlRJVFkgYW5nbXNkYWggIiYjeDI5QUY7Ij48IUVOVElUWSBiZW1wdHl2ICImI3gyOUIwOyI%2BPCFFTlRJVFkgZGVtcHR5diAiJiN4MjlCMTsiPjwhRU5USVRZIGNlbXB0eXYgIiYjeDI5QjI7Ij48IUVOVElUWSByYWVtcHR5diAiJiN4MjlCMzsiPjwhRU5USVRZIGxhZW1wdHl2ICImI3gyOUI0OyI%2BPCFFTlRJVFkgb2hiYXIgIiYjeDI5QjU7Ij48IUVOVElUWSBvbWlkICImI3gyOUI2OyI%2BPCFFTlRJVFkgb3BhciAiJiN4MjlCNzsiPjwhRU5USVRZIG9wZXJwICImI3gyOUI5OyI%2BPCFFTlRJVFkgb2xjcm9zcyAiJiN4MjlCQjsiPjwhRU5USVRZIG9kc29sZCAiJiN4MjlCQzsiPjwhRU5USVRZIG9sY2lyICImI3gyOUJFOyI%2BPCFFTlRJVFkgb2ZjaXIgIiYjeDI5QkY7Ij48IUVOVElUWSBvbHQgIiYjeDI5QzA7Ij48IUVOVElUWSBvZ3QgIiYjeDI5QzE7Ij48IUVOVElUWSBjaXJzY2lyICImI3gyOUMyOyI%2BPCFFTlRJVFkgY2lyRSAiJiN4MjlDMzsiPjwhRU5USVRZIHNvbGIgIiYjeDI5QzQ7Ij48IUVOVElUWSBic29sYiAiJiN4MjlDNTsiPjwhRU5USVRZIGJveGJveCAiJiN4MjlDOTsiPjwhRU5USVRZIHRyaXNiICImI3gyOUNEOyI%2BPCFFTlRJVFkgcnRyaWx0cmkgIiYjeDI5Q0U7Ij48IUVOVElUWSBMZWZ0VHJpYW5nbGVCYXIgIiYjeDI5Q0Y7Ij48IUVOVElUWSBOb3RMZWZ0VHJpYW5nbGVCYXIgIiYjeDI5Q0Y7JiN4MzM4OyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZUJhciAiJiN4MjlEMDsiPjwhRU5USVRZIE5vdFJpZ2h0VHJpYW5nbGVCYXIgIiYjeDI5RDA7JiN4MzM4OyI%2BPCFFTlRJVFkgaWluZmluICImI3gyOURDOyI%2BPCFFTlRJVFkgaW5maW50aWUgIiYjeDI5REQ7Ij48IUVOVElUWSBudmluZmluICImI3gyOURFOyI%2BPCFFTlRJVFkgZXBhcnNsICImI3gyOUUzOyI%2BPCFFTlRJVFkgc21lcGFyc2wgIiYjeDI5RTQ7Ij48IUVOVElUWSBlcXZwYXJzbCAiJiN4MjlFNTsiPjwhRU5USVRZIGxvemYgIiYjeDI5RUI7Ij48IUVOVElUWSBibGFja2xvemVuZ2UgIiYjeDI5RUI7Ij48IUVOVElUWSBSdWxlRGVsYXllZCAiJiN4MjlGNDsiPjwhRU5USVRZIGRzb2wgIiYjeDI5RjY7Ij48IUVOVElUWSB4b2RvdCAiJiN4MkEwMDsiPjwhRU5USVRZIGJpZ29kb3QgIiYjeDJBMDA7Ij48IUVOVElUWSB4b3BsdXMgIiYjeDJBMDE7Ij48IUVOVElUWSBiaWdvcGx1cyAiJiN4MkEwMTsiPjwhRU5USVRZIHhvdGltZSAiJiN4MkEwMjsiPjwhRU5USVRZIGJpZ290aW1lcyAiJiN4MkEwMjsiPjwhRU5USVRZIHh1cGx1cyAiJiN4MkEwNDsiPjwhRU5USVRZIGJpZ3VwbHVzICImI3gyQTA0OyI%2BPCFFTlRJVFkgeHNxY3VwICImI3gyQTA2OyI%2BPCFFTlRJVFkgYmlnc3FjdXAgIiYjeDJBMDY7Ij48IUVOVElUWSBxaW50ICImI3gyQTBDOyI%2BPCFFTlRJVFkgaWlpaW50ICImI3gyQTBDOyI%2BPCFFTlRJVFkgZnBhcnRpbnQgIiYjeDJBMEQ7Ij48IUVOVElUWSBjaXJmbmludCAiJiN4MkExMDsiPjwhRU5USVRZIGF3aW50ICImI3gyQTExOyI%2BPCFFTlRJVFkgcnBwb2xpbnQgIiYjeDJBMTI7Ij48IUVOVElUWSBzY3BvbGludCAiJiN4MkExMzsiPjwhRU5USVRZIG5wb2xpbnQgIiYjeDJBMTQ7Ij48IUVOVElUWSBwb2ludGludCAiJiN4MkExNTsiPjwhRU5USVRZIHF1YXRpbnQgIiYjeDJBMTY7Ij48IUVOVElUWSBpbnRsYXJoayAiJiN4MkExNzsiPjwhRU5USVRZIHBsdXNjaXIgIiYjeDJBMjI7Ij48IUVOVElUWSBwbHVzYWNpciAiJiN4MkEyMzsiPjwhRU5USVRZIHNpbXBsdXMgIiYjeDJBMjQ7Ij48IUVOVElUWSBwbHVzZHUgIiYjeDJBMjU7Ij48IUVOVElUWSBwbHVzc2ltICImI3gyQTI2OyI%2BPCFFTlRJVFkgcGx1c3R3byAiJiN4MkEyNzsiPjwhRU5USVRZIG1jb21tYSAiJiN4MkEyOTsiPjwhRU5USVRZIG1pbnVzZHUgIiYjeDJBMkE7Ij48IUVOVElUWSBsb3BsdXMgIiYjeDJBMkQ7Ij48IUVOVElUWSByb3BsdXMgIiYjeDJBMkU7Ij48IUVOVElUWSBDcm9zcyAiJiN4MkEyRjsiPjwhRU5USVRZIHRpbWVzZCAiJiN4MkEzMDsiPjwhRU5USVRZIHRpbWVzYmFyICImI3gyQTMxOyI%2BPCFFTlRJVFkgc21hc2hwICImI3gyQTMzOyI%2BPCFFTlRJVFkgbG90aW1lcyAiJiN4MkEzNDsiPjwhRU5USVRZIHJvdGltZXMgIiYjeDJBMzU7Ij48IUVOVElUWSBvdGltZXNhcyAiJiN4MkEzNjsiPjwhRU5USVRZIE90aW1lcyAiJiN4MkEzNzsiPjwhRU5USVRZIG9kaXYgIiYjeDJBMzg7Ij48IUVOVElUWSB0cmlwbHVzICImI3gyQTM5OyI%2BPCFFTlRJVFkgdHJpbWludXMgIiYjeDJBM0E7Ij48IUVOVElUWSB0cml0aW1lICImI3gyQTNCOyI%2BPCFFTlRJVFkgaXByb2QgIiYjeDJBM0M7Ij48IUVOVElUWSBpbnRwcm9kICImI3gyQTNDOyI%2BPCFFTlRJVFkgYW1hbGcgIiYjeDJBM0Y7Ij48IUVOVElUWSBjYXBkb3QgIiYjeDJBNDA7Ij48IUVOVElUWSBuY3VwICImI3gyQTQyOyI%2BPCFFTlRJVFkgbmNhcCAiJiN4MkE0MzsiPjwhRU5USVRZIGNhcGFuZCAiJiN4MkE0NDsiPjwhRU5USVRZIGN1cG9yICImI3gyQTQ1OyI%2BPCFFTlRJVFkgY3VwY2FwICImI3gyQTQ2OyI%2BPCFFTlRJVFkgY2FwY3VwICImI3gyQTQ3OyI%2BPCFFTlRJVFkgY3VwYnJjYXAgIiYjeDJBNDg7Ij48IUVOVElUWSBjYXBicmN1cCAiJiN4MkE0OTsiPjwhRU5USVRZIGN1cGN1cCAiJiN4MkE0QTsiPjwhRU5USVRZIGNhcGNhcCAiJiN4MkE0QjsiPjwhRU5USVRZIGNjdXBzICImI3gyQTRDOyI%2BPCFFTlRJVFkgY2NhcHMgIiYjeDJBNEQ7Ij48IUVOVElUWSBjY3Vwc3NtICImI3gyQTUwOyI%2BPCFFTlRJVFkgQW5kICImI3gyQTUzOyI%2BPCFFTlRJVFkgT3IgIiYjeDJBNTQ7Ij48IUVOVElUWSBhbmRhbmQgIiYjeDJBNTU7Ij48IUVOVElUWSBvcm9yICImI3gyQTU2OyI%2BPCFFTlRJVFkgb3JzbG9wZSAiJiN4MkE1NzsiPjwhRU5USVRZIGFuZHNsb3BlICImI3gyQTU4OyI%2BPCFFTlRJVFkgYW5kdiAiJiN4MkE1QTsiPjwhRU5USVRZIG9ydiAiJiN4MkE1QjsiPjwhRU5USVRZIGFuZGQgIiYjeDJBNUM7Ij48IUVOVElUWSBvcmQgIiYjeDJBNUQ7Ij48IUVOVElUWSB3ZWRiYXIgIiYjeDJBNUY7Ij48IUVOVElUWSBzZG90ZSAiJiN4MkE2NjsiPjwhRU5USVRZIHNpbWRvdCAiJiN4MkE2QTsiPjwhRU5USVRZIGNvbmdkb3QgIiYjeDJBNkQ7Ij48IUVOVElUWSBuY29uZ2RvdCAiJiN4MkE2RDsmI3gzMzg7Ij48IUVOVElUWSBlYXN0ZXIgIiYjeDJBNkU7Ij48IUVOVElUWSBhcGFjaXIgIiYjeDJBNkY7Ij48IUVOVElUWSBhcEUgIiYjeDJBNzA7Ij48IUVOVElUWSBuYXBFICImI3gyQTcwOyYjeDMzODsiPjwhRU5USVRZIGVwbHVzICImI3gyQTcxOyI%2BPCFFTlRJVFkgcGx1c2UgIiYjeDJBNzI7Ij48IUVOVElUWSBFc2ltICImI3gyQTczOyI%2BPCFFTlRJVFkgQ29sb25lICImI3gyQTc0OyI%2BPCFFTlRJVFkgRXF1YWwgIiYjeDJBNzU7Ij48IUVOVElUWSBlRERvdCAiJiN4MkE3NzsiPjwhRU5USVRZIGRkb3RzZXEgIiYjeDJBNzc7Ij48IUVOVElUWSBlcXVpdkREICImI3gyQTc4OyI%2BPCFFTlRJVFkgbHRjaXIgIiYjeDJBNzk7Ij48IUVOVElUWSBndGNpciAiJiN4MkE3QTsiPjwhRU5USVRZIGx0cXVlc3QgIiYjeDJBN0I7Ij48IUVOVElUWSBndHF1ZXN0ICImI3gyQTdDOyI%2BPCFFTlRJVFkgbGVzICImI3gyQTdEOyI%2BPCFFTlRJVFkgTGVzc1NsYW50RXF1YWwgIiYjeDJBN0Q7Ij48IUVOVElUWSBsZXFzbGFudCAiJiN4MkE3RDsiPjwhRU5USVRZIG5sZXMgIiYjeDJBN0Q7JiN4MzM4OyI%2BPCFFTlRJVFkgTm90TGVzc1NsYW50RXF1YWwgIiYjeDJBN0Q7JiN4MzM4OyI%2BPCFFTlRJVFkgbmxlcXNsYW50ICImI3gyQTdEOyYjeDMzODsiPjwhRU5USVRZIGdlcyAiJiN4MkE3RTsiPjwhRU5USVRZIEdyZWF0ZXJTbGFudEVxdWFsICImI3gyQTdFOyI%2BPCFFTlRJVFkgZ2Vxc2xhbnQgIiYjeDJBN0U7Ij48IUVOVElUWSBuZ2VzICImI3gyQTdFOyYjeDMzODsiPjwhRU5USVRZIE5vdEdyZWF0ZXJTbGFudEVxdWFsICImI3gyQTdFOyYjeDMzODsiPjwhRU5USVRZIG5nZXFzbGFudCAiJiN4MkE3RTsmI3gzMzg7Ij48IUVOVElUWSBsZXNkb3QgIiYjeDJBN0Y7Ij48IUVOVElUWSBnZXNkb3QgIiYjeDJBODA7Ij48IUVOVElUWSBsZXNkb3RvICImI3gyQTgxOyI%2BPCFFTlRJVFkgZ2VzZG90byAiJiN4MkE4MjsiPjwhRU5USVRZIGxlc2RvdG9yICImI3gyQTgzOyI%2BPCFFTlRJVFkgZ2VzZG90b2wgIiYjeDJBODQ7Ij48IUVOVElUWSBsYXAgIiYjeDJBODU7Ij48IUVOVElUWSBsZXNzYXBwcm94ICImI3gyQTg1OyI%2BPCFFTlRJVFkgZ2FwICImI3gyQTg2OyI%2BPCFFTlRJVFkgZ3RyYXBwcm94ICImI3gyQTg2OyI%2BPCFFTlRJVFkgbG5lICImI3gyQTg3OyI%2BPCFFTlRJVFkgbG5lcSAiJiN4MkE4NzsiPjwhRU5USVRZIGduZSAiJiN4MkE4ODsiPjwhRU5USVRZIGduZXEgIiYjeDJBODg7Ij48IUVOVElUWSBsbmFwICImI3gyQTg5OyI%2BPCFFTlRJVFkgbG5hcHByb3ggIiYjeDJBODk7Ij48IUVOVElUWSBnbmFwICImI3gyQThBOyI%2BPCFFTlRJVFkgZ25hcHByb3ggIiYjeDJBOEE7Ij48IUVOVElUWSBsRWcgIiYjeDJBOEI7Ij48IUVOVElUWSBsZXNzZXFxZ3RyICImI3gyQThCOyI%2BPCFFTlRJVFkgZ0VsICImI3gyQThDOyI%2BPCFFTlRJVFkgZ3RyZXFxbGVzcyAiJiN4MkE4QzsiPjwhRU5USVRZIGxzaW1lICImI3gyQThEOyI%2BPCFFTlRJVFkgZ3NpbWUgIiYjeDJBOEU7Ij48IUVOVElUWSBsc2ltZyAiJiN4MkE4RjsiPjwhRU5USVRZIGdzaW1sICImI3gyQTkwOyI%2BPCFFTlRJVFkgbGdFICImI3gyQTkxOyI%2BPCFFTlRJVFkgZ2xFICImI3gyQTkyOyI%2BPCFFTlRJVFkgbGVzZ2VzICImI3gyQTkzOyI%2BPCFFTlRJVFkgZ2VzbGVzICImI3gyQTk0OyI%2BPCFFTlRJVFkgZWxzICImI3gyQTk1OyI%2BPCFFTlRJVFkgZXFzbGFudGxlc3MgIiYjeDJBOTU7Ij48IUVOVElUWSBlZ3MgIiYjeDJBOTY7Ij48IUVOVElUWSBlcXNsYW50Z3RyICImI3gyQTk2OyI%2BPCFFTlRJVFkgZWxzZG90ICImI3gyQTk3OyI%2BPCFFTlRJVFkgZWdzZG90ICImI3gyQTk4OyI%2BPCFFTlRJVFkgZWwgIiYjeDJBOTk7Ij48IUVOVElUWSBlZyAiJiN4MkE5QTsiPjwhRU5USVRZIHNpbWwgIiYjeDJBOUQ7Ij48IUVOVElUWSBzaW1nICImI3gyQTlFOyI%2BPCFFTlRJVFkgc2ltbEUgIiYjeDJBOUY7Ij48IUVOVElUWSBzaW1nRSAiJiN4MkFBMDsiPjwhRU5USVRZIExlc3NMZXNzICImI3gyQUExOyI%2BPCFFTlRJVFkgTm90TmVzdGVkTGVzc0xlc3MgIiYjeDJBQTE7JiN4MzM4OyI%2BPCFFTlRJVFkgR3JlYXRlckdyZWF0ZXIgIiYjeDJBQTI7Ij48IUVOVElUWSBOb3ROZXN0ZWRHcmVhdGVyR3JlYXRlciAiJiN4MkFBMjsmI3gzMzg7Ij48IUVOVElUWSBnbGogIiYjeDJBQTQ7Ij48IUVOVElUWSBnbGEgIiYjeDJBQTU7Ij48IUVOVElUWSBsdGNjICImI3gyQUE2OyI%2BPCFFTlRJVFkgZ3RjYyAiJiN4MkFBNzsiPjwhRU5USVRZIGxlc2NjICImI3gyQUE4OyI%2BPCFFTlRJVFkgZ2VzY2MgIiYjeDJBQTk7Ij48IUVOVElUWSBzbXQgIiYjeDJBQUE7Ij48IUVOVElUWSBsYXQgIiYjeDJBQUI7Ij48IUVOVElUWSBzbXRlICImI3gyQUFDOyI%2BPCFFTlRJVFkgc210ZXMgIiYjeDJBQUM7JiN4RkUwMDsiPjwhRU5USVRZIGxhdGUgIiYjeDJBQUQ7Ij48IUVOVElUWSBsYXRlcyAiJiN4MkFBRDsmI3hGRTAwOyI%2BPCFFTlRJVFkgYnVtcEUgIiYjeDJBQUU7Ij48IUVOVElUWSBwcmUgIiYjeDJBQUY7Ij48IUVOVElUWSBwcmVjZXEgIiYjeDJBQUY7Ij48IUVOVElUWSBQcmVjZWRlc0VxdWFsICImI3gyQUFGOyI%2BPCFFTlRJVFkgbnByZSAiJiN4MkFBRjsmI3gzMzg7Ij48IUVOVElUWSBucHJlY2VxICImI3gyQUFGOyYjeDMzODsiPjwhRU5USVRZIE5vdFByZWNlZGVzRXF1YWwgIiYjeDJBQUY7JiN4MzM4OyI%2BPCFFTlRJVFkgc2NlICImI3gyQUIwOyI%2BPCFFTlRJVFkgc3VjY2VxICImI3gyQUIwOyI%2BPCFFTlRJVFkgU3VjY2VlZHNFcXVhbCAiJiN4MkFCMDsiPjwhRU5USVRZIG5zY2UgIiYjeDJBQjA7JiN4MzM4OyI%2BPCFFTlRJVFkgbnN1Y2NlcSAiJiN4MkFCMDsmI3gzMzg7Ij48IUVOVElUWSBOb3RTdWNjZWVkc0VxdWFsICImI3gyQUIwOyYjeDMzODsiPjwhRU5USVRZIHByRSAiJiN4MkFCMzsiPjwhRU5USVRZIHNjRSAiJiN4MkFCNDsiPjwhRU5USVRZIHBybkUgIiYjeDJBQjU7Ij48IUVOVElUWSBwcmVjbmVxcSAiJiN4MkFCNTsiPjwhRU5USVRZIHNjbkUgIiYjeDJBQjY7Ij48IUVOVElUWSBzdWNjbmVxcSAiJiN4MkFCNjsiPjwhRU5USVRZIHByYXAgIiYjeDJBQjc7Ij48IUVOVElUWSBwcmVjYXBwcm94ICImI3gyQUI3OyI%2BPCFFTlRJVFkgc2NhcCAiJiN4MkFCODsiPjwhRU5USVRZIHN1Y2NhcHByb3ggIiYjeDJBQjg7Ij48IUVOVElUWSBwcm5hcCAiJiN4MkFCOTsiPjwhRU5USVRZIHByZWNuYXBwcm94ICImI3gyQUI5OyI%2BPCFFTlRJVFkgc2NuYXAgIiYjeDJBQkE7Ij48IUVOVElUWSBzdWNjbmFwcHJveCAiJiN4MkFCQTsiPjwhRU5USVRZIFByICImI3gyQUJCOyI%2BPCFFTlRJVFkgU2MgIiYjeDJBQkM7Ij48IUVOVElUWSBzdWJkb3QgIiYjeDJBQkQ7Ij48IUVOVElUWSBzdXBkb3QgIiYjeDJBQkU7Ij48IUVOVElUWSBzdWJwbHVzICImI3gyQUJGOyI%2BPCFFTlRJVFkgc3VwcGx1cyAiJiN4MkFDMDsiPjwhRU5USVRZIHN1Ym11bHQgIiYjeDJBQzE7Ij48IUVOVElUWSBzdXBtdWx0ICImI3gyQUMyOyI%2BPCFFTlRJVFkgc3ViZWRvdCAiJiN4MkFDMzsiPjwhRU5USVRZIHN1cGVkb3QgIiYjeDJBQzQ7Ij48IUVOVElUWSBzdWJFICImI3gyQUM1OyI%2BPCFFTlRJVFkgc3Vic2V0ZXFxICImI3gyQUM1OyI%2BPCFFTlRJVFkgbnN1YkUgIiYjeDJBQzU7JiN4MzM4OyI%2BPCFFTlRJVFkgbnN1YnNldGVxcSAiJiN4MkFDNTsmI3gzMzg7Ij48IUVOVElUWSBzdXBFICImI3gyQUM2OyI%2BPCFFTlRJVFkgc3Vwc2V0ZXFxICImI3gyQUM2OyI%2BPCFFTlRJVFkgbnN1cEUgIiYjeDJBQzY7JiN4MzM4OyI%2BPCFFTlRJVFkgbnN1cHNldGVxcSAiJiN4MkFDNjsmI3gzMzg7Ij48IUVOVElUWSBzdWJzaW0gIiYjeDJBQzc7Ij48IUVOVElUWSBzdXBzaW0gIiYjeDJBQzg7Ij48IUVOVElUWSBzdWJuRSAiJiN4MkFDQjsiPjwhRU5USVRZIHN1YnNldG5lcXEgIiYjeDJBQ0I7Ij48IUVOVElUWSB2c3VibkUgIiYjeDJBQ0I7JiN4RkUwMDsiPjwhRU5USVRZIHZhcnN1YnNldG5lcXEgIiYjeDJBQ0I7JiN4RkUwMDsiPjwhRU5USVRZIHN1cG5FICImI3gyQUNDOyI%2BPCFFTlRJVFkgc3Vwc2V0bmVxcSAiJiN4MkFDQzsiPjwhRU5USVRZIHZzdXBuRSAiJiN4MkFDQzsmI3hGRTAwOyI%2BPCFFTlRJVFkgdmFyc3Vwc2V0bmVxcSAiJiN4MkFDQzsmI3hGRTAwOyI%2BPCFFTlRJVFkgY3N1YiAiJiN4MkFDRjsiPjwhRU5USVRZIGNzdXAgIiYjeDJBRDA7Ij48IUVOVElUWSBjc3ViZSAiJiN4MkFEMTsiPjwhRU5USVRZIGNzdXBlICImI3gyQUQyOyI%2BPCFFTlRJVFkgc3Vic3VwICImI3gyQUQzOyI%2BPCFFTlRJVFkgc3Vwc3ViICImI3gyQUQ0OyI%2BPCFFTlRJVFkgc3Vic3ViICImI3gyQUQ1OyI%2BPCFFTlRJVFkgc3Vwc3VwICImI3gyQUQ2OyI%2BPCFFTlRJVFkgc3VwaHN1YiAiJiN4MkFENzsiPjwhRU5USVRZIHN1cGRzdWIgIiYjeDJBRDg7Ij48IUVOVElUWSBmb3JrdiAiJiN4MkFEOTsiPjwhRU5USVRZIHRvcGZvcmsgIiYjeDJBREE7Ij48IUVOVElUWSBtbGNwICImI3gyQURCOyI%2BPCFFTlRJVFkgRGFzaHYgIiYjeDJBRTQ7Ij48IUVOVElUWSBEb3VibGVMZWZ0VGVlICImI3gyQUU0OyI%2BPCFFTlRJVFkgVmRhc2hsICImI3gyQUU2OyI%2BPCFFTlRJVFkgQmFydiAiJiN4MkFFNzsiPjwhRU5USVRZIHZCYXIgIiYjeDJBRTg7Ij48IUVOVElUWSB2QmFydiAiJiN4MkFFOTsiPjwhRU5USVRZIFZiYXIgIiYjeDJBRUI7Ij48IUVOVElUWSBOb3QgIiYjeDJBRUM7Ij48IUVOVElUWSBiTm90ICImI3gyQUVEOyI%2BPCFFTlRJVFkgcm5taWQgIiYjeDJBRUU7Ij48IUVOVElUWSBjaXJtaWQgIiYjeDJBRUY7Ij48IUVOVElUWSBtaWRjaXIgIiYjeDJBRjA7Ij48IUVOVElUWSB0b3BjaXIgIiYjeDJBRjE7Ij48IUVOVElUWSBuaHBhciAiJiN4MkFGMjsiPjwhRU5USVRZIHBhcnNpbSAiJiN4MkFGMzsiPjwhRU5USVRZIHBhcnNsICImI3gyQUZEOyI%2BPCFFTlRJVFkgbnBhcnNsICImI3gyQUZEOyYjeDIwRTU7Ij48IUVOVElUWSBmZmxpZyAiJiN4RkIwMDsiPjwhRU5USVRZIGZpbGlnICImI3hGQjAxOyI%2BPCFFTlRJVFkgZmxsaWcgIiYjeEZCMDI7Ij48IUVOVElUWSBmZmlsaWcgIiYjeEZCMDM7Ij48IUVOVElUWSBmZmxsaWcgIiYjeEZCMDQ7Ij48IUVOVElUWSBBc2NyICImI3gxRDQ5QzsiPjwhRU5USVRZIENzY3IgIiYjeDFENDlFOyI%2BPCFFTlRJVFkgRHNjciAiJiN4MUQ0OUY7Ij48IUVOVElUWSBHc2NyICImI3gxRDRBMjsiPjwhRU5USVRZIEpzY3IgIiYjeDFENEE1OyI%2BPCFFTlRJVFkgS3NjciAiJiN4MUQ0QTY7Ij48IUVOVElUWSBOc2NyICImI3gxRDRBOTsiPjwhRU5USVRZIE9zY3IgIiYjeDFENEFBOyI%2BPCFFTlRJVFkgUHNjciAiJiN4MUQ0QUI7Ij48IUVOVElUWSBRc2NyICImI3gxRDRBQzsiPjwhRU5USVRZIFNzY3IgIiYjeDFENEFFOyI%2BPCFFTlRJVFkgVHNjciAiJiN4MUQ0QUY7Ij48IUVOVElUWSBVc2NyICImI3gxRDRCMDsiPjwhRU5USVRZIFZzY3IgIiYjeDFENEIxOyI%2BPCFFTlRJVFkgV3NjciAiJiN4MUQ0QjI7Ij48IUVOVElUWSBYc2NyICImI3gxRDRCMzsiPjwhRU5USVRZIFlzY3IgIiYjeDFENEI0OyI%2BPCFFTlRJVFkgWnNjciAiJiN4MUQ0QjU7Ij48IUVOVElUWSBhc2NyICImI3gxRDRCNjsiPjwhRU5USVRZIGJzY3IgIiYjeDFENEI3OyI%2BPCFFTlRJVFkgY3NjciAiJiN4MUQ0Qjg7Ij48IUVOVElUWSBkc2NyICImI3gxRDRCOTsiPjwhRU5USVRZIGZzY3IgIiYjeDFENEJCOyI%2BPCFFTlRJVFkgaHNjciAiJiN4MUQ0QkQ7Ij48IUVOVElUWSBpc2NyICImI3gxRDRCRTsiPjwhRU5USVRZIGpzY3IgIiYjeDFENEJGOyI%2BPCFFTlRJVFkga3NjciAiJiN4MUQ0QzA7Ij48IUVOVElUWSBsc2NyICImI3gxRDRDMTsiPjwhRU5USVRZIG1zY3IgIiYjeDFENEMyOyI%2BPCFFTlRJVFkgbnNjciAiJiN4MUQ0QzM7Ij48IUVOVElUWSBwc2NyICImI3gxRDRDNTsiPjwhRU5USVRZIHFzY3IgIiYjeDFENEM2OyI%2BPCFFTlRJVFkgcnNjciAiJiN4MUQ0Qzc7Ij48IUVOVElUWSBzc2NyICImI3gxRDRDODsiPjwhRU5USVRZIHRzY3IgIiYjeDFENEM5OyI%2BPCFFTlRJVFkgdXNjciAiJiN4MUQ0Q0E7Ij48IUVOVElUWSB2c2NyICImI3gxRDRDQjsiPjwhRU5USVRZIHdzY3IgIiYjeDFENENDOyI%2BPCFFTlRJVFkgeHNjciAiJiN4MUQ0Q0Q7Ij48IUVOVElUWSB5c2NyICImI3gxRDRDRTsiPjwhRU5USVRZIHpzY3IgIiYjeDFENENGOyI%2BPCFFTlRJVFkgQWZyICImI3gxRDUwNDsiPjwhRU5USVRZIEJmciAiJiN4MUQ1MDU7Ij48IUVOVElUWSBEZnIgIiYjeDFENTA3OyI%2BPCFFTlRJVFkgRWZyICImI3gxRDUwODsiPjwhRU5USVRZIEZmciAiJiN4MUQ1MDk7Ij48IUVOVElUWSBHZnIgIiYjeDFENTBBOyI%2BPCFFTlRJVFkgSmZyICImI3gxRDUwRDsiPjwhRU5USVRZIEtmciAiJiN4MUQ1MEU7Ij48IUVOVElUWSBMZnIgIiYjeDFENTBGOyI%2BPCFFTlRJVFkgTWZyICImI3gxRDUxMDsiPjwhRU5USVRZIE5mciAiJiN4MUQ1MTE7Ij48IUVOVElUWSBPZnIgIiYjeDFENTEyOyI%2BPCFFTlRJVFkgUGZyICImI3gxRDUxMzsiPjwhRU5USVRZIFFmciAiJiN4MUQ1MTQ7Ij48IUVOVElUWSBTZnIgIiYjeDFENTE2OyI%2BPCFFTlRJVFkgVGZyICImI3gxRDUxNzsiPjwhRU5USVRZIFVmciAiJiN4MUQ1MTg7Ij48IUVOVElUWSBWZnIgIiYjeDFENTE5OyI%2BPCFFTlRJVFkgV2ZyICImI3gxRDUxQTsiPjwhRU5USVRZIFhmciAiJiN4MUQ1MUI7Ij48IUVOVElUWSBZZnIgIiYjeDFENTFDOyI%2BPCFFTlRJVFkgYWZyICImI3gxRDUxRTsiPjwhRU5USVRZIGJmciAiJiN4MUQ1MUY7Ij48IUVOVElUWSBjZnIgIiYjeDFENTIwOyI%2BPCFFTlRJVFkgZGZyICImI3gxRDUyMTsiPjwhRU5USVRZIGVmciAiJiN4MUQ1MjI7Ij48IUVOVElUWSBmZnIgIiYjeDFENTIzOyI%2BPCFFTlRJVFkgZ2ZyICImI3gxRDUyNDsiPjwhRU5USVRZIGhmciAiJiN4MUQ1MjU7Ij48IUVOVElUWSBpZnIgIiYjeDFENTI2OyI%2BPCFFTlRJVFkgamZyICImI3gxRDUyNzsiPjwhRU5USVRZIGtmciAiJiN4MUQ1Mjg7Ij48IUVOVElUWSBsZnIgIiYjeDFENTI5OyI%2BPCFFTlRJVFkgbWZyICImI3gxRDUyQTsiPjwhRU5USVRZIG5mciAiJiN4MUQ1MkI7Ij48IUVOVElUWSBvZnIgIiYjeDFENTJDOyI%2BPCFFTlRJVFkgcGZyICImI3gxRDUyRDsiPjwhRU5USVRZIHFmciAiJiN4MUQ1MkU7Ij48IUVOVElUWSByZnIgIiYjeDFENTJGOyI%2BPCFFTlRJVFkgc2ZyICImI3gxRDUzMDsiPjwhRU5USVRZIHRmciAiJiN4MUQ1MzE7Ij48IUVOVElUWSB1ZnIgIiYjeDFENTMyOyI%2BPCFFTlRJVFkgdmZyICImI3gxRDUzMzsiPjwhRU5USVRZIHdmciAiJiN4MUQ1MzQ7Ij48IUVOVElUWSB4ZnIgIiYjeDFENTM1OyI%2BPCFFTlRJVFkgeWZyICImI3gxRDUzNjsiPjwhRU5USVRZIHpmciAiJiN4MUQ1Mzc7Ij48IUVOVElUWSBBb3BmICImI3gxRDUzODsiPjwhRU5USVRZIEJvcGYgIiYjeDFENTM5OyI%2BPCFFTlRJVFkgRG9wZiAiJiN4MUQ1M0I7Ij48IUVOVElUWSBFb3BmICImI3gxRDUzQzsiPjwhRU5USVRZIEZvcGYgIiYjeDFENTNEOyI%2BPCFFTlRJVFkgR29wZiAiJiN4MUQ1M0U7Ij48IUVOVElUWSBJb3BmICImI3gxRDU0MDsiPjwhRU5USVRZIEpvcGYgIiYjeDFENTQxOyI%2BPCFFTlRJVFkgS29wZiAiJiN4MUQ1NDI7Ij48IUVOVElUWSBMb3BmICImI3gxRDU0MzsiPjwhRU5USVRZIE1vcGYgIiYjeDFENTQ0OyI%2BPCFFTlRJVFkgT29wZiAiJiN4MUQ1NDY7Ij48IUVOVElUWSBTb3BmICImI3gxRDU0QTsiPjwhRU5USVRZIFRvcGYgIiYjeDFENTRCOyI%2BPCFFTlRJVFkgVW9wZiAiJiN4MUQ1NEM7Ij48IUVOVElUWSBWb3BmICImI3gxRDU0RDsiPjwhRU5USVRZIFdvcGYgIiYjeDFENTRFOyI%2BPCFFTlRJVFkgWG9wZiAiJiN4MUQ1NEY7Ij48IUVOVElUWSBZb3BmICImI3gxRDU1MDsiPjwhRU5USVRZIGFvcGYgIiYjeDFENTUyOyI%2BPCFFTlRJVFkgYm9wZiAiJiN4MUQ1NTM7Ij48IUVOVElUWSBjb3BmICImI3gxRDU1NDsiPjwhRU5USVRZIGRvcGYgIiYjeDFENTU1OyI%2BPCFFTlRJVFkgZW9wZiAiJiN4MUQ1NTY7Ij48IUVOVElUWSBmb3BmICImI3gxRDU1NzsiPjwhRU5USVRZIGdvcGYgIiYjeDFENTU4OyI%2BPCFFTlRJVFkgaG9wZiAiJiN4MUQ1NTk7Ij48IUVOVElUWSBpb3BmICImI3gxRDU1QTsiPjwhRU5USVRZIGpvcGYgIiYjeDFENTVCOyI%2BPCFFTlRJVFkga29wZiAiJiN4MUQ1NUM7Ij48IUVOVElUWSBsb3BmICImI3gxRDU1RDsiPjwhRU5USVRZIG1vcGYgIiYjeDFENTVFOyI%2BPCFFTlRJVFkgbm9wZiAiJiN4MUQ1NUY7Ij48IUVOVElUWSBvb3BmICImI3gxRDU2MDsiPjwhRU5USVRZIHBvcGYgIiYjeDFENTYxOyI%2BPCFFTlRJVFkgcW9wZiAiJiN4MUQ1NjI7Ij48IUVOVElUWSByb3BmICImI3gxRDU2MzsiPjwhRU5USVRZIHNvcGYgIiYjeDFENTY0OyI%2BPCFFTlRJVFkgdG9wZiAiJiN4MUQ1NjU7Ij48IUVOVElUWSB1b3BmICImI3gxRDU2NjsiPjwhRU5USVRZIHZvcGYgIiYjeDFENTY3OyI%2BPCFFTlRJVFkgd29wZiAiJiN4MUQ1Njg7Ij48IUVOVElUWSB4b3BmICImI3gxRDU2OTsiPjwhRU5USVRZIHlvcGYgIiYjeDFENTZBOyI%2BPCFFTlRJVFkgem9wZiAiJiN4MUQ1NkI7Ij4%3D>the URL given by this link</a>. (This
  URL is a DTD containing the <a href=http://www.w3.org/TR/xml/#sec-entity-decl>entity
  declarations</a> for the names listed in the <a href=#named-character-references>named character references</a> section.) <a href=#refsXML>[XML]</a></p>

  <ul class=brief><li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Transitional//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Frameset//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;Basic&nbsp;1.0//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1&nbsp;plus&nbsp;MathML&nbsp;2.0//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;XHTML&nbsp;1.1&nbsp;plus&nbsp;MathML&nbsp;2.0&nbsp;plus&nbsp;SVG&nbsp;1.1//EN</code></li>
   <li><code title="">-//W3C//DTD&nbsp;MathML&nbsp;2.0//EN</code></li>
   <li><code title="">-//WAPFORUM//DTD&nbsp;XHTML&nbsp;Mobile&nbsp;1.0//EN</code></li>
  </ul><p>Furthermore, user agents should attempt to retrieve the above external entity's content when
  one of the above public identifiers is used, and should not attempt to retrieve any other external
  entity's content.</p>

  <p class=note>This is not strictly a <a href=#willful-violation title="willful violation">violation</a> of the XML
  specification, but it does contradict the spirit of the XML specification's requirements. This is
  motivated by a desire for user agents to all handle entities in an interoperable fashion without
  requiring any network access for handling external subsets. <a href=#refsXML>[XML]</a></p>

  <p id=scriptTagXML>When an <a href=#xml-parser>XML parser</a> creates a <code><a href=#the-script-element>script</a></code> element, it
  must be marked as being <a href=#parser-inserted>"parser-inserted"</a> and its <a href=#force-async>"force-async"</a> flag
  must be unset. If the parser was originally created for the <a href=#xml-fragment-parsing-algorithm>XML fragment parsing
  algorithm</a>, then the element must be marked as <a href=#already-started>"already started"</a> also. When the
  element's end tag is parsed, the user agent must <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>,
  <a href=#provide-a-stable-state>provide a stable state</a>, and then <a href=#prepare-a-script title="prepare a script">prepare</a> the
  <code><a href=#the-script-element>script</a></code> element. If this causes there to be a <a href=#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>XML parser</a>, such that the <a href=#event-loop>event loop</a>
   will not run <a href=#concept-task title=concept-task>tasks</a> that invoke it.</li>

   <li><p><a href=#spin-the-event-loop>Spin the event loop</a> until the parser's <code><a href=#document>Document</a></code> <a href=#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>pending parsing-blocking
   script</a>'s <a href=#ready-to-be-parser-executed>"ready to be parser-executed"</a> flag is set.</li>

   <li><p>Unblock this instance of the <a href=#xml-parser>XML parser</a>, such that <a href=#concept-task title=concept-task>tasks</a> that invoke it can again be run.</li>

   <li><p><a href=#execute-the-script-block title="execute the script block">Execute</a> the <a href=#pending-parsing-blocking-script>pending parsing-blocking
   script</a>.</li>

   <li><p>There is no longer a <a href=#pending-parsing-blocking-script>pending parsing-blocking script</a>.</li>

  </ol><p class=note>Since the <code title=dom-document-write><a href=#dom-document-write>document.write()</a></code> API is not
  available for <a href=#xml-documents>XML documents</a>, much of the complexity in the <a href=#html-parser>HTML parser</a>
  is not needed in the <a href=#xml-parser>XML parser</a>.</p>

  <p id=templateTagXML>When an <a href=#xml-parser>XML parser</a> would append a node to a
  <code><a href=#the-template-element>template</a></code> element, it must instead append it to the <code><a href=#the-template-element>template</a></code> element's
  <a href=#template-contents>template contents</a> (a <code><a href=#documentfragment>DocumentFragment</a></code> node).</p>

  <p class=note>This is a <a href=#willful-violation>willful violation</a> of the XML specification; unfortunately,
  XML is not formally extensible in the manner that is needed for <code><a href=#the-template-element>template</a></code> processing.
  <a href=#refsXML>[XML]</a></p>

  <p>When an <a href=#xml-parser>XML parser</a> creates a <code><a href=#node>Node</a></code> object, its <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> must be set to the <code><a href=#document>Document</a></code> of
  the node into which the newly created node is to be inserted.</p>

  <p>Certain algorithms in this specification <dfn id=feed-the-parser title="feed the parser">spoon-feed the
  parser</dfn> characters one string at a time. In such cases, the <a href=#xml-parser>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>XML parser</a> reaches the end of its input, it must <a href=#stop-parsing>stop
  parsing</a>, following the same rules as the <a href=#html-parser>HTML parser</a>. An <a href=#xml-parser>XML
  parser</a> can also be <a href=#abort-a-parser title="abort a parser">aborted</a>, which must again by done in
  the same way as for an <a href=#html-parser>HTML parser</a>.</p>

  <p>For the purposes of conformance checkers, if a resource is determined to be in <a href=#the-xhtml-syntax>the XHTML
  syntax</a>, then it is an <a href=#xml-documents title="XML documents">XML document</a>.</p>


<!--//HTMLPARSER-->


  <h3 id=serializing-xhtml-fragments><span class=secno>13.3 </span>Serializing XHTML fragments</h3>

  <p>The <dfn id=xml-fragment-serialization-algorithm>XML fragment serialization algorithm</dfn> for a
  <code><a href=#document>Document</a></code> or <code><a href=#element>Element</a></code> node either returns a
  fragment of XML that represents that node or throws an
  exception.</p>

  <p>For <code><a href=#document>Document</a></code>s, the algorithm must return a string in
  the form of a <a href=http://www.w3.org/TR/xml/#sec-well-formed>document
  entity</a>, if none of the error cases below apply.</p>

  <p>For <code><a href=#element>Element</a></code>s, the algorithm must return a string in
  the form of an <a href=http://www.w3.org/TR/xml/#wf-entities>internal general parsed
  entity</a>, if none of the error cases below apply.</p>

  <p>In both cases, the string returned must be XML
  namespace-well-formed and must be an isomorphic serialization of all
  of that node's <a href=#relevant-child-nodes>relevant child nodes</a>, in <a href=#tree-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><a href=#text>Text</a></code> nodes in the DOM.</p>

  <p>A node's <dfn id=relevant-child-nodes>relevant child nodes</dfn> are those that apply given the following rules:</p>

  <dl><dt>For <code><a href=#the-template-element>template</a></code> elements</dt>

   <dd>The <a href=#relevant-child-nodes>relevant child nodes</a> are the child nodes of the <code><a href=#the-template-element>template</a></code>
   element's <a href=#template-contents>template contents</a>, if any.</dd>

   <dt>For all other nodes</dt>

   <dd>The <a href=#relevant-child-nodes>relevant child nodes</a> are the child nodes of node itself, if any.</dd>

  </dl><p>For <code><a href=#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.<!-- because otherwise round-tripping might break since it'll
  pick up the surrounding default ns when setting --> (This doesn't
  apply in the <code><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
  <code><a href=#invalidstateerror>InvalidStateError</a></code> exception instead of returning a
  string:</p>

  <ul><li>A <code><a href=#document>Document</a></code> node with no child element nodes.</li>

   <li>A <code><a href=#documenttype>DocumentType</a></code> node that has an external subset
   public identifier that contains characters that are not matched by
   the XML <code title="">PubidChar</code> production. <a href=#refsXML>[XML]</a></li>

   <li>A <code><a href=#documenttype>DocumentType</a></code> node that has an external subset
   system identifier that contains both a U+0022 QUOTATION MARK (")
   and a U+0027 APOSTROPHE (') or that contains characters that are
   not matched by the XML <code title="">Char</code> production. <a href=#refsXML>[XML]</a></li>

   <li>A node with a <!--prefix or--> local name containing a U+003A
   COLON (:).</li> <!--(prefixes can get adjusted, so this isn't an
   excuse) -->

   <li>A node with a <!--prefix or--> local name that does not match
   the XML <code title="">Name</code> production. <a href=#refsXML>[XML]</a></li> <!--(again, prefixes can get
   adjusted, so this isn't an excuse) -->

   <li>An <code><a href=#attr>Attr</a></code> node with no namespace whose local name is
   the lowercase string "<code title="">xmlns</code>". <a href=#refsXMLNS>[XMLNS]</a></li>

   <li>An <code><a href=#element>Element</a></code> node with two or more attributes with
   the same local name and namespace.</li>

   <li>An <code><a href=#attr>Attr</a></code> node, <code><a href=#text>Text</a></code> node,
   <code><a href=#comment-0>Comment</a></code> node, or <code><a href=#processinginstruction>ProcessingInstruction</a></code>
   node whose data contains characters that are not matched by the XML
   <code title="">Char</code> production. <a href=#refsXML>[XML]</a></li>

   <li>A <code><a href=#comment-0>Comment</a></code> node whose data contains two adjacent
   U+002D HYPHEN-MINUS characters (-) or ends with such a
   character.</li>

   <li>A <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose target name is
   an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">xml</code>".</li>

   <li>A <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose target name
   contains a U+003A COLON (:).</li>

   <li>A <code><a href=#processinginstruction>ProcessingInstruction</a></code> node whose data contains
   the string "<code title="">?&gt;</code>".</li>

  </ul><p class=note>These are the only ways to make a DOM
  unserializable. The DOM enforces all the other XML constraints; for
  example, trying to append two elements to a <code><a href=#document>Document</a></code>
  node will throw a <code><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>



  <h3 id=parsing-xhtml-fragments><span class=secno>13.4 </span>Parsing XHTML fragments</h3>

  <p>The <dfn id=xml-fragment-parsing-algorithm>XML fragment parsing algorithm</dfn> either returns a
  <code><a href=#document>Document</a></code> or throws a <code><a href=#syntaxerror>SyntaxError</a></code> exception.
  Given a string <var title="">input</var> and an optional context
  element <var title=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>XML parser</a>.</p>

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, <a href=#feed-the-parser>feed the
    parser</a> just created the string corresponding to the start tag of that element, declaring
    all the namespace prefixes that are in scope on that element in the DOM, as well as declaring
    the default namespace (if any) that is in scope on that element in the DOM.</p>

    <p>A namespace prefix is in scope if the DOM <code title="">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 title="">isDefaultNamespace()</code> method on the element would return true.</p>

    <p class=note>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, no
    <code title="">DOCTYPE</code> is passed to the parser, and therefore no external subset is
    referenced, and therefore no entities will be recognized.</p>

   </li>

   <li>

    <p><a href=#feed-the-parser>Feed the parser</a> just created the string <var title="">input</var>.</p>

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element,
    <a href=#feed-the-parser>feed the parser</a> just created the string corresponding
    to the end tag of that element.</p>

   </li>

   <li>

    <p>If there is an XML well-formedness or XML namespace
    well-formedness error, then throw a <code><a href=#syntaxerror>SyntaxError</a></code>
    exception and abort these steps.</p>

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, and the
    root element of the resulting <code><a href=#document>Document</a></code> has any
    sibling nodes, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and
    abort these steps.</p>

    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1443 -->

   </li>

   <li>

    <p>If there is a <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element, then
    return the child nodes of the root element of the resulting
    <code><a href=#document>Document</a></code>, in <a href=#tree-order>tree order</a>.</p>

    <p>Otherwise, return the children of the <code><a href=#document>Document</a></code>
    object, in <a href=#tree-order>tree order</a>.</p>

   </li>

  </ol></div>


<!--TOPIC:Rendering-->

  <div class=impl>

  <h2 id=rendering><span class=secno>14 </span>Rendering</h2>

  <p><i>User agents are not required to present HTML documents in any
  particular way. However, this section provides a set of suggestions
  for rendering HTML documents that, if followed, are likely to lead
  to a user experience that closely resembles the experience intended
  by the documents' authors. So as to avoid confusion regarding the
  normativity of this section, RFC2119 terms have not been used.
  Instead, the term "expected" is used to indicate behavior that will
  lead to this experience. For the purposes of conformance for user
  agents designated as <a href=#renderingUA>supporting the suggested
  default rendering</a>, the term "expected" in this section has the
  same conformance implications as the RFC2119-defined term
  "must".</i></p>


  <h3 id=introduction-13><span class=secno>14.1 </span>Introduction</h3>

  <p>In general, user agents are expected to support CSS, and many of the suggestions in this
  section are expressed in CSS terms. User agents that use other presentation mechanisms can derive
  their expected behavior by translating from the CSS rules given in this section.</p>

  <p>In the absence of style-layer rules to the contrary (e.g. author style sheets), user agents are
  expected to render an element so that it conveys to the user the meaning that the element
  <a href=#represents>represents</a>, as described by this specification.</p>

  <p>The suggestions in this section generally assume a visual output medium with a resolution of
  96dpi or greater, but HTML is intended to apply to multiple media (it is a
  <i>media-independent</i> language). User agent implementors are encouraged to adapt the
  suggestions in this section to their target media.</p>

  <hr><p>An element is <dfn id=being-rendered>being rendered</dfn> if it has any associated CSS layout boxes, SVG layout
  boxes, or some equivalent in other styling languages.</p>

  <p class=note>Just being off-screen does not mean the element is not <a href=#being-rendered>being
  rendered</a>. The presence of the <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute normally
  means the element is not <a href=#being-rendered>being rendered</a>, though this might be overridden by the style
  sheets.</p>

  <hr><p>User agents that do not honor author-level CSS style sheets are nonetheless expected to act as
  if they applied the CSS rules given in these sections in a manner consistent with this
  specification and the relevant CSS and Unicode specifications. <a href=#refsCSS>[CSS]</a> <a href=#refsUNICODE>[UNICODE]</a> <a href=#refsBIDI>[BIDI]</a></p>

  <p class=note>This is especially important for issues relating to the 'display', 'unicode-bidi',
  and 'direction' properties.</p>



  <h3 id=the-css-user-agent-style-sheet-and-presentational-hints><span class=secno>14.2 </span>The CSS user agent style sheet and presentational hints</h3>

  <p>The CSS rules given in these subsections are, except where
  otherwise specified, expected to be used as part of the user-agent
  level style sheet defaults for all documents that contain <a href=#html-elements>HTML
  elements</a>.</p>

  <p>Some rules are intended for the author-level zero-specificity
  presentational hints part of the CSS cascade; these are explicitly
  called out as <dfn id=presentational-hints>presentational hints</dfn>.</p>

  <p>Some of the rules regarding left and right margins are given here
  as appropriate for elements whose 'direction' property is 'ltr', and
  are expected to be flipped around on elements whose 'direction'
  property is 'rtl'. These are marked "<dfn id=ltr-specific>LTR-specific</dfn>".</p>

  <p class=note>These markings only affect the handling of attribute
  <em>values</em>, not attribute names or element names.</p>

  <hr><p>When the text below says that an attribute <var title="">attribute</var> on an element <var title="">element</var>
  <dfn id=maps-to-the-pixel-length-property>maps to the pixel length property</dfn> (or properties) <var title="">properties</var>, it means that if <var title="">element</var> has an attribute <var title="">attribute</var> set, and parsing that attribute's value
  using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>
  doesn't generate an error, then the user agent is expected to use
  the parsed value as a pixel length for a <a href=#presentational-hints title="presentational
  hints">presentational hint</a> for <var title="">properties</var>.</p>

  <p>When the text below says that an attribute <var title="">attribute</var> on an element <var title="">element</var>
  <dfn id=maps-to-the-dimension-property>maps to the dimension property</dfn> (or properties) <var title="">properties</var>, it means that if <var title="">element</var> has an attribute <var title="">attribute</var> set, and parsing that attribute's value
  using the <a href=#rules-for-parsing-dimension-values>rules for parsing dimension values</a> doesn't
  generate an error, then the user agent is expected to use the parsed
  dimension as the value for a <a href=#presentational-hints title="presentational
  hints">presentational hint</a> for <var title="">properties</var>, with the value given as a pixel length if
  the dimension was an integer, and with the value given as a
  percentage if the dimension was a percentage.</p>

  <p>When a user agent is to <dfn id=align-descendants>align descendants</dfn> of a node,
  the user agent is expected to align only those descendants that have
  both their 'margin-left' and 'margin-right' properties computing to
  a value other than 'auto', that are over-constrained and that have
  one of those two margins with a used value forced to a greater
  value, and that do not themselves have an applicable <code title=attr-align>align</code> attribute. When multiple elements
  are to <a href=#align-descendants title="align descendants">align</a> a particular
  descendant, the most deeply nested such element is expected to
  override the others. Aligned elements are expected to be aligned by
  having the used values of their left and right margins be set
  accordingly.</p>



  <h3 id=non-replaced-elements><span class=secno>14.3 </span>Non-replaced elements</h3>


  <h4 id=hidden-elements><span class=secno>14.3.1 </span>Hidden elements</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

[hidden], area, base, basefont, datalist, head, input[type=hidden i],
link, menu[type=popup i], meta, noembed, noframes, param, rp, script,
source, style, template, track, title {
  display: none;
}

embed[hidden] { display: inline; height: 0; width: 0; }</pre> <!-- because for legacy reasons it still needs to instantiate the plugin -->

  <p>The user agent is expected to force the 'display' property of <code><a href=#the-noscript-element>noscript</a></code> elements
  for whom <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> to compute to 'none',
  irrespective of CSS rules.</p>

  <p>The user agent is expected to force the 'display' property of <code><a href=#the-input-element>input</a></code> elements whose
  <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state to compute to 'none', irrespective of CSS
  rules.</p>


  <h4 id=the-page><span class=secno>14.3.2 </span>The page</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

html, body { display: block; }</pre>


  <!-- body { margin: 8px; } -->

  <p>For each property in the table below, given a <code><a href=#the-body-element>body</a></code>
  element, the first attribute that exists <a href=#maps-to-the-pixel-length-property>maps to the pixel
  length property</a> on the <code><a href=#the-body-element>body</a></code> element. If none of
  the attributes for a property are found, or if the value of the
  attribute that was found cannot be parsed successfully, then, if the
  <code><a href=#the-body-element>body</a></code> element's <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing
  context</a> does not have its <a href=#seamless-browsing-context-flag>seamless browsing context
  flag</a> set, a default value of 8px is expected to be used for
  that property instead.</p>

  <table><thead><tr><th>Property
     <th>Source
   <tbody><tr><td rowspan=3>'margin-top'
     <td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-marginheight><a href=#attr-body-marginheight>marginheight</a></code> attribute
    <tr><td>The <code><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> attribute
    <tr><td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-topmargin>topmargin</code> attribute
   <tbody><tr><td rowspan=3>'margin-right'
     <td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-marginwidth><a href=#attr-body-marginwidth>marginwidth</a></code> attribute
    <tr><td>The <code><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> attribute
    <tr><td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-rightmargin>rightmargin</code> attribute
   <tbody><tr><td rowspan=3>'margin-bottom'
     <td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-marginheight><a href=#attr-body-marginheight>marginheight</a></code> attribute
    <tr><td>The <code><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> attribute
    <tr><td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-bottommargin>bottommargin</code> attribute
   <tbody><tr><td rowspan=3>'margin-left'
     <td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-marginwidth><a href=#attr-body-marginwidth>marginwidth</a></code> attribute
    <tr><td>The <code><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element>container frame element</a>'s <code title=attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> attribute
    <tr><td><code><a href=#the-body-element>body</a></code> element's <code title=attr-body-leftmargin>leftmargin</code> attribute
  </table><p>If the <code><a href=#the-body-element>body</a></code> element's <code><a href=#document>Document</a></code>'s
  <a href=#browsing-context>browsing context</a> is a <a href=#nested-browsing-context>nested browsing
  context</a>, and the <a href=#browsing-context-container>browsing context container</a> of
  that <a href=#nested-browsing-context>nested browsing context</a> is a <code><a href=#frame>frame</a></code> or
  <code><a href=#the-iframe-element>iframe</a></code> element, then the <dfn id=container-frame-element>container frame
  element</dfn> of the <code><a href=#the-body-element>body</a></code> element is that
  <code><a href=#frame>frame</a></code> or <code><a href=#the-iframe-element>iframe</a></code> element. Otherwise, there
  is no <a href=#container-frame-element>container frame element</a>.</p>

  <p class=warning>The above requirements imply that a page can
  change the margins of another page (including one from another
  <a href=#origin>origin</a>) using, for example, an
  <code><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 the <code><a href=#document>Document</a></code> has a <a href=#root-element>root element</a>, and
  the <code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> is a
  <a href=#nested-browsing-context>nested browsing context</a>, and the <a href=#browsing-context-container>browsing context
  container</a> of that <a href=#nested-browsing-context>nested browsing context</a> is a
  <code><a href=#frame>frame</a></code> or <code><a href=#the-iframe-element>iframe</a></code> element, and that element
  has a <code title=attr-frames-scrolling>scrolling</code>
  attribute, then the user agent is expected to compare the value of
  the attribute in an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> manner to
  the values in the first column of the following table, and if one of
  them matches, then the user agent is expected to treat that
  attribute as a <a href=#presentational-hints title="presentational hints">presentational
  hint</a> for the aforementioned root element's 'overflow'
  property, setting it to the value given in the corresponding cell on
  the same row in the second column:</p>

  <table><thead><tr><th> Attribute value
     <th> 'overflow' value
   <tbody><tr><td><code title="">on</code>
     <td>'scroll'
    <tr><td><code title="">scroll</code>
     <td>'scroll'
    <tr><td><code title="">yes</code>
     <td>'scroll'
    <tr><td><code title="">off</code>
     <td>'hidden'
    <tr><td><code title="">noscroll</code>
     <td>'hidden'
    <tr><td><code title="">no</code>
     <td>'hidden'
    <tr><td><code title="">auto</code>
     <td>'auto'
  </table><hr><p>When a <code><a href=#the-body-element>body</a></code> element has a <code title=attr-background><a href=#attr-background>background</a></code> attribute set to a
  non-empty value, the new value is expected to be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element, and
  if this is successful, the user agent is expected to treat the
  attribute as a <a href=#presentational-hints title="presentational hints">presentational
  hint</a> setting the element's 'background-image' property to the
  resulting <a href=#absolute-url>absolute URL</a>.</p>

  <p>When a <code><a href=#the-body-element>body</a></code> element has a <code title=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-color-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 title="presentational hints">presentational hint</a> setting the
  element's 'background-color' property to the resulting color.</p>

  <p>When a <code><a href=#the-body-element>body</a></code> element has a <code title=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-color-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 title="presentational hints">presentational hint</a> setting the
  element's 'color' property to the resulting color.</p>

  <p>When a <code><a href=#the-body-element>body</a></code> element has a <code title=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-color-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 title="presentational
  hints">presentational hint</a> setting the 'color' property of
  any element in the <code><a href=#document>Document</a></code> matching the ':link'
  pseudo-class to the resulting color.</p>

  <p>When a <code><a href=#the-body-element>body</a></code> element has a <code title=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-color-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 title="presentational hints">presentational hint</a> setting the
  'color' property of any element in the <code><a href=#document>Document</a></code>
  matching the ':visited' pseudo-class to the resulting color.</p>

  <p>When a <code><a href=#the-body-element>body</a></code> element has a <code title=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-color-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 title="presentational hints">presentational hint</a> setting the
  'color' property of any element in the <code><a href=#document>Document</a></code>
  matching the ':active' pseudo-class and either the ':link'
  pseudo-class or the ':visited' pseudo-class to the resulting
  color.</p>



  <h4 id=flow-content-1><span class=secno>14.3.3 </span>Flow content</h4>

  <!-- del, ins, and map are inline. -->

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

address, blockquote, center, div, figure, figcaption, footer, form,
header, hr, legend, listing, main, p, plaintext, pre, summary, xmp {
  display: block;<!-- see also unicode-bidi: isolate rules-->
}

blockquote, figure, listing, p, plaintext, pre, xmp {
  margin-top: 1em; margin-bottom: 1em;
}

blockquote, figure { margin-left: 40px; margin-right: 40px; }

address { font-style: italic; }
listing, plaintext, pre, xmp {
  font-family: monospace; white-space: pre;
}

dialog:not([open]) { display: none; }
dialog {
  position: absolute;
  left: 0; right: 0;
  margin: auto;
  border: solid;
  padding: 1em;
  background: white;
  color: black;
}
dialog::backdrop { background: rgba(0,0,0,0.1); }</pre>

  <p>The following rules are also expected to apply, as
  <a href=#presentational-hints>presentational hints</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

pre[wrap] { white-space: pre-wrap; }</pre>

  <p>In <a href=#quirks-mode>quirks mode</a>, the following rules are also
  expected to apply:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

form { margin-bottom: 1em; }</pre>

  <hr><p>The <code><a href=#center>center</a></code> element, and the <code><a href=#the-div-element>div</a></code> element
  when it has an <code title=attr-div-align><a href=#attr-div-align>align</a></code> attribute
  whose value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
  either the string "<code title="">center</code>" or the string
  "<code title="">middle</code>", are expected to center text within
  themselves, as if they had their 'text-align' property set to
  'center' in a <a href=#presentational-hints title="presentational hints">presentational
  hint</a>, and to <a href=#align-descendants>align descendants</a> to the
  center.</p>

  <p>The <code><a href=#the-div-element>div</a></code> element, when it has an <code title=attr-align>align</code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">left</code>", is expected to left-align text within itself,
  as if it had its 'text-align' property set to 'left' in a <a href=#presentational-hints title="presentational hints">presentational hint</a>, and to
  <a href=#align-descendants>align descendants</a> to the left.</p>

  <p>The <code><a href=#the-div-element>div</a></code> element, when it has an <code title=attr-align>align</code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">right</code>", is expected to right-align text within
  itself, as if it had its 'text-align' property set to 'right' in a
  <a href=#presentational-hints title="presentational hints">presentational hint</a>, and
  to <a href=#align-descendants>align descendants</a> to the right.</p>

  <p>The <code><a href=#the-div-element>div</a></code> element, when it has an <code title=attr-align>align</code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">justify</code>", is expected to full-justify text within
  itself, as if it had its 'text-align' property set to 'justify' in a
  <a href=#presentational-hints title="presentational hints">presentational hint</a>, and
  to <a href=#align-descendants>align descendants</a> to the left.</p>



  <h4 id=phrasing-content-1><span class=secno>14.3.4 </span>Phrasing content</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

cite, dfn, em, i, var { font-style: italic; }
b, strong { font-weight: bolder; }
code, kbd, samp, tt { font-family: monospace; }
big { font-size: larger; }
small { font-size: smaller; }

sub { vertical-align: sub; }
sup { vertical-align: super; }
sub, sup { line-height: normal; font-size: smaller; }

ruby { display: ruby; }
rt { display: ruby-text; }

:link { color: #0000EE; }
:visited { color: #551A8B; }
:link, :visited { text-decoration: underline; }
a:link[rel~=help], a:visited[rel~=help],
area:link[rel~=help], area:visited[rel~=help] { cursor: help; }

:focus { outline: auto; }

mark { background: yellow; color: black; } /* this color is just a suggestion and can be changed based on implementation feedback */

abbr[title], acronym[title] { text-decoration: dotted underline; }<!-- CSS3 http://dev.w3.org/csswg/css3-text/#text-decoration-style -->
ins, u { text-decoration: underline; }
del, s, strike { text-decoration: line-through; }
blink { text-decoration: blink; }

q::before { content: open-quote; }
q::after { content: close-quote; }

br { content: '\A'; white-space: pre; }
nobr { white-space: nowrap; }
wbr { content: '\200B'; }
nobr wbr { white-space: normal; }</pre>

  <p>The following rules are also expected to apply, as
  <a href=#presentational-hints>presentational hints</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

br[clear=left i] { clear: left; }
br[clear=right i] { clear: right; }
br[clear=all i], br[clear=both i] { clear: both; }</pre>

  <p>For the purposes of the CSS ruby model, runs of children of
  <code><a href=#the-ruby-element>ruby</a></code> elements that are not <code><a href=#the-rt-element>rt</a></code> or
  <code><a href=#the-rp-element>rp</a></code> elements are expected to be wrapped in anonymous
  boxes whose 'display' property has the value 'ruby-base'. <a href=#refsCSSRUBY>[CSSRUBY]</a></p>

  <p>When a particular part of a ruby has more than one annotation,
  the annotations should be distributed on both sides of the base text
  so as to minimize the stacking of ruby annotations on one side.</p>

  <p class=note>When it becomes possible to do so, the preceding
  requirement will be updated to be expressed in terms of CSS ruby.
  (Currently, CSS ruby does not handle nested <code><a href=#the-ruby-element>ruby</a></code>
  elements or multiple sequential <code><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><a href=#the-rt-element>rt</a></code>
  elements in the absence of <code><a href=#the-rp-element>rp</a></code> elements.</p>

  <hr><p>User agents are expected to
  support the 'clear' property on inline elements (in order to render
  <code><a href=#the-br-element>br</a></code> elements with <code title=attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
  described in the non-normative note to this effect in CSS2.1.</p>
  <!-- section 9.5.2 of CSS2.1 -->

  <p>The initial value for the 'color' property is expected to be
  black. The initial value for the 'background-color' property is
  expected to be 'transparent'. The canvas' background is expected to
  be white.</p>

  <hr><p>When a <code><a href=#font>font</a></code> element has a <code title=attr-font-color>color</code> attribute, its value is
  expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-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 title="presentational hints">presentational hint</a> setting the
  element's 'color' property to the resulting color.</p>

  <p>When a <code><a href=#font>font</a></code> element has a <code title=attr-font-face>face</code> attribute, the user agent is
  expected to treat the attribute as a <a href=#presentational-hints title="presentational
  hints">presentational hint</a> setting the element's
  'font-family' property to the attribute's value.</p>

  <!-- (Apparently only IE supports this?) (Note: if you add this
  back, make sure to define which of 'size' vs 'pointsize' wins.)

  <p>When a <code>font</code> element has a <code
  title="attr-font-pointsize">pointsize</code> attribute, the user
  agent is expected to parse that attribute's value using the
  <span>rules for parsing non-negative integers</span>, and if this
  doesn't generate an error, then the user agent is expected to use
  the parsed value as a <em>point</em> length for a <span
  title="presentational hints">presentational hint</span> for the
  'font-size' property on the element.</p>
  -->

  <p>When a <code><a href=#font>font</a></code> element has a <code title=attr-font-size>size</code> attribute, the user agent is
  expected to use the following steps, known as the <dfn id=rules-for-parsing-a-legacy-font-size>rules for
  parsing a legacy font size</dfn>, to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
  element's 'font-size' property:</p>

  <ol><li><p>Let <var title="">input</var> be the attribute's
   value.</li>

   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
   string.</li>

   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>

   <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, there is no <a href=#presentational-hints title="presentational
   hints">presentational hint</a>. Abort these steps.</li>

   <li><p>If the character at <var title="">position</var> is a U+002B
   PLUS SIGN character (+), then let <var title="">mode</var> be
   <i>relative-plus</i>, and advance <var title="">position</var> to
   the next character. Otherwise, if the character at <var title="">position</var> is a U+002D HYPHEN-MINUS character (-),
   then let <var title="">mode</var> be <i>relative-minus</i>, and
   advance <var title="">position</var> to the next
   character. Otherwise, let <var title="">mode</var> be
   <i>absolute</i>.</li>

   <li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits>ASCII digits</a>, and let the
   resulting sequence be <var title="">digits</var>.</li>

   <li><p>If <var title="">digits</var> is the empty string, there is
   no <a href=#presentational-hints title="presentational hints">presentational
   hint</a>. Abort these steps.</li>

   <li><p>Interpret <var title="">digits</var> as a base-ten
   integer. Let <var title="">value</var> be the resulting
   number.</li>

   <li>

    <!-- basefont support would go here, but we removed it -->

    <p>If <var title="">mode</var> is <i>relative-plus</i>, then
    increment <var title="">value</var> by 3. If <var title="">mode</var> is <i>relative-minus</i>, then let <var title="">value</var> be the result of subtracting <var title="">value</var> from 3.</p>

   </li>

   <li><p>If <var title="">value</var> is greater than 7, let it be
   7.</li>

   <li><p>If <var title="">value</var> is less than 1, let it be
   1.</li>

   <li>

    <p>Set 'font-size' to the keyword corresponding to the value of
    <var title="">value</var> according to the following table:</p>

    <table><thead><tr><th><var title="">value</var>
       <th>'font-size' keyword
       <th>Notes
     <tbody><tr><td>1
       <td>x-small
       <td>
      <tr><td>2
       <td>small
       <td>
      <tr><td>3
       <td>medium
       <td>
      <tr><td>4
       <td>large
       <td>
      <tr><td>5
       <td>x-large
       <td>
      <tr><td>6
       <td>xx-large
       <td>
      <tr><td>7
       <td>x<!---->xx-large
       <td><i>see below</i>
    </table><p class=tablenote><small>The 'x<!---->xx-large' value is a non-CSS value used here to
    indicate a font size 50% larger than 'xx-large'.</small></p>

   </li>

  </ol><h4 id=bidirectional-text><span class=secno>14.3.5 </span>Bidirectional text</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

[dir]:dir(ltr), bdi:dir(ltr), input[type=tel]:dir(ltr) { direction: ltr; }
[dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; }

address, blockquote, center, div, figure, figcaption, footer, form,
header, hr, legend, listing, main, p, plaintext, pre, summary, xmp, article,
aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section, table, caption,
colgroup, col, thead, tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu,
ol, ul, li {
  unicode-bidi: isolate;<!-- basically anything that is display:block-like -->
}

:matches([dir=ltr i], [dir=rtl i], [dir=auto i]):not(address):not(blockquote
):not(center):not(div):not(figure):not(figcaption):not(footer):not(form
):not(header):not(hr):not(legend):not(listing):not(main):not(p):not(plaintext):not(pre
):not(summary):not(xmp):not(article):not(aside):not(h1):not(h2):not(h3):not(h4
):not(h5):not(h6):not(hgroup):not(nav):not(section):not(table):not(caption
):not(colgroup):not(col):not(thead):not(tbody):not(tfoot):not(tr):not(td
):not(th):not(dir):not(dd):not(dl):not(dt):not(menu):not(ol):not(ul):not(li) {
  unicode-bidi: embed;
}

bdi, bdi:matches([dir=ltr i], [dir=rtl i]),
output, output:matches([dir=ltr i], [dir=rtl i]),
[dir=auto i] {
  unicode-bidi: isolate;
}

bdo, bdo:matches([dir=ltr i], [dir=rtl i]) { unicode-bidi: bidi-override; }
bdo[dir=auto i] { unicode-bidi: isolate-override; }

textarea[dir=auto i], pre[dir=auto i] { unicode-bidi: plaintext; }</pre>

  <p>Input fields (i.e. <code><a href=#the-textarea-element>textarea</a></code> elements, and <code><a href=#the-input-element>input</a></code> elements when their
  <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>,
  <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a>, <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>,
  or <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> state) are expected to present an editing
  user interface with a directionality that matches the element's 'direction' property.</p>


  <h4 id=quotes><span class=secno>14.3.6 </span>Quotes</h4>

  <p>This block is automatically generated from the Unicode Common
  Locale Data Repository. <a href=#refsCLDR>[CLDR]</a></p>

  <p>User agents are expected to use either the block below (which
  will be regularly updated) or to automatically generate their own
  copy directly from the source material. The language codes are
  derived from the CLDR file names. The quotes are derived from the
  <code title="">delimiter</code> blocks, with fallback handled as
  specified in the CLDR documentation.</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

:root                                                         { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(af),       :not(:lang(af)) &gt; :lang(af)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(agq),      :not(:lang(agq)) &gt; :lang(agq)           { quotes: '\201e' '\201d' '\201a' '\2019' } /* &ldquor; &rdquo; &sbquo; &rsquor; */
:root:lang(ak),       :not(:lang(ak)) &gt; :lang(ak)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(am),       :not(:lang(am)) &gt; :lang(am)             { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(ar),       :not(:lang(ar)) &gt; :lang(ar)             { quotes: '\201d' '\201c' '\2019' '\2018' } /* &rdquo; &ldquo; &rsquor; &lsquo; */
:root:lang(asa),      :not(:lang(asa)) &gt; :lang(asa)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(az),       :not(:lang(az)) &gt; :lang(az)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(az-Cyrl),  :not(:lang(az-Cyrl)) &gt; :lang(az-Cyrl)   { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(bas),      :not(:lang(bas)) &gt; :lang(bas)           { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* &laquo; &raquo; &ldquor; &ldquo; */
:root:lang(bem),      :not(:lang(bem)) &gt; :lang(bem)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(bez),      :not(:lang(bez)) &gt; :lang(bez)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(bg),       :not(:lang(bg)) &gt; :lang(bg)             { quotes: '\201e' '\201c' '\201e' '\201c' } /* &ldquor; &ldquo; &ldquor; &ldquo; */
:root:lang(bm),       :not(:lang(bm)) &gt; :lang(bm)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(bn),       :not(:lang(bn)) &gt; :lang(bn)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(br),       :not(:lang(br)) &gt; :lang(br)             { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(brx),      :not(:lang(brx)) &gt; :lang(brx)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(bs-Cyrl),  :not(:lang(bs-Cyrl)) &gt; :lang(bs-Cyrl)   { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(ca),       :not(:lang(ca)) &gt; :lang(ca)             { quotes: '\201c' '\201d' '\00ab' '\00bb' } /* &ldquo; &rdquo; &laquo; &raquo; */
:root:lang(cgg),      :not(:lang(cgg)) &gt; :lang(cgg)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(chr),      :not(:lang(chr)) &gt; :lang(chr)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(cs),       :not(:lang(cs)) &gt; :lang(cs)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(cy),       :not(:lang(cy)) &gt; :lang(cy)             { quotes: '\2018' '\2019' '\201c' '\201d' } /* &lsquo; &rsquor; &ldquo; &rdquo; */
:root:lang(da),       :not(:lang(da)) &gt; :lang(da)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(dav),      :not(:lang(dav)) &gt; :lang(dav)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(de),       :not(:lang(de)) &gt; :lang(de)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(de-CH),    :not(:lang(de-CH)) &gt; :lang(de-CH)       { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(dje),      :not(:lang(dje)) &gt; :lang(dje)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(dua),      :not(:lang(dua)) &gt; :lang(dua)           { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* &laquo; &raquo; &lsquo; &rsquor; */
:root:lang(dyo),      :not(:lang(dyo)) &gt; :lang(dyo)           { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(dz),       :not(:lang(dz)) &gt; :lang(dz)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ebu),      :not(:lang(ebu)) &gt; :lang(ebu)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ee),       :not(:lang(ee)) &gt; :lang(ee)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(el),       :not(:lang(el)) &gt; :lang(el)             { quotes: '\00ab' '\00bb' '\0022' '\0022' } /* &laquo; &raquo; " " */
:root:lang(en),       :not(:lang(en)) &gt; :lang(en)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(en-AU),    :not(:lang(en-AU)) &gt; :lang(en-AU)       { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(en-GB),    :not(:lang(en-GB)) &gt; :lang(en-GB)       { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(es),       :not(:lang(es)) &gt; :lang(es)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(et),       :not(:lang(et)) &gt; :lang(et)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(eu),       :not(:lang(eu)) &gt; :lang(eu)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(ewo),      :not(:lang(ewo)) &gt; :lang(ewo)           { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(fa),       :not(:lang(fa)) &gt; :lang(fa)             { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(ff),       :not(:lang(ff)) &gt; :lang(ff)             { quotes: '\201e' '\201d' '\201a' '\2019' } /* &ldquor; &rdquo; &sbquo; &rsquor; */
:root:lang(fi),       :not(:lang(fi)) &gt; :lang(fi)             { quotes: '\201d' '\201d' '\2019' '\2019' } /* &rdquo; &rdquo; &rsquor; &rsquor; */
:root:lang(fil),      :not(:lang(fil)) &gt; :lang(fil)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(fr),       :not(:lang(fr)) &gt; :lang(fr)             { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* &laquo; &raquo; &laquo; &raquo; */
:root:lang(fr-CA),    :not(:lang(fr-CA)) &gt; :lang(fr-CA)       { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(fr-CH),    :not(:lang(fr-CH)) &gt; :lang(fr-CH)       { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(gsw),      :not(:lang(gsw)) &gt; :lang(gsw)           { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(gu),       :not(:lang(gu)) &gt; :lang(gu)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(guz),      :not(:lang(guz)) &gt; :lang(guz)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ha),       :not(:lang(ha)) &gt; :lang(ha)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(he),       :not(:lang(he)) &gt; :lang(he)             { quotes: '\05f4' '\05f4' '\05f3' '\05f3' } /* &#x5f4; &#x5f4; &#x5f3; &#x5f3; */
:root:lang(hi),       :not(:lang(hi)) &gt; :lang(hi)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(hr),       :not(:lang(hr)) &gt; :lang(hr)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(hu),       :not(:lang(hu)) &gt; :lang(hu)             { quotes: '\201e' '\201d' '\00bb' '\00ab' } /* &ldquor; &rdquo; &raquo; &laquo; */
:root:lang(hy),       :not(:lang(hy)) &gt; :lang(hy)             { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* &laquo; &raquo; &laquo; &raquo; */
:root:lang(id),       :not(:lang(id)) &gt; :lang(id)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ig),       :not(:lang(ig)) &gt; :lang(ig)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(it),       :not(:lang(it)) &gt; :lang(it)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(ja),       :not(:lang(ja)) &gt; :lang(ja)             { quotes: '\300c' '\300d' '\300e' '\300f' } /* &#x300c; &#x300d; &#x300e; &#x300f; */
:root:lang(jgo),      :not(:lang(jgo)) &gt; :lang(jgo)           { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(jmc),      :not(:lang(jmc)) &gt; :lang(jmc)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ka),       :not(:lang(ka)) &gt; :lang(ka)             { quotes: '\201e' '\201c' '\00ab' '\00bb' } /* &ldquor; &ldquo; &laquo; &raquo; */
:root:lang(kab),      :not(:lang(kab)) &gt; :lang(kab)           { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(kam),      :not(:lang(kam)) &gt; :lang(kam)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(kde),      :not(:lang(kde)) &gt; :lang(kde)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(kea),      :not(:lang(kea)) &gt; :lang(kea)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(khq),      :not(:lang(khq)) &gt; :lang(khq)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ki),       :not(:lang(ki)) &gt; :lang(ki)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(kk),       :not(:lang(kk)) &gt; :lang(kk)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(kkj),      :not(:lang(kkj)) &gt; :lang(kkj)           { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* &laquo; &raquo; &lsaquo; &rsaquo; */
:root:lang(kln),      :not(:lang(kln)) &gt; :lang(kln)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(km),       :not(:lang(km)) &gt; :lang(km)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(kn),       :not(:lang(kn)) &gt; :lang(kn)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ko),       :not(:lang(ko)) &gt; :lang(ko)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ksb),      :not(:lang(ksb)) &gt; :lang(ksb)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ksf),      :not(:lang(ksf)) &gt; :lang(ksf)           { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* &laquo; &raquo; &lsquo; &rsquor; */
:root:lang(ky),       :not(:lang(ky)) &gt; :lang(ky)             { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* &laquo; &raquo; &ldquor; &ldquo; */
:root:lang(lag),      :not(:lang(lag)) &gt; :lang(lag)           { quotes: '\201d' '\201d' '\2019' '\2019' } /* &rdquo; &rdquo; &rsquor; &rsquor; */
:root:lang(lg),       :not(:lang(lg)) &gt; :lang(lg)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ln),       :not(:lang(ln)) &gt; :lang(ln)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(lo),       :not(:lang(lo)) &gt; :lang(lo)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(lt),       :not(:lang(lt)) &gt; :lang(lt)             { quotes: '\201e' '\201c' '\201e' '\201c' } /* &ldquor; &ldquo; &ldquor; &ldquo; */
:root:lang(lu),       :not(:lang(lu)) &gt; :lang(lu)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(luo),      :not(:lang(luo)) &gt; :lang(luo)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(luy),      :not(:lang(luy)) &gt; :lang(luy)           { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(lv),       :not(:lang(lv)) &gt; :lang(lv)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mas),      :not(:lang(mas)) &gt; :lang(mas)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mer),      :not(:lang(mer)) &gt; :lang(mer)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mfe),      :not(:lang(mfe)) &gt; :lang(mfe)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mg),       :not(:lang(mg)) &gt; :lang(mg)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(mgo),      :not(:lang(mgo)) &gt; :lang(mgo)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mk),       :not(:lang(mk)) &gt; :lang(mk)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(ml),       :not(:lang(ml)) &gt; :lang(ml)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mn),       :not(:lang(mn)) &gt; :lang(mn)             { quotes: '\2018' '\2019' '\201c' '\201d' } /* &lsquo; &rsquor; &ldquo; &rdquo; */
:root:lang(mr),       :not(:lang(mr)) &gt; :lang(mr)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ms),       :not(:lang(ms)) &gt; :lang(ms)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(mua),      :not(:lang(mua)) &gt; :lang(mua)           { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(my),       :not(:lang(my)) &gt; :lang(my)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(naq),      :not(:lang(naq)) &gt; :lang(naq)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(nb),       :not(:lang(nb)) &gt; :lang(nb)             { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* &laquo; &raquo; &lsquo; &rsquor; */
:root:lang(nd),       :not(:lang(nd)) &gt; :lang(nd)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(nl),       :not(:lang(nl)) &gt; :lang(nl)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(nmg),      :not(:lang(nmg)) &gt; :lang(nmg)           { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* &ldquor; &rdquo; &laquo; &raquo; */
:root:lang(nn),       :not(:lang(nn)) &gt; :lang(nn)             { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* &laquo; &raquo; &lsquo; &rsquor; */
:root:lang(nnh),      :not(:lang(nnh)) &gt; :lang(nnh)           { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(nus),      :not(:lang(nus)) &gt; :lang(nus)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(nyn),      :not(:lang(nyn)) &gt; :lang(nyn)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(pa),       :not(:lang(pa)) &gt; :lang(pa)             { quotes: '\0027' '\0027' '\0022' '\0022' } /* ' ' " " */
:root:lang(pl),       :not(:lang(pl)) &gt; :lang(pl)             { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* &ldquor; &rdquo; &laquo; &raquo; */
:root:lang(pt),       :not(:lang(pt)) &gt; :lang(pt)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(pt-PT),    :not(:lang(pt-PT)) &gt; :lang(pt-PT)       { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(rn),       :not(:lang(rn)) &gt; :lang(rn)             { quotes: '\201d' '\201d' '\2019' '\2019' } /* &rdquo; &rdquo; &rsquor; &rsquor; */
:root:lang(ro),       :not(:lang(ro)) &gt; :lang(ro)             { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* &ldquor; &rdquo; &laquo; &raquo; */
:root:lang(rof),      :not(:lang(rof)) &gt; :lang(rof)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ru),       :not(:lang(ru)) &gt; :lang(ru)             { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* &laquo; &raquo; &ldquor; &ldquo; */
:root:lang(rw),       :not(:lang(rw)) &gt; :lang(rw)             { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* &laquo; &raquo; &lsquo; &rsquor; */
:root:lang(rwk),      :not(:lang(rwk)) &gt; :lang(rwk)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(saq),      :not(:lang(saq)) &gt; :lang(saq)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(sbp),      :not(:lang(sbp)) &gt; :lang(sbp)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(seh),      :not(:lang(seh)) &gt; :lang(seh)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ses),      :not(:lang(ses)) &gt; :lang(ses)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(sg),       :not(:lang(sg)) &gt; :lang(sg)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(shi),      :not(:lang(shi)) &gt; :lang(shi)           { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* &laquo; &raquo; &ldquor; &rdquo; */
:root:lang(shi-Latn), :not(:lang(shi-Latn)) &gt; :lang(shi-Latn) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* &laquo; &raquo; &ldquor; &rdquo; */
:root:lang(si),       :not(:lang(si)) &gt; :lang(si)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(sk),       :not(:lang(sk)) &gt; :lang(sk)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(sl),       :not(:lang(sl)) &gt; :lang(sl)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(sn),       :not(:lang(sn)) &gt; :lang(sn)             { quotes: '\201d' '\201d' '\2019' '\2019' } /* &rdquo; &rdquo; &rsquor; &rsquor; */
:root:lang(so),       :not(:lang(so)) &gt; :lang(so)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(sq),       :not(:lang(sq)) &gt; :lang(sq)             { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* &laquo; &raquo; &ldquo; &rdquo; */
:root:lang(sr),       :not(:lang(sr)) &gt; :lang(sr)             { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(sr-Latn),  :not(:lang(sr-Latn)) &gt; :lang(sr-Latn)   { quotes: '\201e' '\201c' '\201a' '\2018' } /* &ldquor; &ldquo; &sbquo; &lsquo; */
:root:lang(sv),       :not(:lang(sv)) &gt; :lang(sv)             { quotes: '\201d' '\201d' '\2019' '\2019' } /* &rdquo; &rdquo; &rsquor; &rsquor; */
:root:lang(sw),       :not(:lang(sw)) &gt; :lang(sw)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(swc),      :not(:lang(swc)) &gt; :lang(swc)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ta),       :not(:lang(ta)) &gt; :lang(ta)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(te),       :not(:lang(te)) &gt; :lang(te)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(teo),      :not(:lang(teo)) &gt; :lang(teo)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(th),       :not(:lang(th)) &gt; :lang(th)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(ti-ER),    :not(:lang(ti-ER)) &gt; :lang(ti-ER)       { quotes: '\2018' '\2019' '\201c' '\201d' } /* &lsquo; &rsquor; &ldquo; &rdquo; */
:root:lang(to),       :not(:lang(to)) &gt; :lang(to)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(tr),       :not(:lang(tr)) &gt; :lang(tr)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(twq),      :not(:lang(twq)) &gt; :lang(twq)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(tzm),      :not(:lang(tzm)) &gt; :lang(tzm)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(uk),       :not(:lang(uk)) &gt; :lang(uk)             { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* &laquo; &raquo; &ldquor; &ldquo; */
:root:lang(ur),       :not(:lang(ur)) &gt; :lang(ur)             { quotes: '\201d' '\201c' '\2019' '\2018' } /* &rdquo; &ldquo; &rsquor; &lsquo; */
:root:lang(uz),       :not(:lang(uz)) &gt; :lang(uz)             { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
:root:lang(uz-Cyrl),  :not(:lang(uz-Cyrl)) &gt; :lang(uz-Cyrl)   { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(vai),      :not(:lang(vai)) &gt; :lang(vai)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(vai-Latn), :not(:lang(vai-Latn)) &gt; :lang(vai-Latn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(vi),       :not(:lang(vi)) &gt; :lang(vi)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(vun),      :not(:lang(vun)) &gt; :lang(vun)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(xh),       :not(:lang(xh)) &gt; :lang(xh)             { quotes: '\2018' '\2019' '\201c' '\201d' } /* &lsquo; &rsquor; &ldquo; &rdquo; */
:root:lang(xog),      :not(:lang(xog)) &gt; :lang(xog)           { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(yav),      :not(:lang(yav)) &gt; :lang(yav)           { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* &laquo; &raquo; &laquo; &raquo; */
:root:lang(yo),       :not(:lang(yo)) &gt; :lang(yo)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(zgh),      :not(:lang(zgh)) &gt; :lang(zgh)           { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* &laquo; &raquo; &ldquor; &rdquo; */
:root:lang(zh),       :not(:lang(zh)) &gt; :lang(zh)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
:root:lang(zh-Hant),  :not(:lang(zh-Hant)) &gt; :lang(zh-Hant)   { quotes: '\300c' '\300d' '\300e' '\300f' } /* &#x300c; &#x300d; &#x300e; &#x300f; */
:root:lang(zu),       :not(:lang(zu)) &gt; :lang(zu)             { quotes: '\201c' '\201d' '\2018' '\2019' } /* &ldquo; &rdquo; &lsquo; &rsquor; */
</pre>  


  <h4 id=sections-and-headings><span class=secno>14.3.7 </span>Sections and headings</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
  display: block;<!-- see also unicode-bidi: isolate rules-->
}

h1 { margin-top: 0.67em; margin-bottom: 0.67em; font-size: 2.00em; font-weight: bold; }
h2 { margin-top: 0.83em; margin-bottom: 0.83em; font-size: 1.50em; font-weight: bold; }
h3 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; font-weight: bold; }
h4 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; font-weight: bold; }
h5 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; font-weight: bold; }
h6 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; font-weight: bold; }</pre>

  <p>The <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-nav-element>nav</a></code>, and <code><a href=#the-section-element>section</a></code>
  elements are expected to affect the margins and font size of <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements, as well as
  <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code> elements that follow <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements in
  <code><a href=#the-hgroup-element>hgroup</a></code> elements, based on the nesting depth. If <var title="">x</var> is a selector
  that matches elements that are either <code><a href=#the-article-element>article</a></code>, <code><a href=#the-aside-element>aside</a></code>, <code><a href=#the-nav-element>nav</a></code>,
  or <code><a href=#the-section-element>section</a></code> elements, then the following rules capture what is expected:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

<var title="">x</var> h1 { margin-top: 0.83em; margin-bottom: 0.83em; font-size: 1.50em; }
<var title="">x</var> <var title="">x</var> h1 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; }
<var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> h1 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }

<var title="">x</var> hgroup &gt; h1 ~ h2 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; }
<var title="">x</var> <var title="">x</var> hgroup &gt; h1 ~ h2 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
<var title="">x</var> <var title="">x</var> <var title="">x</var> hgroup &gt; h1 ~ h2 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
<var title="">x</var> <var title="">x</var> <var title="">x</var> <var title="">x</var> hgroup &gt; h1 ~ h2 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }

<var title="">x</var> hgroup &gt; h1 ~ h3 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
<var title="">x</var> <var title="">x</var> hgroup &gt; h1 ~ h3 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
<var title="">x</var> <var title="">x</var> <var title="">x</var> hgroup &gt; h1 ~ h3 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }

<var title="">x</var> hgroup &gt; h1 ~ h4 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
<var title="">x</var> <var title="">x</var> hgroup &gt; h1 ~ h4 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }

<var title="">x</var> hgroup &gt; h1 ~ h5 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }</pre>



  <h4 id=lists><span class=secno>14.3.8 </span>Lists</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

dir, dd, dl, dt, menu, ol, ul { display: block; }<!-- see also unicode-bidi:isolate rules -->
li { display: list-item; }<!-- see also unicode-bidi:isolate rules -->

dir, dl, menu, ol, ul { margin-top: 1em; margin-bottom: 1em; }

dir dir, dir dl, dir menu, dir ol, dir ul,
dl dir, dl dl, dl menu, dl ol, dl ul,
menu dir, menu dl, menu menu, menu ol, menu ul,
ol dir, ol dl, ol menu, ol ol, ol ul,
ul dir, ul dl, ul menu, ul ol, ul ul {
  margin-top: 0; margin-bottom: 0;
}

dd { margin-left: 40px; } /* <a href=#ltr-specific>LTR-specific</a>: use 'margin-right' for rtl elements */
dir, menu, ol, ul { padding-left: 40px; } /* <a href=#ltr-specific>LTR-specific</a>: use 'padding-right' for rtl elements */

ol { list-style-type: decimal; }

dir, menu, ul { list-style-type: disc; }

dir dir, dir menu, dir ul,
menu dir, menu menu, menu ul,
ol dir, ol menu, ol ul,
ul dir, ul menu, ul ul {
  list-style-type: circle;
}

dir dir dir, dir dir menu, dir dir ul,
dir menu dir, dir menu menu, dir menu ul,
dir ol dir, dir ol menu, dir ol ul,
dir ul dir, dir ul menu, dir ul ul,
menu dir dir, menu dir menu, menu dir ul,
menu menu dir, menu menu menu, menu menu ul,
menu ol dir, menu ol menu, menu ol ul,
menu ul dir, menu ul menu, menu ul ul,
ol dir dir, ol dir menu, ol dir ul,
ol menu dir, ol menu menu, ol menu ul,
ol ol dir, ol ol menu, ol ol ul,
ol ul dir, ol ul menu, ol ul ul,
ul dir dir, ul dir menu, ul dir ul,
ul menu dir, ul menu menu, ul menu ul,
ul ol dir, ul ol menu, ul ol ul,
ul ul dir, ul ul menu, ul ul ul {
  list-style-type: square;
}</pre>

  <p id=decohints>The following rules are also expected to apply, as
  <a href=#presentational-hints>presentational hints</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

ol[type=1], li[type=1] { list-style-type: decimal; }
ol[type=a], li[type=a] { list-style-type: lower-alpha; }
ol[type=A], li[type=A] { list-style-type: upper-alpha; }
ol[type=i], li[type=i] { list-style-type: lower-roman; }
ol[type=I], li[type=I] { list-style-type: upper-roman; }
ul[type=disc i], li[type=disc i] { list-style-type: disc; }
ul[type=circle i], li[type=circle i] { list-style-type: circle; }
ul[type=square i], li[type=square i] { list-style-type: square; }</pre>

  <p>When rendering <code><a href=#the-li-element>li</a></code> elements, non-CSS user agents are expected to use the
  <a href=#ordinal-value>ordinal value</a> of the <code><a href=#the-li-element>li</a></code> element to render the counter in the list item
  marker.</p>

  <p class=critical id=css-list-rendering>This specification does not yet define the
  CSS-specific rules for rendering <code><a href=#the-li-element>li</a></code> elements, because CSS doesn't yet provide
  sufficient hooks for this purpose.</p>


  <h4 id=tables><span class=secno>14.3.9 </span>Tables</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

table { display: table; }<!-- see also unicode-bidi:isolate rules -->
caption { display: table-caption; }<!-- see also unicode-bidi:isolate rules -->
colgroup, colgroup[hidden] { display: table-column-group; }<!-- see also unicode-bidi:isolate rules -->
col, col[hidden] { display: table-column; }<!-- see also unicode-bidi:isolate rules -->
thead, thead[hidden] { display: table-header-group; }<!-- see also unicode-bidi:isolate rules -->
tbody, tbody[hidden] { display: table-row-group; }<!-- see also unicode-bidi:isolate rules -->
tfoot, tfoot[hidden] { display: table-footer-group; }<!-- see also unicode-bidi:isolate rules -->
tr, tr[hidden] { display: table-row; }<!-- see also unicode-bidi:isolate rules -->
td, th, td[hidden], th[hidden] { display: table-cell; }<!-- see also unicode-bidi:isolate rules -->

colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
tfoot[hidden], tr[hidden], td[hidden], th[hidden] {
  visibility: collapse;
}

table {
  box-sizing: border-box;
  border-spacing: 2px;
  border-collapse: separate;
  text-indent: initial;
}
td, th { padding: 1px; }
th { font-weight: bold; }

thead, tbody, tfoot, table &gt; tr { vertical-align: middle; }
tr, td, th { vertical-align: inherit; }

table, td, th { border-color: gray; }
thead, tbody, tfoot, tr { border-color: inherit; }
table[rules=none i], table[rules=groups i], table[rules=rows i],
table[rules=cols i], table[rules=all i], table[frame=void i],
table[frame=above i], table[frame=below i], table[frame=hsides i],
table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
table[frame=box i], table[frame=border i],
table[rules=none i] &gt; tr &gt; td, table[rules=none i] &gt; tr &gt; th,
table[rules=groups i] &gt; tr &gt; td, table[rules=groups i] &gt; tr &gt; th,
table[rules=rows i] &gt; tr &gt; td, table[rules=rows i] &gt; tr &gt; th,
table[rules=cols i] &gt; tr &gt; td, table[rules=cols i] &gt; tr &gt; th,
table[rules=all i] &gt; tr &gt; td, table[rules=all i] &gt; tr &gt; th,
table[rules=none i] &gt; thead &gt; tr &gt; td, table[rules=none i] &gt; thead &gt; tr &gt; th,
table[rules=groups i] &gt; thead &gt; tr &gt; td, table[rules=groups i] &gt; thead &gt; tr &gt; th,
table[rules=rows i] &gt; thead &gt; tr &gt; td, table[rules=rows i] &gt; thead &gt; tr &gt; th,
table[rules=cols i] &gt; thead &gt; tr &gt; td, table[rules=cols i] &gt; thead &gt; tr &gt; th,
table[rules=all i] &gt; thead &gt; tr &gt; td, table[rules=all i] &gt; thead &gt; tr &gt; th,
table[rules=none i] &gt; tbody &gt; tr &gt; td, table[rules=none i] &gt; tbody &gt; tr &gt; th,
table[rules=groups i] &gt; tbody &gt; tr &gt; td, table[rules=groups i] &gt; tbody &gt; tr &gt; th,
table[rules=rows i] &gt; tbody &gt; tr &gt; td, table[rules=rows i] &gt; tbody &gt; tr &gt; th,
table[rules=cols i] &gt; tbody &gt; tr &gt; td, table[rules=cols i] &gt; tbody &gt; tr &gt; th,
table[rules=all i] &gt; tbody &gt; tr &gt; td, table[rules=all i] &gt; tbody &gt; tr &gt; th,
table[rules=none i] &gt; tfoot &gt; tr &gt; td, table[rules=none i] &gt; tfoot &gt; tr &gt; th,
table[rules=groups i] &gt; tfoot &gt; tr &gt; td, table[rules=groups i] &gt; tfoot &gt; tr &gt; th,
table[rules=rows i] &gt; tfoot &gt; tr &gt; td, table[rules=rows i] &gt; tfoot &gt; tr &gt; th,
table[rules=cols i] &gt; tfoot &gt; tr &gt; td, table[rules=cols i] &gt; tfoot &gt; tr &gt; th,
table[rules=all i] &gt; tfoot &gt; tr &gt; td, table[rules=all i] &gt; tfoot &gt; tr &gt; th {
  border-color: black;
}</pre>

  <p>The following rules are also expected to apply, as
  <a href=#presentational-hints>presentational hints</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

table[align=left i] { float: left; }
table[align=right i] { float: right; }
table[align=center i] { margin-left: auto; margin-right: auto; }
thead[align=absmiddle i], tbody[align=absmiddle i], tfoot[align=absmiddle i],
tr[align=absmiddle i], td[align=absmiddle i], th[align=absmiddle i] {
  text-align: center;
}

caption[align=bottom i] { caption-side: bottom; }
p[align=left i], h1[align=left i], h2[align=left i], h3[align=left i],
h4[align=left i], h5[align=left i], h6[align=left i] {
  text-align: left;
}
p[align=right i], h1[align=right i], h2[align=right i], h3[align=right i],
h4[align=right i], h5[align=right i], h6[align=right i] {
  text-align: right;
}
p[align=center i], h1[align=center i], h2[align=center i], h3[align=center i],
h4[align=center i], h5[align=center i], h6[align=center i] {
  text-align: center;
}
p[align=justify i], h1[align=justify i], h2[align=justify i], h3[align=justify i],
h4[align=justify i], h5[align=justify i], h6[align=justify i] {
  text-align: justify;
}
thead[valign=top i], tbody[valign=top i], tfoot[valign=top i],
tr[valign=top i], td[valign=top i], th[valign=top i] {
  vertical-align: top;
}
thead[valign=middle i], tbody[valign=middle i], tfoot[valign=middle i],
tr[valign=middle i], td[valign=middle i], th[valign=middle i] {
  vertical-align: middle;
}
thead[valign=bottom i], tbody[valign=bottom i], tfoot[valign=bottom i],
tr[valign=bottom i], td[valign=bottom i], th[valign=bottom i] {
  vertical-align: bottom;
}
thead[valign=baseline i], tbody[valign=baseline i], tfoot[valign=baseline i],
tr[valign=baseline i], td[valign=baseline i], th[valign=baseline i] {
  vertical-align: baseline;
}

td[nowrap], th[nowrap] { white-space: nowrap; }

table[rules=none i], table[rules=groups i], table[rules=rows i],
table[rules=cols i], table[rules=all i] {
  border-style: hidden;
  border-collapse: collapse;
}
table[border] { border-style: outset; } /* <a href=#magic-border-selector>only if border is not equivalent to zero</a> */
table[frame=void i] { border-style: hidden; }
table[frame=above i] { border-style: outset hidden hidden hidden; }
table[frame=below i] { border-style: hidden hidden outset hidden; }
table[frame=hsides i] { border-style: outset hidden outset hidden; }
table[frame=lhs i] { border-style: hidden hidden hidden outset; }
table[frame=rhs i] { border-style: hidden outset hidden hidden; }
table[frame=vsides i] { border-style: hidden outset; }
table[frame=box i], table[frame=border i] { border-style: outset; }

table[border] &gt; tr &gt; td, table[border] &gt; tr &gt; th,
table[border] &gt; thead &gt; tr &gt; td, table[border] &gt; thead &gt; tr &gt; th,
table[border] &gt; tbody &gt; tr &gt; td, table[border] &gt; tbody &gt; tr &gt; th,
table[border] &gt; tfoot &gt; tr &gt; td, table[border] &gt; tfoot &gt; tr &gt; th {
  /* <a href=#magic-border-selector>only if border is not equivalent to zero</a> */
  border-width: 1px;
  border-style: inset;
}
table[rules=none i] &gt; tr &gt; td, table[rules=none i] &gt; tr &gt; th,
table[rules=none i] &gt; thead &gt; tr &gt; td, table[rules=none i] &gt; thead &gt; tr &gt; th,
table[rules=none i] &gt; tbody &gt; tr &gt; td, table[rules=none i] &gt; tbody &gt; tr &gt; th,
table[rules=none i] &gt; tfoot &gt; tr &gt; td, table[rules=none i] &gt; tfoot &gt; tr &gt; th,
table[rules=groups i] &gt; tr &gt; td, table[rules=groups i] &gt; tr &gt; th,
table[rules=groups i] &gt; thead &gt; tr &gt; td, table[rules=groups i] &gt; thead &gt; tr &gt; th,
table[rules=groups i] &gt; tbody &gt; tr &gt; td, table[rules=groups i] &gt; tbody &gt; tr &gt; th,
table[rules=groups i] &gt; tfoot &gt; tr &gt; td, table[rules=groups i] &gt; tfoot &gt; tr &gt; th,
table[rules=rows i] &gt; tr &gt; td, table[rules=rows i] &gt; tr &gt; th,
table[rules=rows i] &gt; thead &gt; tr &gt; td, table[rules=rows i] &gt; thead &gt; tr &gt; th,
table[rules=rows i] &gt; tbody &gt; tr &gt; td, table[rules=rows i] &gt; tbody &gt; tr &gt; th,
table[rules=rows i] &gt; tfoot &gt; tr &gt; td, table[rules=rows i] &gt; tfoot &gt; tr &gt; th {
  border-width: 1px;
  border-style: none;
}
table[rules=cols i] &gt; tr &gt; td, table[rules=cols i] &gt; tr &gt; th,
table[rules=cols i] &gt; thead &gt; tr &gt; td, table[rules=cols i] &gt; thead &gt; tr &gt; th,
table[rules=cols i] &gt; tbody &gt; tr &gt; td, table[rules=cols i] &gt; tbody &gt; tr &gt; th,
table[rules=cols i] &gt; tfoot &gt; tr &gt; td, table[rules=cols i] &gt; tfoot &gt; tr &gt; th {
  border-width: 1px;
  border-style: none solid;
}
table[rules=all i] &gt; tr &gt; td, table[rules=all i] &gt; tr &gt; th,
table[rules=all i] &gt; thead &gt; tr &gt; td, table[rules=all i] &gt; thead &gt; tr &gt; th,
table[rules=all i] &gt; tbody &gt; tr &gt; td, table[rules=all i] &gt; tbody &gt; tr &gt; th,
table[rules=all i] &gt; tfoot &gt; tr &gt; td, table[rules=all i] &gt; tfoot &gt; tr &gt; th {
  border-width: 1px;
  border-style: solid;
}

table[rules=groups i] &gt; colgroup {
  border-left-width: 1px;
  border-left-style: solid;
  border-right-width: 1px;
  border-right-style: solid;
}
table[rules=groups i] &gt; thead,
table[rules=groups i] &gt; tbody,
table[rules=groups i] &gt; tfoot {
  border-top-width: 1px;
  border-top-style: solid;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

table[rules=rows i] &gt; tr, table[rules=rows i] &gt; thead &gt; tr,
table[rules=rows i] &gt; tbody &gt; tr, table[rules=rows i] &gt; tfoot &gt; tr {
  border-top-width: 1px;
  border-top-style: solid;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}</pre>

<!--
 Demos that the above (and prose below) must explain:
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1191
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1194
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1195
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1196
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1197
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1199
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1200
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1201
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1209
-->


  <p>In <a href=#quirks-mode>quirks mode</a>, the following rules are also
  expected to apply:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

table {
  font-weight: initial;
  font-style: initial;
  font-variant: initial;
  font-size: initial;
  line-height: initial;
  white-space: initial;
  text-align: initial;
}</pre>

  <hr><p>For the purposes of the CSS table model, the <code><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 title=attr-col-span><a href=#attr-col-span>span</a></code> attribute <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative
  integers">specifies</a>.</p>

  <p>For the purposes of the CSS table model, the
  <code><a href=#the-colgroup-element>colgroup</a></code> element, if it contains no <code><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 title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code>
  attribute <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative
  integers">specifies</a>.</p>

  <p>For the purposes of the CSS table model, the <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> and <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> attributes on
  <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements are expected to <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">provide</a> the
  <i>special knowledge</i> regarding cells spanning rows and
  columns.</p>

  <p>In <a href=#html-documents>HTML documents</a>, the user agent is expected to
  force the 'display' property of <code><a href=#the-form-element>form</a></code> elements that are
  children of <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>,
  <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, or <code><a href=#the-tr-element>tr</a></code> elements
  to compute to 'none', irrespective of CSS rules.</p>

  <hr><p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> attribute
  <a href=#maps-to-the-pixel-length-property>maps to the pixel length property</a> 'border-spacing' on the
  element.</p>

  <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> attribute <a href=#maps-to-the-pixel-length-property title="maps to the pixel length property">maps to the pixel length
  properties</a> 'padding-top', 'padding-right', 'padding-bottom',
  and 'padding-left' of any <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code>
  elements that have corresponding <a href=#concept-cell title=concept-cell>cells</a> in the <a href=#concept-table title=concept-table>table</a> corresponding to the
  <code><a href=#the-table-element>table</a></code> element.</p>

  <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-hspace>hspace</code> attribute <a href=#maps-to-the-dimension-property title="maps
  to the dimension property">maps to the dimension properties</a>
  'margin-left' and 'margin-right' on the <code><a href=#the-table-element>table</a></code>
  element.</p>

  <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-vspace>vspace</code> attribute <a href=#maps-to-the-dimension-property title="maps
  to the dimension property">maps to the dimension properties</a>
  'margin-top' and 'margin-bottom' on the <code><a href=#the-table-element>table</a></code>
  element.</p>

  <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-height>height</code> attribute <a href=#maps-to-the-dimension-property>maps to the
  dimension property</a> 'height' on the <code><a href=#the-table-element>table</a></code>
  element.</p>

  <p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-width><a href=#attr-table-width>width</a></code> attribute <a href=#maps-to-the-dimension-property>maps to the
  dimension property</a> 'width' on the <code><a href=#the-table-element>table</a></code>
  element.</p>

  <p>The <code><a href=#the-col-element>col</a></code> element's <code title=attr-col-width><a href=#attr-col-width>width</a></code> attribute <a href=#maps-to-the-dimension-property>maps to the
  dimension property</a> 'width' on the <code><a href=#the-col-element>col</a></code>
  element.</p>

  <p>The <code><a href=#the-tr-element>tr</a></code> element's <code title=attr-tr-height>height</code> attribute <a href=#maps-to-the-dimension-property>maps to the
  dimension property</a> 'height' on the <code><a href=#the-tr-element>tr</a></code>
  element.</p>

  <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements' <code title=attr-tdth-height><a href=#attr-tdth-height>height</a></code> attributes <a href=#maps-to-the-dimension-property title="maps
  to the dimension property">map to the dimension property</a> 'height'
  on the element.</p>

  <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements' <code title=attr-tdth-width><a href=#attr-tdth-width>width</a></code> attributes <a href=#maps-to-the-dimension-property title="maps
  to the dimension property">map to the dimension property</a> 'width'
  on the element.</p>

  <hr><p>The <code><a href=#the-caption-element>caption</a></code> element unless specified otherwise
  below, and the <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>,
  <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and
  <code><a href=#the-th-element>th</a></code> elements when they have an <code title=attr-div-align><a href=#attr-div-align>align</a></code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for either the string
  "<code title="">center</code>" or the string "<code title="">middle</code>", are expected to center text within
  themselves, as if they had their 'text-align' property set to
  'center' in a <a href=#presentational-hints title="presentational hints">presentational
  hint</a>, and to <a href=#align-descendants>align descendants</a> to the
  center.</p>

  <p>The <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>,
  <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and
  <code><a href=#the-th-element>th</a></code> elements, when they have an <code title=attr-align>align</code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">left</code>", are expected to left-align text within
  themselves, as if they had their 'text-align' property set to 'left'
  in a <a href=#presentational-hints title="presentational hints">presentational hint</a>,
  and to <a href=#align-descendants>align descendants</a> to the left.</p>

  <p>The <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>,
  <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and
  <code><a href=#the-th-element>th</a></code> elements, when they have an <code title=attr-align>align</code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">right</code>", are expected to right-align text within
  themselves, as if they had their 'text-align' property set to
  'right' in a <a href=#presentational-hints title="presentational hints">presentational
  hint</a>, and to <a href=#align-descendants>align descendants</a> to the right.</p>

  <p>The <code><a href=#the-caption-element>caption</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>,
  <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and
  <code><a href=#the-th-element>th</a></code> elements, when they have an <code title=attr-align>align</code> attribute whose value is an
  <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">justify</code>", are expected to full-justify text within
  themselves, as if they had their 'text-align' property set to
  'justify' in a <a href=#presentational-hints title="presentational hints">presentational
  hint</a>, and to <a href=#align-descendants>align descendants</a> to the left.</p>

  <p>User agents are expected to have a rule in their user agent
  stylesheet that matches <code><a href=#the-th-element>th</a></code> elements that have a parent
  node whose computed value for the 'text-align' property is its
  initial value, whose declaration block consists of just a single
  declaration that sets the 'text-align' property to the value
  'center'.</p> <!-- q.v. '-moz-center-or-inherit' -->

  <hr><p>When a <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>,
  <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
  <code><a href=#the-td-element>td</a></code>, or <code><a href=#the-th-element>th</a></code> element has a <code title=attr-background><a href=#attr-background>background</a></code> attribute set to a
  non-empty value, the new value is expected to be <a href=#resolve-a-url title="resolve a url">resolved</a> relative to the element, and
  if this is successful, the user agent is expected to treat the
  attribute as a <a href=#presentational-hints title="presentational hints">presentational
  hint</a> setting the element's 'background-image' property to the
  resulting <a href=#absolute-url>absolute URL</a>.</p>

  <p>When a <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>,
  <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>,
  <code><a href=#the-td-element>td</a></code>, or <code><a href=#the-th-element>th</a></code> element has a <code title="">bgcolor</code> attribute set, the new value is expected to
  be parsed using the <a href=#rules-for-parsing-a-legacy-color-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 title="presentational
  hints">presentational hint</a> setting the element's
  'background-color' property to the resulting color.</p>

  <p>When a <code><a href=#the-table-element>table</a></code> element has a <code title=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-color-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 title="presentational hints">presentational hint</a> setting the
  element's 'border-top-color', 'border-right-color',
  'border-bottom-color', and 'border-right-color' properties to the
  resulting color.</p>

  <hr><p>The <code><a href=#the-table-element>table</a></code> element's <code title=attr-table-border><a href=#attr-table-border>border</a></code> attribute <a href=#maps-to-the-pixel-length-property title="maps
  to the pixel length property">maps to the pixel length
  properties</a> 'border-top-width', 'border-right-width',
  'border-bottom-width', 'border-left-width' on the element. If the
  attribute is present but parsing the attribute's value using the
  <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> generates an
  error, a default value of 1px is expected to be used for that
  property instead.</p>

  <p>Rules marked "<dfn id=magic-border-selector>only if border is
  not equivalent to zero</dfn>" in the CSS block above is expected to
  only be applied if the <code title=attr-table-border><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>rules for parsing
  non-negative integers</a>, is also found to have a value other
  than zero or to generate an error.</p>

  <hr><p>In <a href=#quirks-mode>quirks mode</a>, a <code><a href=#the-td-element>td</a></code> element or a
  <code><a href=#the-th-element>th</a></code> element that has a <code title=attr-tdth-nowrap><a href=#attr-tdth-nowrap>nowrap</a></code> attribute but also has a
  <code title=attr-tdth-width><a href=#attr-tdth-width>width</a></code> attribute whose value,
  when parsed using the <a href=#rules-for-parsing-dimension-values>rules for parsing dimension
  values</a>, is found to be a length (not an error or a number
  classified as a percentage), is expected to have a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
  element's 'white-space' property to 'normal', overriding the rule in
  the CSS block above that sets it to 'nowrap'.</p>
  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1793 -->
  <!-- note that the "rules for parsing dimension values" can't return 0, if the value is "0" they treat it as an error -->

  <hr><p id=sortable-ui>User agents are expected to render <a href=#sorting-interface-th-element title="sorting interface th
  element">sorting interface <code>th</code> elements</a> in such a manner as to indicate that
  activating the elements will cause the table to be sorted.</p>


  <h4 id=margin-collapsing-quirks><span class=secno>14.3.10 </span>Margin collapsing quirks</h4>

  <p>A node is <dfn id=concept-rendering-substantial title=concept-rendering-substantial>substantial</dfn> if it is a text node
  that is not <a href=#inter-element-whitespace>inter-element whitespace</a>, or if it is an element node.</p>

  <p>A node is <dfn id=concept-rendering-blank title=concept-rendering-blank>blank</dfn> if it is an element that contains no
  <a href=#concept-rendering-substantial title=concept-rendering-substantial>substantial</a> nodes.</p>

  <p>The <dfn id=concept-rendering-elements-with-margins title=concept-rendering-elements-with-margins>elements with default margins</dfn>
  are the following elements: <code><a href=#the-blockquote-element>blockquote</a></code>, <code><a href=#dir>dir</a></code>, <code><a href=#the-dl-element>dl</a></code>,
  <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>,
  <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code><a href=#listing>listing</a></code>, <code><a href=#the-menu-element>menu</a></code>, <code><a href=#multicol>multicol</a></code>, <code><a href=#the-ol-element>ol</a></code>,
  <code><a href=#the-p-element>p</a></code>, <code><a href=#plaintext>plaintext</a></code>, <code><a href=#the-pre-element>pre</a></code>, <code><a href=#the-ul-element>ul</a></code>, <code><a href=#xmp>xmp</a></code></p>

  <p>In <a href=#quirks-mode>quirks mode</a>, any <a href=#concept-rendering-elements-with-margins title=concept-rendering-elements-with-margins>element
  with default margins</a> that is the child of a <code><a href=#the-body-element>body</a></code>, <code><a href=#the-td-element>td</a></code>, or
  <code><a href=#the-th-element>th</a></code> element and has no <a href=#concept-rendering-substantial title=concept-rendering-substantial>substantial</a>
  previous siblings is expected to have a user-agent level style sheet rule that sets its
  'margin-top' property to zero.</p>

  <p>In <a href=#quirks-mode>quirks mode</a>, any <a href=#concept-rendering-elements-with-margins title=concept-rendering-elements-with-margins>element
  with default margins</a> that is the child of a <code><a href=#the-body-element>body</a></code>, <code><a href=#the-td-element>td</a></code>, or
  <code><a href=#the-th-element>th</a></code> element, has no <a href=#concept-rendering-substantial title=concept-rendering-substantial>substantial</a>
  previous siblings, and is <a href=#concept-rendering-blank title=concept-rendering-blank>blank</a>, is expected to have
  a user-agent level style sheet rule that sets its 'margin-bottom' property to zero also.</p>

  <p>In <a href=#quirks-mode>quirks mode</a>, any <a href=#concept-rendering-elements-with-margins title=concept-rendering-elements-with-margins>element
  with default margins</a> that is the child of a <code><a href=#the-td-element>td</a></code> or <code><a href=#the-th-element>th</a></code> element, has
  no <a href=#concept-rendering-substantial title=concept-rendering-substantial>substantial</a> following siblings, and is <a href=#concept-rendering-blank title=concept-rendering-blank>blank</a>, is expected to have a user-agent level style sheet
  rule that sets its 'margin-top' property to zero.</p>

  <p>In <a href=#quirks-mode>quirks mode</a>, any <code><a href=#the-p-element>p</a></code> element that is the child of a <code><a href=#the-td-element>td</a></code>
  or <code><a href=#the-th-element>th</a></code> element and has no <a href=#concept-rendering-substantial title=concept-rendering-substantial>substantial</a> following siblings, is expected to have a
  user-agent level style sheet rule that sets its 'margin-bottom' property to zero.</p>


  <h4 id=form-controls><span class=secno>14.3.11 </span>Form controls</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input, select, option, optgroup, button, textarea, keygen {
  text-indent: initial;
}

textarea { white-space: pre-wrap; }

input[type="radio"], input[type="checkbox"], input[type="reset"], input[type="button"],
input[type="submit"], select, button {
  box-sizing: border-box;
}</pre>

  <p>In <a href=#quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input:not([type=image]), textarea { box-sizing: border-box; }</pre>

  <p>Each kind of form control is also given a specific default binding, as described in subsequent
  sections, which implements the look and feel of the control.</p>



  <h4 id=the-hr-element-0><span class=secno>14.3.12 </span>The <code><a href=#the-hr-element>hr</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

hr { color: gray; border-style: inset; border-width: 1px; margin: 0.5em auto; }</pre>

  <p>The following rules are also expected to apply, as
  <a href=#presentational-hints>presentational hints</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

hr[align=left] { margin-left: 0; margin-right: auto; }
hr[align=right] { margin-left: auto; margin-right: 0; }
hr[align=center] { margin-left: auto; margin-right: auto; }
hr[color], hr[noshade] { border-style: solid; }</pre>

  <p>If an <code><a href=#the-hr-element>hr</a></code> element has either a <code title=attr-hr-color><a href=#attr-hr-color>color</a></code> attribute or a <code title=attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code> attribute, and furthermore
  also has a <code title=attr-hr-size><a href=#attr-hr-size>size</a></code> attribute, and
  parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
  non-negative integers</a> doesn't generate an error, then the
  user agent is expected to use the parsed value divided by two as a
  pixel length for <a href=#presentational-hints>presentational hints</a> for the properties
  'border-top-width', 'border-right-width', 'border-bottom-width', and
  'border-left-width' on the element.</p>

  <p>Otherwise, if an <code><a href=#the-hr-element>hr</a></code> element has neither a <code title=attr-hr-color><a href=#attr-hr-color>color</a></code> attribute nor a <code title=attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code> attribute, but does have a
  <code title=attr-hr-size><a href=#attr-hr-size>size</a></code> attribute, and parsing that
  attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
  integers</a> doesn't generate an error, then: if the parsed value
  is one, then the user agent is expected to use the attribute as a
  <a href=#presentational-hints title="presentational hints">presentational hint</a>
  setting the element's 'border-bottom-width' to 0; otherwise, if the
  parsed value is greater than one, then the user agent is expected to
  use the parsed value minus two as a pixel length for
  <a href=#presentational-hints>presentational hints</a> for the 'height' property on the
  element.</p>

  <p>The <code title=attr-hr-width><a href=#attr-hr-width>width</a></code> attribute on an
  <code><a href=#the-hr-element>hr</a></code> element <a href=#maps-to-the-dimension-property>maps to the dimension property</a>
  'width' on the element.</p>

  <p>When an <code><a href=#the-hr-element>hr</a></code> element has a <code title=attr-hr-color><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-color-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 title="presentational
  hints">presentational hint</a> setting the element's 'color'
  property to the resulting color.</p>



  <h4 id=the-fieldset-and-legend-elements><span class=secno>14.3.13 </span>The <code><a href=#the-fieldset-element>fieldset</a></code> and <code><a href=#the-legend-element>legend</a></code> elements</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

fieldset {
  margin-left: 2px; margin-right: 2px;
  border: groove 2px ThreeDFace;
  padding: 0.35em 0.625em 0.75em;
}

legend {
  padding-left: 2px; padding-right: 2px;
}</pre>

  <p>The <code><a href=#the-fieldset-element>fieldset</a></code> element is expected to establish a new
  block formatting context.</p>

  <p>If the <code><a href=#the-fieldset-element>fieldset</a></code> element has a child that matches the
  conditions in the list below, then the first such child is the
  <code><a href=#the-fieldset-element>fieldset</a></code> element's <dfn id=rendered-legend>rendered legend</dfn>:</p>

  <ul class=brief><li>The child is a <code><a href=#the-legend-element>legend</a></code> element.</li>

   <li>The child is not out-of-flow (e.g. not absolutely positioned or floated).</li>

   <li>The child is generating a box (e.g. it is not 'display:none').</li>

  </ul><p>A <code><a href=#the-fieldset-element>fieldset</a></code> element's <a href=#rendered-legend>rendered legend</a>,
  if any, is expected to be rendered over the top border edge of the
  <code><a href=#the-fieldset-element>fieldset</a></code> element as a 'block' box (overriding any
  explicit 'display' value). In the absence of an explicit width, the
  box should shrink-wrap. If the <code><a href=#the-legend-element>legend</a></code> element in
  question has an <code title=attr-legend-align><a href=#attr-legend-align>align</a></code>
  attribute, and its value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
  match for one of the strings in the first column of the following
  table, then the <code><a href=#the-legend-element>legend</a></code> is expected to be rendered
  horizontally aligned over the border edge in the position given in
  the corresponding cell on the same row in the second column. If the
  attribute is absent or has a value that doesn't match any of the
  cases in the table, then the position is expected to be on the right
  if the 'direction' property on this element has a computed value of
  'rtl', and on the left otherwise.</p>

  <table><thead><tr><th>Attribute value
     <th>Alignment position
   <tbody><tr><td><code title="">left</code>
     <td>On the left
    <tr><td><code title="">right</code>
     <td>On the right
    <tr><td><code title="">center</code>
     <td>In the middle
  </table><h3 id=replaced-elements><span class=secno>14.4 </span>Replaced elements</h3>

  <h4 id=embedded-content-2><span class=secno>14.4.1 </span>Embedded content</h4>

  <p>The <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, and <code><a href=#the-video-element>video</a></code> elements are expected to be
  treated as replaced elements.</p>

  <p>A <code><a href=#the-canvas-element>canvas</a></code> element that <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> is
  expected to be treated as a replaced element; the contents of such elements are the element's
  bitmap, if any, or else a transparent black bitmap with the same intrinsic dimensions as the
  element. Other <code><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><a href=#the-object-element>object</a></code> element that <a href=#represents>represents</a> an image, plugin, or <a href=#nested-browsing-context>nested
  browsing context</a> is expected to be treated as a replaced element. Other <code><a href=#the-object-element>object</a></code>
  elements are expected to be treated as ordinary elements in the rendering model.</p>

  <p>An <code><a href=#the-applet-element>applet</a></code> element that <a href=#represents>represents</a> a <a href=#plugin>plugin</a> is expected
  to be treated as a replaced element. Other <code><a href=#the-applet-element>applet</a></code> elements are expected to be treated
  as ordinary elements in the rendering model.</p>

  <p>The <code><a href=#the-audio-element>audio</a></code> element, when it is <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the
  user">exposing a user interface</a>, is expected to be treated as a replaced element about one
  line high, as wide as is necessary to expose the user agent's user interface features. When an
  <code><a href=#the-audio-element>audio</a></code> element is not <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the user">exposing a
  user interface</a>, the user agent is expected to force its 'display' property to compute to
  'none', irrespective of CSS rules.</p>

  <p>Whether a <code><a href=#the-video-element>video</a></code> element is <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the
  user">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><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><a href=#the-video-element>video</a></code>
  element itself, and is expected to be centered in the <code><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><a href=#the-video-element>video</a></code> element, as defined by the relevant rendering rules; for <a href=#webvtt>WebVTT</a>,
  those are the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p>When the user agent starts <a href=#expose-a-user-interface-to-the-user title="expose a user interface to the user">exposing a user
  interface</a> for a <code><a href=#the-video-element>video</a></code> element, the user agent should run the <a href=#rules-for-updating-the-text-track-rendering>rules for
  updating the text track rendering</a> of each of the <a href=#text-track title="text track">text
  tracks</a> in the <code><a href=#the-video-element>video</a></code> element's <a href=#list-of-text-tracks>list of text tracks</a> that are <a href=#text-track-showing title="text track showing">showing</a> and whose <a href=#text-track-kind>text track kind</a> is one of <code title=dom-TextTrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code> or <code title=dom-TextTrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code> (e.g., for <a href=#text-track title="text track">text
  tracks</a> based on <a href=#webvtt>WebVTT</a>, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT
  text tracks</a>). <a href=#refsWEBVTT>[WEBVTT]</a></p>

  <p class=note>Resizing <code><a href=#the-video-element>video</a></code> and <code><a href=#the-canvas-element>canvas</a></code> elements does not interrupt
  video playback or clear the canvas.</p>

  <hr><p>The following CSS rules are expected to apply:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

iframe:not([seamless]) { border: 2px inset; }
iframe[seamless] { display: block; }
<span id=video-object-fit>video { object-fit: contain; }</span></pre>


  <h4 id=images-0><span class=secno>14.4.2 </span>Images</h4>

  <p>When an <code><a href=#the-img-element>img</a></code> element or an <code><a href=#the-input-element>input</a></code> element when its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image
  Button</a> state <a href=#represents>represents</a> an image, it is expected to be treated as a replaced
  element.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element or an <code><a href=#the-input-element>input</a></code> element when its <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image
  Button</a> state does not <a href=#represents title=represents>represent</a> an image, but the element
  already has intrinsic dimensions (e.g. from the <a href=#dimension-attributes>dimension attributes</a> or CSS rules),
  and either the user agent has reason to believe that the image will become <i title=img-available><a href=#img-available>available</a></i><!--input-img-available also--> and be rendered in due course
  or the <code><a href=#document>Document</a></code> is in <a href=#quirks-mode>quirks mode</a>, the element is expected to be treated
  as a replaced element whose content is the text that the element represents, if any, optionally
  alongside an icon indicating that the image is being obtained. For <code><a href=#the-input-element>input</a></code> elements,
  the text is expected to appear button-like to indicate that the element is a <a href=#concept-button title=concept-button>button</a>.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element <a href=#represents>represents</a> some text and the user agent does not
  expect this to change, the element is expected to be treated 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.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element <a href=#represents>represents</a> nothing and the user agent does not
  expect this to change, the element is expected to not be rendered at all.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element might be a key part of the content, but neither the image nor
  any kind of alternative text is available, and the user agent does not expect this to change, the
  element is expected to be treated as a non-replaced phrasing element whose content is an icon
  indicating that an image is missing.</p> <!-- there's also a should requirement for this case in
  the <img> section itself -->

  <p>When an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is
  in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state does not <a href=#represents title=represents>represent</a> an image and the user agent does not expect this to change,
  the element is expected to be treated as a replaced element consisting of a button whose content
  is the element's alternative text. The intrinsic dimensions of the button are expected to be about
  one line in height and whatever width is necessary to render the text on one line.</p>

  <p>The icons mentioned above are expected to be relatively small so as not to disrupt most text
  but be easily clickable. In a visual environment, for instance, icons could be 16 pixels by 16
  pixels square, or 1em by 1em if the images are scalable. In an audio environment, the icon could
  be a short bleep. The icons are intended to indicate to the user that they can be used to get to
  whatever options the UA provides for images, and, where appropriate, are expected to provide
  access to the context menu that would have come up if the user interacted with the actual
  image.</p>

  <hr><p>All animated images with the same <a href=#absolute-url>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 most recent addition to the group.</p>

  <p class=note>In other words, the animation loop of an animated image is restarted each time
  another image with the same <a href=#absolute-url>absolute URL</a> and image data begins to animate, e.g. after
  being inserted into the document.</p>

  <hr><p>The following CSS rules are expected to apply when the <code><a href=#document>Document</a></code> is in <a href=#quirks-mode>quirks
  mode</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

img[align=left i] { margin-right: 3px; }
img[align=right i] { margin-left: 3px; }</pre>

  </div>


  <div class=impl>

  <h4 id=attributes-for-embedded-content-and-images><span class=secno>14.4.3 </span>Attributes for embedded content and images</h4>

  <p>The following CSS rules are expected to apply as
  <a href=#presentational-hints>presentational hints</a>:</p>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

iframe[frameborder=0], iframe[frameborder=no i] { border: none; }

applet[align=left i], embed[align=left i], iframe[align=left i],
img[align=left i], input[type=image i][align=left i], object[align=left i] {
  float: left;
}

applet[align=right i], embed[align=right i], iframe[align=right i],
img[align=right i], input[type=image i][align=right i], object[align=right i] {
  float: right;
}

applet[align=top i], embed[align=top i], iframe[align=top i],
img[align=top i], input[type=image i][align=top i], object[align=top i] {
  vertical-align: top;
}

applet[align=baseline i], embed[align=baseline i], iframe[align=baseline i],
img[align=baseline i], input[type=image i][align=baseline i], object[align=baseline i] {
  vertical-align: baseline;
}

applet[align=texttop i], embed[align=texttop i], iframe[align=texttop i],
img[align=texttop i], input[type=image i][align=texttop i], object[align=texttop i] {
  vertical-align: text-top;
}

applet[align=absmiddle i], embed[align=absmiddle i], iframe[align=absmiddle i],
img[align=absmiddle i], input[type=image i][align=absmiddle i], object[align=absmiddle i],
applet[align=abscenter i], embed[align=abscenter i], iframe[align=abscenter i],
img[align=abscenter i], input[type=image i][align=abscenter i], object[align=abscenter i] {
  vertical-align: middle;
}

applet[align=bottom i], embed[align=bottom i], iframe[align=bottom i],
img[align=bottom i], input[type=image i][align=bottom i],
object[align=bottom i] {
  vertical-align: bottom;
}</pre>

  <p>When an <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>,
  <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code>
  element, or an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, has an
  <code title=attr-dim-align>align</code> attribute whose value is
  an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">center</code>" or the string "<code title="">middle</code>", the user agent is expected to act as if the
  element's 'vertical-align' property was set to a value that aligns
  the vertical middle of the element with the parent element's
  baseline.</p>

  <p>The <code title=attr-dim-hspace>hspace</code> attribute of
  <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
  <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> elements, and
  <code><a href=#the-input-element>input</a></code> elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, <a href=#maps-to-the-dimension-property title="maps to the dimension property">maps to the dimension
  properties</a> 'margin-left' and 'margin-right' on the
  element.</p>

  <p>The <code title=attr-dim-vspace>vspace</code> attribute of
  <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
  <code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> elements, and
  <code><a href=#the-input-element>input</a></code> elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state, <a href=#maps-to-the-dimension-property title="maps to the dimension property">maps to the dimension
  properties</a> 'margin-top' and 'margin-bottom' on the
  element.</p>

  <p>When an <code><a href=#the-img-element>img</a></code> element, <code><a href=#the-object-element>object</a></code> element, or
  <code><a href=#the-input-element>input</a></code> element with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image Button</a> state has a <code title=attr-dim-border>border</code> attribute whose value, when
  parsed using the <a href=#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>presentational hints</a>: four setting the parsed value as
  a pixel length for the element's 'border-top-width',
  'border-right-width', 'border-bottom-width', and 'border-left-width'
  properties, and four setting the element's 'border-top-style',
  'border-right-style', 'border-bottom-style', and 'border-left-style'
  properties to the value 'solid'.</p>

  <p id=dimRendering>The <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes on <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-embed-element>embed</a></code>,
  <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-object-element>object</a></code> or <code><a href=#the-video-element>video</a></code> elements, and <code><a href=#the-input-element>input</a></code>
  elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>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 title="maps to the dimension
  property">map to the dimension properties</a> 'width' and 'height' on the element
  respectively.</p>

  </div>


  <div class=impl>

  <h4 id=image-maps-0><span class=secno>14.4.4 </span>Image maps</h4>

  <p>Shapes on an <a href=#image-map>image map</a> are expected to act, for the
  purpose of the CSS cascade, as elements independent of the original
  <code><a href=#the-area-element>area</a></code> element that happen to match the same style rules
  but inherit from the <code><a href=#the-img-element>img</a></code> or <code><a href=#the-object-element>object</a></code>
  element.</p>

  <p>For the purposes of the rendering, only the 'cursor' property is
  expected to have any effect on the shape.</p>

  <p class=example>Thus, for example, if an <code><a href=#the-area-element>area</a></code>
  element has a <code title=attr-style><a href=#the-style-attribute>style</a></code> attribute that
  sets the 'cursor' property to 'help', then when the user designates
  that shape, the cursor would change to a Help cursor.</p>

  <p class=example>Similarly, if an <code><a href=#the-area-element>area</a></code> element had a
  CSS rule that set its 'cursor' property to 'inherit' (or if no rule
  setting the 'cursor' property matched the element at all), the
  shape's cursor would be inherited from the <code><a href=#the-img-element>img</a></code> or
  <code><a href=#the-object-element>object</a></code> element of the <a href=#image-map>image map</a>, not from
  the parent of the <code><a href=#the-area-element>area</a></code> element.</p>

  </div>


  <div class=impl>

  <h3 id=bindings><span class=secno>14.5 </span>Bindings</h3>

  <h4 id=introduction-14><span class=secno>14.5.1 </span>Introduction</h4>

  <p>A number of elements have their rendering defined in terms of the
  'binding' property. <a href=#refsBECSS>[BECSS]</a></p>

  <p>The CSS snippets below set the 'binding' property to a
  user-agent-defined value, represented below by keywords like <code title=""><i title="">button</i></code>. The rules then described for
  these bindings are only expected to apply if the element's 'binding'
  property has not been overridden (e.g. by the author) to have
  another value.</p>

  <p>Exactly how the bindings are implemented is not specified by this
  specification. User agents are encouraged to make their bindings set
  the 'appearance' CSS property appropriately to achieve
  platform-native appearances for widgets, and are expected to
  implement any relevant animations, etc, that are appropriate for the
  platform. <a href=#refsCSSUI>[CSSUI]</a></p>

  </div>


  <div class=impl>

  <h4 id=the-button-element-0><span class=secno>14.5.2 </span>The <code><a href=#the-button-element>button</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

button { binding: <i title="">button</i>; }</pre>

  <p>When the <i title="">button</i> binding applies to a
  <code><a href=#the-button-element>button</a></code> element, the element is expected to render as an
  'inline-block' box rendered as a button whose contents are the
  contents of the element.</p>

  <p>When the <code><a href=#the-button-element>button</a></code> element's <code title=attr-button-type><a href=#attr-button-type>type</a></code> attribute is
  in the <a href=#attr-button-type-menu-state title=attr-button-type-menu-state>Menu</a> state, the user agent is expected to
  indicate that activating the element will display a menu, e.g. by displaying a down-pointing
  triangle after the button's label.</p>

  </div>


  <div class=impl>

  <h4 id=the-details-element-0><span class=secno>14.5.3 </span>The <code><a href=#the-details-element>details</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

details { binding: <i title="">details</i>; }</pre>

  <p>When the <i title="">details</i> binding applies to a
  <code><a href=#the-details-element>details</a></code> element, the element is expected to render as a
  'block' box with its 'padding-left' property set to '40px' for
  left-to-right elements (<a href=#ltr-specific>LTR-specific</a>) and with its
  'padding-right' property set to '40px' for right-to-left
  elements. The element's shadow tree is expected to take the
  element's first child <code><a href=#the-summary-element>summary</a></code> element, if any, and
  place it in a first 'block' box container, and then take the
  element's remaining descendants, if any, and place them in a second
  'block' box container.</p>

  <p>The first container is expected to contain at least one line box,
  and that line box is expected to contain a disclosure widget
  (typically a triangle), horizontally positioned within the left
  padding of the <code><a href=#the-details-element>details</a></code> element. That widget is expected
  to allow the user to request that the details be shown or
  hidden.</p>

  <p>The second container is expected to have its 'overflow' property
  set to 'hidden'. When the <code><a href=#the-details-element>details</a></code> element does not have
  an <code title=attr-details-open><a href=#attr-details-open>open</a></code> attribute, this
  second container is expected to be removed from the rendering.</p>

  <!-- http://mail.gnome.org/archives/usability/2006-June/msg00015.html -->

  </div>

  <div class=impl>

  <h4 id=the-input-element-as-a-text-entry-widget><span class=secno>14.5.4 </span>The <code><a href=#the-input-element>input</a></code> element as a text entry widget</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input { binding: <i title="">input-textfield</i>; }
input[type=password i] { binding: <i title="">input-password</i>; }
/* later rules override this for other values of type="" */</pre>

  <p>When the <i title="">input-textfield</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-search>Search</a>, <a href="#telephone-state-(type=tel)" title=attr-input-type-tel>Telephone</a>, <a href="#url-state-(type=url)" title=attr-input-type-url>URL</a>, or <a href="#e-mail-state-(type=email)" title=attr-input-type-email>E-mail</a> state, the element is
  expected to render as an 'inline-block' box rendered as a text
  field.</p>

  <p>When the <i title="">input-password</i> binding applies, to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#password-state-(type=password)" title=attr-input-type-password>Password</a> state, the element
  is expected to render as an 'inline-block' box rendered as a text
  field whose contents are obscured.</p>

  <p>If an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the above
  states has a <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute,
  and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing
  non-negative integers</a> doesn't generate an error, then the
  user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
  'width' property on the element, with the value obtained from
  applying the <a href=#converting-a-character-width-to-pixels>converting a character width to pixels</a>
  algorithm to the value of the attribute.</p>

  <p>If an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the above
  states does <em>not</em> have a <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute, then the user agent
  is expected to act as if it had a user-agent-level style sheet rule
  setting the 'width' property on the element to the value obtained
  from applying the <a href=#converting-a-character-width-to-pixels>converting a character width to
  pixels</a> algorithm to the number 20.</p>

  <p>The <dfn id=converting-a-character-width-to-pixels>converting a character width to pixels</dfn> algorithm
  returns <span title="">(<var title="">size</var>-1)&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">max</var></span>, where
  <var title="">size</var> is the character width to convert, <var title="">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 title="">max</var> is the maximum character width
  of that same font, also in pixels. (The element's 'letter-spacing'
  property does not affect the result.)</p>

  </div>


  <div class=impl>

  <h4 id=the-input-element-as-domain-specific-widgets><span class=secno>14.5.5 </span>The <code><a href=#the-input-element>input</a></code> element as domain-specific widgets</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input[type=datetime i] { binding: <i title="">input-datetime</i>; }
input[type=date i] { binding: <i title="">input-date</i>; }
input[type=month i] { binding: <i title="">input-month</i>; }
input[type=week i] { binding: <i title="">input-week</i>; }
input[type=time i] { binding: <i title="">input-time</i>; }
input[type=datetime-local i] { binding: <i title="">input-datetime-local</i>; }
input[type=number i] { binding: <i title="">input-number</i>; }</pre>

  <p>When the <i title="">input-datetime</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#date-and-time-state-(type=datetime)" title=attr-input-type-datetime>Date and Time</a> state, the
  element is expected to render as an 'inline-block' box depicting a
  Date and Time control.</p>

  <p>When the <i title="">input-date</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#date-state-(type=date)" title=attr-input-type-date>Date</a> state, the element is
  expected to render as an 'inline-block' box depicting a Date
  control.</p>

  <p>When the <i title="">input-month</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#month-state-(type=month)" title=attr-input-type-month>Month</a> state, the element is
  expected to render as an 'inline-block' box depicting a Month
  control.</p>

  <p>When the <i title="">input-week</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#week-state-(type=week)" title=attr-input-type-week>Week</a> state, the element is
  expected to render as an 'inline-block' box depicting a Week
  control.</p>

  <p>When the <i title="">input-time</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#time-state-(type=time)" title=attr-input-type-time>Time</a> state, the element is
  expected to render as an 'inline-block' box depicting a Time
  control.</p>

  <p>When the <i title="">input-datetime-local</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#local-date-and-time-state-(type=datetime-local)" title=attr-input-type-datetime-local>Local Date and Time</a>
  state, the element is expected to render as an 'inline-block' box
  depicting a Local Date and Time control.</p>

  <p>When the <i title="">input-number</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state, the element is
  expected to render as an 'inline-block' box depicting a Number
  control.</p>

  <p>These controls are all expected to be about one line high, and
  about as wide as necessary to show the widest possible value.</p>

  </div>


  <div class=impl>

  <h4 id=the-input-element-as-a-range-control><span class=secno>14.5.6 </span>The <code><a href=#the-input-element>input</a></code> element as a range control</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input[type=range i] { binding: <i title="">input-range</i>; }</pre>

  <p>When the <i title="">input-range</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#range-state-(type=range)" title=attr-input-type-range>Range</a> state, the element is
  expected to render as an 'inline-block' box depicting a slider
  control.</p>

  <p>When the control is wider than it is tall (or square), the
  control is expected to be a horizontal slider, with the lowest value
  on the right if the 'direction' property on this element has a
  computed value of 'rtl', and on the left otherwise. When the control
  is taller than it is wide, it is expected to be a vertical slider,
  with the lowest value on the bottom.</p>

  <p>Predefined suggested values (provided by the <code title=attr-input-list><a href=#attr-input-list>list</a></code> attribute) are expected to be
  shown as tick marks on the slider, which the slider can snap to.</p>

  <p>User agents are expected to use the used value of the 'direction'
  property on the element to determine the direction in which the
  slider operates. Typically, a left-to-right ('ltr') horizontal
  control would have the lowest value on the left and the highest
  value on the right, and vice versa.</p>

  </div>


  <div class=impl>

  <h4 id=the-input-element-as-a-color-well><span class=secno>14.5.7 </span>The <code><a href=#the-input-element>input</a></code> element as a color well</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input[type=color i] { binding: <i title="">input-color</i>; }</pre>

  <p>When the <i title="">input-color</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#color-state-(type=color)" title=attr-input-type-color>Color</a> state, the element is
  expected to render as an 'inline-block' 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 title=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>

  </div>


  <div class=impl>

  <h4 id=the-input-element-as-a-checkbox-and-radio-button-widgets><span class=secno>14.5.8 </span>The <code><a href=#the-input-element>input</a></code> element as a checkbox and radio button widgets</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input[type=checkbox i] { binding: <i title="">input-checkbox</i>; }
input[type=radio i] { binding: <i title="">input-radio</i>; }</pre>

  <p>When the <i title="">input-checkbox</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" title=attr-input-type-checkbox>Checkbox</a> state, the element
  is expected to render as an 'inline-block' box containing a single
  checkbox control, with no label.</p>

  <p>When the <i title="">input-radio</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" title=attr-input-type-radio>Radio Button</a> state, the element
  is expected to render as an 'inline-block' box containing a single
  radio button control, with no label.</p>

  </div>


  <div class=impl>

  <h4 id=the-input-element-as-a-file-upload-control><span class=secno>14.5.9 </span>The <code><a href=#the-input-element>input</a></code> element as a file upload control</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input[type=file i] { binding: <i title="">input-file</i>; }</pre>

  <p>When the <i title="">input-file</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#file-upload-state-(type=file)" title=attr-input-type-file>File Upload</a> state, the element
  is expected to render as an 'inline-block' box containing a span of
  text giving the file name(s) of the <a href=#concept-input-type-file-selected title=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>

  </div>


  <div class=impl>

  <h4 id=the-input-element-as-a-button><span class=secno>14.5.10 </span>The <code><a href=#the-input-element>input</a></code> element as a button</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

input[type=submit i], input[type=reset i], input[type=button i] {
  binding: <i title="">input-button</i>;
}</pre>

  <p>When the <i title="">input-button</i> binding applies to an
  <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#submit-button-state-(type=submit)" title=attr-input-type-submit>Submit Button</a>, <a href="#reset-button-state-(type=reset)" title=attr-input-type-reset>Reset Button</a>, or <a href="#button-state-(type=button)" title=attr-input-type-button>Button</a> state, the element is
  expected to render as an 'inline-block' box rendered as a button,
  about one line high, containing the contents of the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if any, or text
  derived from the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code>
  attribute in a user-agent-defined (and probably locale-specific)
  fashion, if not.</p>

  </div>


  <div class=impl>

  <h4 id=the-marquee-element-0><span class=secno>14.5.11 </span>The <code><a href=#the-marquee-element>marquee</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

marquee { binding: <i title="">marquee</i>; }</pre>

  <p>When the <i title="">marquee</i> binding applies to a
  <code><a href=#the-marquee-element>marquee</a></code> element, while the element is <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>, the element is expected
  to render in an animated fashion according to its attributes as
  follows:</p>

  <dl><dt>If the element's <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
   <a href=#attr-marquee-behavior-scroll title=attr-marquee-behavior-scroll>scroll</a> state</dt>

   <dd>

    <p>Slide the contents of the element in the direction described by
    the <code title=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><a href=#the-marquee-element>marquee</a></code>, and ends flush with the inner end
    side.</p>

    <p class=example>For example, if the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute is <a href=#attr-marquee-direction-left title=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><a href=#the-marquee-element>marquee</a></code>'s content
    area, and the contents would then slide up to the point where the
    left edge of the contents are flush with the left inner edge of
    the <code><a href=#the-marquee-element>marquee</a></code>'s content area.</p>

    <p>Once the animation has ended, the user agent is expected to
    <a href=#increment-the-marquee-current-loop-index>increment the marquee current loop index</a>. If the
    element is still <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>
    after this, then the user agent is expected to restart the
    animation.</p>

   </dd>

   <dt>If the element's <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
   <a href=#attr-marquee-behavior-slide title=attr-marquee-behavior-slide>slide</a> state</dt>

   <dd>

    <p>Slide the contents of the element in the direction described by
    the <code title=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><a href=#the-marquee-element>marquee</a></code>, and ends off the end side of the
    <code><a href=#the-marquee-element>marquee</a></code>.</p>

    <p class=example>For example, if the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute is <a href=#attr-marquee-direction-left title=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><a href=#the-marquee-element>marquee</a></code>'s content
    area, and the contents would then slide up to the point where the
    <em>right</em> edge of the contents are flush with the left inner
    edge of the <code><a href=#the-marquee-element>marquee</a></code>'s content area.</p>

    <p>Once the animation has ended, the user agent is expected to
    <a href=#increment-the-marquee-current-loop-index>increment the marquee current loop index</a>. If the
    element is still <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>
    after this, then the user agent is expected to restart the
    animation.</p>

   </dd>

   <dt>If the element's <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
   <a href=#attr-marquee-behavior-alternate title=attr-marquee-behavior-alternate>alternate</a>
   state</dt>

   <dd>

    <p>When the <a href=#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 title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute as
    defined below, such that it begins flush with the start side of
    the <code><a href=#the-marquee-element>marquee</a></code>, and ends flush with the end side of the
    <code><a href=#the-marquee-element>marquee</a></code>.</p>

    <p>When the <a href=#marquee-current-loop-index>marquee current loop index</a> is odd, slide
    the contents of the element in the opposite direction than that
    described by the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute as
    defined below, such that it begins flush with the end side of the
    <code><a href=#the-marquee-element>marquee</a></code>, and ends flush with the start side of the
    <code><a href=#the-marquee-element>marquee</a></code>.</p>

    <p class=example>For example, if the <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute is <a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a> (the default),
    then the contents would with their right edge flush with the right
    inner edge of the <code><a href=#the-marquee-element>marquee</a></code>'s content area, and the
    contents would then slide up to the point where the <em>left</em>
    edge of the contents are flush with the left inner edge of the
    <code><a href=#the-marquee-element>marquee</a></code>'s content area.</p>

    <p>Once the animation has ended, the user agent is expected to
    <a href=#increment-the-marquee-current-loop-index>increment the marquee current loop index</a>. If the
    element is still <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>
    after this, then the user agent is expected to continue the
    animation.</p>

   </dd>

  </dl><p>The <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code>
  attribute has the meanings described in the following table:</p>

  <table><thead><tr><th><code title=attr-marquee-direction><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 title=attr-marquee-direction-left>left</a>
     <td>&slarr; Right to left
     <td>Right
     <td>Left
     <td>&srarr; Left to Right
    <tr><td><a href=#attr-marquee-direction-right title=attr-marquee-direction-right>right</a>
     <td>&srarr; Left to Right
     <td>Left
     <td>Right
     <td>&slarr; Right to left
    <tr><td><a href=#attr-marquee-direction-up title=attr-marquee-direction-up>up</a>
     <td>&uparrow; Up (Bottom to Top)
     <td>Bottom
     <td>Top
     <td>&downarrow; Down (Top to Bottom)
    <tr><td><a href=#attr-marquee-direction-down title=attr-marquee-direction-down>down</a>
     <td>&downarrow; Down (Top to Bottom)
     <td>Top
     <td>Bottom
     <td>&uparrow; 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>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>marquee scroll distance</a> with each frame.</p>

  <p>When a <code><a href=#the-marquee-element>marquee</a></code> element has a <code title=attr-marquee-bgcolor>bgcolor</code> attribute set, the value
  is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-color-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 title="presentational hints">presentational hint</a> setting the
  element's 'background-color' property to the resulting color.</p>

  <p>The <code title=attr-marquee-width>width</code> and <code title=attr-marquee-height>height</code> attributes on a
  <code><a href=#the-marquee-element>marquee</a></code> element <a href=#maps-to-the-dimension-property title="maps to the dimension
  property">map to the dimension properties</a> 'width' and
  'height' on the element respectively.</p>

  <p>The intrinsic height of a <code><a href=#the-marquee-element>marquee</a></code> element with its
  <code title=attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute in
  the <a href=#attr-marquee-direction-up title=attr-marquee-direction-up>up</a> or <a href=#attr-marquee-direction-down title=attr-marquee-direction-down>down</a> states is 200 CSS
  pixels.</p>

  <p>The <code title=attr-marquee-vspace>vspace</code> attribute of
  a <code><a href=#the-marquee-element>marquee</a></code> element <a href=#maps-to-the-dimension-property title="maps to the dimension
  property">maps to the dimension properties</a> 'margin-top' and
  'margin-bottom' on the element. The <code title=attr-marquee-hspace>hspace</code> attribute of a
  <code><a href=#the-marquee-element>marquee</a></code> element <a href=#maps-to-the-dimension-property title="maps to the dimension
  property">maps to the dimension properties</a> 'margin-left' and
  'margin-right' on the element.</p>

  <p>The 'overflow' property on the <code><a href=#the-marquee-element>marquee</a></code> element is
  expected to be ignored; overflow is expected to always be
  hidden.</p>

  </div>


  <div class=impl>

  <h4 id=the-meter-element-0><span class=secno>14.5.12 </span>The <code><a href=#the-meter-element>meter</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

meter { binding: <i title="">meter</i>; }</pre>

  <p>When the <i title="">meter</i> binding applies to a
  <code><a href=#the-meter-element>meter</a></code> element, the element is expected to render as an
  'inline-block' box with a 'height' of '1em' and a 'width' of '5em',
  a 'vertical-align' of '-0.2em', and with its contents depicting a
  gauge.</p>

  <p>When the element is wider than it is tall (or square), the
  depiction is expected to be of a horizontal gauge, with the minimum
  value on the right if the 'direction' property on this element has a
  computed value of 'rtl', and on the left otherwise. When the element
  is taller than it is wide, it is expected to depict a vertical
  gauge, with the minimum value on the bottom.</p>

  <p>User agents are expected to use a presentation consistent with
  platform conventions for gauges, if any.</p>

  <p class=note>Requirements for what must be depicted in the gauge
  are included in the definition of the <code><a href=#the-meter-element>meter</a></code>
  element.</p>

  </div>


  <div class=impl>

  <h4 id=the-progress-element-0><span class=secno>14.5.13 </span>The <code><a href=#the-progress-element>progress</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

progress { binding: <i title="">progress</i>; }</pre>

  <p>When the <i title="">progress</i> binding applies to a
  <code><a href=#the-progress-element>progress</a></code> element, the element is expected to render as
  an 'inline-block' box with a 'height' of '1em' and a 'width' of
  '10em', and a 'vertical-align' of '-0.2em'.</p>

  <!-- http://software.hixie.ch/utilities/js/canvas/?c.clearRect(0%2C%200%2C%20640%2C%20480)%3B%0Ac.save()%3B%0Atry%20{%0A%20%20c.fillStyle%20%3D%20'black'%3B%0A%20%20c.font%20%3D%20'8px%20sans-serif'%3B%0A%20%20c.fillText('Wide'%2C%2043%2C105)%3B%0A%20%20c.fillText('Tall'%2C%20100%2C105)%3B%0A%20%20c.fillText('Square'%2C%20128%2C105)%3B%0A%20%20c.font%20%3D%20'700%2010px%20sans-serif'%3B%0A%20%20c.fillText('Progress%20Bars'%2C%2013%2C30)%3B%0A%20%20c.font%20%3D%20'100%2010px%20sans-serif'%3B%0A%20%20c.fillText('(80%25)'%2C%2037%2C45)%3B%0A%20%20c.beginPath()%3B%0A%20%20var%20g%20%3D%20c.createLinearGradient(10%2C0%2C80%2C0)%3B%0A%20%20g.addColorStop(0%2C%20'%2300FF00')%3B%0A%20%20g.addColorStop(0.8%2C%20'%2300FF00')%3B%0A%20%20g.addColorStop(0.9%2C%20'%23FFFF00')%3B%0A%20%20c.fillStyle%20%3D%20g%3B%0A%20%20c.rect(10%2C80%2C80%2C15)%3B%0A%20%20c.fill()%3B%0A%20%20c.strokeStyle%20%3D%20'black'%3B%0A%20%20c.stroke()%3B%0A%20%20c.beginPath()%3B%0A%20%20var%20g%20%3D%20c.createLinearGradient(0%2C80%2C0%2C20)%3B%0A%20%20g.addColorStop(0%2C%20'%2300FF00')%3B%0A%20%20g.addColorStop(0.75%2C%20'%2300FF00')%3B%0A%20%20g.addColorStop(0.85%2C%20'%23FFFF00')%3B%0A%20%20c.fillStyle%20%3D%20g%3B%0A%20%20c.rect(100%2C15%2C15%2C80)%3B%0A%20%20c.fill()%3B%0A%20%20c.strokeStyle%20%3D%20'black'%3B%0A%20%20c.stroke()%3B%0A%0A%20%20c.beginPath()%3B%0A%20%20c.fillStyle%20%3D%20'yellow'%3B%0A%20%20c.arc(140%2C80%2C15%2C0%2C2*Math.PI%2C%20true)%3B%0A%20%20c.fill()%3B%0A%20%20c.beginPath()%3B%0A%20%20c.fillStyle%20%3D%20'lime'%3B%0A%20%20c.moveTo(140%2C80)%3B%0A%20%20c.arc(140%2C80%2C15%2C-Math.PI%2F2%2C1.2*Math.PI%2C%20false)%3B%0A%20%20c.fill()%3B%0A%20%20c.beginPath()%3B%0A%20%20c.arc(140%2C80%2C15%2C0%2C2*Math.PI%2C%20true)%3B%0A%20%20c.strokeStyle%20%3D%20'black'%3B%0A%20%20c.stroke()%3B%0A}%20finally%20{%0A%20%20c.restore()%3B%0A}%0A -->

  <p> <img src=http://images.whatwg.org/sample-progress.png width=157 class=extra alt="" height=103>
  When the element is wider than it is tall, the element is
  expected to be depicted as a horizontal progress bar, with the start
  on the right and the end on the left if the 'direction' property on
  this element has a computed value of 'rtl', and with the start on
  the left and the end on the right otherwise. When the element is
  taller than it is wide, it is expected to depicted as a vertical
  progress bar, with the lowest value on the bottom. When the element
  is square, it is expected to be depicted as a direction-independent
  progress widget (e.g. a circular progress ring).</p>

  <p>User agents are expected to use a presentation consistent with
  platform conventions for progress bars. In particular, user agents
  are expected to use different presentations for determinate and
  indeterminate progress bars. User agents are also expected to vary
  the presentation based on the dimensions of the element.</p>

  <p class=example>For example, on some platforms for showing
  indeterminate progress there is an asynchronous progress indicator
  with square dimensions, which could be used when the element is
  square, and an indeterminate progress bar, which could be used when
  the element is wide.</p>

  <p class=note>Requirements for how to determine if the progress
  bar is determinate or indeterminate, and what progress a determinate
  progress bar is to show, are included in the definition of the
  <code><a href=#the-progress-element>progress</a></code> element.</p>

  </div>


  <div class=impl>

  <h4 id=the-select-element-0><span class=secno>14.5.14 </span>The <code><a href=#the-select-element>select</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

select { binding: <i title="">select</i>; }</pre>

  <p>When the <i title="">select</i> binding applies to a
  <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present,
  the element is expected to render as a multi-select list box.</p>

  <p>When the <i title="">select</i> binding applies to a
  <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent,
  and the element's <a href=#concept-select-size title=concept-select-size>display
  size</a> is greater than 1, the element is expected to render as
  a single-select list box.</p>

  <p>When the element renders as a list box, it is expected to render
  as an 'inline-block' box whose 'height' is the height necessary to
  contain as many rows for items as given by the element's <a href=#concept-select-size title=concept-select-size>display size</a>, or four rows if the
  attribute is absent, and whose 'width' is the <a href="#width-of-the-select's-labels">width of the
  <code>select</code>'s labels</a> plus the width of a
  scrollbar.</p>

  <p>When the <i title="">select</i> binding applies to a
  <code><a href=#the-select-element>select</a></code> element whose <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent,
  and the element's <a href=#concept-select-size title=concept-select-size>display
  size</a> is 1, the element is expected to render as a one-line
  drop down box whose width is the <a href="#width-of-the-select's-labels">width of the
  <code>select</code>'s labels</a>.</p>

  <p>In either case (list box or drop-down box), the element's items
  are expected to be the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, with the
  element's <code><a href=#the-optgroup-element>optgroup</a></code> element children providing headers
  for groups of options where applicable.</p>

  <p>An <code><a href=#the-optgroup-element>optgroup</a></code> element is expected to be rendered by
  displaying the element's <code title=attr-optgroup-label><a href=#attr-optgroup-label>label</a></code> attribute.</p>

  <p>An <code><a href=#the-option-element>option</a></code> element is expected to be rendered by
  displaying the element's <a href=#concept-option-label title=concept-option-label>label</a>, indented under its
  <code><a href=#the-optgroup-element>optgroup</a></code> element if it has one.</p>

  <p>The <dfn id="width-of-the-select's-labels">width of the <code>select</code>'s labels</dfn> is the
  wider of the width necessary to render the widest
  <code><a href=#the-optgroup-element>optgroup</a></code>, and the width necessary to render the widest
  <code><a href=#the-option-element>option</a></code> element in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> (including
  its indent, if any).</p>

  <p>If a <code><a href=#the-select-element>select</a></code> element contains a <a href=#placeholder-label-option>placeholder
  label option</a>, the user agent is expected to render that
  <code><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>placeholder label option</a> from being
  explicitly selected by the user. When the <a href=#placeholder-label-option>placeholder label
  option</a>'s <a href=#concept-option-selectedness title=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><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>

  </div>


  <div class=impl>

  <h4 id=the-textarea-element-0><span class=secno>14.5.15 </span>The <code><a href=#the-textarea-element>textarea</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

textarea { binding: <i title="">textarea</i>; white-space: pre-wrap; }</pre>

  <p>When the <i title="">textarea</i> binding applies to a
  <code><a href=#the-textarea-element>textarea</a></code> element, the element is expected to render as
  an 'inline-block' box rendered as a multiline text field.</p>

  <p>If the element has a <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code>
  attribute, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules
  for parsing non-negative integers</a> doesn't generate an error,
  then the user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
  'width' property on the element, with the value being the
  <a href=#textarea-effective-width>textarea effective width</a> (as defined below). Otherwise,
  the user agent is expected to act as if it had a user-agent-level
  style sheet rule setting the 'width' property on the element to the
  <a href=#textarea-effective-width>textarea effective width</a>.</p>

  <p>The <dfn id=textarea-effective-width>textarea effective width</dfn> of a
  <code><a href=#the-textarea-element>textarea</a></code> element is <span title=""><var title="">size</var>&times;<var title="">avg</var>&nbsp;+&nbsp;<var title="">sbw</var></span>, where <var title="">size</var> is the
  element's <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character
  width</a>, <var title="">avg</var> is the average character width
  of the primary font of the element, in CSS pixels, and <var title="">sbw</var> is the width of a scroll bar, in CSS pixels. (The
  element's 'letter-spacing' property does not affect the result.)</p>

  <p>If the element has a <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>
  attribute, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers>rules
  for parsing non-negative integers</a> doesn't generate an error,
  then the user agent is expected to use the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> for the
  'height' property on the element, with the value being the
  <a href=#textarea-effective-height>textarea effective height</a> (as defined
  below). Otherwise, the user agent is expected to act as if it had a
  user-agent-level style sheet rule setting the 'height' property on
  the element to the <a href=#textarea-effective-height>textarea effective height</a>.</p>

  <p>The <dfn id=textarea-effective-height>textarea effective height</dfn> of a
  <code><a href=#the-textarea-element>textarea</a></code> element is the height in CSS pixels of the
  number of lines specified the element's <a href=#attr-textarea-rows-value title=attr-textarea-rows-value>character height</a>, plus the
  height of a scrollbar in CSS pixels.</p>

  <p>User agents are expected to apply the 'white-space' CSS property
  to <code><a href=#the-textarea-element>textarea</a></code> elements. For historical reasons, if the
  element has a <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute
  whose value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
  string "<code title=attr-textarea-wrap-off>off</code>", then the
  user agent is expected to treat the attribute as a <a href=#presentational-hints title="presentational hints">presentational hint</a> setting the
  element's 'white-space' property to 'pre'.</p>

  </div>


  <div class=impl>

  <h4 id=the-keygen-element-0><span class=secno>14.5.16 </span>The <code><a href=#the-keygen-element>keygen</a></code> element</h4>

  <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);

keygen { binding: <i title="">keygen</i>; }</pre>

  <p>When the <i title="">keygen</i> binding applies to a
  <code><a href=#the-keygen-element>keygen</a></code> element, the element is expected to render as an
  'inline-block' box containing a user interface to configure the key
  pair to be generated.</p>

  </div>



  <div class=impl>

  <h3 id=frames-and-framesets><span class=secno>14.6 </span>Frames and framesets</h3>

  <p>User agent are expected to render <code><a href=#frameset>frameset</a></code> elements as a box with the height and
  width of the viewport, with a surface rendered according to the following layout algorithm:</p>

  <ol><li>

    <p>The <var title="">cols</var> and <var title="">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>rules for parsing a list of dimensions</a> to parse the value of the
    element's <code title=attr-frameset-cols>cols</code> attribute, if there is one. Let <var title="">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>rules for parsing a list of dimensions</a> to parse the value of the
    element's <code title=attr-frameset-rows>rows</code> attribute, if there is one. Let <var title="">rows</var> be the result, or an empty list if there is no such attribute.</p>

   </li>

   <li>

    <p>For any of the entries in <var title="">cols</var> or <var title="">rows</var> that have the
    number zero and the unit <i>relative</i>, change the entry's number to one.</p>

   </li>

   <li>

    <p>If <var title="">cols</var> has no entries, then add a single entry consisting of the value 1
    and the unit <i>relative</i> to <var title="">cols</var>.</p>

    <p>If <var title="">rows</var> has no entries, then add a single entry consisting of the value 1
    and the unit <i>relative</i> to <var title="">rows</var>.</p>

   </li>

   <li>

    <p>Invoke the algorithm defined below to <a href=#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 title="">cols</var> as the input list, and the width of the surface
    that the <code><a href=#frameset>frameset</a></code> is being rendered into, in CSS pixels, as the input dimension.
    Let <var title="">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>convert a list of dimensions to a list of pixel
    values</a> using <var title="">rows</var> as the input list, and the height of the surface
    that the <code><a href=#frameset>frameset</a></code> is being rendered into, in CSS pixels, as the input dimension.
    Let <var title="">sized rows</var> be the resulting list.</p>

   </li>

   <li>

    <p>Split the surface into a grid of <span title=""><var title="">w</var>&times;<var title="">h</var></span> rectangles, where <var title="">w</var> is the number of entries in <var title="">sized cols</var> and <var title="">h</var> is the number of entries in <var title="">sized rows</var>.</p>

    <p>Size the columns so that each column in the grid is as many CSS pixels wide as the
    corresponding entry in the <var title="">sized cols</var> list.</p>

    <p>Size the rows so that each row in the grid is as many CSS pixels high as the corresponding
    entry in the <var title="">sized rows</var> list.</p>

   </li>

   <li>

    <p>Let <var title="">children</var> be the list of <code><a href=#frame>frame</a></code> and <code><a href=#frameset>frameset</a></code>
    elements that are children of the <code><a href=#frameset>frameset</a></code> element for which the algorithm was
    invoked.</p>

   </li>

   <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 title="">children</var>, take the first element in
        the list, and assign it to the rectangle.</p>

        <p>If this is a <code><a href=#frameset>frameset</a></code> element, then recurse the entire <code><a href=#frameset>frameset</a></code>
        layout algorithm for that <code><a href=#frameset>frameset</a></code> element, with the rectangle as the
        surface.</p>

        <p>Otherwise, it is a <code><a href=#frame>frame</a></code> element; create a <a href=#nested-browsing-context>nested browsing
        context</a> sized to fit the rectangle.</p>

       </li>

       <li>

        <p>If there are any elements left in <var title="">children</var>, remove the first element
        from <var title="">children</var>.</p>

      </ol></li>

    </ol></li>

   <li>

    <p>If the <code><a href=#frameset>frameset</a></code> element <a href=#has-a-border>has a border</a>, draw an outer set of borders
    around the rectangles, using the element's <a href=#frame-border-color>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>has a border</a>, draw an inner set of borders around that rectangle, using the
    element's <a href=#frame-border-color>frame border color</a>.</p>

    <p>For each (visible) border that does not abut a rectangle that is assigned a
    <code><a href=#frame>frame</a></code> element with a <code title=attr-frame-noresize>noresize</code> attribute
    (including rectangles in further nested <code><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><a href=#frameset>frameset</a></code> grids.</p>

    <p>A <code><a href=#frameset>frameset</a></code> or <code><a href=#frame>frame</a></code> element <dfn id=has-a-border>has a border</dfn> if the
    following algorithm returns true:</p>

    <ol><li><p>If the element has a <code title=attr-frames-frameborder>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>

     <li><p>Otherwise, if the element has a <code title=attr-frames-frameborder>frameborder</code>
     attribute, return false.</li>

     <li><p>Otherwise, if the element has a parent element that is a <code><a href=#frameset>frameset</a></code> element,
     then return true if <em>that</em> element <a href=#has-a-border>has a border</a>, and false if it does
     not.</li>

     <li><p>Otherwise, return true.</li>

    </ol><p>The <dfn id=frame-border-color>frame border color</dfn> of a <code><a href=#frameset>frameset</a></code> or <code><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 title=attr-frames-bordercolor>bordercolor</code> attribute,
     and applying the <a href=#rules-for-parsing-a-legacy-color-value>rules for parsing a legacy color value</a> to that attribute's value
     does not result in an error, then return the color so obtained.</li>

     <li><p>Otherwise, if the element has a parent element that is a <code><a href=#frameset>frameset</a></code> element,
     then return the <a href=#frame-border-color>frame border color</a> of that element.</p>

     <li><p>Otherwise, return gray.</li>

    </ol></li>

  </ol><p>The algorithm to <dfn id=convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of dimensions to a list of pixel values</dfn> consists of
  the following steps:</p>

  <ol><li>

    <p>Let <var title="">input list</var> be the list of numbers and units passed to the
    algorithm.</p>

    <p>Let <var title="">output list</var> be a list of numbers the same length as <var title="">input list</var>, all zero.</p>

    <p>Entries in <var title="">output list</var> correspond to the entries in <var title="">input
    list</var> that have the same position.</p>

   </li>

   <li><p>Let <var title="">input dimension</var> be the size passed to the algorithm.</p>

   <li>

    <p>Let <var title="">count percentage</var> be the number of entries in <var title="">input
    list</var> whose unit is <i>percentage</i>.</p>

    <p>Let <var title="">total percentage</var> be the sum of all the numbers in <var title="">input
    list</var> whose unit is <i>percentage</i>.</p>

    <p>Let <var title="">count relative</var> be the number of entries in <var title="">input
    list</var> whose unit is <i>relative</i>.</p>

    <p>Let <var title="">total relative</var> be the sum of all the numbers in <var title="">input
    list</var> whose unit is <i>relative</i>.</p>

    <p>Let <var title="">count absolute</var> be the number of entries in <var title="">input
    list</var> whose unit is <i>absolute</i>.</p>

    <p>Let <var title="">total absolute</var> be the sum of all the numbers in <var title="">input
    list</var> whose unit is <i>absolute</i>.</p>

    <p>Let <var title="">remaining space</var> be the value of <var title="">input
    dimension</var>.</p>

   </li>

   <li>

    <p>If <var title="">total absolute</var> is greater than <var title="">remaining space</var>,
    then for each entry in <var title="">input list</var> whose unit is <i>absolute</i>, set the
    corresponding value in <var title="">output list</var> to the number of the entry in <var title="">input list</var> multiplied by <var title="">remaining space</var> and divided by <var title="">total absolute</var>. Then, set <var title="">remaining space</var> to zero.</p>

    <p>Otherwise, for each entry in <var title="">input list</var> whose unit is <i>absolute</i>,
    set the corresponding value in <var title="">output list</var> to the number of the entry in
    <var title="">input list</var>. Then, decrement <var title="">remaining space</var> by <var title="">total absolute</var>.</p>

   </li>

   <li>

    <p>If <var title="">total percentage</var> multiplied by the <var title="">input dimension</var>
    and divided by 100 is greater than <var title="">remaining space</var>, then for each entry in
    <var title="">input list</var> whose unit is <i>percentage</i>, set the corresponding value in
    <var title="">output list</var> to the number of the entry in <var title="">input list</var>
    multiplied by <var title="">remaining space</var> and divided by <var title="">total
    percentage</var>. Then, set <var title="">remaining space</var> to zero.</p>

    <p>Otherwise, for each entry in <var title="">input list</var> whose unit is <i>percentage</i>,
    set the corresponding value in <var title="">output list</var> to the number of the entry in
    <var title="">input list</var> multiplied by the <var title="">input dimension</var> and divided
    by 100. Then, decrement <var title="">remaining space</var> by <var title="">total
    percentage</var> multiplied by the <var title="">input dimension</var> and divided by 100.</p>

   </li>

   <li>

    <p>For each entry in <var title="">input list</var> whose unit is <i>relative</i>, set the
    corresponding value in <var title="">output list</var> to the number of the entry in <var title="">input list</var> multiplied by <var title="">remaining space</var> and divided by <var title="">total relative</var>.</p>

   </li>

   <li><p>Return <var title="">output list</var>.</li>

  </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>

  </div>


  <div class=impl>

  <h3 id=interactive-media><span class=secno>14.7 </span>Interactive media</h3>

  <h4 id=links,-forms,-and-navigation><span class=secno>14.7.1 </span>Links, forms, and navigation</h4>

  <p>User agents are expected to allow the user to control aspects of <a href=#hyperlink>hyperlink</a>
  activation and <a href=#form-submission>form submission</a>, such as which <a href=#browsing-context>browsing context</a> is to be
  used for the subsequent <a href=#navigate title=navigate>navigation</a>.</p>

  <p>User agents are expected to allow users to discover the destination of <a href=#hyperlink title=hyperlink>hyperlinks</a> and of <a href=#the-form-element title=form>forms</a> before triggering their
  <a href=#navigate title=navigate>navigation</a>.</p>

  <p>User agents are expected to inform the user of whether a <a href=#hyperlink>hyperlink</a> includes
  <a href=#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>navigate</a><!--DONAV cite=""--> <a href=#browsing-context title="browsing
  context">browsing contexts</a> to the resources <a href=#resolve-a-url title="resolve a url">indicated</a> by
  the <code title="">cite</code> attributes on <code><a href=#the-q-element>q</a></code>, <code><a href=#the-blockquote-element>blockquote</a></code>,
  <code><a href=#the-ins-element>ins</a></code>, and <code><a href=#the-del-element>del</a></code> elements.</p>

  <p>User agents may surface <a href=#hyperlink title=hyperlink>hyperlinks</a> created by <code><a href=#the-link-element>link</a></code>
  elements in their user interface.</p>

  <p class=note>While <code><a href=#the-link-element>link</a></code> elements that create <a href=#hyperlink title=hyperlink>hyperlinks</a> will match the ':link' or ':visited' pseudo-classes, will
  react to clicks if visible, and so forth, this does not extend to any browser interface constructs
  that expose those same links. Activating a link through the browser's interface, rather than in
  the page itself, does not trigger <code title=event-click><a href=#event-click>click</a></code> events and the like.</p>




  <h4 id=the-title-attribute-0><span class=secno>14.7.2 </span>The <code title=attr-title><a href=#attr-title>title</a></code> attribute</h4>

  <p>User agents are expected to expose the <a href=#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 focusable and always displaying the
  <a href=#advisory-information>advisory information</a> of the currently focused element,
  or by showing the <a href=#advisory-information>advisory information</a> of the elements
  under the user's finger on a touch device as the user pans around
  the screen.</p>

  <p>U+000A LINE FEED (LF) characters are expected to cause line
  breaks in the tooltip; U+0009 CHARACTER TABULATION (tab) characters
  are expected to render as a non-zero horizontal shift that lines up
  the next glyph with the next tab stop, with tab stops occurring at
  points that are multiples of 8 times the width of a U+0020 SPACE
  character.</p>

  <div class=example>

   <p>For example, a visual user agent could make elements with a
   <code title=attr-title><a href=#attr-title>title</a></code> attribute focusable, and
   could make any focused element with a <code title=attr-title><a href=#attr-title>title</a></code> attribute show its tooltip under
   the element while the element has focus. This would allow a user to
   tab around the document to find all the advisory text.</p>

  </div>

  <div class=example>

   <p>As another example, a screen reader could provide an audio cue
   when reading an element with a tooltip, with an associated key to
   read the last tooltip for which a cue was played.</p>

  </div>


  <h4 id=editing-hosts><span class=secno>14.7.3 </span>Editing hosts</h4>

  <p>The current text editing caret (i.e. the <a href=#active-range>active
  range</a>, if it is empty and in an <a href=#editing-host>editing host</a>),
  if any, is expected to act like an inline replaced element with the
  vertical dimensions of the caret and with zero width for the
  purposes of the CSS rendering model.</p>

  <p class=note>This means that even an empty block can have the
  caret inside it, and that when the caret is in such an element, it
  prevents margins from collapsing through the element.</p>



  <h4 id=text-rendered-in-native-user-interfaces><span class=secno>14.7.4 </span>Text rendered in native user interfaces</h4>

  <p>User agents are expected to honor the Unicode semantics of text
  that is exposed in user interfaces, for example supporting the
  bidirectional algorithm in text shown in dialogs, title bars, pop-up
  menus, and tooltips. Text from the contents of elements is expected to be rendered in a manner
  that honors <a href=#the-directionality>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>directionality of the attribute</a>.</p>

  <div class=example>

   <p>Consider the following markup, which has Hebrew text asking for
   a programming language, the languages being text for which a
   left-to-right direction is important given the punctuation in some
   of their names:</p>

   <pre>&lt;p dir="rtl" lang="he"&gt;
 &lt;label&gt;
  <span dir=rtl lang=he title="">&#x5d1;&#x5d7;&#x5e8; &#x5e9;&#x5e4;&#x5ea; &#x5ea;&#x5db;&#x5e0;&#x5d5;&#x5ea;:</span>
  &lt;select&gt;
   &lt;option dir="ltr"&gt;C++&lt;/option&gt;
   &lt;option dir="ltr"&gt;C#&lt;/option&gt;
   &lt;option dir="ltr"&gt;FreePascal&lt;/option&gt;
   &lt;option dir="ltr"&gt;F#&lt;/option&gt;
  &lt;/select&gt;
 &lt;/label&gt;
&lt;/p&gt;</pre>

   <p>If the <code><a href=#the-select-element>select</a></code> element was rendered as a drop down
   box, a correct rendering would ensure that the punctuation was the
   same both in the drop down, and in the box showing the current
   selection.</p>

   <p><img src=http://images.whatwg.org/bidiselect.png width=206 alt="" height=105></p> <!-- no need for alt text, the previous paragraph
   describes it completely -->

  </div>

  <div class=example>

   <p>The directionality of attributes depends on the attribute and on the element's <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute, as the following example demonstrates. Consider this
   markup:</p>

   <pre><bdo dir=ltr>&lt;table&gt;
 &lt;tr&gt;
  &lt;th abbr="(&#x5d0;" dir=ltr&gt;A
  &lt;th abbr="(&#x5d0;" dir=rtl&gt;A
  &lt;th abbr="(&#x5d0;" dir=auto&gt;A
&lt;/table&gt;</bdo></pre>

   <p>If the <code title=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>directionality-capable attribute</a>, the
   results would be different:</p>

   <pre><bdo dir=ltr>&lt;table&gt;
 &lt;tr&gt;
  &lt;th data-abbr="(&#x5d0;" dir=ltr&gt;A
  &lt;th data-abbr="(&#x5d0;" dir=rtl&gt;A
  &lt;th data-abbr="(&#x5d0;" dir=auto&gt;A
&lt;/table&gt;</bdo></pre>

   <p>In this case, if the user agent were to expose the <code title="">data-abbr</code> attribute
   in the user interface (e.g. in a debugging environment), the last case would be rendered with a
   <em>left</em> parenthesis, because the direction would be determined from the element's
   contents.</p>

  </div>

  <p>A string provided by a script (e.g. the argument to <code title=dom-alert><a href=#dom-alert>window.alert()</a></code>) is expected to be treated
  as an independent set of one or more bidirectional algorithm
  paragraphs when displayed, as defined by the bidirectional
  algorithm, including, for instance, supporting the
  paragraph-breaking behaviour of U+000A LINE FEED (LF) characters.
  For the purposes of determining the paragraph level of such text in
  the bidirectional algorithm, this specification does <em>not</em>
  provide a higher-level override of rules P2 and P3. <a href=#refsBIDI>[BIDI]</a></p>

  <p>When necessary, authors can enforce a particular direction for a
  given paragraph by starting it with the Unicode U+200E LEFT-TO-RIGHT
  MARK or U+200F RIGHT-TO-LEFT MARK characters.</p>

  <div class=example>

   <p>Thus, the following script:</p>

   <pre>alert('\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!')</pre>

   <p>...would always result in a message reading
        "<bdo dir=rtl lang="" title="">&#x5dc;&#x5de;&#x5d3;&nbsp;LMTH&nbsp;&#x5d4;&#x5d9;&#x5d5;&#x5dd;!</bdo>"
   (not "<bdo dir=ltr lang="" title="">&#x5d3;&#x5de;&#x5dc;&nbsp;HTML&nbsp;&#x5dd;&#x5d5;&#x5d9;&#x5d4;!</bdo>"),
   regardless of the language of the user agent interface or the
   direction of the page or any of its elements.</p>

  </div>

  <div class=example>

   <p>For a more complex example, consider the following script:</p>

   <pre class=bad>/* Warning: this script does not handle right-to-left scripts correctly */
var s;
if (s = prompt('What is your name?')) {
  alert(s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
}</pre>

   <p>When the user enters "<kbd>Kitty</kbd>", the user agent would
   alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
   car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;</kbd>",
   then the bidirectional algorithm will determine that the direction
   of the paragraph is right-to-left, and so the output will be the
   following unintended mess: "<samp lang=""><bdo dir=rtl>&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;!&nbsp;derF&nbsp;,kO,&nbsp;&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"</p>

   <p>To force an alert that starts with user-provided text (or other
   text of unknown directionality) to render left-to-right, the string
   can be prefixed with a U+200E LEFT-TO-RIGHT MARK character:</p>

   <pre>var s;
if (s = prompt('What is your name?')) {
  alert('<strong>\u200E</strong>' + s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
}</pre>

  </div>



  <h3 id=print-media><span class=secno>14.8 </span>Print media</h3>

  <p>User agents are expected to allow the user to request the
  opportunity to <dfn id=obtain-a-physical-form>obtain a physical form</dfn> (or a
  representation of a physical form) of a <code><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 title="obtain a physical
  form">obtains a physical form</a> (or a representation of a
  physical form) of a <code><a href=#document>Document</a></code>, the user agent is
  expected to create a new rendering of the <code><a href=#document>Document</a></code> for
  the print media.</p>



  <h3 id=unstyled-xml-documents><span class=secno>14.9 </span>Unstyled XML documents</h3>

  <!-- http://hixie.ch/tests/evil/xml/ -->

  <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><a href=#document>Document</a></code> is an <a href=#unstyled-document>unstyled document</a>, the user agent is expected
  to render <a href=#an-unstyled-document-view>an unstyled document view</a>.</p>

  <p>A <code><a href=#document>Document</a></code> is an <dfn id=unstyled-document>unstyled document</dfn> while it matches the following
  conditions:</p>

  <ul><li>The <code><a href=#document>Document</a></code> has no author style sheets (whether referenced by HTTP headers, processing instructions, elements like <code><a href=#the-link-element>link</a></code>, inline elements like <code><a href=#the-style-element>style</a></code>, or any other mechanism).
   <li>None of the elements in the <code><a href=#document>Document</a></code> have any <a href=#presentational-hints>presentational hints</a>.
   <li>None of the elements in the <code><a href=#document>Document</a></code> have any <a href=#css-styling-attribute title="CSS styling attribute">CSS styling attributes</a>.
   <li>None of the elements in the <code><a href=#document>Document</a></code> are in any of the following namespaces: <a href=#html-namespace-0>HTML namespace</a>, <a href=#svg-namespace>SVG namespace</a>, <a href=#mathml-namespace>MathML namespace</a>
   <li>The <code><a href=#document>Document</a></code> has no <a href=#focusable>focusable</a> elements (e.g. from XLink).
   <li>The <code><a href=#document>Document</a></code> has no <a href=#hyperlink title=hyperlink>hyperlinks</a> (e.g. from XLink).
   <li>There exists no <a href=#concept-script title=concept-script>script</a> whose <a href="#script's-document" title="script's document">document</a> is this <code><a href=#document>Document</a></code>.
   <li>None of the elements in the <code><a href=#document>Document</a></code> have any registered event listeners.
  </ul><p><dfn id=an-unstyled-document-view>An unstyled document view</dfn> is one where the DOM is not rendered according to CSS
  (which would, since there are no applicable styles in this context, just result in a wall of
  text), but is instead rendered in a manner that is useful for a developer. This could consist of
  just showing the <code><a href=#document>Document</a></code> object's source, maybe with syntax highlighting, or it
  could consist of displaying just the DOM tree, or simply a message saying that the page is not a
  styled document.</p>

  <p class=note>If a <code><a href=#document>Document</a></code> stops being an <a href=#unstyled-document>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>

  </div>



  <!--TOPIC:HTML-->

  <h2 id=obsolete><span class=secno>15 </span>Obsolete features</h2>

  <h3 id=obsolete-but-conforming-features><span class=secno>15.1 </span>Obsolete but conforming features</h3>

  <p>Features listed in this section will trigger warnings in
  conformance checkers.</p>

  <p>Authors should not specify a <code title=attr-img-border><a href=#attr-img-border>border</a></code> attribute on an
  <code><a href=#the-img-element>img</a></code> element. If the attribute is present, its value
  must be the string "<code title="">0</code>". CSS should be used
  instead.</p>

  <p>Authors should not specify a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute on a
  <code><a href=#the-script-element>script</a></code> element. If the attribute is present, its value
  must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string
  "<code title="">JavaScript</code>" and either the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute must be omitted or
  its value must be an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for
  the string "<code title="">text/javascript</code>". The attribute
  should be entirely omitted instead (with the value "<code title="">JavaScript</code>", it has no effect), or replaced with use
  of the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute.</p>

  <p>Authors should not specify the <code title=attr-a-name><a href=#attr-a-name>name</a></code> attribute on <code><a href=#the-a-element>a</a></code>
  elements. If the attribute is present, its value must not be the
  empty string and must neither be equal to the value of any of the
  <a href=#concept-id title=concept-id>IDs</a> in the element's <a href=#home-subtree>home
  subtree</a> other than the element's own <a href=#concept-id title=concept-id>ID</a>, if any, nor be equal to the value of
  any of the other <code title=attr-a-name><a href=#attr-a-name>name</a></code> attributes on
  <code><a href=#the-a-element>a</a></code> elements in the element's <a href=#home-subtree>home
  subtree</a>. If this attribute is present and the element has an
  <a href=#concept-id title=concept-id>ID</a>, then the attribute's value must
  be equal to the element's <a href=#concept-id title=concept-id>ID</a>. In
  earlier versions of the language, this attribute was intended as a
  way to specify possible targets for fragment identifiers in <a href=#url title=URL>URLs</a>. The <code title=attr-id><a href=#the-id-attribute>id</a></code>
  attribute should be used instead.</p>

  <!-- remove this once type=number is widely supported -->
  <p>Authors should not, but may despite requirements to the contrary
  elsewhere in this specification, specify the <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> and <code title=attr-input-size><a href=#attr-input-size>size</a></code> attributes on <code><a href=#the-input-element>input</a></code>
  elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attributes
  are in the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state.
  One valid reason for using these attributes regardless is to help
  legacy user agents that do not support <code><a href=#the-input-element>input</a></code> elements
  with <code title="">type="number"</code> to still render the text
  field with a useful width.</p>

  <p class=note>In <a href=#syntax>the HTML syntax</a>, specifying a <a href=#syntax-doctype title=syntax-DOCTYPE>DOCTYPE</a> that is an <a href=#obsolete-permitted-doctype>obsolete
  permitted DOCTYPE</a> will also trigger a warning.</p>


  <div class=impl>

  <h4 id=warnings-for-obsolete-but-conforming-features><span class=secno>15.1.1 </span>Warnings for obsolete but conforming features</h4>

  <p>To ease the transition from HTML4 Transitional documents to the
  language defined in <em>this</em> specification, and to discourage
  certain features that are only allowed in very few circumstances,
  conformance checkers are required to 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><!-- downplayed list --><li><p>The presence of an <a href=#obsolete-permitted-doctype>obsolete permitted DOCTYPE</a>
   in an <a href=#html-documents title="HTML documents">HTML document</a>.</li>

   <li><p>The presence of a <code title=attr-img-border><a href=#attr-img-border>border</a></code> attribute on an
   <code><a href=#the-img-element>img</a></code> element if its value is the string "<code title="">0</code>".</li>

   <li><p>The presence of a <code title=attr-script-language><a href=#attr-script-language>language</a></code> attribute on a
   <code><a href=#the-script-element>script</a></code> element if its value is an <a href=#ascii-case-insensitive>ASCII
   case-insensitive</a> match for the string "<code title="">JavaScript</code>" and if there is no <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute or there is and its
   value is an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the
   string "<code title="">text/javascript</code>".</li>

   <li><p>The presence of a <code title=attr-a-name><a href=#attr-a-name>name</a></code>
   attribute on an <code><a href=#the-a-element>a</a></code> element, if its value is not the
   empty string.</li>

   <li><p>The presence of a <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> attribute on an
   <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state.</li>

   <li><p>The presence of a <code title=attr-input-size><a href=#attr-input-size>size</a></code> attribute on an
   <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#number-state-(type=number)" title=attr-input-type-number>Number</a> state.</li>

  </ul><p>Conformance checkers must distinguish between pages that have no
  conformance errors and have none of these obsolete features, and
  pages that have no conformance errors but do have some of these
  obsolete features.</p>

  <p class=example>For example, a validator could report some pages
  as "Valid HTML" and others as "Valid HTML with warnings".</p>

  </div>


  <h3 id=non-conforming-features><span class=secno>15.2 </span>Non-conforming features</h3>

  <p>Elements in the following list are entirely obsolete, and must not be used by authors:</p>

  <dl><!-- alphabetical by first element in the group, except CSS goes last --><dt><code><a href=#the-applet-element>applet</a></code></dt>
   <dd><p>Use <code><a href=#the-embed-element>embed</a></code> or <code><a href=#the-object-element>object</a></code> instead.</dd>

   <dt><dfn id=acronym><code>acronym</code></dfn></dt>
   <dd><p>Use <code><a href=#the-abbr-element>abbr</a></code> instead.</dd>

   <dt><dfn id=bgsound><code>bgsound</code></dfn></dt>
   <dd><p>Use <code><a href=#the-audio-element>audio</a></code> instead.</dd>

   <dt><dfn id=dir><code>dir</code></dfn></dt>
   <dd><p>Use <code><a href=#the-ul-element>ul</a></code> instead.</dd>

   <dt><code><a href=#frame>frame</a></code></dt>
   <dt><code><a href=#frameset>frameset</a></code></dt>
   <dt><dfn id=noframes><code>noframes</code></dfn></dt>
   <dd><p>Either use <code><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.</dd>

   <dt><dfn id=isindex-0><code>isindex</code></dfn></dt>
   <dd><p>Use an explicit <code><a href=#the-form-element>form</a></code> and <a href="#text-(type=text)-state-and-search-state-(type=search)" title=attr-input-type-text>text field</a> combination instead.</dd>

   <dt><dfn id=listing><code>listing</code></dfn></dt>
   <dd><p>Use <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-code-element>code</a></code> instead.</dd>

   <dt><dfn id=nextid><code>nextid</code></dfn></dt>
   <dd><p>Use GUIDs instead.</dd>

   <dt><dfn id=noembed><code>noembed</code></dfn></dt>
   <dd><p>Use <code><a href=#the-object-element>object</a></code> instead of <code><a href=#the-embed-element>embed</a></code> when fallback is necessary.</dd>

   <dt><dfn id=plaintext><code>plaintext</code></dfn></dt>
   <dd><p>Use the "<code>text/plain</code>" <a href=#mime-type>MIME type</a> instead.</dd>

   <dt><dfn id=rb><code>rb</code></dfn></dt>
   <dd><p>Providing the ruby base directly inside the <code><a href=#the-ruby-element>ruby</a></code> element is sufficient; the <code><a href=#rb>rb</a></code> element is unnecessary. Omit it altogether.</dd>

   <dt><dfn id=strike><code>strike</code></dfn></dt>
   <dd><p>Use <code><a href=#the-del-element>del</a></code> instead if the element is marking an edit, otherwise use <code><a href=#the-s-element>s</a></code> instead.</dd>

   <dt><dfn id=xmp><code>xmp</code></dfn></dt>
   <dd><p>Use <code><a href=#the-pre-element>pre</a></code> and <code><a href=#the-code-element>code</a></code> instead, and escape "<code title="">&lt;</code>" and "<code title="">&amp;</code>" characters as "<code title="">&amp;lt;</code>" and "<code title="">&amp;amp;</code>" respectively.</dd>

   <dt><dfn id=basefont><code>basefont</code></dfn></dt>
   <dt><dfn id=big><code>big</code></dfn></dt>
   <dt><dfn id=blink><code>blink</code></dfn></dt>
   <dt><dfn id=center><code>center</code></dfn></dt>
   <dt><dfn id=font><code>font</code></dfn></dt>
   <dt><code><a href=#the-marquee-element>marquee</a></code></dt>
   <dt><dfn id=multicol><code>multicol</code></dfn></dt>
   <dt><dfn id=nobr><code>nobr</code></dfn></dt>
   <dt><dfn id=spacer><code>spacer</code></dfn></dt>
   <dt><dfn id=tt><code>tt</code></dfn></dt>

   <dd>

    <p>Use appropriate elements or CSS instead.</p>

    <p>Where the <code><a href=#tt>tt</a></code> element would have been used for marking up keyboard input,
    consider the <code><a href=#the-kbd-element>kbd</a></code> element; for variables, consider the <code><a href=#the-var-element>var</a></code> element; for
    computer code, consider the <code><a href=#the-code-element>code</a></code> element; and for computer output, consider the
    <code><a href=#the-samp-element>samp</a></code> element.</p>

    <p>Similarly, if the <code><a href=#big>big</a></code> element is being used to denote a heading, consider using
    the <code><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><a href=#the-strong-element>strong</a></code> element; and if it is being used for highlighting text for reference
    purposes, consider the <code><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>

   </dd>

  </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><!-- alphabetical by element then attribute of first item in group, except CSS goes last --><dt><dfn id=attr-a-charset title=attr-a-charset><code>charset</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
   <dt><dfn id=attr-link-charset title=attr-link-charset><code>charset</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
   <dd><p>Use an HTTP Content-Type header on the linked resource instead.</dd>

   <dt><dfn id=attr-a-coords title=attr-a-coords><code>coords</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
   <dt><dfn id=attr-a-shape title=attr-a-shape><code>shape</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
   <dd><p>Use <code><a href=#the-area-element>area</a></code> instead of <code><a href=#the-a-element>a</a></code> for image maps.</dd>

   <dt><dfn id=attr-a-methods title=attr-a-methods><code>methods</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
   <dt><dfn id=attr-link-methods title=attr-link-methods><code>methods</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
   <dd><p>Use the HTTP OPTIONS feature instead.</dd>

   <dt><dfn id=attr-a-name title=attr-a-name><code>name</code></dfn> on <code><a href=#the-a-element>a</a></code> elements (except as noted in the previous section)</dt>
   <dt><dfn id=attr-embed-name title=attr-embed-name><code>name</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
   <dt><dfn id=attr-img-name title=attr-img-name><code>name</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
   <dt><dfn id=attr-option-name title=attr-option-name><code>name</code></dfn> on <code><a href=#the-option-element>option</a></code> elements</dt>
   <dd><p>Use the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute instead.</dd>

   <dt><dfn id=attr-a-rev title=attr-a-rev><code>rev</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
   <dt><dfn id=attr-link-rev title=attr-link-rev><code>rev</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
   <dd><p>Use the <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>
   attribute instead, with an opposite term. (For example, instead of
   <code title="">rev="made"</code>, use <code title="">rel="author"</code>.)</dd>

   <dt><dfn id=attr-a-urn title=attr-a-urn><code>urn</code></dfn> on <code><a href=#the-a-element>a</a></code> elements</dt>
   <dt><dfn id=attr-link-urn title=attr-link-urn><code>urn</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
   <dd><p>Specify the preferred persistent identifier using the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute instead.</dd>

   <dt><dfn id=attr-form-accept title=attr-form-accept><code>accept</code></dfn> on <code><a href=#the-form-element>form</a></code> elements</dt>
   <dd><p>Use the <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code> attribute directly on the <code><a href=#the-input-element>input</a></code> elements instead.</dd>

   <dt><dfn id=attr-area-nohref title=attr-area-nohref><code>nohref</code></dfn> on <code><a href=#the-area-element>area</a></code> elements</dt>
   <dd><p>Omitting the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
   attribute is sufficient; the <code title=attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> attribute is
   unnecessary. Omit it altogether.</dd>

   <dt><dfn id=attr-head-profile title=attr-head-profile><code>profile</code></dfn> on <code><a href=#the-head-element>head</a></code> elements</dt>
   <dd><p>When used for declaring which <code><a href=#the-meta-element>meta</a></code> terms are
   used in the document, unnecessary; omit it altogether, and <a href=#concept-meta-extensions title=concept-meta-extensions>register the names</a>.</dd>
   <dd><p>When used for triggering specific user agent behaviors: use
   a <code><a href=#the-link-element>link</a></code> element instead.</dd>

   <dt><dfn id=attr-html-version title=attr-html-version><code>version</code></dfn> on <code><a href=#the-html-element>html</a></code> elements</dt>
   <dd><p>Unnecessary. Omit it altogether.</dd>

   <dt><dfn id=attr-input-ismap title=attr-input-ismap><code>ismap</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
   <dd><p>Unnecessary. Omit it altogether. All <code><a href=#the-input-element>input</a></code> elements with a <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" title=attr-input-type-image>Image
   Button</a> state are processed as server-side image maps.</dd>

   <dt><dfn id=attr-input-usemap title=attr-input-usemap><code>usemap</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
   <dd><p>Use <code><a href=#the-img-element>img</a></code> instead of <code><a href=#the-input-element>input</a></code> for image maps.</dd>

   <dt><dfn id=attr-iframe-longdesc title=attr-iframe-longdesc><code>longdesc</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-img-longdesc title=attr-img-longdesc><code>longdesc</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
   <dd><p>Use a regular <code><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>image
   map</a> to provide a link from the image to the image's
   description.</dd>

   <dt><dfn id=attr-img-lowsrc title=attr-img-lowsrc><code>lowsrc</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
   <dd><p>Use a progressive JPEG image (given in the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute),
   instead of using two separate images.</dd>

   <dt><dfn id=attr-link-target title=attr-link-target><code>target</code></dfn> on <code><a href=#the-link-element>link</a></code> elements</dt>
   <dd><p>Unnecessary. Omit it altogether.</dd>

   <dt><dfn id=attr-meta-scheme title=attr-meta-scheme><code>scheme</code></dfn> on <code><a href=#the-meta-element>meta</a></code> elements</dt>
   <dd><p>Use only one scheme per field, or make the scheme declaration part of the value.</dd>

   <dt><dfn id=attr-object-archive title=attr-object-archive><code>archive</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-classid title=attr-object-classid><code>classid</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-code title=attr-object-code><code>code</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-codebase title=attr-object-codebase><code>codebase</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-codetype title=attr-object-codetype><code>codetype</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dd><p>Use the <code title=attr-object-data><a href=#attr-object-data>data</a></code> and <code title=attr-object-type><a href=#attr-object-type>type</a></code> attributes to invoke <a href=#plugin title=plugin>plugins</a>. To set parameters with these names
   in particular, the <code><a href=#the-param-element>param</a></code> element can be used.</dd>

   <dt><dfn id=attr-object-declare title=attr-object-declare><code>declare</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dd><p>Repeat the <code><a href=#the-object-element>object</a></code> element completely each time the resource is to be reused.</dd>

   <dt><dfn id=attr-object-standby title=attr-object-standby><code>standby</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dd><p>Optimize the linked resource so that it loads quickly or, at least, incrementally.</dd>

   <dt><dfn id=attr-param-type title=attr-param-type><code>type</code></dfn> on <code><a href=#the-param-element>param</a></code> elements</dt>
   <dt><dfn id=attr-param-valuetype title=attr-param-valuetype><code>valuetype</code></dfn> on <code><a href=#the-param-element>param</a></code> elements</dt>
   <dd><p>Use the <code title=attr-param-name><a href=#attr-param-name>name</a></code> and <code title=attr-param-value><a href=#attr-param-value>value</a></code> attributes without declaring
   value types.</dd>

   <dt><dfn id=attr-script-language title=attr-script-language><code>language</code></dfn> on <code><a href=#the-script-element>script</a></code> elements (except as noted in the previous section)</dt>
   <dd><p>Use the <code title=attr-script-type><a href=#attr-script-type>type</a></code> attribute
   instead.</dd>

   <dt><dfn id=attr-script-event title=attr-script-event><code>event</code></dfn> on <code><a href=#the-script-element>script</a></code> elements</dt>
   <dt><dfn id=attr-script-for title=attr-script-for><code>for</code></dfn> on <code><a href=#the-script-element>script</a></code> elements</dt>
   <dd><p>Use DOM Events mechanisms to register event listeners. <a href=#refsDOM>[DOM]</a></dd>

   <dt><dfn id=attr-table-datapagesize title=attr-table-datapagesize><code>datapagesize</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dd><p>Unnecessary. Omit it altogether.</dd>

   <dt><dfn id=attr-table-summary title=attr-table-summary><code>summary</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt><!-- 2.65% pages -->
   <dd><p>Use one of the <a href=#table-descriptions-techniques>techniques for describing
   tables</a> given in the <code><a href=#the-table-element>table</a></code> section
   instead.</dd>

   <dt><dfn id=attr-td-abbr title=attr-td-abbr><code>abbr</code></dfn> on <code><a href=#the-td-element>td</a></code> elements</dt>
   <dd><p>Use text that begins in an unambiguous and terse manner, and include any more elaborate text after that. The <code title=attr-title><a href=#attr-title>title</a></code> attribute can also be useful in including more detailed text, so that the cell's contents can be made terse. If it's a heading, use <code><a href=#the-th-element>th</a></code> (which has an <code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> attribute).</p>

   <dt><dfn id=attr-tdth-axis title=attr-tdth-axis><code>axis</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dd><p>Use the <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute on the relevant <code><a href=#the-th-element>th</a></code>.</p>

   <dt><dfn id=attr-td-scope title=attr-td-scope><code>scope</code></dfn> on <code><a href=#the-td-element>td</a></code> elements</dt>
   <dd><p>Use <code><a href=#the-th-element>th</a></code> elements for heading cells.</p>

   <dt><dfn id=attr-datasrc title=attr-datasrc><code>datasrc</code></dfn> on <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-button-element>button</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-label-element>label</a></code>, <code><a href=#the-legend-element>legend</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-option-element>option</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-span-element>span</a></code>, <code><a href=#the-table-element>table</a></code>, and <code><a href=#the-textarea-element>textarea</a></code> elements</dt>
   <dt><dfn id=attr-datafld title=attr-datafld><code>datafld</code></dfn> on <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-button-element>button</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>, <code><a href=#frame>frame</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-label-element>label</a></code>, <code><a href=#the-legend-element>legend</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-param-element>param</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-span-element>span</a></code>, and <code><a href=#the-textarea-element>textarea</a></code> elements</dt>
   <dt><dfn id=attr-dataformatas title=attr-dataformatas><code>dataformatas</code></dfn> on <code><a href=#the-button-element>button</a></code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-label-element>label</a></code>, <code><a href=#the-legend-element>legend</a></code>, <code><a href=#the-marquee-element>marquee</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-option-element>option</a></code>, <code><a href=#the-select-element>select</a></code>, <code><a href=#the-span-element>span</a></code>, and <code><a href=#the-table-element>table</a></code> elements</dt>
   <dd><p>Use script and a mechanism such as <code>XMLHttpRequest</code> to populate the page dynamically. <a href=#refsXHR>[XHR]</a></dd>

   <dt><dfn id=attr-body-alink title=attr-body-alink><code>alink</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-bgcolor title=attr-body-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-link title=attr-body-link><code>link</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-marginbottom title=attr-body-marginbottom><code>marginbottom</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-marginheight title=attr-body-marginheight><code>marginheight</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-marginleft title=attr-body-marginleft><code>marginleft</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-marginright title=attr-body-marginright><code>marginright</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-margintop title=attr-body-margintop><code>margintop</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-marginwidth title=attr-body-marginwidth><code>marginwidth</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-text title=attr-body-text><code>text</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-body-vlink title=attr-body-vlink><code>vlink</code></dfn> on <code><a href=#the-body-element>body</a></code> elements</dt>
   <dt><dfn id=attr-br-clear title=attr-br-clear><code>clear</code></dfn> on <code><a href=#the-br-element>br</a></code> elements</dt>
   <dt><dfn id=attr-caption-align title=attr-caption-align><code>align</code></dfn> on <code><a href=#the-caption-element>caption</a></code> elements</dt>
   <dt><dfn id=attr-col-align title=attr-col-align><code>align</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
   <dt><dfn id=attr-col-char title=attr-col-char><code>char</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
   <dt><dfn id=attr-col-charoff title=attr-col-charoff><code>charoff</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
   <dt><dfn id=attr-col-valign title=attr-col-valign><code>valign</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
   <dt><dfn id=attr-col-width title=attr-col-width><code>width</code></dfn> on <code><a href=#the-col-element>col</a></code> elements</dt>
   <dt><dfn id=attr-div-align title=attr-div-align><code>align</code></dfn> on <code><a href=#the-div-element>div</a></code> elements</dt>
   <dt><dfn id=attr-dl-compact title=attr-dl-compact><code>compact</code></dfn> on <code><a href=#the-dl-element>dl</a></code> elements</dt>
   <dt><dfn id=attr-embed-align title=attr-embed-align><code>align</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
   <dt><dfn id=attr-embed-hspace title=attr-embed-hspace><code>hspace</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
   <dt><dfn id=attr-embed-vspace title=attr-embed-vspace><code>vspace</code></dfn> on <code><a href=#the-embed-element>embed</a></code> elements</dt>
   <dt><dfn id=attr-hr-align title=attr-hr-align><code>align</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
   <dt><dfn id=attr-hr-color title=attr-hr-color><code>color</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
   <dt><dfn id=attr-hr-noshade title=attr-hr-noshade><code>noshade</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
   <dt><dfn id=attr-hr-size title=attr-hr-size><code>size</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
   <dt><dfn id=attr-hr-width title=attr-hr-width><code>width</code></dfn> on <code><a href=#the-hr-element>hr</a></code> elements</dt>
   <dt><dfn id=attr-hx-align title=attr-hx-align><code>align</code></dfn> on <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&mdash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements</dt>
   <dt><dfn id=attr-iframe-align title=attr-iframe-align><code>align</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-allowtransparency title=attr-iframe-allowtransparency><code>allowtransparency</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-frameborder title=attr-iframe-frameborder><code>frameborder</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-hspace title=attr-iframe-hspace><code>hspace</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-marginheight title=attr-iframe-marginheight><code>marginheight</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-marginwidth title=attr-iframe-marginwidth><code>marginwidth</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-scrolling title=attr-iframe-scrolling><code>scrolling</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-iframe-vspace title=attr-iframe-vspace><code>vspace</code></dfn> on <code><a href=#the-iframe-element>iframe</a></code> elements</dt>
   <dt><dfn id=attr-input-align title=attr-input-align><code>align</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
   <dt><dfn id=attr-input-hspace title=attr-input-hspace><code>hspace</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
   <dt><dfn id=attr-input-vspace title=attr-input-vspace><code>vspace</code></dfn> on <code><a href=#the-input-element>input</a></code> elements</dt>
   <dt><dfn id=attr-img-align title=attr-img-align><code>align</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
   <dt><dfn id=attr-img-border title=attr-img-border><code>border</code></dfn> on <code><a href=#the-img-element>img</a></code> elements (except as noted in the previous section)</dt>
   <dt><dfn id=attr-img-hspace title=attr-img-hspace><code>hspace</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
   <dt><dfn id=attr-img-vspace title=attr-img-vspace><code>vspace</code></dfn> on <code><a href=#the-img-element>img</a></code> elements</dt>
   <dt><dfn id=attr-legend-align title=attr-legend-align><code>align</code></dfn> on <code><a href=#the-legend-element>legend</a></code> elements</dt>
   <dt><dfn id=attr-li-type title=attr-li-type><code>type</code></dfn> on <code><a href=#the-li-element>li</a></code> elements</dt>
   <dt><dfn id=attr-menu-compact title=attr-menu-compact><code>compact</code></dfn> on <code><a href=#the-menu-element>menu</a></code> elements</dt>
   <dt><dfn id=attr-object-align title=attr-object-align><code>align</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-border title=attr-object-border><code>border</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-hspace title=attr-object-hspace><code>hspace</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-object-vspace title=attr-object-vspace><code>vspace</code></dfn> on <code><a href=#the-object-element>object</a></code> elements</dt>
   <dt><dfn id=attr-ol-compact title=attr-ol-compact><code>compact</code></dfn> on <code><a href=#the-ol-element>ol</a></code> elements</dt>
   <dt><dfn id=attr-p-align title=attr-p-align><code>align</code></dfn> on <code><a href=#the-p-element>p</a></code> elements</dt>
   <dt><dfn id=attr-pre-width title=attr-pre-width><code>width</code></dfn> on <code><a href=#the-pre-element>pre</a></code> elements</dt>
   <dt><dfn id=attr-table-align title=attr-table-align><code>align</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-bgcolor title=attr-table-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-border title=attr-table-border><code>border</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-bordercolor title=attr-table-bordercolor><code>bordercolor</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-cellpadding title=attr-table-cellpadding><code>cellpadding</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-cellspacing title=attr-table-cellspacing><code>cellspacing</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-frame title=attr-table-frame><code>frame</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-rules title=attr-table-rules><code>rules</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-table-width title=attr-table-width><code>width</code></dfn> on <code><a href=#the-table-element>table</a></code> elements</dt>
   <dt><dfn id=attr-tbody-align title=attr-tbody-align><code>align</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
   <dt><dfn id=attr-tbody-char title=attr-tbody-char><code>char</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
   <dt><dfn id=attr-tbody-charoff title=attr-tbody-charoff><code>charoff</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
   <dt><dfn id=attr-tbody-valign title=attr-tbody-vAlign><code>valign</code></dfn> on <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and <code><a href=#the-tfoot-element>tfoot</a></code> elements</dt>
   <dt><dfn id=attr-tdth-align title=attr-tdth-align><code>align</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-bgcolor title=attr-tdth-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-char title=attr-tdth-char><code>char</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-charoff title=attr-tdth-charoff><code>charoff</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-height title=attr-tdth-height><code>height</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-nowrap title=attr-tdth-nowrap><code>nowrap</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-valign title=attr-tdth-valign><code>valign</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tdth-width title=attr-tdth-width><code>width</code></dfn> on <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dt><dfn id=attr-tr-align title=attr-tr-align><code>align</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
   <dt><dfn id=attr-tr-bgcolor title=attr-tr-bgcolor><code>bgcolor</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
   <dt><dfn id=attr-tr-char title=attr-tr-char><code>char</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
   <dt><dfn id=attr-tr-charoff title=attr-tr-charoff><code>charoff</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
   <dt><dfn id=attr-tr-valign title=attr-tr-valign><code>valign</code></dfn> on <code><a href=#the-tr-element>tr</a></code> elements</dt>
   <dt><dfn id=attr-ul-compact title=attr-ul-compact><code>compact</code></dfn> on <code><a href=#the-ul-element>ul</a></code> elements</dt>
   <dt><dfn id=attr-ul-type title=attr-ul-type><code>type</code></dfn> on <code><a href=#the-ul-element>ul</a></code> elements</dt>
   <dt><dfn id=attr-background title=attr-background><code>background</code></dfn> on <code><a href=#the-body-element>body</a></code>, <code><a href=#the-table-element>table</a></code>, <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-td-element>td</a></code>, and <code><a href=#the-th-element>th</a></code> elements</dt>
   <dd><p>Use CSS instead.</dd>

  </dl><div class=impl>

  <h3 id=requirements-for-implementations><span class=secno>15.3 </span>Requirements for implementations</h3>

  <h4 id=the-applet-element><span class=secno>15.3.1 </span>The <dfn><code>applet</code></dfn> element</h4>

  <p>The <code><a href=#the-applet-element>applet</a></code> element is a Java-specific variant of the <code><a href=#the-embed-element>embed</a></code> element.
  The <code><a href=#the-applet-element>applet</a></code> element is now obsoleted so that all extension frameworks (Java, .NET,
  Flash, etc) are handled in a consistent manner.</p>

  <p>When the element matches any of the following conditions, it <a href=#represents>represents</a> its
  contents:</p>

  <ul class=brief><li>The element is still in the <a href=#stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser>HTML
   parser</a> or <a href=#xml-parser>XML parser</a>.</li>

   <li>The element is not <a href=#in-a-document>in a <code>Document</code></a>.</li>

   <li>The element's <code><a href=#document>Document</a></code> is not <a href=#fully-active>fully active</a>.</li>

   <li id=sandboxPluginApplet>The element's <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag
   set</a> has its <a href=#sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> set.</li>

   <li>The element has an ancestor <a href=#media-element>media element</a>.</li>

   <li>The element has an ancestor <code><a href=#the-object-element>object</a></code> element that is <em>not</em> showing its
   <a href=#fallback-content>fallback content</a>.</li>

   <li>No Java Language runtime <a href=#plugin>plugin</a> is available.</li>

   <li>A Java runtime <a href=#plugin>plugin</a> is available but it is disabled.</li>

  </ul><!-- we assume here that the Java plugin can't be <span
  title="concept-plugin-secure">secured</span>; if anyone does end up securing one we can always
  change this --><p>Otherwise, the user agent should instantiate a Java Language runtime <a href=#plugin>plugin</a>, and
  should pass the names and values of all the attributes on the element, in the order they were
  added to the element, with the attributes added by the parser being ordered in source order, and
  then a parameter named "PARAM" whose value is null, and then all the names and values of <a href=#concept-param-parameter title=concept-param-parameter>parameters</a> given by <code><a href=#the-param-element>param</a></code> elements that are
  children of the <code><a href=#the-applet-element>applet</a></code> element, in <a href=#tree-order>tree order</a>, to the
  <a href=#plugin>plugin</a> used. If the <a href=#plugin>plugin</a> supports a scriptable interface, the
  <code><a href=#htmlappletelement>HTMLAppletElement</a></code> object representing the element should expose that interface. The
  <code><a href=#the-applet-element>applet</a></code> element <a href=#represents>represents</a> the <a href=#plugin>plugin</a>.</p>

  <!-- If we ever make this fetch anything manually, remember to delay the load event, and to
  include ", from the element's <span>browsing context scope origin</span> if it has one" when
  fetching -->

  <p class=note>The <code><a href=#the-applet-element>applet</a></code> element is unaffected by the CSS 'display' property. The
  Java Language runtime is instantiated even if the element is hidden with a 'display:none' CSS
  style.</p>

  <p>The <code><a href=#the-applet-element>applet</a></code> element must implement the <code><a href=#htmlappletelement>HTMLAppletElement</a></code>
  interface.</p>

  <pre class=idl>interface <dfn id=htmlappletelement>HTMLAppletElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-applet-align title=dom-applet-align>align</a>;
           attribute DOMString <a href=#dom-applet-alt title=dom-applet-alt>alt</a>;
           attribute DOMString <a href=#dom-applet-archive title=dom-applet-archive>archive</a>;
           attribute DOMString <a href=#dom-applet-code title=dom-applet-code>code</a>;
           attribute DOMString <a href=#dom-applet-codebase title=dom-applet-codeBase>codeBase</a>;
           attribute DOMString <a href=#dom-applet-height title=dom-applet-height>height</a>;
           attribute unsigned long <a href=#dom-applet-hspace title=dom-applet-hspace>hspace</a>;
           attribute DOMString <a href=#dom-applet-name title=dom-applet-name>name</a>;
           attribute DOMString _<a href=#dom-applet-object title=dom-applet-object>object</a>; // the underscore is not part of the identifier <!-- it's a Web IDL escaping mechanism -->
           attribute unsigned long <a href=#dom-applet-vspace title=dom-applet-vspace>vspace</a>;
           attribute DOMString <a href=#dom-applet-width title=dom-applet-width>width</a>;
};</pre>

  <p>The <dfn id=dom-applet-align title=dom-applet-align><code>align</code></dfn>, <dfn id=dom-applet-alt title=dom-applet-alt><code>alt</code></dfn>, <dfn id=dom-applet-archive title=dom-applet-archive><code>archive</code></dfn>, <dfn id=dom-applet-code title=dom-applet-code><code>code</code></dfn>, <dfn id=dom-applet-height title=dom-applet-height><code>height</code></dfn>, <dfn id=dom-applet-hspace title=dom-applet-hspace><code>hspace</code></dfn>, <dfn id=dom-applet-name title=dom-applet-name><code>name</code></dfn>, <dfn id=dom-applet-object title=dom-applet-object><code>object</code></dfn>, <dfn id=dom-applet-vspace title=dom-applet-vspace><code>vspace</code></dfn>, and <dfn id=dom-applet-width title=dom-applet-width><code>width</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name. For the purposes of reflection, the
  <code><a href=#the-applet-element>applet</a></code> element's <code title=attr-applet-object>object</code> content attribute is
  defined as containing a <a href=#url>URL</a>.</p>

  <p>The <dfn id=dom-applet-codebase title=dom-applet-codeBase><code>codeBase</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-applet-codebase>codebase</code> content attribute,
  which for the purposes of reflection is defined as containing a <a href=#url>URL</a>.</p>


  <h4 id=the-marquee-element><span class=secno>15.3.2 </span>The <dfn><code>marquee</code></dfn> element</h4>

  <p>The <code><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>task source</a> for tasks mentioned in this section is the <a href=#dom-manipulation-task-source>DOM manipulation
  task source</a>.</p>

  <p>The <code><a href=#the-marquee-element>marquee</a></code> element must implement the <code><a href=#htmlmarqueeelement>HTMLMarqueeElement</a></code>
  interface.</p>

  <pre class=idl>interface <dfn id=htmlmarqueeelement>HTMLMarqueeElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-marquee-behavior title=dom-marquee-behavior>behavior</a>;
           attribute DOMString <a href=#dom-marquee-bgcolor title=dom-marquee-bgColor>bgColor</a>;
           attribute DOMString <a href=#dom-marquee-direction title=dom-marquee-direction>direction</a>;
           attribute DOMString <a href=#dom-marquee-height title=dom-marquee-height>height</a>;
           attribute unsigned long <a href=#dom-marquee-hspace title=dom-marquee-hspace>hspace</a>;
           attribute long <a href=#dom-marquee-loop title=dom-marquee-loop>loop</a>;
           attribute unsigned long <a href=#dom-marquee-scrollamount title=dom-marquee-scrollamount>scrollAmount</a>;
           attribute unsigned long <a href=#dom-marquee-scrolldelay title=dom-marquee-scrollDelay>scrollDelay</a>;
           attribute boolean <a href=#dom-marquee-truespeed title=dom-marquee-trueSpeed>trueSpeed</a>;
           attribute unsigned long <a href=#dom-marquee-vspace title=dom-marquee-vspace>vspace</a>;
           attribute DOMString <a href=#dom-marquee-width title=dom-marquee-width>width</a>;

           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-marquee-onbounce title=handler-marquee-onbounce>onbounce</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-marquee-onfinish title=handler-marquee-onfinish>onfinish</a>;
           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-marquee-onstart title=handler-marquee-onstart>onstart</a>;

  void <a href=#dom-marquee-start title=dom-marquee-start>start</a>();
  void <a href=#dom-marquee-stop title=dom-marquee-stop>stop</a>();
};</pre>

  <p>A <code><a href=#the-marquee-element>marquee</a></code> element can be <dfn id=concept-marquee-on title=concept-marquee-on>turned on</dfn> or <dfn id=concept-marquee-off title=concept-marquee-off>turned off</dfn>. When it is created, it is <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>.</p>

  <p>When the <dfn id=dom-marquee-start title=dom-marquee-start><code>start()</code></dfn> method is called, the
  <code><a href=#the-marquee-element>marquee</a></code> element must be <a href=#concept-marquee-on title=concept-marquee-on>turned on</a>.</p>

  <p>When the <dfn id=dom-marquee-stop title=dom-marquee-stop><code>stop()</code></dfn> method is called, the
  <code><a href=#the-marquee-element>marquee</a></code> element must be <a href=#concept-marquee-off title=concept-marquee-off>turned off</a>.</p>

  <p>When a <code><a href=#the-marquee-element>marquee</a></code> element is created, the user agent must <a href=#queue-a-task>queue a task</a>
  to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-start>start</code> at the
  element.</p>

  <hr><p>The <dfn id=attr-marquee-behavior title=attr-marquee-behavior><code>behavior</code></dfn> content attribute on
  <code><a href=#the-marquee-element>marquee</a></code> elements is an <a href=#enumerated-attribute>enumerated attribute</a> with the following keywords
  (all non-conforming):</p>

  <table><thead><tr><th>Keyword
     <th>State
   <tbody><tr><td><code title="">scroll</code>
     <td><dfn id=attr-marquee-behavior-scroll title=attr-marquee-behavior-scroll>scroll</dfn>
    <tr><td><code title="">slide</code>
     <td><dfn id=attr-marquee-behavior-slide title=attr-marquee-behavior-slide>slide</dfn>
    <tr><td><code title="">alternate</code>
     <td><dfn id=attr-marquee-behavior-alternate title=attr-marquee-behavior-alternate>alternate</dfn>
  </table><p>The <i>missing value default</i> is the <a href=#attr-marquee-behavior-scroll title=attr-marquee-behavior-scroll>scroll</a> state.</p>

  <hr><p>The <dfn id=attr-marquee-direction title=attr-marquee-direction><code>direction</code></dfn> content attribute on
  <code><a href=#the-marquee-element>marquee</a></code> elements is an <a href=#enumerated-attribute>enumerated attribute</a> with the following keywords
  (all non-conforming):</p>

  <table><thead><tr><th>Keyword
     <th>State
   <tbody><tr><td><code title="">left</code>
     <td><dfn id=attr-marquee-direction-left title=attr-marquee-direction-left>left</dfn>
    <tr><td><code title="">right</code>
     <td><dfn id=attr-marquee-direction-right title=attr-marquee-direction-right>right</dfn>
    <tr><td><code title="">up</code>
     <td><dfn id=attr-marquee-direction-up title=attr-marquee-direction-up>up</dfn>
    <tr><td><code title="">down</code>
     <td><dfn id=attr-marquee-direction-down title=attr-marquee-direction-down>down</dfn>
  </table><p>The <i>missing value default</i> is the <a href=#attr-marquee-direction-left title=attr-marquee-direction-left>left</a>
  state.</p>

  <hr><p>The <dfn id=attr-marquee-truespeed title=attr-marquee-truespeed><code>truespeed</code></dfn> content attribute on
  <code><a href=#the-marquee-element>marquee</a></code> elements is a <a href=#boolean-attribute>boolean attribute</a>.</p>

  <hr><p>A <code><a href=#the-marquee-element>marquee</a></code> element has a <dfn id=marquee-scroll-interval>marquee scroll interval</dfn>, which is obtained as
  follows:</p>

  <ol><li><p>If the element has a <code title=attr-marquee-scrolldelay>scrolldelay</code> attribute,
   and parsing its value using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> does not
   return an error, then let <var title="">delay</var> be the parsed value. Otherwise, let <var title="">delay</var> be 85.</li>

   <li><p>If the element does not have a <code title=attr-marquee-truespeed><a href=#attr-marquee-truespeed>truespeed</a></code>
   attribute, and the <var title="">delay</var> value is less than 60, then let <var title="">delay</var> be 60 instead.</li>

   <li><p>The <a href=#marquee-scroll-interval>marquee scroll interval</a> is <var title="">delay</var>, interpreted in
   milliseconds.</li>

  </ol><hr><p>A <code><a href=#the-marquee-element>marquee</a></code> element has a <dfn id=marquee-scroll-distance>marquee scroll distance</dfn>, which, if the element
  has a <code title=attr-marquee-scrollamount>scrollamount</code> attribute, and parsing its value
  using the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> does not return an error, is the
  parsed value interpreted in CSS pixels, and otherwise is 6 CSS pixels.</p>

  <hr><p>A <code><a href=#the-marquee-element>marquee</a></code> element has a <dfn id=marquee-loop-count>marquee loop count</dfn>, which, if the element has a
  <code title=attr-marquee-loop>loop</code> attribute, and parsing its value using the <a href=#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 &minus;1.</p>

  <p>The <dfn id=dom-marquee-loop title=dom-marquee-loop><code>loop</code></dfn> IDL attribute, on getting, must
  return the element's <a href=#marquee-loop-count>marquee loop count</a>; and on setting, if the new value is
  different than the element's <a href=#marquee-loop-count>marquee loop count</a> and either greater than zero or equal
  to &minus;1, must set the element's <code title=attr-marquee-loop>loop</code> content attribute
  (adding it if necessary) to the <a href=#valid-integer>valid integer</a> that represents the new value. (Other
  values are ignored.)</p>

  <p>A <code><a href=#the-marquee-element>marquee</a></code> element also has a <dfn id=marquee-current-loop-index>marquee current loop index</dfn>, which is zero
  when the element is created.</p>

  <p>The rendering layer will occasionally <dfn id=increment-the-marquee-current-loop-index>increment the marquee current loop index</dfn>,
  which must cause the following steps to be run:</p>

  <ol><li><p>If the <a href=#marquee-loop-count>marquee loop count</a> is &minus;1, then abort these steps.</p>

   <li><p>Increment the <a href=#marquee-current-loop-index>marquee current loop index</a> by one.</li>

   <li>

    <p>If the <a href=#marquee-current-loop-index>marquee current loop index</a> is now equal to or greater than the element's
    <a href=#marquee-loop-count>marquee loop count</a>, <a href=#concept-marquee-off title=concept-marquee-off>turn off</a> the
    <code><a href=#the-marquee-element>marquee</a></code> element and <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
    named <code title=event-finish>finish</code> at the <code><a href=#the-marquee-element>marquee</a></code> element.</p>

    <p>Otherwise, if the <code title=attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
    <a href=#attr-marquee-behavior-alternate title=attr-marquee-behavior-alternate>alternate</a> state, then <a href=#queue-a-task>queue a
    task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-bounce>bounce</code>
    at the <code><a href=#the-marquee-element>marquee</a></code> element.</p>

    <p>Otherwise, <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-start>start</code> at the <code><a href=#the-marquee-element>marquee</a></code> element.</p>

   </li>

  </ol><hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
  handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-content-attributes>event handler content attributes</a> and <a href=#event-handler-idl-attributes>event handler IDL
  attributes</a>, by <code><a href=#the-marquee-element>marquee</a></code> elements:</p>

  <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn id=handler-marquee-onbounce title=handler-marquee-onbounce><code>onbounce</code></dfn> <td> <code title=event-bounce>bounce</code>
    <tr><td><dfn id=handler-marquee-onfinish title=handler-marquee-onfinish><code>onfinish</code></dfn> <td> <code title=event-finish>finish</code>
    <tr><td><dfn id=handler-marquee-onstart title=handler-marquee-onstart><code>onstart</code></dfn> <td> <code title=event-start>start</code>
  </table><hr><p>The <dfn id=dom-marquee-behavior title=dom-marquee-behavior><code>behavior</code></dfn>, <dfn id=dom-marquee-direction title=dom-marquee-direction><code>direction</code></dfn>, <dfn id=dom-marquee-height title=dom-marquee-height><code>height</code></dfn>, <dfn id=dom-marquee-hspace title=dom-marquee-hspace><code>hspace</code></dfn>, <dfn id=dom-marquee-vspace title=dom-marquee-vspace><code>vspace</code></dfn>, and <dfn id=dom-marquee-width title=dom-marquee-width><code>width</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p>The <dfn id=dom-marquee-bgcolor title=dom-marquee-bgColor><code>bgColor</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-marquee-bgcolor>bgcolor</code> content attribute.</p>

  <p>The <dfn id=dom-marquee-scrollamount title=dom-marquee-scrollAmount><code>scrollAmount</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-marquee-scrollamount>scrollamount</code> content
  attribute. The default value is 6.</p>

  <p>The <dfn id=dom-marquee-scrolldelay title=dom-marquee-scrollDelay><code>scrollDelay</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-marquee-scrolldelay>scrolldelay</code> content
  attribute. The default value is 85.</p>

  <p>The <dfn id=dom-marquee-truespeed title=dom-marquee-trueSpeed><code>trueSpeed</code></dfn> IDL attribute must
  <a href=#reflect>reflect</a> the <code title=attr-marquee-truespeed><a href=#attr-marquee-truespeed>truespeed</a></code> content
  attribute.</p>


  <h4 id=frames><span class=secno>15.3.3 </span>Frames</h4>

  <p>The <dfn id=frameset><code>frameset</code></dfn> element acts as <a href=#the-body-element-0>the body element</a> in documents
  that use frames.</p>

  <p>The <code><a href=#frameset>frameset</a></code> element must implement the <code><a href=#htmlframesetelement>HTMLFrameSetElement</a></code>
  interface.</p>

  <pre class=idl>interface <dfn id=htmlframesetelement>HTMLFrameSetElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-frameset-cols title=dom-frameset-cols>cols</a>;
           attribute DOMString <a href=#dom-frameset-rows title=dom-frameset-rows>rows</a>;
};
<a href=#htmlframesetelement>HTMLFrameSetElement</a> implements <a href=#windoweventhandlers>WindowEventHandlers</a>;</pre>

  <p>The <dfn id=dom-frameset-cols title=dom-frameset-cols><code>cols</code></dfn> and <dfn id=dom-frameset-rows title=dom-frameset-rows><code>rows</code></dfn> IDL attributes of the <code><a href=#frameset>frameset</a></code>
  element must <a href=#reflect>reflect</a> the respective content attributes of the same name.</p>

  <p>The <code><a href=#frameset>frameset</a></code> element exposes as <a href=#event-handler-content-attributes>event handler
  content attributes</a> a number of the <a href=#event-handlers>event
  handlers</a> of the <code><a href=#window>Window</a></code> object. It also mirrors
  their <a href=#event-handler-idl-attributes>event handler IDL attributes</a>.</p>

  <p>The <code title=handler-onblur><a href=#handler-onblur>onblur</a></code>, <code title=handler-onerror><a href=#handler-onerror>onerror</a></code>, <code title=handler-onfocus><a href=#handler-onfocus>onfocus</a></code>, <code title=handler-onload><a href=#handler-onload>onload</a></code>,
  and <code title=handler-onscroll><a href=#handler-onscroll>onscroll</a></code> <a href=#event-handlers>event handlers</a> of the
  <code><a href=#window>Window</a></code> object, exposed on the <code><a href=#frameset>frameset</a></code> element, replace the generic
  <a href=#event-handlers>event handlers</a> with the same names normally supported by <a href=#html-elements>HTML elements</a>.</p>

  <hr><p>The <dfn id=frame><code>frame</code></dfn> element defines a <a href=#nested-browsing-context>nested browsing context</a>
  similar to the <code><a href=#the-iframe-element>iframe</a></code> element, but rendered within a <code><a href=#frameset>frameset</a></code>
  element.</p>

  <!-- START of section that's very similar to <iframe> -->

  <p>A <code><a href=#frame>frame</a></code> element is said to be an <dfn id=active-frame-element>active <code>frame</code> element</dfn> when
  it is <a href=#in-a-document>in a <code>Document</code></a> and its parent element, if any, is a
  <code><a href=#frameset>frameset</a></code> element.</p>

  <p>When a <code><a href=#frame>frame</a></code> element is created as an <a href=#active-frame-element>active <code>frame</code>
  element</a>, or becomes an <a href=#active-frame-element>active <code>frame</code> element</a> after not having been
  one, the user agent must create a <a href=#nested-browsing-context>nested browsing context</a>, and then <a href=#process-the-frame-attributes>process the
  <code>frame</code> attributes</a> for the first time.</p>

  <p>When a <code><a href=#frame>frame</a></code> element stops being an <a href=#active-frame-element>active <code>frame</code>
  element</a>, the user agent must <a href=#a-browsing-context-is-discarded title="a browsing context is discarded">discard</a>
  the <a href=#nested-browsing-context>nested browsing context</a>.</p>

  <p>Whenever a <code><a href=#frame>frame</a></code> element with a <a href=#nested-browsing-context>nested browsing context</a> has its <code title=attr-frame-src>src</code> attribute set, changed, or removed, the user agent must
  <a href=#process-the-frame-attributes>process the <code>frame</code> attributes</a>.</p> <!-- It doesn't happen when the base
  URL is changed, though. -->

  <p>When the user agent is to <dfn id=process-the-frame-attributes>process the <code>frame</code> attributes</dfn>, it must run the
  first appropriate steps from the following list:</p>

  <dl class=switch><dt>If the element has no <code title=attr-frame-src>src</code> attribute specified, and the
   user agent is processing the <code><a href=#frame>frame</a></code>'s attributes for the first time</dt>

   <dd>

    <p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the <code><a href=#frame>frame</a></code> element.</p>

   </dd>

   <dt>Otherwise</dt>

   <dd>

    <ol><li>

      <p>If the value of the <code title=attr-frame-src>src</code> attribute is the empty string,
      let <var title="">url</var> be the string "<code><a href=#about:blank>about:blank</a></code>".</p>

      <p>Otherwise, <a href=#resolve-a-url title="resolve a url">resolve</a> the value of the <code title=attr-frame-src>src</code> attribute, relative to the <code><a href=#frame>frame</a></code> element.</p>

      <p>If that is not successful, then let <var title="">url</var> be the string
      "<code><a href=#about:blank>about:blank</a></code>". Otherwise, let <var title="">url</var> be the resulting
      <a href=#absolute-url>absolute URL</a>.</p>

     </li>

     <li>

      <p><a href=#navigate>Navigate</a><!--DONAV frame--> the element's <a href=#child-browsing-context>child browsing context</a>
      to <var title="">url</var>.</p>
      
     </li>

    </ol></dd>

  </dl><p>Any <a href=#navigate title=navigate>navigation</a> required of the user agent in the <a href=#process-the-frame-attributes>process
  the <code>frame</code> attributes</a> algorithm must be completed as an <a href=#explicit-self-navigation-override>explicit
  self-navigation override</a> and with the <code><a href=#frame>frame</a></code> element's document's
  <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source browsing context</a>.</p>

  <p>Furthermore, if the <a href=#active-document>active document</a> of the element's <a href=#child-browsing-context>child browsing
  context</a> before such a <a href=#navigate title=navigate>navigation</a> was not <a href=#completely-loaded>completely
  loaded</a> at the time of the new <a href=#navigate title=navigate>navigation</a>, then the <a href=#navigate title=navigate>navigation</a> must be completed with <a href=#replacement-enabled>replacement enabled</a>.</p>

  <p>Similarly, if the <a href=#child-browsing-context>child browsing context</a>'s <a href=#session-history>session history</a> contained
  only one <code><a href=#document>Document</a></code> when the <a href=#process-the-frame-attributes>process the <code>frame</code> attributes</a>
  algorithm was invoked, and that was the <code><a href=#about:blank>about:blank</a></code> <code><a href=#document>Document</a></code> created
  when the <a href=#child-browsing-context>child browsing context</a> was created, then any <a href=#navigate title=navigate>navigation</a> required of the user agent in that algorithm must be completed
  with <a href=#replacement-enabled>replacement enabled</a>.</p> <!-- see also the note near similar text for the
  location.assign() method -->

  <!-- END of section that's very similar to <iframe> -->

  <p>When the browsing context is created, if a <code title=attr-frame-name>name</code> attribute
  is present, the <a href=#browsing-context-name>browsing context name</a> must be set to the value of this attribute;
  otherwise, the <a href=#browsing-context-name>browsing context name</a> must be set to the empty string.</p>

  <p>Whenever the <code title=attr-frame-name>name</code> attribute is set, the nested
  <a href=#browsing-context>browsing context</a>'s <a href=#browsing-context-name title="browsing context name">name</a> must be changed to
  the new value. If the attribute is removed, the <a href=#browsing-context-name>browsing context name</a> must be set to
  the empty string.</p>

  <p>When content loads in a <code><a href=#frame>frame</a></code>, after any <code title=event-load>load</code>
  events are fired within the content itself, the user agent must <a href=#queue-a-task>queue a task</a> to
  <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-load>load</code> at the
  <code><a href=#frame>frame</a></code> element. When content fails to load (e.g. due to a network error), then the
  user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the element instead.</p>

  <p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> above is the
  <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>

  <p>When there is an <a href=#active-parser>active parser</a> in the <code><a href=#frame>frame</a></code>, and when anything in the
  <code><a href=#frame>frame</a></code> is <a href=#delay-the-load-event title="delay the load event">delaying the load event</a> of the
  <code><a href=#frame>frame</a></code>'s <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>, the
  <code><a href=#frame>frame</a></code> must <a href=#delay-the-load-event>delay the load event</a> of its document.</p>

  <p>The <code><a href=#frame>frame</a></code> element must implement the <code><a href=#htmlframeelement>HTMLFrameElement</a></code> interface.</p>

  <pre class=idl>interface <dfn id=htmlframeelement>HTMLFrameElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute DOMString <a href=#dom-frame-name title=dom-frame-name>name</a>;
           attribute DOMString <a href=#dom-frame-scrolling title=dom-frame-scrolling>scrolling</a>;
           attribute DOMString <a href=#dom-frame-src title=dom-frame-src>src</a>;
           attribute DOMString <a href=#dom-frame-frameborder title=dom-frame-frameBorder>frameBorder</a>;
           attribute DOMString <a href=#dom-frame-longdesc title=dom-frame-longDesc>longDesc</a>;
           attribute boolean <a href=#dom-frame-noresize title=dom-frame-noResize>noResize</a>;
  readonly attribute Document? <a href=#dom-frame-contentdocument title=dom-frame-contentDocument>contentDocument</a>;
  readonly attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-frame-contentwindow title=dom-frame-contentWindow>contentWindow</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-frame-marginheight title=dom-frame-marginHeight>marginHeight</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-frame-marginwidth title=dom-frame-marginWidth>marginWidth</a>;
};</pre>

  <p>The <dfn id=dom-frame-name title=dom-frame-name><code>name</code></dfn>, <dfn id=dom-frame-scrolling title=dom-frame-scrolling><code>scrolling</code></dfn>, and <dfn id=dom-frame-src title=dom-frame-src><code>src</code></dfn> IDL attributes of the <code><a href=#frame>frame</a></code> element must
  <a href=#reflect>reflect</a> the respective content attributes of the same name. For the purposes of
  reflection, the <code><a href=#frame>frame</a></code> element's <code title=attr-frame-src>src</code> content
  attribute is defined as containing a <a href=#url>URL</a>.</p>

  <p>The <dfn id=dom-frame-frameborder title=dom-frame-frameBorder><code>frameBorder</code></dfn> IDL attribute of the
  <code><a href=#frame>frame</a></code> element must <a href=#reflect>reflect</a> the element's <code title=attr-frame-frameborder>frameborder</code> content attribute.</p>

  <p>The <dfn id=dom-frame-longdesc title=dom-frame-longDesc><code>longDesc</code></dfn> IDL attribute of the
  <code><a href=#frame>frame</a></code> element must <a href=#reflect>reflect</a> the element's <code title=attr-frame-longdesc>longdesc</code> content attribute, which for the purposes of
  reflection is defined as containing a <a href=#url>URL</a>.</p>

  <p>The <dfn id=dom-frame-noresize title=dom-frame-noResize><code>noResize</code></dfn> IDL attribute of the
  <code><a href=#frame>frame</a></code> element must <a href=#reflect>reflect</a> the element's <code title=attr-frame-noresize>noresize</code> content attribute.</p>

  <p>The <dfn id=dom-frame-contentdocument title=dom-frame-contentDocument><code>contentDocument</code></dfn> IDL attribute of
  the <code><a href=#frame>frame</a></code> element must return the <code><a href=#document>Document</a></code> object of the <a href=#active-document>active
  document</a> of the <code><a href=#frame>frame</a></code> element's <a href=#nested-browsing-context>nested browsing context</a>.</p>

  <p>The <dfn id=dom-frame-contentwindow title=dom-frame-contentWindow><code>contentWindow</code></dfn> IDL attribute must
  return the <code><a href=#windowproxy>WindowProxy</a></code> object of the <code><a href=#frame>frame</a></code> element's <a href=#nested-browsing-context>nested
  browsing context</a>.</p>

  <p>The <dfn id=dom-frame-marginheight title=dom-frame-marginHeight><code>marginHeight</code></dfn> IDL attribute of the
  <code><a href=#frame>frame</a></code> element must <a href=#reflect>reflect</a> the element's <code title=attr-frame-marginheight>marginheight</code> content attribute.</p>

  <p>The <dfn id=dom-frame-marginwidth title=dom-frame-marginWidth><code>marginWidth</code></dfn> IDL attribute of the
  <code><a href=#frame>frame</a></code> element must <a href=#reflect>reflect</a> the element's <code title=attr-frame-marginwidth>marginwidth</code> content attribute.</p>



  <h4 id=other-elements,-attributes-and-apis><span class=secno>15.3.4 </span>Other elements, attributes and APIs</h4> <!-- alphabetical by name and attribute -->

  <p>User agents must treat <code><a href=#acronym>acronym</a></code> elements in a manner
  equivalent to <code><a href=#the-abbr-element>abbr</a></code> elements in terms of semantics and
  for purposes of rendering.</p>

  <hr><pre class=idl>partial interface <a href=#htmlanchorelement id=HTMLAnchorElement-partial>HTMLAnchorElement</a> {
           attribute DOMString <a href=#dom-a-coords title=dom-a-coords>coords</a>;
           attribute DOMString <a href=#dom-a-charset title=dom-a-charset>charset</a>;
           attribute DOMString <a href=#dom-a-name title=dom-a-name>name</a>;
           attribute DOMString <a href=#dom-a-rev title=dom-a-rev>rev</a>;
           attribute DOMString <a href=#dom-a-shape title=dom-a-shape>shape</a>;
};</pre>

  <p>The <dfn id=dom-a-coords title=dom-a-coords><code>coords</code></dfn>, <dfn id=dom-a-charset title=dom-a-charset><code>charset</code></dfn>, <dfn id=dom-a-name title=dom-a-name><code>name</code></dfn>, <dfn id=dom-a-rev title=dom-a-rev><code>rev</code></dfn>, and <dfn id=dom-a-shape title=dom-a-shape><code>shape</code></dfn> IDL attributes of the
  <code><a href=#the-a-element>a</a></code> element must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlareaelement id=HTMLAreaElement-partial>HTMLAreaElement</a> {
           attribute boolean <a href=#dom-area-nohref title=dom-area-noHref>noHref</a>;
};</pre>

  <p>The <dfn id=dom-area-nohref title=dom-area-noHref><code>noHref</code></dfn> IDL
  attribute of the <code><a href=#the-area-element>area</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> content
  attribute.</p>

<!--(removed for https://www.w3.org/Bugs/Public/show_bug.cgi?id=21142 in the hope that we can drop it entirely
  <hr>

  <p>The <code>basefont</code> element must implement the
  <code>HTMLBaseFontElement</code> interface.</p>

  <pre class="idl">interface <dfn>HTMLBaseFontElement</dfn> : <span>HTMLElement</span> {
           attribute DOMString <span title="dom-basefont-color">color</span>;
           attribute DOMString <span title="dom-basefont-face">face</span>;
           attribute long <span title="dom-basefont-size">size</span>; <!- - yes, long, not DOMString (so says DOM2 HTML) - ->
};</pre>

  <p>The <dfn title="dom-basefont-color"><code>color</code></dfn>,
  <dfn title="dom-basefont-face"><code>face</code></dfn>, and <dfn
  title="dom-basefont-size"><code>size</code></dfn> IDL attributes of
  the <code>basefont</code> element must <span>reflect</span> the
  respective content attributes of the same name.</p>
-->

  <hr><pre class=idl>partial interface <a href=#htmlbodyelement id=HTMLBodyElement-partial>HTMLBodyElement</a> {
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-text title=dom-body-text>text</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-link title=dom-body-link>link</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-vlink title=dom-body-vLink>vLink</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-alink title=dom-body-aLink>aLink</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-bgcolor title=dom-body-bgColor>bgColor</a>;
                            attribute DOMString <a href=#dom-body-background title=dom-body-background>background</a>;
};</pre>

  <p>The <dfn id=dom-body-text title=dom-body-text><code>text</code></dfn> IDL
  attribute of the <code><a href=#the-body-element>body</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-body-text><a href=#attr-body-text>text</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-body-link title=dom-body-link><code>link</code></dfn> IDL
  attribute of the <code><a href=#the-body-element>body</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-body-link><a href=#attr-body-link>link</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-body-alink title=dom-body-aLink><code>aLink</code></dfn> IDL
  attribute of the <code><a href=#the-body-element>body</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-body-alink><a href=#attr-body-alink>alink</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-body-vlink title=dom-body-vLink><code>vLink</code></dfn> IDL
  attribute of the <code><a href=#the-body-element>body</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-body-vlink><a href=#attr-body-vlink>vlink</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-body-bgcolor title=dom-body-bgColor><code>bgColor</code></dfn> IDL
  attribute of the <code><a href=#the-body-element>body</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-body-bgcolor><a href=#attr-body-bgcolor>bgcolor</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-body-background title=dom-body-background><code>background</code></dfn> IDL
  attribute of the <code><a href=#the-body-element>body</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-background><a href=#attr-background>background</a></code>
  content attribute. (The <code title=attr-background><a href=#attr-background>background</a></code> content is <em>not</em>
  defined to contain a <a href=#url>URL</a>, despite rules regarding its
  handling in the rendering section above.)</p>

  <hr><pre class=idl>partial interface <a href=#htmlbrelement id=HTMLBRElement-partial>HTMLBRElement</a> {
           attribute DOMString <a href=#dom-br-clear title=dom-br-clear>clear</a>;
};</pre>

  <p>The <dfn id=dom-br-clear title=dom-br-clear><code>clear</code></dfn> IDL
  attribute of the <code><a href=#the-br-element>br</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmltablecaptionelement id=HTMLTableCaptionElement-partial>HTMLTableCaptionElement</a> {
           attribute DOMString <a href=#dom-caption-align title=dom-caption-align>align</a>;
};</pre>

  <p>The <dfn id=dom-caption-align title=dom-caption-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-caption-element>caption</a></code> element must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmltablecolelement id=HTMLTableColElement-partial>HTMLTableColElement</a> {
           attribute DOMString <a href=#dom-col-align title=dom-col-align>align</a>;
           attribute DOMString <a href=#dom-col-ch title=dom-col-ch>ch</a>;
           attribute DOMString <a href=#dom-col-choff title=dom-col-chOff>chOff</a>;
           attribute DOMString <a href=#dom-col-valign title=dom-col-vAlign>vAlign</a>;
           attribute DOMString <a href=#dom-col-width title=dom-col-width>width</a>;
};</pre>

  <p>The <dfn id=dom-col-align title=dom-col-align><code>align</code></dfn> and <dfn id=dom-col-width title=dom-col-width><code>width</code></dfn> IDL attributes of
  the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p>The <dfn id=dom-col-ch title=dom-col-ch><code>ch</code></dfn> IDL attribute
  of the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a> the
  element's <code title=attr-col-char><a href=#attr-col-char>char</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-col-choff title=dom-col-chOff><code>chOff</code></dfn> IDL
  attribute of the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-col-charoff><a href=#attr-col-charoff>charoff</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-col-valign title=dom-col-vAlign><code>vAlign</code></dfn> IDL
  attribute of the <code><a href=#the-col-element>col</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-col-valign><a href=#attr-col-valign>valign</a></code> content
  attribute.</p>

  <hr><p>User agents must treat <code><a href=#dir>dir</a></code> elements in a manner
  equivalent to <code><a href=#the-ul-element>ul</a></code> elements in terms of semantics and for
  purposes of rendering.</p>

  <p>The <code><a href=#dir>dir</a></code> element must implement the
  <code><a href=#htmldirectoryelement>HTMLDirectoryElement</a></code> interface.</p>

  <pre class=idl>interface <dfn id=htmldirectoryelement>HTMLDirectoryElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
           attribute boolean <a href=#dom-dir-compact title=dom-dir-compact>compact</a>;
};</pre>

  <p>The <dfn id=dom-dir-compact title=dom-dir-compact><code>compact</code></dfn> IDL
  attribute of the <code><a href=#dir>dir</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmldivelement id=HTMLDivElement-partial>HTMLDivElement</a> {
           attribute DOMString <a href=#dom-div-align title=dom-div-align>align</a>;
};</pre>

  <p>The <dfn id=dom-div-align title=dom-div-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-div-element>div</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmldlistelement id=HTMLDListElement-partial>HTMLDListElement</a> {
           attribute boolean <a href=#dom-dl-compact title=dom-dl-compact>compact</a>;
};</pre>

  <p>The <dfn id=dom-dl-compact title=dom-dl-compact><code>compact</code></dfn> IDL
  attribute of the <code><a href=#the-dl-element>dl</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlembedelement id=HTMLEmbedElement-partial>HTMLEmbedElement</a> {
           attribute DOMString <a href=#dom-embed-align title=dom-embed-align>align</a>;
           attribute DOMString <a href=#dom-embed-name title=dom-embed-name>name</a>;
};</pre>

  <p>The <dfn id=dom-embed-name title=dom-embed-name><code>name</code></dfn> and <dfn id=dom-embed-align title=dom-embed-align><code>align</code></dfn> IDL attributes of
  the <code><a href=#the-embed-element>embed</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <hr><p>The <code><a href=#font>font</a></code> element must implement the
  <code><a href=#htmlfontelement>HTMLFontElement</a></code> interface.</p>

  <pre class=idl>interface <dfn id=htmlfontelement>HTMLFontElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-font-color title=dom-font-color>color</a>;
                            attribute DOMString <a href=#dom-font-face title=dom-font-face>face</a>;
                            attribute DOMString <a href=#dom-font-size title=dom-font-size>size</a>; <!-- yes, DOMString, not long (so says DOM2 HTML) -->
};</pre>

  <p>The <dfn id=dom-font-color title=dom-font-color><code>color</code></dfn>,
  <dfn id=dom-font-face title=dom-font-face><code>face</code></dfn>, and <dfn id=dom-font-size title=dom-font-size><code>size</code></dfn> IDL attributes of
  the <code><a href=#font>font</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlheadingelement id=HTMLHeadingElement-partial>HTMLHeadingElement</a> {
           attribute DOMString <a href=#dom-hx-align title=dom-hx-align>align</a>;
};</pre>

  <p>The <dfn id=dom-hx-align title=dom-hx-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>&ndash;<code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  <hr><p class=note>The <dfn id=dom-head-profile title=dom-head-profile><code>profile</code></dfn> IDL attribute on
  <code><a href=#the-head-element>head</a></code> elements (with the <code><a href=#htmlheadelement>HTMLHeadElement</a></code>
  interface) is intentionally omitted. Unless so required by <a href=#other-applicable-specifications title="other applicable specifications">another applicable
  specification</a>, implementations would therefore not support
  this attribute. (It is mentioned here as it was defined in a
  previous version of the DOM specifications.)</p>

  <hr><pre class=idl>partial interface <a href=#htmlhrelement id=HTMLHRElement-partial>HTMLHRElement</a> {
           attribute DOMString <a href=#dom-hr-align title=dom-hr-align>align</a>;
           attribute DOMString <a href=#dom-hr-color title=dom-hr-color>color</a>;
           attribute boolean <a href=#dom-hr-noshade title=dom-hr-noShade>noShade</a>;
           attribute DOMString <a href=#dom-hr-size title=dom-hr-size>size</a>;
           attribute DOMString <a href=#dom-hr-width title=dom-hr-width>width</a>;
};</pre>

  <p>The <dfn id=dom-hr-align title=dom-hr-align><code>align</code></dfn>, <dfn id=dom-hr-color title=dom-hr-color><code>color</code></dfn>, <dfn id=dom-hr-size title=dom-hr-size><code>size</code></dfn>, and <dfn id=dom-hr-width title=dom-hr-width><code>width</code></dfn> IDL attributes of the
  <code><a href=#the-hr-element>hr</a></code> element must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <p>The <dfn id=dom-hr-noshade title=dom-hr-noShade><code>noShade</code></dfn> IDL
  attribute of the <code><a href=#the-hr-element>hr</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code> content
  attribute.</p>

  <hr><pre class=idl>partial interface <a href=#htmlhtmlelement id=HTMLHtmlElement-partial>HTMLHtmlElement</a> {
           attribute DOMString <a href=#dom-html-version title=dom-html-version>version</a>;
};</pre>

  <p>The <dfn id=dom-html-version title=dom-html-version><code>version</code></dfn> IDL
  attribute of the <code><a href=#the-html-element>html</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmliframeelement id=HTMLIFrameElement-partial>HTMLIFrameElement</a> {
           attribute DOMString <a href=#dom-iframe-align title=dom-iframe-align>align</a>;
           attribute DOMString <a href=#dom-iframe-scrolling title=dom-iframe-scrolling>scrolling</a>;
           attribute DOMString <a href=#dom-iframe-frameborder title=dom-iframe-frameBorder>frameBorder</a>;
           attribute DOMString <a href=#dom-iframe-longdesc title=dom-iframe-longDesc>longDesc</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-iframe-marginheight title=dom-iframe-marginHeight>marginHeight</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-iframe-marginwidth title=dom-iframe-marginWidth>marginWidth</a>;
};</pre>

  <p>The <dfn id=dom-iframe-align title=dom-iframe-align><code>align</code></dfn> and
  <dfn id=dom-iframe-scrolling title=dom-iframe-scrolling><code>scrolling</code></dfn> IDL
  attributes of the <code><a href=#the-iframe-element>iframe</a></code> element must
  <a href=#reflect>reflect</a> the respective content attributes of the same
  name.</p>

  <p>The <dfn id=dom-iframe-frameborder title=dom-iframe-frameBorder><code>frameBorder</code></dfn> IDL
  attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-iframe-frameborder><a href=#attr-iframe-frameborder>frameborder</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-iframe-longdesc title=dom-iframe-longDesc><code>longDesc</code></dfn>
  IDL attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-iframe-longdesc><a href=#attr-iframe-longdesc>longdesc</a></code> content attribute,
  which for the purposes of reflection is defined as containing a
  <a href=#url>URL</a>.</p>

  <p>The <dfn id=dom-iframe-marginheight title=dom-iframe-marginHeight><code>marginHeight</code></dfn> IDL
  attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-iframe-marginwidth title=dom-iframe-marginWidth><code>marginWidth</code></dfn> IDL
  attribute of the <code><a href=#the-iframe-element>iframe</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> content
  attribute.</p>

  <hr><pre class=idl>partial interface <a href=#htmlimageelement id=HTMLImageElement-partial>HTMLImageElement</a> {
           attribute DOMString <a href=#dom-img-name title=dom-img-name>name</a>;
           attribute DOMString <a href=#dom-img-lowsrc title=dom-img-lowsrc>lowsrc</a>;
           attribute DOMString <a href=#dom-img-align title=dom-img-align>align</a>;
           attribute unsigned long <a href=#dom-img-hspace title=dom-img-hspace>hspace</a>;
           attribute unsigned long <a href=#dom-img-vspace title=dom-img-vspace>vspace</a>;
           attribute DOMString <a href=#dom-img-longdesc title=dom-img-longDesc>longDesc</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-img-border title=dom-img-border>border</a>;
};</pre>

  <p>The <dfn id=dom-img-name title=dom-img-name><code>name</code></dfn>, <dfn id=dom-img-align title=dom-img-align><code>align</code></dfn>, <dfn id=dom-img-border title=dom-img-border><code>border</code></dfn>, <dfn id=dom-img-hspace title=dom-img-hspace><code>hspace</code></dfn>, and <dfn id=dom-img-vspace title=dom-img-vspace><code>vspace</code></dfn> IDL attributes of
  the <code><a href=#the-img-element>img</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p>The <dfn id=dom-img-longdesc title=dom-img-longDesc><code>longDesc</code></dfn> IDL
  attribute of the <code><a href=#the-img-element>img</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-img-longdesc><a href=#attr-img-longdesc>longdesc</a></code>
  content attribute, which for the purposes of reflection is defined
  as containing a <a href=#url>URL</a>.</p>

  <p>The <dfn id=dom-img-lowsrc title=dom-img-lowsrc><code>lowsrc</code></dfn> IDL
  attribute of the <code><a href=#the-img-element>img</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-img-lowsrc><a href=#attr-img-lowsrc>lowsrc</a></code>
  content attribute, which for the purposes of reflection is defined
  as containing a <a href=#url>URL</a>.</p>

  <hr><pre class=idl>partial interface <a href=#htmlinputelement id=HTMLInputElement-partial>HTMLInputElement</a> {
           attribute DOMString <a href=#dom-input-align title=dom-input-align>align</a>;
           attribute DOMString <a href=#dom-input-usemap title=dom-input-useMap>useMap</a>;
};</pre>

  <p>The <dfn id=dom-input-align title=dom-input-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-input-element>input</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <p>The <dfn id=dom-input-usemap title=dom-input-useMap><code>useMap</code></dfn> IDL
  attribute of the <code><a href=#the-input-element>input</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-input-usemap><a href=#attr-input-usemap>usemap</a></code> content attribute.</p>

  <hr><pre class=idl>partial interface <a href=#htmllegendelement id=HTMLLegendElement-partial>HTMLLegendElement</a> {
           attribute DOMString <a href=#dom-legend-align title=dom-legend-align>align</a>;
};</pre>

  <p>The <dfn id=dom-legend-align title=dom-legend-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-legend-element>legend</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmllielement id=HTMLLIElement-partial>HTMLLIElement</a> {
           attribute DOMString <a href=#dom-li-type title=dom-li-type>type</a>;
};</pre>

  <p>The <dfn id=dom-li-type title=dom-li-type><code>type</code></dfn> IDL
  attribute of the <code><a href=#the-li-element>li</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmllinkelement id=HTMLLinkElement-partial>HTMLLinkElement</a> {
           attribute DOMString <a href=#dom-link-charset title=dom-link-charset>charset</a>;
           attribute DOMString <a href=#dom-link-rev title=dom-link-rev>rev</a>;
           attribute DOMString <a href=#dom-link-target title=dom-link-target>target</a>;
};</pre>

  <p>The <dfn id=dom-link-charset title=dom-link-charset><code>charset</code></dfn>,
  <dfn id=dom-link-rev title=dom-link-rev><code>rev</code></dfn>, and <dfn id=dom-link-target title=dom-link-target><code>target</code></dfn> IDL attributes of
  the <code><a href=#the-link-element>link</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <hr><p>User agents must treat <code><a href=#listing>listing</a></code> elements in a manner
  equivalent to <code><a href=#the-pre-element>pre</a></code> elements in terms of semantics and
  for purposes of rendering.</p>

  <hr><pre class=idl>partial interface <a href=#htmlmenuelement id=HTMLMenuElement-partial>HTMLMenuElement</a> {
           attribute boolean <a href=#dom-menu-compact title=dom-menu-compact>compact</a>;
};</pre>

  <p>The <dfn id=dom-menu-compact title=dom-menu-compact><code>compact</code></dfn> IDL
  attribute of the <code><a href=#the-menu-element>menu</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlmetaelement id=HTMLMetaElement-partial>HTMLMetaElement</a> {
           attribute DOMString <a href=#dom-meta-scheme title=dom-meta-scheme>scheme</a>;
};</pre>

  <p>User agents may treat the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> content attribute on the
  <code><a href=#the-meta-element>meta</a></code> element as an extension of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> content attribute when processing
  a <code><a href=#the-meta-element>meta</a></code> element with a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute whose value is one that
  the user agent recognizes as supporting the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute.</p>

  <p>User agents are encouraged to ignore the <code title=attr-meta-scheme><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 title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute.</p>

  <div class=example>

   <p>For example, if the user agent acts on <code><a href=#the-meta-element>meta</a></code>
   elements with <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attributes
   having the value "eGMS.subject.keyword", and knows that the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute is used with this
   metadata name, then it could take the <code title=attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> attribute into account,
   acting as if it was an extension of the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute. Thus the following
   two <code><a href=#the-meta-element>meta</a></code> elements could be treated as two elements
   giving values for two different metadata names, one consisting of a
   combination of "eGMS.subject.keyword" and "LGCL", and the other
   consisting of a combination of "eGMS.subject.keyword" and
   "ORLY":</p>

   <pre class=bad>&lt;!-- this markup is invalid --&gt;
&lt;meta name="eGMS.subject.keyword" scheme="LGCL" content="Abandoned vehicles"&gt;
&lt;meta name="eGMS.subject.keyword" scheme="ORLY" content="Mah car: kthxbye"&gt;</pre>

   <p>The suggested processing of this markup, however, would be equivalent to the following:</p>

   <pre>&lt;meta name="eGMS.subject.keyword" content="Abandoned vehicles"&gt;
&lt;meta name="eGMS.subject.keyword" content="Mah car: kthxbye"&gt;</pre>

  </div>

  <p>The <dfn id=dom-meta-scheme title=dom-meta-scheme><code>scheme</code></dfn> IDL
  attribute of the <code><a href=#the-meta-element>meta</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlobjectelement id=HTMLObjectElement-partial>HTMLObjectElement</a> {
           attribute DOMString <a href=#dom-object-align title=dom-object-align>align</a>;
           attribute DOMString <a href=#dom-object-archive title=dom-object-archive>archive</a>;
           attribute DOMString <a href=#dom-object-code title=dom-object-code>code</a>;
           attribute boolean <a href=#dom-object-declare title=dom-object-declare>declare</a>;
           attribute unsigned long <a href=#dom-object-hspace title=dom-object-hspace>hspace</a>;
           attribute DOMString <a href=#dom-object-standby title=dom-object-standby>standby</a>;
           attribute unsigned long <a href=#dom-object-vspace title=dom-object-vspace>vspace</a>;
           attribute DOMString <a href=#dom-object-codebase title=dom-object-codeBase>codeBase</a>;
           attribute DOMString <a href=#dom-object-codetype title=dom-object-codeType>codeType</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-object-border title=dom-object-border>border</a>;
};</pre>

  <p>The <dfn id=dom-object-align title=dom-object-align><code>align</code></dfn>, <dfn id=dom-object-archive title=dom-object-archive><code>archive</code></dfn>, <dfn id=dom-object-border title=dom-object-border><code>border</code></dfn>, <dfn id=dom-object-code title=dom-object-code><code>code</code></dfn>, <dfn id=dom-object-declare title=dom-object-declare><code>declare</code></dfn>, <dfn id=dom-object-hspace title=dom-object-hspace><code>hspace</code></dfn>, <dfn id=dom-object-standby title=dom-object-standby><code>standby</code></dfn>, and <dfn id=dom-object-vspace title=dom-object-vspace><code>vspace</code></dfn> IDL attributes
  of the <code><a href=#the-object-element>object</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p>The <dfn id=dom-object-codebase title=dom-object-codeBase><code>codeBase</code></dfn>
  IDL attribute of the <code><a href=#the-object-element>object</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-object-codebase><a href=#attr-object-codebase>codebase</a></code> content attribute,
  which for the purposes of reflection is defined as containing a
  <a href=#url>URL</a>.</p>

  <p>The <dfn id=dom-object-codetype title=dom-object-codeType><code>codeType</code></dfn> IDL
  attribute of the <code><a href=#the-object-element>object</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-object-codetype><a href=#attr-object-codetype>codetype</a></code> content
  attribute.</p>

  <hr><pre class=idl>partial interface <a href=#htmlolistelement id=HTMLOListElement-partial>HTMLOListElement</a> {
           attribute boolean <a href=#dom-ol-compact title=dom-ol-compact>compact</a>;
};</pre>

  <p>The <dfn id=dom-ol-compact title=dom-ol-compact><code>compact</code></dfn> IDL
  attribute of the <code><a href=#the-ol-element>ol</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlparagraphelement id=HTMLParagraphElement-partial>HTMLParagraphElement</a> {
           attribute DOMString <a href=#dom-p-align title=dom-p-align>align</a>;
};</pre>

  <p>The <dfn id=dom-p-align title=dom-p-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-p-element>p</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlparamelement id=HTMLParamElement-partial>HTMLParamElement</a> {
           attribute DOMString <a href=#dom-param-type title=dom-param-type>type</a>;
           attribute DOMString <a href=#dom-param-valuetype title=dom-param-valueType>valueType</a>;
};</pre>

  <p>The <dfn id=dom-param-type title=dom-param-type><code>type</code></dfn> IDL
  attribute of the <code><a href=#the-param-element>param</a></code> element must
  <a href=#reflect>reflect</a> the content attribute of the same name.</p>

  <p>The <dfn id=dom-param-valuetype title=dom-param-valueType><code>valueType</code></dfn>
  IDL attribute of the <code><a href=#the-param-element>param</a></code> element must
  <a href=#reflect>reflect</a> the element's <code title=attr-param-valuetype><a href=#attr-param-valuetype>valuetype</a></code> content attribute.</p>

  <hr><p>User agents must treat <code><a href=#plaintext>plaintext</a></code> elements in a
  manner equivalent to <code><a href=#the-pre-element>pre</a></code> elements in terms of semantics
  and for purposes of rendering. (The parser has special behavior for
  this element, though.)</p>

  <hr><pre class=idl>partial interface <a href=#htmlpreelement id=HTMLPreElement-partial>HTMLPreElement</a> {
           attribute long <a href=#dom-pre-width title=dom-pre-width>width</a>;
};</pre>

  <p>The <dfn id=dom-pre-width title=dom-pre-width><code>width</code></dfn> IDL
  attribute of the <code><a href=#the-pre-element>pre</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmlscriptelement id=HTMLScriptElement-partial>HTMLScriptElement</a> {
           attribute DOMString <a href=#dom-script-event title=dom-script-event>event</a>;
           attribute DOMString <a href=#dom-script-htmlfor title=dom-script-htmlFor>htmlFor</a>;
};</pre>

  <p>The <dfn id=dom-script-event title=dom-script-event><code>event</code></dfn> and
  <dfn id=dom-script-htmlfor title=dom-script-htmlFor><code>htmlFor</code></dfn> IDL
  attributes of the <code><a href=#the-script-element>script</a></code> element must return the empty
  string on getting, and do nothing on setting.</p>

  <hr><pre class=idl>partial interface <a href=#htmltableelement id=HTMLTableElement-partial>HTMLTableElement</a> {
           attribute DOMString <a href=#dom-table-align title=dom-table-align>align</a>;
           attribute DOMString <a href=#dom-table-border title=dom-table-border>border</a>;
           attribute DOMString <a href=#dom-table-frame title=dom-table-frame>frame</a>;
           attribute DOMString <a href=#dom-table-rules title=dom-table-rules>rules</a>;
           attribute DOMString <a href=#dom-table-summary title=dom-table-summary>summary</a>;
           attribute DOMString <a href=#dom-table-width title=dom-table-width>width</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-bgcolor title=dom-table-bgColor>bgColor</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-cellpadding title=dom-table-cellPadding>cellPadding</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-cellspacing title=dom-table-cellSpacing>cellSpacing</a>;
};</pre>

  <p>The <dfn id=dom-table-align title=dom-table-align><code>align</code></dfn>, <dfn id=dom-table-border title=dom-table-border><code>border</code></dfn>, <dfn id=dom-table-frame title=dom-table-frame><code>frame</code></dfn>, <dfn id=dom-table-summary title=dom-table-summary><code>summary</code></dfn>, <dfn id=dom-table-rules title=dom-table-rules><code>rules</code></dfn>, and <dfn id=dom-table-width title=dom-table-width><code>width</code></dfn>, IDL attributes of
  the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a> the
  respective content attributes of the same name.</p>

  <p>The <dfn id=dom-table-bgcolor title=dom-table-bgColor><code>bgColor</code></dfn> IDL
  attribute of the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-table-bgcolor><a href=#attr-table-bgcolor>bgcolor</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-table-cellpadding title=dom-table-cellPadding><code>cellPadding</code></dfn> IDL
  attribute of the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-table-cellspacing title=dom-table-cellSpacing><code>cellSpacing</code></dfn> IDL
  attribute of the <code><a href=#the-table-element>table</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> content
  attribute.</p>

  <hr><pre class=idl>partial interface <a href=#htmltablesectionelement id=HTMLTableSectionElement-partial>HTMLTableSectionElement</a> {
           attribute DOMString <a href=#dom-tbody-align title=dom-tbody-align>align</a>;
           attribute DOMString <a href=#dom-tbody-ch title=dom-tbody-ch>ch</a>;
           attribute DOMString <a href=#dom-tbody-choff title=dom-tbody-chOff>chOff</a>;
           attribute DOMString <a href=#dom-tbody-valign title=dom-tbody-vAlign>vAlign</a>;
};</pre>

  <p>The <dfn id=dom-tbody-align title=dom-tbody-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
  <code><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect>reflect</a> the content
  attribute of the same name.</p>

  <p>The <dfn id=dom-tbody-ch title=dom-tbody-ch><code>ch</code></dfn> IDL attribute
  of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
  <code><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect>reflect</a> the elements'
  <code title=attr-tbody-char><a href=#attr-tbody-char>char</a></code> content attributes.</p>

  <p>The <dfn id=dom-tbody-choff title=dom-tbody-chOff><code>chOff</code></dfn> IDL
  attribute of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
  <code><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect>reflect</a> the elements'
  <code title=attr-tbody-charoff><a href=#attr-tbody-charoff>charoff</a></code> content attributes.</p>

  <p>The <dfn id=dom-tbody-valign title=dom-tbody-vAlign><code>vAlign</code></dfn> IDL
  attribute of the <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-thead-element>thead</a></code>, and
  <code><a href=#the-tfoot-element>tfoot</a></code> element must <a href=#reflect>reflect</a> the elements'
  <code title=attr-tbody-valign><a href=#attr-tbody-valign>valign</a></code> content
  attributes.</p>

  <hr><pre class=idl>partial interface <a href=#htmltablecellelement id=HTMLTableCellElement-partial>HTMLTableCellElement</a> {
           attribute DOMString <a href=#dom-tdth-align title=dom-tdth-align>align</a>;
           attribute DOMString <a href=#dom-tdth-axis title=dom-tdth-axis>axis</a>;
           attribute DOMString <a href=#dom-tdth-height title=dom-tdth-height>height</a>;
           attribute DOMString <a href=#dom-tdth-width title=dom-tdth-width>width</a>;

           attribute DOMString <a href=#dom-tdth-ch title=dom-tdth-ch>ch</a>;
           attribute DOMString <a href=#dom-tdth-choff title=dom-tdth-chOff>chOff</a>;
           attribute boolean <a href=#dom-tdth-nowrap title=dom-tdth-noWrap>noWrap</a>;
           attribute DOMString <a href=#dom-tdth-valign title=dom-tdth-vAlign>vAlign</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-tdth-bgcolor title=dom-tdth-bgColor>bgColor</a>;
};</pre>

  <p>The <dfn id=dom-tdth-align title=dom-tdth-align><code>align</code></dfn>, <dfn id=dom-tdth-axis title=dom-tdth-axis><code>axis</code></dfn>, <dfn id=dom-tdth-height title=dom-tdth-height><code>height</code></dfn>, and <dfn id=dom-tdth-width title=dom-tdth-width><code>width</code></dfn> IDL attributes of the <code><a href=#the-td-element>td</a></code> and
  <code><a href=#the-th-element>th</a></code> elements must <a href=#reflect>reflect</a> the respective content attributes of the same
  name.</p>

  <p>The <dfn id=dom-tdth-ch title=dom-tdth-ch><code>ch</code></dfn> IDL
  attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
  <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-char><a href=#attr-tdth-char>char</a></code> content attributes.</p>

  <p>The <dfn id=dom-tdth-choff title=dom-tdth-chOff><code>chOff</code></dfn> IDL
  attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
  <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-charoff><a href=#attr-tdth-charoff>charoff</a></code> content attributes.</p>

  <p>The <dfn id=dom-tdth-nowrap title=dom-tdth-noWrap><code>noWrap</code></dfn> IDL
  attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
  <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-nowrap><a href=#attr-tdth-nowrap>nowrap</a></code> content attributes.</p>

  <p>The <dfn id=dom-tdth-valign title=dom-tdth-vAlign><code>vAlign</code></dfn> IDL
  attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> element must
  <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-valign><a href=#attr-tdth-valign>valign</a></code> content attributes.</p>

  <p>The <dfn id=dom-tdth-bgcolor title=dom-tdth-bgColor><code>bgColor</code></dfn> IDL
  attribute of the <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements must
  <a href=#reflect>reflect</a> the elements' <code title=attr-tdth-bgcolor><a href=#attr-tdth-bgcolor>bgcolor</a></code> content attributes.</p>

  <hr><pre class=idl>partial interface <a href=#htmltabledatacellelement id=HTMLTableDataCellElement-partial>HTMLTableDataCellElement</a> {
           attribute DOMString <a href=#dom-td-abbr title=dom-td-abbr>abbr</a>;
};</pre>

  <p>The <dfn id=dom-td-abbr title=dom-td-abbr><code>abbr</code></dfn> IDL attribute of the <code><a href=#the-td-element>td</a></code>
  element must <a href=#reflect>reflect</a> the respective content attributes of the same name.</p>

  <hr><pre class=idl>partial interface <a href=#htmltablerowelement id=HTMLTableRowElement-partial>HTMLTableRowElement</a> {
           attribute DOMString <a href=#dom-tr-align title=dom-tr-align>align</a>;
           attribute DOMString <a href=#dom-tr-ch title=dom-tr-ch>ch</a>;
           attribute DOMString <a href=#dom-tr-choff title=dom-tr-chOff>chOff</a>;
           attribute DOMString <a href=#dom-tr-valign title=dom-tr-vAlign>vAlign</a>;

  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-tr-bgcolor title=dom-tr-bgColor>bgColor</a>;
};</pre>

  <p>The <dfn id=dom-tr-align title=dom-tr-align><code>align</code></dfn> IDL
  attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
  the content attribute of the same name.</p>

  <p>The <dfn id=dom-tr-ch title=dom-tr-ch><code>ch</code></dfn> IDL attribute of
  the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a> the element's
  <code title=attr-tr-char><a href=#attr-tr-char>char</a></code> content attribute.</p>

  <p>The <dfn id=dom-tr-choff title=dom-tr-chOff><code>chOff</code></dfn> IDL
  attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-tr-charoff><a href=#attr-tr-charoff>charoff</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-tr-valign title=dom-tr-vAlign><code>vAlign</code></dfn> IDL
  attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-tr-valign><a href=#attr-tr-valign>valign</a></code> content
  attribute.</p>

  <p>The <dfn id=dom-tr-bgcolor title=dom-tr-bgColor><code>bgColor</code></dfn> IDL
  attribute of the <code><a href=#the-tr-element>tr</a></code> element must <a href=#reflect>reflect</a>
  the element's <code title=attr-tr-bgcolor><a href=#attr-tr-bgcolor>bgcolor</a></code> content
  attribute.</p>

  <hr><pre class=idl>partial interface <a href=#htmlulistelement id=HTMLUListElement-partial>HTMLUListElement</a> {
           attribute boolean <a href=#dom-ul-compact title=dom-ul-compact>compact</a>;
           attribute DOMString <a href=#dom-ul-type title=dom-ul-type>type</a>;
};</pre>

  <p>The <dfn id=dom-ul-compact title=dom-ul-compact><code>compact</code></dfn> and
  <dfn id=dom-ul-type title=dom-ul-type><code>type</code></dfn> IDL attributes of
  the <code><a href=#the-ul-element>ul</a></code> element must <a href=#reflect>reflect</a> the respective
  content attributes of the same name.</p>

  <hr><p>User agents must treat <code><a href=#xmp>xmp</a></code> elements in a manner
  equivalent to <code><a href=#the-pre-element>pre</a></code> elements in terms of semantics and
  for purposes of rendering. (The parser has special behavior for this
  element though.)</p>

  <hr><p>The <code><a href=#blink>blink</a></code>, <code><a href=#bgsound>bgsound</a></code>, <code><a href=#isindex-0>isindex</a></code>,
  <code><a href=#multicol>multicol</a></code>, <code><a href=#nextid>nextid</a></code>, <code><a href=#rb>rb</a></code>, and
  <code><a href=#spacer>spacer</a></code> elements must use the
  <code><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface.</p> <!-- has to be
  explicitly listed because technically we define the elements in the
  spec, albeit as obsolete, and then we say that only elements not
  defined in this spec use HTMLUnknownElement. -->

  <hr><pre class=idl>partial interface <a href=#document id=Document-partial>Document</a> {
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-fgcolor title=dom-document-fgColor>fgColor</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-linkcolor title=dom-document-linkColor>linkColor</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-vlinkcolor title=dom-document-vlinkColor>vlinkColor</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-alinkcolor title=dom-document-alinkColor>alinkColor</a>;
  [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-bgcolor title=dom-document-bgColor>bgColor</a>;

  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-anchors title=dom-document-anchors>anchors</a>;
  readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-document-applets title=dom-document-applets>applets</a>;

  void <a href=#dom-document-clear title=dom-document-clear>clear</a>();
  void <a href=#dom-document-captureevents title=dom-document-captureEvents>captureEvents</a>(long dummy);
  void <a href=#dom-document-releaseevents title=dom-document-releaseEvents>releaseEvents</a>(long dummy);

  readonly attribute <a href=#htmlallcollection>HTMLAllCollection</a> <a href=#dom-document-all title=dom-document-all>all</a>;
};</pre>

  <p>The attributes of the <code><a href=#document>Document</a></code> object listed in the
  first column of the following table must <a href=#reflect>reflect</a> the
  content attribute on <a href=#the-body-element-0>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-0>the body element</a> is a <code><a href=#the-body-element>body</a></code> element
  (as opposed to a <code><a href=#frameset>frameset</a></code> element). When there is no
  <a href=#the-body-element-0 title="the body element">body element</a> or if it is a
  <code><a href=#frameset>frameset</a></code> element, the attributes must instead return
  the empty string on getting and do nothing on setting.</p>

  <table><thead><tr><th> IDL attribute
     <th> Content attribute
   <tbody><tr><td><dfn id=dom-document-fgcolor title=dom-document-fgColor><code>fgColor</code></dfn>
     <td><code title=attr-body-text><a href=#attr-body-text>text</a></code>
    <tr><td><dfn id=dom-document-linkcolor title=dom-document-linkColor><code>linkColor</code></dfn>
     <td><code title=attr-body-link><a href=#attr-body-link>link</a></code>
    <tr><td><dfn id=dom-document-vlinkcolor title=dom-document-vlinkColor><code>vlinkColor</code></dfn>
     <td><code title=attr-body-vlink><a href=#attr-body-vlink>vlink</a></code>
    <tr><td><dfn id=dom-document-alinkcolor title=dom-document-alinkColor><code>alinkColor</code></dfn>
     <td><code title=attr-body-alink><a href=#attr-body-alink>alink</a></code>
    <tr><td><dfn id=dom-document-bgcolor title=dom-document-bgColor><code>bgColor</code></dfn>
     <td><code title=attr-body-bgcolor><a href=#attr-body-bgcolor>bgcolor</a></code>
  </table><hr><p>The <dfn id=dom-document-anchors title=dom-document-anchors><code>anchors</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only <code><a href=#the-a-element>a</a></code>
  elements with <code title=attr-a-name><a href=#attr-a-name>name</a></code>
  attributes.</p>

  <p>The <dfn id=dom-document-applets title=dom-document-applets><code>applets</code></dfn>
  attribute must return an <code><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches only
  <code><a href=#the-applet-element>applet</a></code> elements.</p>

  <p>The <dfn id=dom-document-clear title=dom-document-clear><code>clear()</code></dfn>,
  <dfn id=dom-document-captureevents title=dom-document-captureEvents><code>captureEvents()</code></dfn>, and
  <dfn id=dom-document-releaseevents title=dom-document-releaseEvents><code>releaseEvents()</code></dfn>
  methods must do nothing.</p>

  <hr><p>The <dfn id=dom-document-all title=dom-document-all><code>all</code></dfn>
  attribute must return an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> rooted at the
  <code><a href=#document>Document</a></code> node, whose filter matches all elements.</p>

  <p>The object returned for <code title=dom-document-all><a href=#dom-document-all>all</a></code>
  has several unusual behaviors:</p>

  <ul><li><p>The user agent must act as if the ToBoolean() operator in
   JavaScript converts the object returned for <code title=dom-document-all><a href=#dom-document-all>all</a></code> to the false value.</li>

   <li><p>The user agent must act as if, for the purposes of the <code title="">==</code> and <code title="">!=</code> operators in JavaScript, the object returned for <code title=dom-document-all><a href=#dom-document-all>all</a></code> compares as equal to the <code title="">undefined</code> and
   <code title="">null</code> values. (Comparisons using the <code title="">===</code> operator, and
   comparisons to other values such as strings or objects, are unaffected.)</li>

   <li><p>The user agent must act such that the <code title="">typeof</code> operator in JavaScript returns the string
   <code title="">undefined</code> when applied to the object returned
   for <code title=dom-document-all><a href=#dom-document-all>all</a></code>.</li>

  </ul><p class=note>These requirements are a <a href=#willful-violation>willful
  violation</a> of the JavaScript specification current at the time
  of writing (ECMAScript edition 5). The JavaScript specification
  requires that the ToBoolean() operator convert all objects to the
  true value, and does not have provisions for objects acting as if
  they were <code title="">undefined</code> for the purposes of
  certain operators. This violation is motivated by a desire for
  compatibility with two classes of legacy content: one that uses the
  presence of <code title=dom-document-all><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 title=dom-document-all><a href=#dom-document-all>document.all</a></code> object without testing
  for its presence first. <a href=#refsECMA262>[ECMA262]</a></p>

  <hr><pre class=idl>partial interface <a href=#window id=Window-partial>Window</a> {
  void <a href=#dom-window-captureevents title=dom-window-captureEvents>captureEvents</a>(long dummy);
  void <a href=#dom-window-releaseevents title=dom-window-releaseEvents>releaseEvents</a>(long dummy);
};</pre>

  <p>The
  <dfn id=dom-window-captureevents title=dom-window-captureEvents><code>captureEvents()</code></dfn> and
  <dfn id=dom-window-releaseevents title=dom-window-releaseEvents><code>releaseEvents()</code></dfn>
  methods must do nothing.</p>

  </div>



  <h2 id=iana><span class=secno>16 </span>IANA considerations</h2>

  <!-- http://www.w3.org/2002/06/registering-mediatype.html -->


  <h3 id=text/html><span class=secno>16.1 </span><dfn><code>text/html</code></dfn></h3>

  <p>This registration is for community review and will be submitted to the IESG for review,
  approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type text/html
  -->

  <!--
   Obsoletes:
   http://tools.ietf.org/html/rfc2854

   Include a request to retire RFC 2854 persuant to section 6.4 of RFC 2026.
  -->

  <dl><dt>Type name:</dt>
   <dd>text</dd>
   <dt>Subtype name:</dt>
   <dd>html</dd>
   <dt>Required parameters:</dt>
   <dd>No required parameters</dd>
   <dt>Optional parameters:</dt>
   <dd>
    <dl><dt><code title="">charset</code></dt>
     <dd>
<!--CLEANUP-->
      <p>The <code title="">charset</code> parameter may be provided to definitively specify the
      <a href="#document's-character-encoding">document's character encoding</a>, overriding any <a href=#character-encoding-declaration title="character encoding
      declaration">character encoding declarations</a> in the document. The parameter's value
      must be one of the <a href=#encoding-label title="encoding label">labels</a> of the <a href=#encoding title=encoding>character
      encoding</a> used to serialize the file. <a href=#refsENCODING>[ENCODING]</a></p>
     </dd>
    </dl></dd>
   <dt>Encoding considerations:</dt>
   <dd>
    8bit (see the section on <a href=#character-encoding-declaration title="character encoding
    declaration">character encoding declarations</a>)
   </dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <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><a href=#the-img-element>img</a></code> element can be used in conjunction with
    some other features as a way to effect a port scan from the user's location on the Internet.
    This can expose local network topologies that the attacker would otherwise not be able to
    determine.</p>

    <p>HTML relies on a compartmentalization scheme sometimes known as the <i>same-origin
    policy</i>. An <a href=#origin>origin</a> in most cases consists of all the pages served from the same
    host, on the same port, using the same protocol.</p>

    <p>It is critical, therefore, to ensure that any untrusted content that forms part of a site be
    hosted on a different <a href=#origin>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>

   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>
    Rules for processing both conforming and non-conforming content
    are defined in this specification.
   </dd>
   <dt>Published specification:</dt>
   <dd id=authors-using-html>
    This document is the relevant specification. Labeling a resource
    with the <code><a href=#text/html>text/html</a></code> type asserts that the resource is
    an <a href=#html-documents title="HTML documents">HTML document</a> using
    <a href=#syntax>the HTML syntax</a>.
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    Web browsers, tools for processing Web content, HTML authoring
    tools, search engines, validators.
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>No sequence of bytes can uniquely identify an HTML
     document. More information on detecting HTML documents is
     available in the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></dd>
     <dt>File extension(s):</dt>
     <dd>"<code title="">html</code>" and "<code title="">htm</code>"
     are commonly, but certainly not exclusively, used as the
     extension for HTML documents.</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd><code title="">TEXT</code></dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>No restrictions apply.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers used with <code><a href=#text/html>text/html</a></code> resources either refer to <a href=#the-indicated-part-of-the-document>the
  indicated part of the document</a> or provide state information for in-page scripts.</p>




  <h3 id=multipart/x-mixed-replace><span class=secno>16.2 </span><dfn><code>multipart/x-mixed-replace</code></dfn></h3>

  <p>This registration is for community review and will be submitted to the IESG for review,
  approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type multipart/x-mixed-replace
  -->

  <dl><dt>Type name:</dt>
   <dd>multipart</dd>
   <dt>Subtype name:</dt>
   <dd>x-mixed-replace</dd>
   <dt>Required parameters:</dt>
   <dd>
    <ul class=brief><li><code title="">boundary</code> (defined in RFC2046) <a href=#refsRFC2046>[RFC2046]</a>
    </ul></dd>
   <dt>Optional parameters:</dt>
   <dd>No optional parameters.</dd>
   <dt>Encoding considerations:</dt>
   <dd>binary</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <dd>
    Subresources of a <code><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><a href=#text/html>text/html</a></code>.
   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>
    None.
   </dd>
   <dt>Published specification:</dt>
   <dd>
    This specification describes processing rules for Web browsers.
    Conformance requirements for generating resources with this type are the same as for <code>multipart/mixed</code>. <a href=#refsRFC2046>[RFC2046]</a>
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    This type is intended to be used in resources generated by Web servers, for consumption by Web browsers.
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>No sequence of bytes can uniquely identify a <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> resource.</dd>
     <dt>File extension(s):</dt>
     <dd>No specific file extensions are recommended for this type.</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd>No specific Macintosh file type codes are recommended for this type.</dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>No restrictions apply.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers used with
  <code><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> resources apply to each body
  part as defined by the type used by that body part.</p>


  <h3 id=application/xhtml+xml><span class=secno>16.3 </span><dfn><code>application/xhtml+xml</code></dfn></h3>

  <p>This registration is for community review and will be submitted
  to the IESG for review, approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type application/xhtml+xml
  -->

  <!--
   Obsoletes:
   http://tools.ietf.org/html/rfc3236
  -->

  <dl><dt>Type name:</dt>
   <dd>application</dd>
   <dt>Subtype name:</dt>
   <dd>xhtml+xml</dd>
   <dt>Required parameters:</dt>
   <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
   <dt>Optional parameters:</dt>
   <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
   <dt>Encoding considerations:</dt>
   <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
   <dt id=authors-using-xhtml>Published specification:</dt>
   <dd>
    Labeling a resource with the <code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>
    type asserts that the resource is an XML document that likely has
    a root element from the <a href=#html-namespace-0>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>
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>Same as for <code>application/xml</code> <a href=#refsRFC3023>[RFC3023]</a></dd>
     <dt>File extension(s):</dt>
     <dd>"<code title="">xhtml</code>" and "<code title="">xht</code>"
     are sometimes used as extensions for XML resources that have a
     root element from the <a href=#html-namespace-0>HTML namespace</a>.</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd><code title="">TEXT</code></dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>No restrictions apply.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers used with <code><a href=#application/xhtml+xml>application/xhtml+xml</a></code>
  resources have the same semantics as with any <a href=#xml-mime-type>XML MIME
  type</a>. <a href=#refsRFC3023>[RFC3023]</a></p>


  <h3 id=application/x-www-form-urlencoded><span class=secno>16.4 </span><dfn><code>application/x-www-form-urlencoded</code></dfn></h3>

  <p>This registration is for community review and will be submitted
  to the IESG for review, approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type application/x-www-form-urlencoded
  -->

  <dl><dt>Type name:</dt>
   <dd>application</dd>
   <dt>Subtype name:</dt>
   <dd>x-www-form-urlencoded</dd>
   <dt>Required parameters:</dt>
   <dd>No parameters</dd>
   <dt>Optional parameters:</dt>
   <dd>No parameters</dd>
   <dt>Encoding considerations:</dt>
   <dd>7bit (US-ASCII encoding of octets that themselves can be encoding text using any <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>)</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <dd>
    <p>In isolation, an <code><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code>
    payload poses no security risks. However, as this type is usually
    used as part of a form submission, all the risks that apply to
    HTML forms need to be considered in the context of this type.</p>
   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>
    Rules for generating and processing
    <code><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> payloads are
    defined in this specification.
   </dd>
   <dt>Published specification:</dt>
   <dd>
    This document is the relevant specification.
    Algorithms for <a href=#application/x-www-form-urlencoded-encoding-algorithm title="application/x-www-form-urlencoded encoding algorithm">encoding</a>
    and <a href=#application/x-www-form-urlencoded-decoding-algorithm title="application/x-www-form-urlencoded decoding algorithm">decoding</a> are defined.
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    Web browsers and servers.
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>There is no reliable mechanism for recognising <code><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> payloads.</dd>
     <dt>File extension(s):</dt>
     <dd>Not applicable.</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd>Not applicable.</dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>This type is only intended to be used to describe HTML form
   submission payloads.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers have no meaning with the
  <code><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> type.</p>


  <h3 id=text/cache-manifest><span class=secno>16.5 </span><dfn><code>text/cache-manifest</code></dfn></h3>

  <p>This registration is for community review and will be submitted
  to the IESG for review, approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type text/cache-manifest
  -->

  <dl><dt>Type name:</dt>
   <dd>text</dd>
   <dt>Subtype name:</dt>
   <dd>cache-manifest</dd>
   <dt>Required parameters:</dt>
   <dd>No parameters</dd>
   <dt>Optional parameters:</dt>
   <dd>
    <dl><dt><code title="">charset</code></dt>
     <dd>

      <p>The <code title="">charset</code> parameter may be provided.
      The parameter's value must be "<code title="">utf-8</code>".
      This parameter serves no purpose; it is only allowed for
      compatibility with legacy servers.</p>

     </dd>
    </dl></dd>
   <dt>Encoding considerations:</dt>
   <dd>8bit (always UTF-8)</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <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>
   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>
    Rules for processing both conforming and non-conforming content
    are defined in this specification.
   </dd>
   <dt>Published specification:</dt>
   <dd>
    This document is the relevant specification.
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    Web browsers.
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>Cache manifests begin with the string "<code title="">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.</dd>
     <dt>File extension(s):</dt>
     <dd>"<code title="">appcache</code>"</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd>No specific Macintosh file type codes are recommended for this type.</dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>No restrictions apply.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers have no meaning with
  <code><a href=#text/cache-manifest>text/cache-manifest</a></code> resources.</p>


  <h3 id=text/ping><span class=secno>16.6 </span><dfn><code>text/ping</code></dfn></h3>

  <p>This registration is for community review and will be submitted
  to the IESG for review, approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type text/ping
  -->

  <dl><dt>Type name:</dt>
   <dd>text</dd>
   <dt>Subtype name:</dt>
   <dd>ping</dd>
   <dt>Required parameters:</dt>
   <dd>No parameters</dd>
   <dt>Optional parameters:</dt>
   <dd>
    <dl><dt><code title="">charset</code></dt>
     <dd>

      <p>The <code title="">charset</code> parameter may be provided.
      The parameter's value must be "<code title="">utf-8</code>".
      This parameter serves no purpose; it is only allowed for
      compatibility with legacy servers.</p>

     </dd>
    </dl></dd>
   <dt>Encoding considerations:</dt>
   <dd>Not applicable.</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <dd>
    <p>If used exclusively in the fashion described in the context of
    <a href=#hyperlink-auditing>hyperlink auditing</a>, this type introduces no new
    security concerns.</p>
   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>
    Rules applicable to this type are defined in this specification.
   </dd>
   <dt>Published specification:</dt>
   <dd>
    This document is the relevant specification.
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    Web browsers.
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd><code><a href=#text/ping>text/ping</a></code> resources always consist of the four
     bytes 0x50 0x49 0x4E 0x47 (ASCII 'PING').</dd>
     <dt>File extension(s):</dt>
     <dd>No specific file extension is recommended for this type.</dd>
     <dt>Macintosh file type code(s):</dt>
     <dd>No specific Macintosh file type codes are recommended for this type.</dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>Only intended for use with HTTP POST requests generated as part
   of a Web browser's processing of the <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers have no meaning with
  <code><a href=#text/ping>text/ping</a></code> resources.</p>


<!--TOPIC:Microdata-->
  <h3 id=application/microdata+json><span class=secno>16.7 </span><dfn><code>application/microdata+json</code></dfn></h3>

  <p>This registration is for community review and will be submitted
  to the IESG for review, approval, and registration with IANA.</p>

  <!--
   To: ietf-types@iana.org
   Subject: Registration of media type application/microdata+json
  -->

  <dl><dt>Type name:</dt>
   <dd>application</dd>
   <dt>Subtype name:</dt>
   <dd>microdata+json</dd>
   <dt>Required parameters:</dt>
   <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
   <dt>Optional parameters:</dt>
   <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
   <dt>Encoding considerations:</dt>
   <dd>8bit (always UTF-8)</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Interoperability considerations:</dt>
   <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
   <dt>Published specification:</dt>
   <dd>
    Labeling a resource with the
    <code><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 title="">items</code>" consisting of an array
    of entries, each of which consists of an object with an entry
    called "<code title="">id</code>" whose value is a string, an
    entry called "<code title="">type</code>" whose value is another
    string, and an entry called "<code title="">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 title="">items</code>" entry. Thus, the relevant specifications
    are the JSON specification and this specification. <a href=#refsJSON>[JSON]</a>
   </dd>
   <dt>Applications that use this media type:</dt>
   <dd>
    <p>Applications that transfer data intended for use with HTML's microdata feature, especially in
    the context of drag-and-drop, are the primary application class for this type.</p>
   </dd>
   <dt>Additional information:</dt>
   <dd>
    <dl><dt>Magic number(s):</dt>
     <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
     <dt>File extension(s):</dt>
     <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
     <dt>Macintosh file type code(s):</dt>
     <dd>Same as for <code>application/json</code> <a href=#refsJSON>[JSON]</a></dd>
    </dl></dd>
   <dt>Person &amp; email address to contact for further information:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Intended usage:</dt>
   <dd>Common</dd>
   <dt>Restrictions on usage:</dt>
   <dd>No restrictions apply.</dd>
   <dt>Author:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Change controller:</dt>
   <dd>W3C</dd>
  </dl><p>Fragment identifiers used with
  <code><a href=#application/microdata+json>application/microdata+json</a></code> resources have the same
  semantics as when used with <code>application/json</code> (namely,
  at the time of writing, no semantics at all). <a href=#refsJSON>[JSON]</a></p>


<!--TOPIC:HTML-->
  <h3 id=ping-from><span class=secno>16.8 </span><dfn title=http-ping-from><code>Ping-From</code></dfn></h3>

  <p>This section describes a header field for registration in the
  Permanent Message Header Field Registry.  <a href=#refsRFC3864>[RFC3864]</a></p>

  <dl><dt>Header field name:</dt>
   <dd>Ping-From</dd>
   <dt>Applicable protocol:</dt>
   <dd>http</dd>
   <dt>Status:</dt>
   <dd>standard</dd>
   <dt>Author/Change controller:</dt>
   <dd>W3C</dd>
   <dt>Specification document(s):</dt>
   <dd>
    This document is the relevant specification.
   </dd>
   <dt>Related information:</dt>
   <dd>None.</dd>
  </dl><h3 id=ping-to><span class=secno>16.9 </span><dfn title=http-ping-to><code>Ping-To</code></dfn></h3>

  <p>This section describes a header field for registration in the
  Permanent Message Header Field Registry.  <a href=#refsRFC3864>[RFC3864]</a></p>

  <dl><dt>Header field name:</dt>
   <dd>Ping-To</dd>
   <dt>Applicable protocol:</dt>
   <dd>http</dd>
   <dt>Status:</dt>
   <dd>standard</dd>
   <dt>Author/Change controller:</dt>
   <dd>W3C</dd>
   <dt>Specification document(s):</dt>
   <dd>
    This document is the relevant specification.
   </dd>
   <dt>Related information:</dt>
   <dd>None.</dd>
  </dl><h3 id=web+-scheme-prefix><span class=secno>16.10 </span><dfn title=scheme-web><code>web+</code> scheme prefix</dfn></h3>

  <p>This section describes a convention for use with the IANA URI
  scheme registry. It does not itself register a specific scheme. <a href=#refsRFC4395>[RFC4395]</a></p>

  <dl><dt>URI scheme name:</dt>
   <dd>
    Schemes starting with the four characters "<code title="">web+</code>" followed by one or more letters in the range
    <code title="">a</code>-<code title="">z</code>.
   </dd>
   <dt>Status:</dt>
   <dd>permanent</dd>
   <dt>URI scheme syntax:</dt>
   <dd>Scheme-specific.</dd>
   <dt>URI scheme semantics:</dt>
   <dd>Scheme-specific.</dd>
   <dt>Encoding considerations:</dt>
   <dd>All "<code title="">web+</code>" schemes should use UTF-8 encodings where relevant.</dd>
   <dt>Applications/protocols that use this URI scheme name:</dt>
   <dd>Scheme-specific.</dd>
   <dt>Interoperability considerations:</dt>
   <dd>The scheme is expected to be used in the context of Web applications.</dd>
<!--ADD-TOPIC:Security-->
   <dt>Security considerations:</dt>
   <dd>
    Any Web page is able to register a handler for all "<code title="">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.
   </dd>
<!--REMOVE-TOPIC:Security-->
   <dt>Contact:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>Author/Change controller:</dt>
   <dd>Ian Hickson &lt;ian@hixie.ch&gt;</dd>
   <dt>References:</dt>
   <dd>
    <cite>Custom scheme and content handlers</cite>, HTML Living Standard:
    <a href=#custom-handlers>http://www.whatwg.org/specs/web-apps/current-work/#custom-handlers</a>
   </dd>
  </dl><h2 class=no-num id=index>Index</h2>

  <div class=impl>

  <p>The following sections only cover conforming elements and features.</p>

  </div>

  <h3 class=no-num id=elements-1>Elements</h3>

  <p><i>This section is non-normative.</i></p>

  <!-- XXX this index doesn't list the palpable elements -->

  <table><caption>List of elements</caption>
   <thead><tr><th> Element
     <th> Description
     <th> Categories
     <th> Parents&dagger;
     <th> Children
     <th> Attributes
     <th> Interface
   <tbody><tr><th><code><a href=#the-a-element>a</a></code></th>
     <td>Hyperlink</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*;
         <a href=#interactive-content title="Interactive content">interactive</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#transparent>transparent</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>;
         <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>;
         <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>;
         <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>;
         <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>;
         <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
         <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code></td>
     <td><code><a href=#htmlanchorelement>HTMLAnchorElement</a></code></td>
    <tr><th><code><a href=#the-abbr-element>abbr</a></code></th>
     <td>Abbreviation</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-address-element>address</a></code></th>
     <td>Contact information for a page or <code><a href=#the-article-element>article</a></code> element</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-area-element>area</a></code></th>
     <td>Hyperlink or dead area on an image map</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-area-alt><a href=#attr-area-alt>alt</a></code>;
         <code title=attr-area-coords><a href=#attr-area-coords>coords</a></code>;
         <code title=attr-area-shape><a href=#attr-area-shape>shape</a></code>;
         <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>;
         <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>;
         <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>;
         <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>;
         <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>;
         <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
         <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code></td>
     <td><code><a href=#htmlareaelement>HTMLAreaElement</a></code></td>
    <tr><th><code><a href=#the-article-element>article</a></code></th>
     <td>Self-contained syndicatable or reusable composition</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-content title="Sectioning content">sectioning</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-aside-element>aside</a></code></th>
     <td>Sidebar for tangentially related content</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-content title="Sectioning content">sectioning</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-audio-element>audio</a></code></th>
     <td>Audio player</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a>;
         <a href=#interactive-content title="Interactive content">interactive</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><code><a href=#the-source-element>source</a></code>*;
         <a href=#transparent>transparent</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-media-src><a href=#attr-media-src>src</a></code>;
         <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code>;
         <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>;
         <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>;
         <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>;
         <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>;
         <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code>;
         <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code></td>
     <td><code><a href=#htmlaudioelement>HTMLAudioElement</a></code></td>
    <tr><th><code><a href=#the-b-element>b</a></code></th>
     <td>Keywords</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-base-element>base</a></code></th>
     <td>Base URL and default target <a href=#browsing-context>browsing context</a> for <a href=#attr-hyperlink-target title=attr-hyperlink-target>hyperlinks</a> and <a href=#attr-fs-target title=attr-fs-target>forms</a></td>
     <td><a href=#metadata-content title="Metadata content">metadata</a></td>
     <td><code><a href=#the-head-element>head</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-base-href><a href=#attr-base-href>href</a></code>;
         <code title=attr-base-target><a href=#attr-base-target>target</a></code></td>
     <td><code><a href=#htmlbaseelement>HTMLBaseElement</a></code></td>
    <tr><th><code><a href=#the-bdi-element>bdi</a></code></th>
     <td>Text directionality isolation</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-bdo-element>bdo</a></code></th>
     <td>Text directionality formatting</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-blockquote-element>blockquote</a></code></th>
     <td>A section quoted from another source</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code></td>
     <td><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code></td>
    <tr><th><code><a href=#the-body-element>body</a></code></th>
     <td>Document body</td>
     <td><a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
     <td><code><a href=#the-html-element>html</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code>;
         <code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code>;
         <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code>;
         <code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code>;
         <code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code>;
         <code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code>;
         <code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code>;
         <code title=handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code>;
         <code title=handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code>;
         <code title=handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code>;
         <code title=handler-window-onresize><a href=#handler-window-onresize>onresize</a></code>;
         <code title=handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code>;
         <code title=handler-window-onunload><a href=#handler-window-onunload>onunload</a></code></td>
     <td><code><a href=#htmlbodyelement>HTMLBodyElement</a></code></td>
    <tr><th><code><a href=#the-br-element>br</a></code></th>
     <td>Line break, e.g. in poem or postal address</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlbrelement>HTMLBRElement</a></code></td>
    <tr><th><code><a href=#the-button-element>button</a></code></th>
     <td>Button control</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-label title=category-label>labelable</a>;
         <a href=#category-submit title=category-submit>submittable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
         <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>;
         <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>;
         <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>;
         <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
         <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>;
         <code title=attr-button-menu><a href=#attr-button-menu>menu</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
         <code title=attr-button-type><a href=#attr-button-type>type</a></code>;
         <code title=attr-button-value><a href=#attr-button-value>value</a></code></td>
     <td><code><a href=#htmlbuttonelement>HTMLButtonElement</a></code></td>
    <tr><th><code><a href=#the-canvas-element>canvas</a></code></th>
     <td>Scriptable bitmap canvas</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#transparent>transparent</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code>;
         <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code></td>
     <td><code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code></td>
    <tr><th><code><a href=#the-caption-element>caption</a></code></th>
     <td>Table caption</td>
     <td>none</td>
     <td><code><a href=#the-table-element>table</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code></td>
    <tr><th><code><a href=#the-cite-element>cite</a></code></th>
     <td>Title of a work</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-code-element>code</a></code></th>
     <td>Computer code</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-col-element>col</a></code></th>
     <td>Table column</td>
     <td>none</td>
     <td><code><a href=#the-colgroup-element>colgroup</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-col-span><a href=#attr-col-span>span</a></code></td>
     <td><code><a href=#htmltablecolelement>HTMLTableColElement</a></code></td>
    <tr><th><code><a href=#the-colgroup-element>colgroup</a></code></th>
     <td>Group of columns in a table</td>
     <td>none</td>
     <td><code><a href=#the-table-element>table</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><code><a href=#the-col-element>col</a></code>*;
         <a href=#script-supporting-elements>script-supporting elements</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-colgroup-span><a href=#attr-colgroup-span>span</a></code></td>
     <td><code><a href=#htmltablecolelement>HTMLTableColElement</a></code></td>
    <tr><th><code><a href=#the-data-element>data</a></code></th>
     <td>Machine-readable equivalent</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-data-value><a href=#attr-data-value>value</a></code></td>
     <td><code><a href=#htmldataelement>HTMLDataElement</a></code></td>
    <tr><th><code><a href=#the-datalist-element>datalist</a></code></th>
     <td>Container for options for <a href=#attr-input-list title=attr-input-list>combo box control</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <code><a href=#the-option-element>option</a></code></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmldatalistelement>HTMLDataListElement</a></code></td>
    <tr><th><code><a href=#the-dd-element>dd</a></code></th>
     <td>Content for corresponding <code><a href=#the-dt-element>dt</a></code> element(s)</td>
     <td>none</td>
     <td><code><a href=#the-dl-element>dl</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-del-element>del</a></code></th>
     <td>A removal from the document</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#transparent>transparent</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code>;
         <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code></td>
     <td><code><a href=#htmlmodelement>HTMLModElement</a></code></td>
    <tr><th><code><a href=#the-details-element>details</a></code></th>
     <td>Disclosure control for hiding details</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-root title="Sectioning root">sectioning root</a>;
         <a href=#interactive-content title="Interactive content">interactive</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-summary-element>summary</a></code>*;
         <a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-details-open><a href=#attr-details-open>open</a></code></td>
     <td><code><a href=#htmldetailselement>HTMLDetailsElement</a></code></td>
    <tr><th><code><a href=#the-dfn-element>dfn</a></code></th>
     <td>Defining instance</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-dialog-element>dialog</a></code></th>
     <td>Dialog box or window</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-dialog-open><a href=#attr-dialog-open>open</a></code></td>
     <td><code><a href=#htmldialogelement>HTMLDialogElement</a></code></td>
    <tr><th><code><a href=#the-div-element>div</a></code></th>
     <td>Generic flow container</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmldivelement>HTMLDivElement</a></code></td>
    <tr><th><code><a href=#the-dl-element>dl</a></code></th>
     <td>Association list consisting of zero or more name-value groups</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-dt-element>dt</a></code>*;
         <code><a href=#the-dd-element>dd</a></code>*;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmldlistelement>HTMLDListElement</a></code></td>
    <tr><th><code><a href=#the-dt-element>dt</a></code></th>
     <td>Legend for corresponding <code><a href=#the-dd-element>dd</a></code> element(s)</td>
     <td>none</td>
     <td><code><a href=#the-dl-element>dl</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-em-element>em</a></code></th>
     <td>Stress emphasis</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-embed-element>embed</a></code></th>
     <td><a href=#plugin>Plugin</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a>;
         <a href=#interactive-content title="Interactive content">interactive</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-embed-src><a href=#attr-embed-src>src</a></code>;
         <code title=attr-embed-type><a href=#attr-embed-type>type</a></code>;
         <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
         <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>;
         any*</td>
     <td><code><a href=#htmlembedelement>HTMLEmbedElement</a></code></td>
    <tr><th><code><a href=#the-fieldset-element>fieldset</a></code></th>
     <td>Group of form controls</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-root title="Sectioning root">sectioning root</a>;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-legend-element>legend</a></code>*;
         <a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code></td>
     <td><code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code></td>
    <tr><th><code><a href=#the-figcaption-element>figcaption</a></code></th>
     <td>Caption for <code><a href=#the-figure-element>figure</a></code></td>
     <td>none</td>
     <td><code><a href=#the-figure-element>figure</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-figure-element>figure</a></code></th>
     <td>Figure with optional caption</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-figcaption-element>figcaption</a></code>*;
         <a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-footer-element>footer</a></code></th>
     <td>Footer for a page or section</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-form-element>form</a></code></th>
     <td>User-submittable form</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code>;
         <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>;
         <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code>;
         <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>;
         <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>;
         <code title=attr-form-name><a href=#attr-form-name>name</a></code>;
         <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>;
         <code title=attr-fs-target><a href=#attr-fs-target>target</a></code></td>
     <td><code><a href=#htmlformelement>HTMLFormElement</a></code></td>
    <tr><th><code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code></th>
     <td>Section heading</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#heading-content title="Heading content">heading</a></td>
     <td><code><a href=#the-hgroup-element>hgroup</a></code>;
         <a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlheadingelement>HTMLHeadingElement</a></code></td>
    <tr><th><code><a href=#the-head-element>head</a></code></th>
     <td>Container for document metadata</td>
     <td>none</td>
     <td><code><a href=#the-html-element>html</a></code></td>
     <td><a href=#metadata-content title="Metadata content">metadata content</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlheadelement>HTMLHeadElement</a></code></td>
    <tr><th><code><a href=#the-header-element>header</a></code></th>
     <td>Introductory or navigational aids for a page or section</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-hgroup-element>hgroup</a></code></th>
     <td>heading group</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#heading-content title="Heading content">heading</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td>One or more <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, and <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-hr-element>hr</a></code></th>
     <td>Thematic break</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlhrelement>HTMLHRElement</a></code></td>
    <tr><th><code><a href=#the-html-element>html</a></code></th>
     <td>Root element</td>
     <td>none</td>
     <td>none*</td>
     <td><code><a href=#the-head-element>head</a></code>*;
         <code><a href=#the-body-element>body</a></code>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-html-manifest><a href=#attr-html-manifest>manifest</a></code></td>
     <td><code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code></td>
    <tr><th><code><a href=#the-i-element>i</a></code></th>
     <td>Alternate voice</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-iframe-element>iframe</a></code></th>
     <td><a href=#nested-browsing-context>Nested browsing context</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a>;
         <a href=#interactive-content title="Interactive content">interactive</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>text*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>;
         <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>;
         <code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code>;
         <code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>;
         <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>;
         <code title=attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>;
         <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
         <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
     <td><code><a href=#htmliframeelement>HTMLIFrameElement</a></code></td>
    <tr><th><code><a href=#the-img-element>img</a></code></th>
     <td>Image</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>*;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code>;
         <code title=attr-img-src><a href=#attr-img-src>src</a></code>;
         <code title=attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>;
         <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code>;
         <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code>;
         <code title=attr-img-ismap><a href=#attr-img-ismap>ismap</a></code>;
         <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
         <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
     <td><code><a href=#htmlimageelement>HTMLImageElement</a></code></td>
    <tr><th><code><a href=#the-input-element>input</a></code></th>
     <td>Form control</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>*;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-label title=category-label>labelable</a>;
         <a href=#category-submit title=category-submit>submittable</a>;
         <a href=#category-reset title=category-reset>resettable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-input-accept><a href=#attr-input-accept>accept</a></code>;
         <code title=attr-input-alt><a href=#attr-input-alt>alt</a></code>;
         <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>;
         <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
         <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>;
         <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>;
         <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>;
         <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>;
         <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>;
         <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
         <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>;
         <code title=attr-dim-height><a href=#attr-dim-height>height</a></code>;
         <code title=attr-input-list><a href=#attr-input-list>list</a></code>;
         <code title=attr-input-max><a href=#attr-input-max>max</a></code>;
         <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>;
         <code title=attr-input-min><a href=#attr-input-min>min</a></code>;
         <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
         <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>;
         <code title=attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>;
         <code title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>;
         <code title=attr-input-required><a href=#attr-input-required>required</a></code>;
         <code title=attr-input-size><a href=#attr-input-size>size</a></code>;
         <code title=attr-input-src><a href=#attr-input-src>src</a></code>;
         <code title=attr-input-step><a href=#attr-input-step>step</a></code>;
         <code title=attr-input-type><a href=#attr-input-type>type</a></code>;
         <code title=attr-input-value><a href=#attr-input-value>value</a></code>;
         <code title=attr-dim-width><a href=#attr-dim-width>width</a></code></td>
     <td><code><a href=#htmlinputelement>HTMLInputElement</a></code></td>
    <tr><th><code><a href=#the-ins-element>ins</a></code></th>
     <td>An addition to the document</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#transparent>transparent</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-mod-cite><a href=#attr-mod-cite>cite</a></code>;
         <code title=attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code></td>
     <td><code><a href=#htmlmodelement>HTMLModElement</a></code></td>
    <tr><th><code><a href=#the-kbd-element>kbd</a></code></th>
     <td>User input</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-keygen-element>keygen</a></code></th>
     <td>Cryptographic key-pair generator form control</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-label title=category-label>labelable</a>;
         <a href=#category-submit title=category-submit>submittable</a>;
         <a href=#category-reset title=category-reset>resettable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
         <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code>;
         <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code></td>
     <td><code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code></td>
    <tr><th><code><a href=#the-label-element>label</a></code></th>
     <td>Caption for a form control</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-label-for><a href=#attr-label-for>for</a></code></td>
     <td><code><a href=#htmllabelelement>HTMLLabelElement</a></code></td>
    <tr><th><code><a href=#the-legend-element>legend</a></code></th>
     <td>Caption for <code><a href=#the-fieldset-element>fieldset</a></code></td>
     <td>none</td>
     <td><code><a href=#the-fieldset-element>fieldset</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmllegendelement>HTMLLegendElement</a></code></td>
    <tr><th><code><a href=#the-li-element>li</a></code></th>
     <td>List item</td>
     <td>none</td>
     <td><code><a href=#the-ol-element>ol</a></code>;
         <code><a href=#the-ul-element>ul</a></code>;
         <code><a href=#the-menu-element>menu</a></code>*;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-li-value><a href=#attr-li-value>value</a></code>*</td>
     <td><code><a href=#htmllielement>HTMLLIElement</a></code></td>
    <tr><th><code><a href=#the-link-element>link</a></code></th>
     <td>Link metadata</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#flow-content title="Flow content">flow</a>*;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><code><a href=#the-head-element>head</a></code>;
         <code><a href=#the-template-element>template</a></code>;
         <code><a href=#the-noscript-element>noscript</a></code>*;
         <a href=#phrasing-content title="phrasing content">phrasing</a>*</td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-link-href><a href=#attr-link-href>href</a></code>;
         <code title=attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code>;
         <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code>;
         <code title=attr-link-media><a href=#attr-link-media>media</a></code>;
         <code title=attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code>;
         <code title=attr-link-type><a href=#attr-link-type>type</a></code>;
         <code title=attr-link-sizes><a href=#attr-link-sizes>sizes</a></code></td>
     <td><code><a href=#htmllinkelement>HTMLLinkElement</a></code></td>
    <tr><th><code><a href=#the-main-element>main</a></code></th>
     <td>Container for the dominant contents of another element</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-map-element>map</a></code></th>
     <td><a href=#image-map>Image map</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#transparent>transparent</a>;
         <code><a href=#the-area-element>area</a></code>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-map-name><a href=#attr-map-name>name</a></code></td>
     <td><code><a href=#htmlmapelement>HTMLMapElement</a></code></td>
    <tr><th><code><a href=#the-mark-element>mark</a></code></th>
     <td>Highlight</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-menu-element>menu</a></code></th>
     <td>Menu of commands</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <code><a href=#the-menu-element>menu</a></code>*</td>
     <td><code><a href=#the-li-element>li</a></code>*;
         <a href=#flow-content title="Flow content">flow</a>*;
         <code><a href=#the-menuitem-element>menuitem</a></code>*;
         <code><a href=#the-hr-element>hr</a></code>*;
         <code><a href=#the-menu-element>menu</a></code>*;
         <a href=#script-supporting-elements>script-supporting elements</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-menu-type><a href=#attr-menu-type>type</a></code>;
         <code title=attr-menu-label><a href=#attr-menu-label>label</a></code></td>
     <td><code><a href=#htmlmenuelement>HTMLMenuElement</a></code></td>
    <tr><th><code><a href=#the-menuitem-element>menuitem</a></code></th>
     <td>Menu command</td>
     <td>none</td>
     <td><code><a href=#the-menu-element>menu</a></code>;     
         <code><a href=#the-template-element>template</a></code></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-menuitem-type><a href=#attr-menuitem-type>type</a></code>;
         <code title=attr-menuitem-label><a href=#attr-menuitem-label>label</a></code>;
         <code title=attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code>;
         <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code>;
         <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>;
         <code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code>;
         <code title=attr-menuitem-default><a href=#attr-menuitem-default>default</a></code>;
         <code title=attr-menuitem-command><a href=#attr-menuitem-command>command</a></code></td>
     <td><code><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code></td>
    <tr><th><code><a href=#the-meta-element>meta</a></code></th>
     <td>Text metadata</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#flow-content title="Flow content">flow</a>*;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><code><a href=#the-head-element>head</a></code>;
         <code><a href=#the-template-element>template</a></code>;
         <code><a href=#the-noscript-element>noscript</a></code>*;
         <a href=#phrasing-content title="phrasing content">phrasing</a>*</td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-meta-name><a href=#attr-meta-name>name</a></code>;
         <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>;
         <code title=attr-meta-content><a href=#attr-meta-content>content</a></code>;
         <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code></td>
     <td><code><a href=#htmlmetaelement>HTMLMetaElement</a></code></td>
    <tr><th><code><a href=#the-meter-element>meter</a></code></th>
     <td>Gauge</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#category-label title=category-label>labelable</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>;
         <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>;
         <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>;
         <code title=attr-meter-low><a href=#attr-meter-low>low</a></code>;
         <code title=attr-meter-high><a href=#attr-meter-high>high</a></code>;
         <code title=attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code></td>
     <td><code><a href=#htmlmeterelement>HTMLMeterElement</a></code></td>
    <tr><th><code><a href=#the-nav-element>nav</a></code></th>
     <td>Section with navigational links</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-content title="Sectioning content">sectioning</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-noscript-element>noscript</a></code></th>
     <td>Fallback content for script</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><code><a href=#the-head-element>head</a></code>*;
         <code><a href=#the-template-element>template</a></code>*;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td>varies*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-object-element>object</a></code></th>
     <td>Image, <a href=#nested-browsing-context>nested browsing context</a>, or <a href=#plugin>plugin</a></td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>*;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-submit title=category-submit>submittable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><code><a href=#the-param-element>param</a></code>*;
         <a href=#transparent>transparent</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-object-data><a href=#attr-object-data>data</a></code>;
         <code title=attr-object-type><a href=#attr-object-type>type</a></code>;
         <code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code>;
         <code title=attr-object-name><a href=#attr-object-name>name</a></code>;
         <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
         <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
     <td><code><a href=#htmlobjectelement>HTMLObjectElement</a></code></td>
    <tr><th><code><a href=#the-ol-element>ol</a></code></th>
     <td>Ordered list</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-li-element>li</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code>;
         <code title=attr-ol-start><a href=#attr-ol-start>start</a></code>;
         <code title=attr-ol-type><a href=#attr-ol-type>type</a></code></td>
     <td><code><a href=#htmlolistelement>HTMLOListElement</a></code></td>
    <tr><th><code><a href=#the-optgroup-element>optgroup</a></code></th>
     <td>Group of options in a list box</td>
     <td>none</td>
     <td><code><a href=#the-select-element>select</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><code><a href=#the-option-element>option</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code>;
         <code title=attr-optgroup-label><a href=#attr-optgroup-label>label</a></code></td>
     <td><code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code></td>
    <tr><th><code><a href=#the-option-element>option</a></code></th>
     <td>Option in a list box or combo box control</td>
     <td>none</td>
     <td><code><a href=#the-select-element>select</a></code>;
         <code><a href=#the-datalist-element>datalist</a></code>;
         <code><a href=#the-optgroup-element>optgroup</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#text-content title="text content">text</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-option-disabled><a href=#attr-option-disabled>disabled</a></code>;
         <code title=attr-option-label><a href=#attr-option-label>label</a></code>;
         <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code>;
         <code title=attr-option-value><a href=#attr-option-value>value</a></code></td>
     <td><code><a href=#htmloptionelement>HTMLOptionElement</a></code></td>
    <tr><th><code><a href=#the-output-element>output</a></code></th>
     <td>Calculated output value</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-label title=category-label>labelable</a>;
         <a href=#category-reset title=category-reset>resettable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-output-for><a href=#attr-output-for>for</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code></td>
     <td><code><a href=#htmloutputelement>HTMLOutputElement</a></code></td>
    <tr><th><code><a href=#the-p-element>p</a></code></th>
     <td>Paragraph</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code></td>
    <tr><th><code><a href=#the-param-element>param</a></code></th>
     <td>Parameter for <code><a href=#the-object-element>object</a></code></td>
     <td>none</td>
     <td><code><a href=#the-object-element>object</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-param-name><a href=#attr-param-name>name</a></code>;
         <code title=attr-param-value><a href=#attr-param-value>value</a></code></td>
     <td><code><a href=#htmlparamelement>HTMLParamElement</a></code></td>
    <tr><th><code><a href=#the-pre-element>pre</a></code></th>
     <td>Block of preformatted text</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlpreelement>HTMLPreElement</a></code></td>
    <tr><th><code><a href=#the-progress-element>progress</a></code></th>
     <td>Progress bar</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#category-label title=category-label>labelable</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>;
         <code title=attr-progress-max><a href=#attr-progress-max>max</a></code></td>
     <td><code><a href=#htmlprogresselement>HTMLProgressElement</a></code></td>
    <tr><th><code><a href=#the-q-element>q</a></code></th>
     <td>Quotation</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-q-cite><a href=#attr-q-cite>cite</a></code></td>
     <td><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code></td>
    <tr><th><code><a href=#the-rp-element>rp</a></code></th>
     <td>Parenthesis for ruby annotation text</td>
     <td>none</td>
     <td><code><a href=#the-ruby-element>ruby</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-rt-element>rt</a></code></th>
     <td>Ruby annotation text</td>
     <td>none</td>
     <td><code><a href=#the-ruby-element>ruby</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-ruby-element>ruby</a></code></th>
     <td>Ruby annotation(s)</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <code><a href=#the-rt-element>rt</a></code>;
         <code><a href=#the-rp-element>rp</a></code>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-s-element>s</a></code></th>
     <td>Inaccurate text</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-samp-element>samp</a></code></th>
     <td>Computer output</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-script-element>script</a></code></th>
     <td>Embedded script</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#script-supporting-elements title="Script-supporting elements">script-supporting</a></td>
     <td><code><a href=#the-head-element>head</a></code>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#script-supporting-elements title="Script-supporting elements">script-supporting</a></td>
     <td>script, data, or script documentation*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-script-src><a href=#attr-script-src>src</a></code>;
         <code title=attr-script-type><a href=#attr-script-type>type</a></code>;
         <code title=attr-script-charset><a href=#attr-script-charset>charset</a></code>;
         <code title=attr-script-async><a href=#attr-script-async>async</a></code>;
         <code title=attr-script-defer><a href=#attr-script-defer>defer</a></code>;
         <code title=attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code></td>
     <td><code><a href=#htmlscriptelement>HTMLScriptElement</a></code></td>
    <tr><th><code><a href=#the-section-element>section</a></code></th>
     <td>Generic document or application section</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#sectioning-content title="Sectioning content">sectioning</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-select-element>select</a></code></th>
     <td>List box control</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-label title=category-label>labelable</a>;
         <a href=#category-submit title=category-submit>submittable</a>;
         <a href=#category-reset title=category-reset>resettable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><code><a href=#the-option-element>option</a></code>, <code><a href=#the-optgroup-element>optgroup</a></code></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
         <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
         <code title=attr-select-required><a href=#attr-select-required>required</a></code>;
         <code title=attr-select-size><a href=#attr-select-size>size</a></code></td>
     <td><code><a href=#htmlselectelement>HTMLSelectElement</a></code></td>
    <tr><th><code><a href=#the-small-element>small</a></code></th>
     <td>Side comment</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-source-element>source</a></code></th>
     <td>Media source for <code><a href=#the-video-element>video</a></code> or <code><a href=#the-audio-element>audio</a></code></td>
     <td>none</td>
     <td><code><a href=#the-video-element>video</a></code>;
         <code><a href=#the-audio-element>audio</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-source-src><a href=#attr-source-src>src</a></code>;
         <code title=attr-source-type><a href=#attr-source-type>type</a></code>;
         <code title=attr-source-media><a href=#attr-source-media>media</a></code></td>
     <td><code><a href=#htmlsourceelement>HTMLSourceElement</a></code></td>
    <tr><th><code><a href=#the-span-element>span</a></code></th>
     <td>Generic phrasing container</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlspanelement>HTMLSpanElement</a></code></td>
    <tr><th><code><a href=#the-strong-element>strong</a></code></th>
     <td>Importance</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-style-element>style</a></code></th>
     <td>Embedded styling information</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-head-element>head</a></code>;
         <code><a href=#the-noscript-element>noscript</a></code>*;
         <a href=#flow-content title="flow content">flow</a>*</td>
     <td>varies*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-style-media><a href=#attr-style-media>media</a></code>;
         <code title=attr-style-type><a href=#attr-style-type>type</a></code>;
         <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code></td>
     <td><code><a href=#htmlstyleelement>HTMLStyleElement</a></code></td>
    <tr><th><code><a href=#the-sub-and-sup-elements>sub</a></code></th>
     <td>Subscript</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-summary-element>summary</a></code></th>
     <td>Caption for <code><a href=#the-details-element>details</a></code></td>
     <td>none</td>
     <td><code><a href=#the-details-element>details</a></code></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-sub-and-sup-elements>sup</a></code></th>
     <td>Superscript</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-table-element>table</a></code></th>
     <td>Table</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-caption-element>caption</a></code>*;
         <code><a href=#the-colgroup-element>colgroup</a></code>*;
         <code><a href=#the-thead-element>thead</a></code>*;
         <code><a href=#the-tbody-element>tbody</a></code>*;
         <code><a href=#the-tfoot-element>tfoot</a></code>*;
         <code><a href=#the-tr-element>tr</a></code>*;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltableelement>HTMLTableElement</a></code></td>
    <tr><th><code><a href=#the-tbody-element>tbody</a></code></th>
     <td>Group of rows in a table</td>
     <td>none</td>
     <td><code><a href=#the-table-element>table</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><code><a href=#the-tr-element>tr</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code></td>
    <tr><th><code><a href=#the-td-element>td</a></code></th>
     <td>Table cell</td>
     <td><a href=#sectioning-root title="Sectioning root">sectioning root</a></td>
     <td><code><a href=#the-tr-element>tr</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>;
         <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>;
         <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code></td>
     <td><code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code></td>
    <tr><th><code><a href=#the-template-element>template</a></code></th>
     <td>Template</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#script-supporting-elements title="Script-supporting elements">script-supporting</a></td>
     <td><a href=#metadata-content title="Metadata content">metadata</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#script-supporting-elements title="Script-supporting elements">script-supporting</a>;
         <code><a href=#the-colgroup-element>colgroup</a></code>*</td>
     <td>it's complicated*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltemplateelement>HTMLTemplateElement</a></code></td>
    <tr><th><code><a href=#the-textarea-element>textarea</a></code></th>
     <td>Multiline text field</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#interactive-content title="Interactive content">interactive</a>;
         <a href=#category-listed title=category-listed>listed</a>;
         <a href=#category-label title=category-label>labelable</a>;
         <a href=#category-submit title=category-submit>submittable</a>;
         <a href=#category-reset title=category-reset>resettable</a>;
         <a href=#category-form-attr title=category-form-attr>reassociateable</a>;
         <a href=#form-associated-element title="Form-associated element">form-associated</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#text-content title="text content">text</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
         <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code>;
         <code title=attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>;
         <code title=attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
         <code title=attr-fae-form><a href=#attr-fae-form>form</a></code>;
         <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>;
         <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>;
         <code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code>;
         <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code>;
         <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>;
         <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>;
         <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code></td>
     <td><code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code></td>
    <tr><th><code><a href=#the-tfoot-element>tfoot</a></code></th>
     <td>Group of footer rows in a table</td>
     <td>none</td>
     <td><code><a href=#the-table-element>table</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><code><a href=#the-tr-element>tr</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code></td>
    <tr><th><code><a href=#the-th-element>th</a></code></th>
     <td>Table header cell</td>
     <td>none</td>
     <td><code><a href=#the-tr-element>tr</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#flow-content title="Flow content">flow</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>;
         <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>;
         <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>;
         <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code>;
         <code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code></td>
     <td><code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code></td>
    <tr><th><code><a href=#the-thead-element>thead</a></code></th>
     <td>Group of heading rows in a table</td>
     <td>none</td>
     <td><code><a href=#the-table-element>table</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><code><a href=#the-tr-element>tr</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code></td>
    <tr><th><code><a href=#the-time-element>time</a></code></th>
     <td>Machine-readable equivalent of date- or time-related data</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-time-datetime><a href=#attr-time-datetime>datetime</a></code></td>
     <td><code><a href=#htmltimeelement>HTMLTimeElement</a></code></td>
    <tr><th><code><a href=#the-title-element>title</a></code></th>
     <td>Document title</td>
     <td><a href=#metadata-content title="Metadata content">metadata</a></td>
     <td><code><a href=#the-head-element>head</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><a href=#text-content title="text content">text</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltitleelement>HTMLTitleElement</a></code></td>
    <tr><th><code><a href=#the-tr-element>tr</a></code></th>
     <td>Table row</td>
     <td>none</td>
     <td><code><a href=#the-table-element>table</a></code>;
         <code><a href=#the-thead-element>thead</a></code>;
         <code><a href=#the-tbody-element>tbody</a></code>;
         <code><a href=#the-tfoot-element>tfoot</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td><code><a href=#the-th-element>th</a></code>*;
         <code><a href=#the-td-element>td</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmltablerowelement>HTMLTableRowElement</a></code></td>
    <tr><th><code><a href=#the-track-element>track</a></code></th>
     <td>Timed text track</td>
     <td>none</td>
     <td><code><a href=#the-audio-element>audio</a></code>;
         <code><a href=#the-video-element>video</a></code>;
         <code><a href=#the-template-element>template</a></code></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-track-default><a href=#attr-track-default>default</a></code>;
         <code title=attr-track-kind><a href=#attr-track-kind>kind</a></code>;
         <code title=attr-track-label><a href=#attr-track-label>label</a></code>;
         <code title=attr-track-src><a href=#attr-track-src>src</a></code>;
         <code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code></td>
     <td><code><a href=#htmltrackelement>HTMLTrackElement</a></code></td>
    <tr><th><code><a href=#the-u-element>u</a></code></th>
     <td>Keywords</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-ul-element>ul</a></code></th>
     <td>List</td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><a href=#flow-content title="Flow content">flow</a></td>
     <td><code><a href=#the-li-element>li</a></code>;
         <a href=#script-supporting-elements>script-supporting elements</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlulistelement>HTMLUListElement</a></code></td>
    <tr><th><code><a href=#the-var-element>var</a></code></th>
     <td>Variable</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    <tr><th><code><a href=#the-video-element>video</a></code></th>
     <td>Video player</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a>;
         <a href=#embedded-content title="Embedded content">embedded</a>;
         <a href=#interactive-content title="Interactive content">interactive</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><code><a href=#the-source-element>source</a></code>*;
         <a href=#transparent>transparent</a>*</td>
     <td><a href=#global-attributes title="global attributes">globals</a>;
         <code title=attr-media-src><a href=#attr-media-src>src</a></code>;
         <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code>;
         <code title=attr-video-poster><a href=#attr-video-poster>poster</a></code>;
         <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>;
         <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>;
         <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>;
         <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>;
         <code title=attr-media-muted><a href=#attr-media-muted>muted</a></code>;
         <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>;
         <code title=attr-dim-width><a href=#attr-dim-width>width</a></code>;
         <code title=attr-dim-height><a href=#attr-dim-height>height</a></code></td>
     <td><code><a href=#htmlvideoelement>HTMLVideoElement</a></code></td>
    <tr><th><code><a href=#the-wbr-element>wbr</a></code></th>
     <td>Line breaking opportunity</td>
     <td><a href=#flow-content title="Flow content">flow</a>;
         <a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td><a href=#phrasing-content title="Phrasing content">phrasing</a></td>
     <td>empty</td>
     <td><a href=#global-attributes title="global attributes">globals</a></td>
     <td><code><a href=#htmlelement>HTMLElement</a></code></td>
    </table><p class=tablenote><small>An asterisk (*) in a cell indicates that the actual rules are more
  complicated than indicated in the table above.</small></p>

  <p>&dagger; 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><a href=#the-a-element>a</a></code> element's "Parents" column says "phrasing", so any element whose content model
  contains the "phrasing" category could be a parent of an <code><a href=#the-a-element>a</a></code> element. Since the "flow"
  category includes all the "phrasing" elements, that means the <code><a href=#the-th-element>th</a></code> element could be a
  parent to an <code><a href=#the-a-element>a</a></code> element.</p>



  <h3 class=no-num id=element-content-categories>Element content categories</h3>

  <p><i>This section is non-normative.</i></p>

  <!-- when updating this also check the category-list <ul>s -->

  <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>Metadata content</a>
     <td>
      <code><a href=#the-base-element>base</a></code>;
      <code><a href=#the-link-element>link</a></code>;
      <code><a href=#the-meta-element>meta</a></code>;
      <code><a href=#the-noscript-element>noscript</a></code>;
      <code><a href=#the-script-element>script</a></code>;
      <code><a href=#the-style-element>style</a></code>;
      <code><a href=#the-template-element>template</a></code>;
      <code><a href=#the-title-element>title</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#flow-content>Flow content</a>
     <td>
      <code><a href=#the-a-element>a</a></code>;
      <code><a href=#the-abbr-element>abbr</a></code>;
      <code><a href=#the-address-element>address</a></code>;
      <code><a href=#the-article-element>article</a></code>;
      <code><a href=#the-aside-element>aside</a></code>;
      <code><a href=#the-audio-element>audio</a></code>;
      <code><a href=#the-b-element>b</a></code>;
      <code><a href=#the-bdi-element>bdi</a></code>;
      <code><a href=#the-bdo-element>bdo</a></code>;
      <code><a href=#the-blockquote-element>blockquote</a></code>;
      <code><a href=#the-br-element>br</a></code>;
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-canvas-element>canvas</a></code>;
      <code><a href=#the-cite-element>cite</a></code>;
      <code><a href=#the-code-element>code</a></code>;
      <code><a href=#the-data-element>data</a></code>;
      <code><a href=#the-datalist-element>datalist</a></code>;
      <code><a href=#the-del-element>del</a></code>;
      <code><a href=#the-details-element>details</a></code>;
      <code><a href=#the-dfn-element>dfn</a></code>;
      <code><a href=#the-dialog-element>dialog</a></code>;
      <code><a href=#the-div-element>div</a></code>;
      <code><a href=#the-dl-element>dl</a></code>;
      <code><a href=#the-em-element>em</a></code>;
      <code><a href=#the-embed-element>embed</a></code>;
      <code><a href=#the-fieldset-element>fieldset</a></code>;
      <code><a href=#the-figure-element>figure</a></code>;
      <code><a href=#the-footer-element>footer</a></code>;
      <code><a href=#the-form-element>form</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
      <code><a href=#the-header-element>header</a></code>;
      <code><a href=#the-hgroup-element>hgroup</a></code>;
      <code><a href=#the-hr-element>hr</a></code>;
      <code><a href=#the-i-element>i</a></code>;
      <code><a href=#the-iframe-element>iframe</a></code>;
      <code><a href=#the-img-element>img</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-ins-element>ins</a></code>;
      <code><a href=#the-kbd-element>kbd</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-label-element>label</a></code>;
      <code><a href=#the-main-element>main</a></code>;
      <code><a href=#the-map-element>map</a></code>;
      <code><a href=#the-mark-element>mark</a></code>;
      <code><a href=#math>math</a></code>;
      <code><a href=#the-menu-element>menu</a></code>;
      <code><a href=#the-meter-element>meter</a></code>;
      <code><a href=#the-nav-element>nav</a></code>;
      <code><a href=#the-noscript-element>noscript</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-ol-element>ol</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-p-element>p</a></code>;
      <code><a href=#the-pre-element>pre</a></code>;
      <code><a href=#the-progress-element>progress</a></code>;
      <code><a href=#the-q-element>q</a></code>;
      <code><a href=#the-ruby-element>ruby</a></code>;
      <code><a href=#the-s-element>s</a></code>;
      <code><a href=#the-samp-element>samp</a></code>;
      <code><a href=#the-script-element>script</a></code>;
      <code><a href=#the-section-element>section</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-small-element>small</a></code>;
      <code><a href=#the-span-element>span</a></code>;
      <code><a href=#the-strong-element>strong</a></code>;
      <code><a href=#the-sub-and-sup-elements>sub</a></code>;
      <code><a href=#the-sub-and-sup-elements>sup</a></code>;
      <code><a href=#svg>svg</a></code>;
      <code><a href=#the-table-element>table</a></code>;
      <code><a href=#the-template-element>template</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>;
      <code><a href=#the-time-element>time</a></code>;
      <code><a href=#the-u-element>u</a></code>;
      <code><a href=#the-ul-element>ul</a></code>;
      <code><a href=#the-var-element>var</a></code>;
      <code><a href=#the-video-element>video</a></code>;
      <code><a href=#the-wbr-element>wbr</a></code>;
      <a href=#text-content title="text content">Text</a>
     <td>
      <code><a href=#the-area-element>area</a></code> (if it is a descendant of a <code><a href=#the-map-element>map</a></code> element);
      <code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
      <code><a href=#the-meta-element>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
      <code><a href=#the-style-element>style</a></code> (if the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present)

    <tr><td> <a href=#sectioning-content>Sectioning content</a>
     <td>
      <code><a href=#the-article-element>article</a></code>;
      <code><a href=#the-aside-element>aside</a></code>;
      <code><a href=#the-nav-element>nav</a></code>;
      <code><a href=#the-section-element>section</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#heading-content>Heading content</a>
     <td>
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
      <code><a href=#the-hgroup-element>hgroup</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#phrasing-content>Phrasing content</a>
     <td>
      <code><a href=#the-a-element>a</a></code>;
      <code><a href=#the-abbr-element>abbr</a></code>;
      <code><a href=#the-audio-element>audio</a></code>;
      <code><a href=#the-b-element>b</a></code>;
      <code><a href=#the-bdi-element>bdi</a></code>;
      <code><a href=#the-bdo-element>bdo</a></code>;
      <code><a href=#the-br-element>br</a></code>;
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-canvas-element>canvas</a></code>;
      <code><a href=#the-cite-element>cite</a></code>;
      <code><a href=#the-code-element>code</a></code>;
      <code><a href=#the-data-element>data</a></code>;
      <code><a href=#the-datalist-element>datalist</a></code>;
      <code><a href=#the-del-element>del</a></code>;
      <code><a href=#the-dfn-element>dfn</a></code>;
      <code><a href=#the-em-element>em</a></code>;
      <code><a href=#the-embed-element>embed</a></code>;
      <code><a href=#the-i-element>i</a></code>;
      <code><a href=#the-iframe-element>iframe</a></code>;
      <code><a href=#the-img-element>img</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-ins-element>ins</a></code>;
      <code><a href=#the-kbd-element>kbd</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-label-element>label</a></code>;
      <code><a href=#the-map-element>map</a></code>;
      <code><a href=#the-mark-element>mark</a></code>;
      <code><a href=#math>math</a></code>;
      <code><a href=#the-meter-element>meter</a></code>;
      <code><a href=#the-noscript-element>noscript</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-progress-element>progress</a></code>;
      <code><a href=#the-q-element>q</a></code>;
      <code><a href=#the-ruby-element>ruby</a></code>;
      <code><a href=#the-s-element>s</a></code>;
      <code><a href=#the-samp-element>samp</a></code>;
      <code><a href=#the-script-element>script</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-small-element>small</a></code>;
      <code><a href=#the-span-element>span</a></code>;
      <code><a href=#the-strong-element>strong</a></code>;
      <code><a href=#the-sub-and-sup-elements>sub</a></code>;
      <code><a href=#the-sub-and-sup-elements>sup</a></code>;
      <code><a href=#svg>svg</a></code>;
      <code><a href=#the-template-element>template</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>;
      <code><a href=#the-time-element>time</a></code>;
      <code><a href=#the-u-element>u</a></code>;
      <code><a href=#the-var-element>var</a></code>;
      <code><a href=#the-video-element>video</a></code>;
      <code><a href=#the-wbr-element>wbr</a></code>;
      <a href=#text-content title="text content">Text</a>
     <td>
      <code><a href=#the-area-element>area</a></code> (if it is a descendant of a  <code><a href=#the-map-element>map</a></code> element);
      <code><a href=#the-link-element>link</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
      <code><a href=#the-meta-element>meta</a></code> (if the <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)

    <tr><td> <a href=#embedded-content>Embedded content</a>
     <td>
      <code><a href=#the-audio-element>audio</a></code>
      <code><a href=#the-canvas-element>canvas</a></code>
      <code><a href=#the-embed-element>embed</a></code>
      <code><a href=#the-iframe-element>iframe</a></code>
      <code><a href=#the-img-element>img</a></code>
      <code><a href=#math>math</a></code>
      <code><a href=#the-object-element>object</a></code>
      <code><a href=#svg>svg</a></code>
      <code><a href=#the-video-element>video</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#interactive-content>Interactive content</a>
     <td>
      <code><a href=#the-a-element>a</a></code>;
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-details-element>details</a></code>;
      <code><a href=#the-embed-element>embed</a></code>;
      <code><a href=#the-iframe-element>iframe</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-label-element>label</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>;
     <td>
      <code><a href=#the-audio-element>audio</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present);
      <code><a href=#the-img-element>img</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present);
      <code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state);
      <code><a href=#the-object-element>object</a></code> (if the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)<!-- see also comment in <object> section -->;
      <code><a href=#the-video-element>video</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)

    <tr><td> <a href=#sectioning-root title="sectioning root">Sectioning roots</a>
     <td>
      <code><a href=#the-blockquote-element>blockquote</a></code>;
      <code><a href=#the-body-element>body</a></code>;
      <code><a href=#the-details-element>details</a></code>;
      <code><a href=#the-dialog-element>dialog</a></code>;
      <code><a href=#the-fieldset-element>fieldset</a></code>;
      <code><a href=#the-figure-element>figure</a></code>;
      <code><a href=#the-td-element>td</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#form-associated-element title="form-associated element">Form-associated elements</a>
     <td>
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-fieldset-element>fieldset</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-label-element>label</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>;
      <code><a href=#the-img-element>img</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#category-listed title=category-listed>Listed elements</a>
     <td>
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-fieldset-element>fieldset</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#category-submit title=category-submit>Submittable elements</a>
     <td>
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#category-reset title=category-reset>Resettable elements</a>
     <td>
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#category-label title=category-label>Labelable elements</a>
     <td>
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-meter-element>meter</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-progress-element>progress</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#category-form-attr title=category-form-attr>Reassociateable elements</a>
     <td>
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-fieldset-element>fieldset</a></code>;
      <code><a href=#the-input-element>input</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-label-element>label</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>
     <td>
      &mdash;

    <tr><td> <a href=#palpable-content>Palpable content</a>
     <td>
      <code><a href=#the-a-element>a</a></code>;
      <code><a href=#the-abbr-element>abbr</a></code>;
      <code><a href=#the-address-element>address</a></code>;
      <code><a href=#the-article-element>article</a></code>;
      <code><a href=#the-aside-element>aside</a></code>;
      <code><a href=#the-b-element>b</a></code>;
      <code><a href=#the-bdi-element>bdi</a></code>;
      <code><a href=#the-bdo-element>bdo</a></code>;
      <code><a href=#the-blockquote-element>blockquote</a></code>;
      <code><a href=#the-button-element>button</a></code>;
      <code><a href=#the-canvas-element>canvas</a></code>;
      <code><a href=#the-cite-element>cite</a></code>;
      <code><a href=#the-code-element>code</a></code>;
      <code><a href=#the-data-element>data</a></code>;
      <code><a href=#the-details-element>details</a></code>;
      <code><a href=#the-dfn-element>dfn</a></code>;
      <code><a href=#the-div-element>div</a></code>;
      <code><a href=#the-em-element>em</a></code>;
      <code><a href=#the-embed-element>embed</a></code>;
      <code><a href=#the-fieldset-element>fieldset</a></code>;
      <code><a href=#the-figure-element>figure</a></code>;
      <code><a href=#the-footer-element>footer</a></code>;
      <code><a href=#the-form-element>form</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
      <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
      <code><a href=#the-header-element>header</a></code>;
      <code><a href=#the-hgroup-element>hgroup</a></code>;
      <code><a href=#the-i-element>i</a></code>;
      <code><a href=#the-iframe-element>iframe</a></code>;
      <code><a href=#the-img-element>img</a></code>;
      <code><a href=#the-ins-element>ins</a></code>;
      <code><a href=#the-kbd-element>kbd</a></code>;
      <code><a href=#the-keygen-element>keygen</a></code>;
      <code><a href=#the-label-element>label</a></code>;
      <code><a href=#the-main-element>main</a></code>;
      <code><a href=#the-map-element>map</a></code>;
      <code><a href=#the-mark-element>mark</a></code>;
      <code><a href=#math>math</a></code>;
      <code><a href=#the-meter-element>meter</a></code>;
      <code><a href=#the-nav-element>nav</a></code>;
      <code><a href=#the-object-element>object</a></code>;
      <code><a href=#the-output-element>output</a></code>;
      <code><a href=#the-p-element>p</a></code>;
      <code><a href=#the-pre-element>pre</a></code>;
      <code><a href=#the-progress-element>progress</a></code>;
      <code><a href=#the-q-element>q</a></code>;
      <code><a href=#the-ruby-element>ruby</a></code>;
      <code><a href=#the-s-element>s</a></code>;
      <code><a href=#the-samp-element>samp</a></code>;
      <code><a href=#the-section-element>section</a></code>;
      <code><a href=#the-select-element>select</a></code>;
      <code><a href=#the-small-element>small</a></code>;
      <code><a href=#the-span-element>span</a></code>;
      <code><a href=#the-strong-element>strong</a></code>;
      <code><a href=#the-sub-and-sup-elements>sub</a></code>;
      <code><a href=#the-sub-and-sup-elements>sup</a></code>;
      <code><a href=#svg>svg</a></code>;
      <code><a href=#the-table-element>table</a></code>;
      <code><a href=#the-textarea-element>textarea</a></code>;
      <code><a href=#the-time-element>time</a></code>;
      <code><a href=#the-u-element>u</a></code>;
      <code><a href=#the-var-element>var</a></code>;
      <code><a href=#the-video-element>video</a></code>
     <td>
      <code><a href=#the-audio-element>audio</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present);
      <code><a href=#the-dl-element>dl</a></code> (if the element's children include at least one name-value group);
      <code><a href=#the-input-element>input</a></code> (if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" title=attr-input-type-hidden>Hidden</a> state);
      <code><a href=#the-menu-element>menu</a></code> (if the <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state title="toolbar state">toolbar</a> state);
      <code><a href=#the-ol-element>ol</a></code> (if the element's children include at least one <code><a href=#the-li-element>li</a></code> element);
      <code><a href=#the-ul-element>ul</a></code> (if the element's children include at least one <code><a href=#the-li-element>li</a></code> element);
      <a href=#text-content title="text content">Text</a> that is not <a href=#inter-element-whitespace>inter-element whitespace</a>

    <tr><td> <a href=#script-supporting-elements>Script-supporting elements</a>
     <td>
      <code><a href=#the-script-element>script</a></code>;
      <code><a href=#the-template-element>template</a></code>
     <td>
      &mdash;

  </table><h3 class=no-num id=attributes-1>Attributes</h3>

  <p><i>This section is non-normative.</i></p>

  <table><caption>List of attributes (excluding event handler content attributes)</caption>
   <thead><tr><th> Attribute
     <th> Element(s)
     <th> Description
     <th> Value
   <tbody><tr><th> <code title="">abbr</code>
     <td> <code title=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 title="">accept</code>
     <td> <code title=attr-input-accept><a href=#attr-input-accept>input</a></code>
     <td> Hint for expected file type in <a href="#file-upload-state-(type=file)" title=attr-input-type-file>file upload controls</a>
     <td> <a href=#set-of-comma-separated-tokens>Set of comma-separated tokens</a>* consisting of <a href=#valid-mime-type title="valid MIME type">valid MIME types with no parameters</a> or <code title="">audio/*</code>, <code title="">video/*</code>, or <code title="">image/*</code>
    <tr><th> <code title="">accept-charset</code>
     <td> <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>form</a></code>
     <td> Character encodings to use for <a href=#form-submission>form submission</a>
     <td> <a href=#ordered-set-of-unique-space-separated-tokens>Ordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive>ASCII case-insensitive</a>, consisting of <a href=#encoding-label title="encoding label">labels</a> of <a href=#ascii-compatible-character-encoding title="ASCII-compatible character encoding">ASCII-compatible character encodings</a>*
    <tr><th> <code title="">accesskey</code>
     <td> <a href=#the-accesskey-attribute title=attr-accesskey>HTML elements</a>
     <td> Keyboard shortcut to activate or focus element
     <td> <a href=#ordered-set-of-unique-space-separated-tokens>Ordered set of unique space-separated tokens</a>, <a href=#case-sensitive>case-sensitive</a>, consisting of one Unicode code point in length
    <tr><th> <code title="">action</code>
     <td> <code title=attr-fs-action><a href=#attr-fs-action>form</a></code>
     <td> <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a>
     <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">allowfullscreen</code>
     <td> <code title=attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>iframe</a></code>
     <td> Whether to allow the <code><a href=#the-iframe-element>iframe</a></code>'s contents to use <code title=dom-element-requestFullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code>
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">alt</code>
     <td> <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>;
          <code title=attr-img-alt><a href=#attr-img-alt>img</a></code>;
          <code title=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 title="">async</code>
     <td> <code title=attr-script-async><a href=#attr-script-async>script</a></code>
     <td> Execute script asynchronously
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">autocomplete</code>
     <td> <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>form</a></code>
     <td> Default setting for autofill feature for controls in the form
     <td> "<code title="">on</code>"; "<code title="">off</code>"
    <tr><th> <code title="">autocomplete</code>
     <td> <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>input</a></code>;
          <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>select</a></code>;
          <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>textarea</a></code>
     <td> Hint for form autofill feature
     <td> <a href=#autofill-field title="autofill field">Autofill field</a> name and related tokens*
    <tr><th> <code title="">autofocus</code>
     <td> <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>button</a></code>;
          <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>input</a></code>;
          <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>keygen</a></code>;
          <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>select</a></code>;
          <code title=attr-fe-autofocus><a href=#attr-fe-autofocus>textarea</a></code>
     <td> Automatically focus the form control when the page is loaded
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">autoplay</code>
     <td> <code title=attr-media-autoplay><a href=#attr-media-autoplay>audio</a></code>;
          <code title=attr-media-autoplay><a href=#attr-media-autoplay>video</a></code>
     <td> Hint that the <a href=#media-resource>media resource</a> can be started automatically when the page is loaded
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">challenge</code>
     <td> <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>keygen</a></code>
     <td> String to package with the generated and signed public key
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">charset</code>
     <td> <code title=attr-meta-charset><a href=#attr-meta-charset>meta</a></code>
     <td> <a href=#character-encoding-declaration>Character encoding declaration</a>
     <td> <a href=#encoding-label>Encoding label</a>*
    <tr><th> <code title="">charset</code>
     <td> <code title=attr-script-charset><a href=#attr-script-charset>script</a></code>
     <td> Character encoding of the external script resource
     <td> <a href=#encoding-label>Encoding label</a>*
    <tr><th> <code title="">checked</code>
     <td> <code title=attr-menuitem-checked><a href=#attr-menuitem-checked>menuitem</a></code>;
          <code title=attr-input-checked><a href=#attr-input-checked>input</a></code>
     <td> Whether the command or control is checked
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">cite</code>
     <td> <code title=attr-blockquote-cite><a href=#attr-blockquote-cite>blockquote</a></code>;
          <code title=attr-mod-cite><a href=#attr-mod-cite>del</a></code>;
          <code title=attr-mod-cite><a href=#attr-mod-cite>ins</a></code>;
          <code title=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>Valid URL potentially surrounded by spaces</a>
    <tr><th> <code title="">class</code>
     <td> <a href=#classes title=attr-class>HTML elements</a>
     <td> Classes to which the element belongs
     <td> <a href=#set-of-space-separated-tokens>Set of space-separated tokens</a>
    <tr><th> <code title="">cols</code>
     <td> <code title=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>Valid non-negative integer</a> greater than zero
    <tr><th> <code title="">colspan</code>
     <td> <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>td</a></code>;
          <code title=attr-tdth-colspan><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>Valid non-negative integer</a> greater than zero
    <tr><th> <code title="">command</code>
     <td> <code title=attr-menuitem-command><a href=#attr-menuitem-command>menuitem</a></code>
     <td> Command definition
     <td> <a href=#concept-id title=concept-id>ID</a>*
    <tr><th> <code title="">content</code>
     <td> <code title=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 title="">contenteditable</code>
     <td> <a href=#attr-contenteditable title=attr-contenteditable>HTML elements</a>
     <td> Whether the element is editable
     <td> "<code title="">true</code>"; "<code title="">false</code>"
    <tr><th> <code title="">contextmenu</code>
     <td> <a href=#attr-contextmenu title=attr-contextmenu>HTML elements</a>
     <td> The element's context menu
     <td> <a href=#concept-id title=concept-id>ID</a>*
    <tr><th> <code title="">controls</code>
     <td> <code title=attr-media-controls><a href=#attr-media-controls>audio</a></code>;
          <code title=attr-media-controls><a href=#attr-media-controls>video</a></code>
     <td> Show user agent controls
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">coords</code>
     <td> <code title=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>image map</a>
     <td> <a href=#valid-list-of-integers>Valid list of integers</a>*
    <tr><th> <code title="">crossorigin</code>
     <td> <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>audio</a></code>;
          <code title=attr-img-crossorigin><a href=#attr-img-crossorigin>img</a></code>;
          <code title=attr-link-crossorigin><a href=#attr-link-crossorigin>link</a></code>;
          <code title=attr-script-crossorigin><a href=#attr-script-crossorigin>script</a></code>;
          <code title=attr-media-crossorigin><a href=#attr-media-crossorigin>video</a></code>
     <td> How the element handles crossorigin requests
     <td> "<code title=attr-crossorigin-anonymous-keyword><a href=#attr-crossorigin-anonymous-keyword>anonymous</a></code>"; "<code title=attr-crossorigin-use-credentials-keyword><a href=#attr-crossorigin-use-credentials-keyword>use-credentials</a></code>"
    <tr><th> <code title="">data</code>
     <td> <code title=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>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">datetime</code>
     <td> <code title=attr-mod-datetime><a href=#attr-mod-datetime>del</a></code>;
          <code title=attr-mod-datetime><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>Valid date string with optional time</a>
    <tr><th> <code title="">datetime</code>
     <td> <code title=attr-time-datetime><a href=#attr-time-datetime>time</a></code>
     <td> Machine-readable value
     <td> <a href=#valid-month-string>Valid month string</a>,
          <a href=#valid-date-string>valid date string</a>,
          <a href=#valid-yearless-date-string>valid yearless date string</a>,
          <a href=#valid-time-string>valid time string</a>,
          <a href=#valid-local-date-and-time-string>valid local date and time string</a>,
          <a href=#valid-time-zone-offset-string>valid time-zone offset string</a>,
          <a href=#valid-global-date-and-time-string>valid global date and time string</a>,
          <a href=#valid-week-string>valid week string</a>,
          <a href=#valid-non-negative-integer>valid non-negative integer</a>, or
          <a href=#valid-duration-string>valid duration string</a>
    <tr><th> <code title="">default</code>
     <td> <code title=attr-menuitem-default><a href=#attr-menuitem-default>menuitem</a></code>
     <td> Mark the command as being a default command
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">default</code>
     <td> <code title=attr-track-default><a href=#attr-track-default>track</a></code>
     <td> Enable the track if no other <a href=#text-track>text track</a> is more suitable
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">defer</code>
     <td> <code title=attr-script-defer><a href=#attr-script-defer>script</a></code>
     <td> Defer script execution
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">dir</code>
     <td> <a href=#the-dir-attribute title=attr-dir>HTML elements</a>
     <td> <a href=#the-directionality title="the directionality">The text directionality</a> of the element
     <td> "<code title=attr-dir-ltr><a href=#attr-dir-ltr>ltr</a></code>"; "<code title=attr-dir-rtl><a href=#attr-dir-rtl>rtl</a></code>"; "<code title=attr-dir-auto><a href=#attr-dir-auto>auto</a></code>"
    <tr><th> <code title="">dirname</code>
     <td> <code title=attr-fe-dirname><a href=#attr-fe-dirname>input</a></code>;
          <code title=attr-fe-dirname><a href=#attr-fe-dirname>textarea</a></code>
     <td> Name of form field to use for sending the element's <a href=#the-directionality title="the directionality">directionality</a> in <a href=#form-submission>form submission</a>
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">disabled</code>
     <td> <code title=attr-fe-disabled><a href=#attr-fe-disabled>button</a></code>;
          <code title=attr-menuitem-disabled><a href=#attr-menuitem-disabled>menuitem</a></code>;
          <code title=attr-fieldset-disabled><a href=#attr-fieldset-disabled>fieldset</a></code>;
          <code title=attr-fe-disabled><a href=#attr-fe-disabled>input</a></code>;
          <code title=attr-fe-disabled><a href=#attr-fe-disabled>keygen</a></code>;
          <code title=attr-optgroup-disabled><a href=#attr-optgroup-disabled>optgroup</a></code>;
          <code title=attr-option-disabled><a href=#attr-option-disabled>option</a></code>;
          <code title=attr-fe-disabled><a href=#attr-fe-disabled>select</a></code>;
          <code title=attr-fe-disabled><a href=#attr-fe-disabled>textarea</a></code>
     <td> Whether the form control is disabled
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">download</code>
     <td> <code title=attr-hyperlink-download><a href=#attr-hyperlink-download>a</a></code>;
          <code title=attr-hyperlink-download><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 title="">draggable</code>
     <td> <a href=#the-draggable-attribute title=attr-draggable>HTML elements</a>
     <td> Whether the element is draggable
     <td> "<code title="">true</code>"; "<code title="">false</code>"
    <tr><th> <code title="">dropzone</code>
     <td> <a href=#the-dropzone-attribute title=attr-dropzone>HTML elements</a>
     <td> Accepted item types for drag-and-drop
     <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive>ASCII case-insensitive</a>, consisting of accepted types and drag feedback*
    <tr><th> <code title="">enctype</code>
     <td> <code title=attr-fs-enctype><a href=#attr-fs-enctype>form</a></code>
     <td> Form data set encoding type to use for <a href=#form-submission>form submission</a>
     <td> "<code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>"; "<code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code>"; "<code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code>"
    <tr><th> <code title="">for</code>
     <td> <code title=attr-label-for><a href=#attr-label-for>label</a></code>
     <td> Associate the label with form control
     <td> <a href=#concept-id title=concept-id>ID</a>*
    <tr><th> <code title="">for</code>
     <td> <code title=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>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive>case-sensitive</a>, consisting of IDs*
    <tr><th> <code title="">form</code>
     <td> <code title=attr-fae-form><a href=#attr-fae-form>button</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>fieldset</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>input</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>keygen</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>label</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>object</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>output</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>select</a></code>;
          <code title=attr-fae-form><a href=#attr-fae-form>textarea</a></code>
     <td> Associates the control with a <code><a href=#the-form-element>form</a></code> element
     <td> <a href=#concept-id title=concept-id>ID</a>*
    <tr><th> <code title="">formaction</code>
     <td> <code title=attr-fs-formaction><a href=#attr-fs-formaction>button</a></code>;
          <code title=attr-fs-formaction><a href=#attr-fs-formaction>input</a></code>
     <td> <a href=#url>URL</a> to use for <a href=#form-submission>form submission</a>
     <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">formenctype</code>
     <td> <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>button</a></code>;
          <code title=attr-fs-formenctype><a href=#attr-fs-formenctype>input</a></code>
     <td> Form data set encoding type to use for <a href=#form-submission>form submission</a>
     <td> "<code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>"; "<code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code>"; "<code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code>"
    <tr><th> <code title="">formmethod</code>
     <td> <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>button</a></code>;
          <code title=attr-fs-formmethod><a href=#attr-fs-formmethod>input</a></code>
     <td> HTTP method to use for <a href=#form-submission>form submission</a>
     <td> "<code title="">GET</code>"; "<code title="">POST</code>"
    <tr><th> <code title="">formnovalidate</code>
     <td> <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>button</a></code>;
          <code title=attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>input</a></code>
     <td> Bypass form control validation for <a href=#form-submission>form submission</a>
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">formtarget</code>
     <td> <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>button</a></code>;
          <code title=attr-fs-formtarget><a href=#attr-fs-formtarget>input</a></code>
     <td> <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a>
     <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
    <tr><th> <code title="">headers</code>
     <td> <code title=attr-tdth-headers><a href=#attr-tdth-headers>td</a></code>;
          <code title=attr-tdth-headers><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>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive>case-sensitive</a>, consisting of IDs*
    <tr><th> <code title="">height</code>
     <td> <code title=attr-canvas-height><a href=#attr-canvas-height>canvas</a></code>;
          <code title=attr-dim-height><a href=#attr-dim-height>embed</a></code>;
          <code title=attr-dim-height><a href=#attr-dim-height>iframe</a></code>;
          <code title=attr-dim-height><a href=#attr-dim-height>img</a></code>;
          <code title=attr-dim-height><a href=#attr-dim-height>input</a></code>;
          <code title=attr-dim-height><a href=#attr-dim-height>object</a></code>;
          <code title=attr-dim-height><a href=#attr-dim-height>video</a></code>
     <td> Vertical dimension
     <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
    <tr><th> <code title="">hidden</code>
     <td> <a href=#the-hidden-attribute title=attr-hidden>HTML elements</a>
     <td> Whether the element is relevant
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">high</code>
     <td> <code title=attr-meter-high><a href=#attr-meter-high>meter</a></code>
     <td> Low limit of high range
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a>*
    <tr><th> <code title="">href</code>
     <td> <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>a</a></code>;
          <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>area</a></code>
     <td> Address of the <a href=#hyperlink>hyperlink</a>
     <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
    <tr><th> <code title="">href</code>
     <td> <code title=attr-link-href><a href=#attr-link-href>link</a></code>
     <td> Address of the <a href=#hyperlink>hyperlink</a>
     <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">href</code>
     <td> <code title=attr-base-href><a href=#attr-base-href>base</a></code>
     <td> <a href=#document-base-url>Document base URL</a>
     <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
    <tr><th> <code title="">hreflang</code>
     <td> <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>a</a></code>;
          <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>area</a></code>;
          <code title=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 title="">http-equiv</code>
     <td> <code title=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 title="">icon</code>
     <td> <code title=attr-menuitem-icon><a href=#attr-menuitem-icon>menuitem</a></code>
     <td> Icon for the command
     <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">id</code>
     <td> <a href=#the-id-attribute title=attr-id>HTML elements</a>
     <td> The element's <a href=#concept-id title=concept-id>ID</a>
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">inert</code>
     <td> <a href=#the-inert-attribute title=attr-inert>HTML elements</a>
     <td> Whether the element is inert
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">inputmode</code>
     <td> <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>input</a></code>;
          <code title=attr-fe-inputmode><a href=#attr-fe-inputmode>textarea</a></code>
     <td> Hint for selecting an input modality
     <td> <code title=attr-fe-inputmode-keyword-verbatim><a href=#attr-fe-inputmode-keyword-verbatim>verbatim</a></code>; 
          <code title=attr-fe-inputmode-keyword-latin><a href=#attr-fe-inputmode-keyword-latin>latin</a></code>; 
          <code title=attr-fe-inputmode-keyword-latin-name><a href=#attr-fe-inputmode-keyword-latin-name>latin-name</a></code>; 
          <code title=attr-fe-inputmode-keyword-latin-prose><a href=#attr-fe-inputmode-keyword-latin-prose>latin-prose</a></code>; 
          <code title=attr-fe-inputmode-keyword-full-width-latin><a href=#attr-fe-inputmode-keyword-full-width-latin>full-width-latin</a></code>; 
          <code title=attr-fe-inputmode-keyword-kana><a href=#attr-fe-inputmode-keyword-kana>kana</a></code>; 
          <code title=attr-fe-inputmode-keyword-katakana><a href=#attr-fe-inputmode-keyword-katakana>katakana</a></code>; 
          <!-- <code title="attr-fe-inputmode-keyword-half-width-katakana">half-width-katakana</code>; -->
          <code title=attr-fe-inputmode-keyword-numeric><a href=#attr-fe-inputmode-keyword-numeric>numeric</a></code>; 
          <code title=attr-fe-inputmode-keyword-tel><a href=#attr-fe-inputmode-keyword-tel>tel</a></code>; 
          <code title=attr-fe-inputmode-keyword-email><a href=#attr-fe-inputmode-keyword-email>email</a></code>; 
          <code title=attr-fe-inputmode-keyword-url><a href=#attr-fe-inputmode-keyword-url>url</a></code>
    <tr><th> <code title="">ismap</code>
     <td> <code title=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>Boolean attribute</a>
    <tr><th> <code title="">itemid</code>
     <td> <a href=#attr-itemid title=attr-itemid>HTML elements</a>
     <td> <a href=#global-identifier>Global identifier</a> for a microdata item
     <td> <a href=#valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
    <tr><th> <code title="">itemprop</code>
     <td> <a href=#names:-the-itemprop-attribute title=attr-itemprop>HTML elements</a>
     <td> <a href=#property-names>Property names</a> of a microdata item
     <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive>case-sensitive</a>, consisting of <a href=#absolute-url title="absolute URL">valid absolute URLs</a>, <a href=#defined-property-name title="defined property name">defined property names</a>, or text*
    <tr><th> <code title="">itemref</code>
     <td> <a href=#attr-itemref title=attr-itemref>HTML elements</a>
     <td> Referenced elements
     <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive>case-sensitive</a>, consisting of IDs*
    <tr><th> <code title="">itemscope</code>
     <td> <a href=#attr-itemscope title=attr-itemscope>HTML elements</a>
     <td> Introduces a microdata item
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">itemtype</code>
     <td> <a href=#attr-itemtype title=attr-itemtype>HTML elements</a>
     <td> <a href=#item-types>Item types</a> of a microdata item
     <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive>case-sensitive</a>, consisting of <a href=#absolute-url title="absolute URL">valid absolute URL</a>*
    <tr><th> <code title="">keytype</code>
     <td> <code title=attr-keygen-keytype><a href=#attr-keygen-keytype>keygen</a></code>
     <td> The type of cryptographic key to generate
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">kind</code>
     <td> <code title=attr-track-kind><a href=#attr-track-kind>track</a></code>
     <td> The type of text track
     <td> "<code title=attr-track-kind-subtitles><a href=#attr-track-kind-subtitles>subtitles</a></code>";
          "<code title=attr-track-kind-captions><a href=#attr-track-kind-captions>captions</a></code>";
          "<code title=attr-track-kind-descriptions><a href=#attr-track-kind-descriptions>descriptions</a></code>";
          "<code title=attr-track-kind-chapters><a href=#attr-track-kind-chapters>chapters</a></code>";
          "<code title=attr-track-kind-metadata><a href=#attr-track-kind-metadata>metadata</a></code>"
    <tr><th> <code title="">label</code>
     <td> <code title=attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>;
          <code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>;
          <code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>;
          <code title=attr-option-label><a href=#attr-option-label>option</a></code>;
          <code title=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 title="">lang</code>
     <td> <a href=#attr-lang title=attr-lang>HTML elements</a>
     <td> <a href=#language>Language</a> of the element
     <td> Valid BCP 47 language tag or the empty string
    <tr><th> <code title="">list</code>
     <td> <code title=attr-input-list><a href=#attr-input-list>input</a></code>
     <td> List of autocomplete options
     <td> <a href=#concept-id title=concept-id>ID</a>*
    <tr><th> <code title="">loop</code>
     <td> <code title=attr-media-loop><a href=#attr-media-loop>audio</a></code>;
          <code title=attr-media-loop><a href=#attr-media-loop>video</a></code>
     <td> Whether to loop the <a href=#media-resource>media resource</a>
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">low</code>
     <td> <code title=attr-meter-low><a href=#attr-meter-low>meter</a></code>
     <td> High limit of low range
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a>*
    <tr><th> <code title="">manifest</code>
     <td> <code title=attr-html-manifest><a href=#attr-html-manifest>html</a></code>
     <td> <a href=#concept-appcache-manifest title=concept-appcache-manifest>Application cache manifest</a>
     <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">max</code>
     <td> <code title=attr-input-max><a href=#attr-input-max>input</a></code>
     <td> Maximum value
     <td> Varies*
    <tr><th> <code title="">max</code>
     <td> <code title=attr-meter-max><a href=#attr-meter-max>meter</a></code>;
          <code title=attr-progress-max><a href=#attr-progress-max>progress</a></code>
     <td> Upper bound of range
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a>*
    <tr><th> <code title="">maxlength</code>
     <td> <code title=attr-input-maxlength><a href=#attr-input-maxlength>input</a></code>;
          <code title=attr-textarea-maxlength><a href=#attr-textarea-maxlength>textarea</a></code>
     <td> Maximum length of value
     <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
    <tr><th> <code title="">media</code>
     <td> <code title=attr-link-media><a href=#attr-link-media>link</a></code>;
          <code title=attr-source-media><a href=#attr-source-media>source</a></code>;
          <code title=attr-style-media><a href=#attr-style-media>style</a></code>
     <td> Applicable media
     <td> <a href=#valid-media-query>Valid media query</a>
    <tr><th> <code title="">mediagroup</code>
     <td> <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>audio</a></code>;
          <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>video</a></code>
     <td> Groups <a href=#media-element title="media element">media elements</a> together with an implicit <code><a href=#mediacontroller>MediaController</a></code>
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">menu</code>
     <td> <code title=attr-button-menu><a href=#attr-button-menu>button</a></code>
     <td> Specifies the element's <a href=#designated-pop-up-menu>designated pop-up menu</a>
     <td> <a href=#concept-id title=concept-id>ID</a>*
    <tr><th> <code title="">method</code>
     <td> <code title=attr-fs-method><a href=#attr-fs-method>form</a></code>
     <td> HTTP method to use for <a href=#form-submission>form submission</a>
     <td> "<code title=attr-fs-method-GET-keyword><a href=#attr-fs-method-get-keyword>GET</a></code>";
          "<code title=attr-fs-method-POST-keyword><a href=#attr-fs-method-post-keyword>POST</a></code>";
          "<code title=attr-fs-method-dialog-keyword><a href=#attr-fs-method-dialog-keyword>dialog</a></code>"
    <tr><th> <code title="">min</code>
     <td> <code title=attr-input-min><a href=#attr-input-min>input</a></code>
     <td> Minimum value
     <td> Varies*
    <tr><th> <code title="">min</code>
     <td> <code title=attr-meter-min><a href=#attr-meter-min>meter</a></code>
     <td> Lower bound of range
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a>*
    <tr><th> <code title="">multiple</code>
     <td> <code title=attr-input-multiple><a href=#attr-input-multiple>input</a></code>;
          <code title=attr-select-multiple><a href=#attr-select-multiple>select</a></code>
     <td> Whether to allow multiple values
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">muted</code>
     <td> <code title=attr-media-muted><a href=#attr-media-muted>audio</a></code>;
          <code title=attr-media-muted><a href=#attr-media-muted>video</a></code>
     <td> Whether to mute the <a href=#media-resource>media resource</a> by default
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">name</code>
     <td> <code title=attr-fe-name><a href=#attr-fe-name>button</a></code>;
          <code title=attr-fe-name><a href=#attr-fe-name>fieldset</a></code>;
          <code title=attr-fe-name><a href=#attr-fe-name>input</a></code>;
          <code title=attr-fe-name><a href=#attr-fe-name>keygen</a></code>;
          <code title=attr-fe-name><a href=#attr-fe-name>output</a></code>;
          <code title=attr-fe-name><a href=#attr-fe-name>select</a></code>;
          <code title=attr-fe-name><a href=#attr-fe-name>textarea</a></code>
     <td> Name of form control to use for <a href=#form-submission>form submission</a> and in the <code title=dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">name</code>
     <td> <code title=attr-form-name><a href=#attr-form-name>form</a></code>
     <td> Name of form to use in the <code title=dom-document-forms><a href=#dom-document-forms>document.forms</a></code> API
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">name</code>
     <td> <code title=attr-iframe-name><a href=#attr-iframe-name>iframe</a></code>;
          <code title=attr-object-name><a href=#attr-object-name>object</a></code>
     <td> Name of <a href=#nested-browsing-context>nested browsing context</a>
     <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
    <tr><th> <code title="">name</code>
     <td> <code title=attr-map-name><a href=#attr-map-name>map</a></code>
     <td> Name of <a href=#image-map>image map</a> to reference from the <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">name</code>
     <td> <code title=attr-meta-name><a href=#attr-meta-name>meta</a></code>
     <td> Metadata name
     <td> <a href=#attribute-text>Text</a>*
    <tr><th> <code title="">name</code>
     <td> <code title=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 title="">novalidate</code>
     <td> <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>form</a></code>
     <td> Bypass form control validation for <a href=#form-submission>form submission</a>
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">open</code>
     <td> <code title=attr-details-open><a href=#attr-details-open>details</a></code>
     <td> Whether the details are visible
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">open</code>
     <td> <code title=attr-dialog-open><a href=#attr-dialog-open>dialog</a></code>
     <td> Whether the dialog box is showing
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">optimum</code>
     <td> <code title=attr-meter-optimum><a href=#attr-meter-optimum>meter</a></code>
     <td> Optimum value in gauge
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a>*
    <tr><th> <code title="">pattern</code>
     <td> <code title=attr-input-pattern><a href=#attr-input-pattern>input</a></code>
     <td> Pattern to be matched by the form control's value
     <td> Regular expression matching the JavaScript <i title="">Pattern</i> production
    <tr><th> <code title="">ping</code>
     <td> <code title=attr-hyperlink-ping><a href=#ping>a</a></code>;
          <code title=attr-hyperlink-ping><a href=#ping>area</a></code>
     <td> <a href=#url title=URL>URLs</a> to ping
     <td> <a href=#set-of-space-separated-tokens>Set of space-separated tokens</a> consisting of <a href=#valid-non-empty-url title="valid non-empty URL">valid non-empty URLs</a>
    <tr><th> <code title="">placeholder</code>
     <td> <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code>;
          <code title=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 title="">poster</code>
     <td> <code title=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>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">preload</code>
     <td> <code title=attr-media-preload><a href=#attr-media-preload>audio</a></code>;
          <code title=attr-media-preload><a href=#attr-media-preload>video</a></code>
     <td> Hints how much buffering the <a href=#media-resource>media resource</a> will likely need
     <td> "<code title=attr-media-preload-none><a href=#attr-media-preload-none>none</a></code>";
          "<code title=attr-media-preload-metadata><a href=#attr-media-preload-metadata>metadata</a></code>";
          "<code title=attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>"
    <tr><th> <code title="">radiogroup</code>
     <td> <code title=attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>menuitem</a></code>
     <td> Name of group of commands to treat as a radio button group
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">readonly</code>
     <td> <code title=attr-input-readonly><a href=#attr-input-readonly>input</a></code>;
          <code title=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>Boolean attribute</a>
    <tr><th> <code title="">rel</code>
     <td> <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>a</a></code>;
          <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>area</a></code>;
          <code title=attr-link-rel><a href=#attr-link-rel>link</a></code>
     <td> Relationship between the document containing the hyperlink and the destination resource
     <td> <a href=#set-of-space-separated-tokens>Set of space-separated tokens</a>*
    <tr><th> <code title="">required</code>
     <td> <code title=attr-input-required><a href=#attr-input-required>input</a></code>;
          <code title=attr-select-required><a href=#attr-select-required>select</a></code>;
          <code title=attr-textarea-required><a href=#attr-textarea-required>textarea</a></code>
     <td> Whether the control is required for <a href=#form-submission>form submission</a>
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">reversed</code>
     <td> <code title=attr-ol-reversed><a href=#attr-ol-reversed>ol</a></code>
     <td> Number the list backwards
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">rows</code>
     <td> <code title=attr-textarea-rows><a href=#attr-textarea-rows>textarea</a></code>
     <td> Number of lines to show
     <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
    <tr><th> <code title="">rowspan</code>
     <td> <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>td</a></code>;
          <code title=attr-tdth-rowspan><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>Valid non-negative integer</a>
    <tr><th> <code title="">sandbox</code>
     <td> <code title=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>Unordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive>ASCII case-insensitive</a>, consisting of
          "<code title=attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>",
          "<code title=attr-iframe-sandbox-allow-pointer-lock><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>",
          "<code title=attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>",
          "<code title=attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>",
          "<code title=attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> and
          "<code title=attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>"
    <tr><th> <code title="">spellcheck</code>
     <td> <a href=#attr-spellcheck title=attr-spellcheck>HTML elements</a>
     <td> Whether the element is to have its spelling and grammar checked
     <td> "<code title="">true</code>"; "<code title="">false</code>"
    <tr><th> <code title="">scope</code>
     <td> <code title=attr-th-scope><a href=#attr-th-scope>th</a></code>
     <td> Specifies which cells the header cell applies to
     <td> "<code title=attr-th-scope-row><a href=#attr-th-scope-row>row</a></code>";
          "<code title=attr-th-scope-col><a href=#attr-th-scope-col>col</a></code>";
          "<code title=attr-th-scope-rowgroup><a href=#attr-th-scope-rowgroup>rowgroup</a></code>";
          "<code title=attr-th-scope-colgroup><a href=#attr-th-scope-colgroup>colgroup</a></code>"
    <tr><th> <code title="">scoped</code>
     <td> <code title=attr-style-scoped><a href=#attr-style-scoped>style</a></code>
     <td> Whether the styles apply to the entire document or just the parent subtree
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">seamless</code>
     <td> <code title=attr-iframe-seamless><a href=#attr-iframe-seamless>iframe</a></code>
     <td> Whether to apply the document's styles to the nested content
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">selected</code>
     <td> <code title=attr-option-selected><a href=#attr-option-selected>option</a></code>
     <td> Whether the option is selected by default
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">shape</code>
     <td> <code title=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>image map</a>
     <td> "<code title=attr-area-shape-keyword-circle><a href=#attr-area-shape-keyword-circle>circle</a></code>";
          "<code title=attr-area-shape-keyword-default><a href=#attr-area-shape-keyword-default>default</a></code>";
          "<code title=attr-area-shape-keyword-poly><a href=#attr-area-shape-keyword-poly>poly</a></code>";
          "<code title=attr-area-shape-keyword-rect><a href=#attr-area-shape-keyword-rect>rect</a></code>"
    <tr><th> <code title="">size</code>
     <td> <code title=attr-input-size><a href=#attr-input-size>input</a></code>;
          <code title=attr-select-size><a href=#attr-select-size>select</a></code>
     <td> Size of the control
     <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
    <tr><th> <code title="">sizes</code>
     <td> <code title=attr-link-sizes><a href=#attr-link-sizes>link</a></code>
     <td> Sizes of the icons (for <code title=attr-link-rel><a href=#attr-link-rel>rel</a></code>="<code title=rel-icon><a href=#rel-icon>icon</a></code>")
     <td> <a href=#unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive>ASCII case-insensitive</a>, consisting of sizes*
    <tr><th> <code title="">span</code>
     <td> <code title=attr-col-span><a href=#attr-col-span>col</a></code>;
          <code title=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>Valid non-negative integer</a> greater than zero
    <tr><th> <code title="">src</code>
     <td> <code title=attr-media-src><a href=#attr-media-src>audio</a></code>;
          <code title=attr-embed-src><a href=#attr-embed-src>embed</a></code>;
          <code title=attr-iframe-src><a href=#attr-iframe-src>iframe</a></code>;
          <code title=attr-img-src><a href=#attr-img-src>img</a></code>;
          <code title=attr-input-src><a href=#attr-input-src>input</a></code>;
          <code title=attr-script-src><a href=#attr-script-src>script</a></code>;
          <code title=attr-source-src><a href=#attr-source-src>source</a></code>;
          <code title=attr-track-src><a href=#attr-track-src>track</a></code>;
          <code title=attr-media-src><a href=#attr-media-src>video</a></code>
     <td> Address of the resource
     <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
    <tr><th> <code title="">srcdoc</code>
     <td> <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>iframe</a></code>
     <td> A document to render in the <code><a href=#the-iframe-element>iframe</a></code>
     <td> The source of <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>*
    <tr><th> <code title="">srclang</code>
     <td> <code title=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 title="">srcset</code>
     <td> <code title=attr-img-srcset><a href=#attr-img-srcset>img</a></code>
     <td> Images to use in different situations (e.g. high-resolution displays, small monitors, etc)
     <td> Comma-separated list of <span>image candidate strings</span>
    <tr><th> <code title="">start</code>
     <td> <code title=attr-ol-start><a href=#attr-ol-start>ol</a></code>
     <td> <a href=#ordinal-value>Ordinal value</a> of the first item
     <td> <a href=#valid-integer>Valid integer</a>
    <tr><th> <code title="">step</code>
     <td> <code title=attr-input-step><a href=#attr-input-step>input</a></code>
     <td> Granularity to be matched by the form control's value
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a> greater than zero, or "<code title="">any</code>"
    <tr><th> <code title="">style</code>
     <td> <a href=#the-style-attribute title=attr-style>HTML elements</a>
     <td> Presentational and formatting instructions
     <td> CSS declarations*
    <tr><th> <code title="">tabindex</code>
     <td> <a href=#attr-tabindex title=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>Valid integer</a>
    <tr><th> <code title="">target</code>
     <td> <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>a</a></code>;
          <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>area</a></code>
     <td> <a href=#browsing-context>Browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a>
     <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
    <tr><th> <code title="">target</code>
     <td> <code title=attr-base-target><a href=#attr-base-target>base</a></code>
     <td> Default <a href=#browsing-context>browsing context</a> for <a href=#hyperlink>hyperlink</a> <a href=#navigate title=navigate>navigation</a> and <a href=#form-submission>form submission</a>
     <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
    <tr><th> <code title="">target</code>
     <td> <code title=attr-fs-target><a href=#attr-fs-target>form</a></code>
     <td> <a href=#browsing-context>Browsing context</a> for <a href=#form-submission>form submission</a>
     <td> <a href=#valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
    <tr><th> <code title="">title</code>
     <td> <a href=#attr-title title=attr-title>HTML elements</a>
     <td> Advisory information for the element
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">title</code>
     <td> <code title=attr-abbr-title><a href=#attr-abbr-title>abbr</a></code>;
          <code title=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="">title</code>
     <td> <code title=attr-menuitem-title><a href=#attr-menuitem-title>menuitem</a></code>
     <td> Hint describing the command
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">title</code>
     <td> <code title=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="">title</code>
     <td> <code title=attr-link-title><a href=#attr-link-title>link</a></code>;
          <code title=attr-style-title><a href=#attr-style-title>style</a></code>
     <td> Alternative style sheet set name
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">translate</code>
     <td> <a href=#attr-translate title=attr-translate>HTML elements</a>
     <td> Whether the element is to be translated when the page is localized
     <td> "<code title="">yes</code>"; "<code title="">no</code>"
    <tr><th> <code title="">type</code>
     <td> <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>a</a></code>;
          <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>area</a></code>;
          <code title=attr-link-type><a href=#attr-link-type>link</a></code>
     <td> Hint for the type of the referenced resource
     <td> <a href=#valid-mime-type>Valid MIME type</a>
    <tr><th> <code title="">type</code>
     <td> <code title=attr-button-type><a href=#attr-button-type>button</a></code>
     <td> Type of button
     <td> "<code title=attr-button-type-submit><a href=#attr-button-type-submit>submit</a></code>";
          "<code title=attr-button-type-reset><a href=#attr-button-type-reset>reset</a></code>";
          "<code title=attr-button-type-button><a href=#attr-button-type-button>button</a></code>";
          "<code title=attr-button-type-menu><a href=#attr-button-type-menu>menu</a></code>"
    <tr><th> <code title="">type</code>
     <td> <code title=attr-embed-type><a href=#attr-embed-type>embed</a></code>;
          <code title=attr-object-type><a href=#attr-object-type>object</a></code>;
          <code title=attr-script-type><a href=#attr-script-type>script</a></code>;
          <code title=attr-source-type><a href=#attr-source-type>source</a></code>;
          <code title=attr-style-type><a href=#attr-style-type>style</a></code>
     <td> Type of embedded resource
     <td> <a href=#valid-mime-type>Valid MIME type</a>
    <tr><th> <code title="">type</code>
     <td> <code title=attr-input-type><a href=#attr-input-type>input</a></code>
     <td> Type of form control
     <td> <a href=#attr-input-type title=attr-input-type><code>input</code> type keyword</a>
    <tr><th> <code title="">type</code>
     <td> <code title=attr-menu-type><a href=#attr-menu-type>menu</a></code>
     <td> Type of menu
     <td> "<code title="popup menu state"><a href=#popup-menu-state>popup</a></code>"; "<code title="toolbar state"><a href=#toolbar-state>toolbar</a></code>"
    <tr><th> <code title="">type</code>
     <td> <code title=attr-menuitem-type><a href=#attr-menuitem-type>menuitem</a></code>
     <td> Type of command
     <td> "<code title=attr-menuitem-type-keyword-command><a href=#attr-menuitem-type-keyword-command>command</a></code>";
          "<code title=attr-menuitem-type-keyword-checkbox><a href=#attr-menuitem-type-keyword-checkbox>checkbox</a></code>";
          "<code title=attr-menuitem-type-keyword-radio><a href=#attr-menuitem-type-keyword-radio>radio</a></code>"
    <tr><th> <code title="">type</code>
     <td> <code title=attr-ol-type><a href=#attr-ol-type>ol</a></code>
     <td> Kind of list marker
     <td> "<code title=attr-ol-type-keyword-decimal><a href=#attr-ol-type-keyword-decimal>1</a></code>";
          "<code title=attr-ol-type-keyword-lower-alpha><a href=#attr-ol-type-keyword-lower-alpha>a</a></code>";
          "<code title=attr-ol-type-keyword-upper-alpha><a href=#attr-ol-type-keyword-upper-alpha>A</a></code>";
          "<code title=attr-ol-type-keyword-lower-roman><a href=#attr-ol-type-keyword-lower-roman>i</a></code>";
          "<code title=attr-ol-type-keyword-upper-roman><a href=#attr-ol-type-keyword-upper-roman>I</a></code>"
    <tr><th> <code title="">typemustmatch</code>
     <td> <code title=attr-object-typemustmatch><a href=#attr-object-typemustmatch>object</a></code>
     <td> Whether the <code title=attr-object-type><a href=#attr-object-type>type</a></code> attribute and the <a href=#content-type>Content-Type</a> value need to match for the resource to be used
     <td> <a href=#boolean-attribute>Boolean attribute</a>
    <tr><th> <code title="">usemap</code>
     <td> <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>img</a></code>;
          <code title=attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>object</a></code>
     <td> Name of <a href=#image-map>image map</a> to use
     <td> <a href=#valid-hash-name-reference>Valid hash-name reference</a>*
    <tr><th> <code title="">value</code>
     <td> <code title=attr-button-value><a href=#attr-button-value>button</a></code>;
          <code title=attr-option-value><a href=#attr-option-value>option</a></code>
     <td> Value to be used for <a href=#form-submission>form submission</a>
     <td> <a href=#attribute-text>Text</a>
    <tr><th> <code title="">value</code>
     <td> <code title=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 title="">value</code>
     <td> <code title=attr-input-value><a href=#attr-input-value>input</a></code>
     <td> Value of the form control
     <td> Varies*
    <tr><th> <code title="">value</code>
     <td> <code title=attr-li-value><a href=#attr-li-value>li</a></code>
     <td> <a href=#ordinal-value>Ordinal value</a> of the list item
     <td> <a href=#valid-integer>Valid integer</a>
    <tr><th> <code title="">value</code>
     <td> <code title=attr-meter-value><a href=#attr-meter-value>meter</a></code>;
          <code title=attr-progress-value><a href=#attr-progress-value>progress</a></code>
     <td> Current value of the element
     <td> <a href=#valid-floating-point-number>Valid floating-point number</a>
    <tr><th> <code title="">value</code>
     <td> <code title=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 title="">width</code>
     <td> <code title=attr-canvas-width><a href=#attr-canvas-width>canvas</a></code>;
          <code title=attr-dim-width><a href=#attr-dim-width>embed</a></code>;
          <code title=attr-dim-width><a href=#attr-dim-width>iframe</a></code>;
          <code title=attr-dim-width><a href=#attr-dim-width>img</a></code>;
          <code title=attr-dim-width><a href=#attr-dim-width>input</a></code>;
          <code title=attr-dim-width><a href=#attr-dim-width>object</a></code>;
          <code title=attr-dim-width><a href=#attr-dim-width>video</a></code>
     <td> Horizontal dimension
     <td> <a href=#valid-non-negative-integer>Valid non-negative integer</a>
    <tr><th> <code title="">wrap</code>
     <td> <code title=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>form submission</a>
     <td> "<code title=attr-textarea-wrap-soft><a href=#attr-textarea-wrap-soft>soft</a></code>";
          "<code title=attr-textarea-wrap-hard><a href=#attr-textarea-wrap-hard>hard</a></code>"
  </table><p class=tablenote><small>An asterisk (*) in a cell indicates that the actual rules are more
  complicated than indicated in the table above.</small></p>

  <hr><table id=ix-event-handlers><caption>List of event handler content attributes</caption>
   <thead><tr><th> Attribute
     <th> Element(s)
     <th> Description
     <th> Value
   <tbody><tr><th id=ix-handler-onabort> <code title="">onabort</code>
     <td> <a href=#handler-onabort title=handler-onabort>HTML elements</a>
     <td> <code title=event-abort>abort</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onafterprint> <code title="">onafterprint</code>
     <td> <code title=handler-window-onafterprint><a href=#handler-window-onafterprint>body</a></code>
     <td> <code title=event-afterprint>afterprint</code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onbeforeprint> <code title="">onbeforeprint</code>
     <td> <code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>body</a></code>
     <td> <code title=event-beforeprint>beforeprint</code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onbeforeunload> <code title="">onbeforeunload</code>
     <td> <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>body</a></code>
     <td> <code title=event-beforeunload>beforeunload</code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onblur> <code title="">onblur</code>
     <td> <a href=#handler-onblur title=handler-onblur>HTML elements</a>
     <td> <code title=event-blur>blur</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oncancel> <code title="">oncancel</code>
     <td> <a href=#handler-oncancel title=handler-oncancel>HTML elements</a>
     <td> <code title=event-media-cancel>cancel</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oncanplay> <code title="">oncanplay</code>
     <td> <a href=#handler-oncanplay title=handler-oncanplay>HTML elements</a>
     <td> <code title=event-media-canplay><a href=#event-media-canplay>canplay</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oncanplaythrough> <code title="">oncanplaythrough</code>
     <td> <a href=#handler-oncanplaythrough title=handler-oncanplaythrough>HTML elements</a>
     <td> <code title=event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onchange> <code title="">onchange</code>
     <td> <a href=#handler-onchange title=handler-onchange>HTML elements</a>
     <td> <code title=event-change>change</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onclick> <code title="">onclick</code>
     <td> <a href=#handler-onclick title=handler-onclick>HTML elements</a>
     <td> <code title=event-click><a href=#event-click>click</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onclose> <code title="">onclose</code>
     <td> <a href=#handler-onclose title=handler-onclose>HTML elements</a>
     <td> <code title=event-close><a href=#event-close>close</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oncontextmenu> <code title="">oncontextmenu</code>
     <td> <a href=#handler-oncontextmenu title=handler-oncontextmenu>HTML elements</a>
     <td> <code title=event-contextmenu>contextmenu</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oncuechange> <code title="">oncuechange</code>
     <td> <a href=#handler-oncuechange title=handler-oncuechange>HTML elements</a>
     <td> <code title=event-cuechange>cuechange</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondblclick> <code title="">ondblclick</code>
     <td> <a href=#handler-ondblclick title=handler-ondblclick>HTML elements</a>
     <td> <code title=event-dblclick>dblclick</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondrag> <code title="">ondrag</code>
     <td> <a href=#handler-ondrag title=handler-ondrag>HTML elements</a>
     <td> <code title=event-drag><a href=#event-drag>drag</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondragend> <code title="">ondragend</code>
     <td> <a href=#handler-ondragend title=handler-ondragend>HTML elements</a>
     <td> <code title=event-dragend><a href=#event-dragend>dragend</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondragenter> <code title="">ondragenter</code>
     <td> <a href=#handler-ondragenter title=handler-ondragenter>HTML elements</a>
     <td> <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondragexit> <code title="">ondragexit</code>
     <td> <a href=#handler-ondragexit title=handler-ondragexit>HTML elements</a>
     <td> <code title=event-dragexit><a href=#event-dragexit>dragexit</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondragleave> <code title="">ondragleave</code>
     <td> <a href=#handler-ondragleave title=handler-ondragleave>HTML elements</a>
     <td> <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondragover> <code title="">ondragover</code>
     <td> <a href=#handler-ondragover title=handler-ondragover>HTML elements</a>
     <td> <code title=event-dragover><a href=#event-dragover>dragover</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondragstart> <code title="">ondragstart</code>
     <td> <a href=#handler-ondragstart title=handler-ondragstart>HTML elements</a>
     <td> <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondrop> <code title="">ondrop</code>
     <td> <a href=#handler-ondrop title=handler-ondrop>HTML elements</a>
     <td> <code title=event-drop><a href=#event-drop>drop</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ondurationchange> <code title="">ondurationchange</code>
     <td> <a href=#handler-ondurationchange title=handler-ondurationchange>HTML elements</a>
     <td> <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onemptied> <code title="">onemptied</code>
     <td> <a href=#handler-onemptied title=handler-onemptied>HTML elements</a>
     <td> <code title=event-media-emptied><a href=#event-media-emptied>emptied</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onended> <code title="">onended</code>
     <td> <a href=#handler-onended title=handler-onended>HTML elements</a>
     <td> <code title=event-media-ended><a href=#event-media-ended>ended</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onerror> <code title="">onerror</code>
     <td> <a href=#handler-onerror title=handler-onerror>HTML elements</a>
     <td> <code title=event-error>error</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onfocus> <code title="">onfocus</code>
     <td> <a href=#handler-onfocus title=handler-onfocus>HTML elements</a>
     <td> <code title=event-focus>focus</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onhashchange> <code title="">onhashchange</code>
     <td> <code title=handler-window-onhashchange><a href=#handler-window-onhashchange>body</a></code>
     <td> <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oninput> <code title="">oninput</code>
     <td> <a href=#handler-oninput title=handler-oninput>HTML elements</a>
     <td> <code title=event-input>input</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-oninvalid> <code title="">oninvalid</code>
     <td> <a href=#handler-oninvalid title=handler-oninvalid>HTML elements</a>
     <td> <code title=event-invalid>invalid</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onkeydown> <code title="">onkeydown</code>
     <td> <a href=#handler-onkeydown title=handler-onkeydown>HTML elements</a>
     <td> <code title=event-keydown>keydown</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onkeypress> <code title="">onkeypress</code>
     <td> <a href=#handler-onkeypress title=handler-onkeypress>HTML elements</a>
     <td> <code title=event-keypress>keypress</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onkeyup> <code title="">onkeyup</code>
     <td> <a href=#handler-onkeyup title=handler-onkeyup>HTML elements</a>
     <td> <code title=event-keyup>keyup</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onload> <code title="">onload</code>
     <td> <a href=#handler-onload title=handler-onload>HTML elements</a>
     <td> <code title=event-load>load</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onloadeddata> <code title="">onloadeddata</code>
     <td> <a href=#handler-onloadeddata title=handler-onloadeddata>HTML elements</a>
     <td> <code title=event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onloadedmetadata> <code title="">onloadedmetadata</code>
     <td> <a href=#handler-onloadedmetadata title=handler-onloadedmetadata>HTML elements</a>
     <td> <code title=event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onloadstart> <code title="">onloadstart</code>
     <td> <a href=#handler-onloadstart title=handler-onloadstart>HTML elements</a>
     <td> <code title=event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onmessage> <code title="">onmessage</code>
     <td> <code title=handler-window-onmessage><a href=#handler-window-onmessage>body</a></code>
     <td> <code title=event-message><a href=#event-message>message</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmousedown> <code title="">onmousedown</code>
     <td> <a href=#handler-onmousedown title=handler-onmousedown>HTML elements</a>
     <td> <code title=event-mousedown>mousedown</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmouseenter> <code title="">onmouseenter</code>
     <td> <a href=#handler-onmouseenter title=handler-onmouseenter>HTML elements</a>
     <td> <code title=event-mouseenter>mouseenter</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmouseleave> <code title="">onmouseleave</code>
     <td> <a href=#handler-onmouseleave title=handler-onmouseleave>HTML elements</a>
     <td> <code title=event-mouseleave>mouseleave</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmousemove> <code title="">onmousemove</code>
     <td> <a href=#handler-onmousemove title=handler-onmousemove>HTML elements</a>
     <td> <code title=event-mousemove>mousemove</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmouseout> <code title="">onmouseout</code>
     <td> <a href=#handler-onmouseout title=handler-onmouseout>HTML elements</a>
     <td> <code title=event-mouseout>mouseout</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmouseover> <code title="">onmouseover</code>
     <td> <a href=#handler-onmouseover title=handler-onmouseover>HTML elements</a>
     <td> <code title=event-mouseover>mouseover</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmouseup> <code title="">onmouseup</code>
     <td> <a href=#handler-onmouseup title=handler-onmouseup>HTML elements</a>
     <td> <code title=event-mouseup>mouseup</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onmousewheel> <code title="">onmousewheel</code>
     <td> <a href=#handler-onmousewheel title=handler-onmousewheel>HTML elements</a>
     <td> <code title=event-mousewheel>mousewheel</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onoffline> <code title="">onoffline</code>
     <td> <code title=handler-window-onoffline><a href=#handler-window-onoffline>body</a></code>
     <td> <code title=event-offline><a href=#event-offline>offline</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-ononline> <code title="">ononline</code>
     <td> <code title=handler-window-ononline><a href=#handler-window-ononline>body</a></code>
     <td> <code title=event-online><a href=#event-online>online</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onpagehide> <code title="">onpagehide</code>
     <td> <code title=handler-window-onpagehide><a href=#handler-window-onpagehide>body</a></code>
     <td> <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onpageshow> <code title="">onpageshow</code>
     <td> <code title=handler-window-onpageshow><a href=#handler-window-onpageshow>body</a></code>
     <td> <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onpause> <code title="">onpause</code>
     <td> <a href=#handler-onpause title=handler-onpause>HTML elements</a>
     <td> <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onplay> <code title="">onplay</code>
     <td> <a href=#handler-onplay title=handler-onplay>HTML elements</a>
     <td> <code title=event-media-play><a href=#event-media-play>play</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onplaying> <code title="">onplaying</code>
     <td> <a href=#handler-onplaying title=handler-onplaying>HTML elements</a>
     <td> <code title=event-media-playing><a href=#event-media-playing>playing</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onpopstate> <code title="">onpopstate</code>
     <td> <code title=handler-window-onpopstate><a href=#handler-window-onpopstate>body</a></code>
     <td> <code title=event-popstate><a href=#event-popstate>popstate</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onprogress> <code title="">onprogress</code>
     <td> <a href=#handler-onprogress title=handler-onprogress>HTML elements</a>
     <td> <code title=event-media-progress><a href=#event-media-progress>progress</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onratechange> <code title="">onratechange</code>
     <td> <a href=#handler-onratechange title=handler-onratechange>HTML elements</a>
     <td> <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onreset> <code title="">onreset</code>
     <td> <a href=#handler-onreset title=handler-onreset>HTML elements</a>
     <td> <code title=event-reset>reset</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onresize> <code title="">onresize</code>
     <td> <code title=handler-window-onresize><a href=#handler-window-onresize>body</a></code>
     <td> <code title=event-resize>resize</code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onscroll> <code title="">onscroll</code>
     <td> <a href=#handler-onscroll title=handler-onscroll>HTML elements</a>
     <td> <code title=event-scroll>scroll</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onseeked> <code title="">onseeked</code>
     <td> <a href=#handler-onseeked title=handler-onseeked>HTML elements</a>
     <td> <code title=event-media-seeked><a href=#event-media-seeked>seeked</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onseeking> <code title="">onseeking</code>
     <td> <a href=#handler-onseeking title=handler-onseeking>HTML elements</a>
     <td> <code title=event-media-seeking><a href=#event-media-seeking>seeking</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onselect> <code title="">onselect</code>
     <td> <a href=#handler-onselect title=handler-onselect>HTML elements</a>
     <td> <code title=event-select>select</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onshow> <code title="">onshow</code>
     <td> <a href=#handler-onshow title=handler-onshow>HTML elements</a>
     <td> <code title=event-show>show</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onsort> <code title="">onsort</code>
     <td> <a href=#handler-onsort title=handler-onsort>HTML elements</a>
     <td> <code title=event-sort>sort</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onstalled> <code title="">onstalled</code>
     <td> <a href=#handler-onstalled title=handler-onstalled>HTML elements</a>
     <td> <code title=event-media-stalled><a href=#event-media-stalled>stalled</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onstorage> <code title="">onstorage</code>
     <td> <code title=handler-window-onstorage><a href=#handler-window-onstorage>body</a></code>
     <td> <code title=event-storage><a href=#event-storage>storage</a></code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onsubmit> <code title="">onsubmit</code>
     <td> <a href=#handler-onsubmit title=handler-onsubmit>HTML elements</a>
     <td> <code title=event-submit>submit</code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onsuspend> <code title="">onsuspend</code>
     <td> <a href=#handler-onsuspend title=handler-onsuspend>HTML elements</a>
     <td> <code title=event-media-suspend><a href=#event-media-suspend>suspend</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-ontimeupdate> <code title="">ontimeupdate</code>
     <td> <a href=#handler-ontimeupdate title=handler-ontimeupdate>HTML elements</a>
     <td> <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-window-onunload> <code title="">onunload</code>
     <td> <code title=handler-window-onunload><a href=#handler-window-onunload>body</a></code>
     <td> <code title=event-unload>unload</code> event handler for <code><a href=#window>Window</a></code> object
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onvolumechange> <code title="">onvolumechange</code>
     <td> <a href=#handler-onvolumechange title=handler-onvolumechange>HTML elements</a>
     <td> <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

    <tr><th id=ix-handler-onwaiting> <code title="">onwaiting</code>
     <td> <a href=#handler-onwaiting title=handler-onwaiting>HTML elements</a>
     <td> <code title=event-media-waiting><a href=#event-media-waiting>waiting</a></code> event handler
     <td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

  </table><!-- v2 for completeness: (also search for REFLECTIDL)
  <h3 class="no-num">Reflecting IDL attributes</h3>

  <p><i>This section is non-normative.</i></p>

  <table>
   <caption>List of <dfn>reflecting IDL attributes</dfn></caption>
   <thead>
    <tr>
     <th> Interface
     <th> Element(s)
     <th> IDL attribute
     <th> Reflects...
   <tbody>
    ...
    <tr>
     <td> <code>HTMLElement</code>
     <td> <span>HTML elements</span>
     <td> <code title="dom-contextMenu">contextMenu</code>
     <td> <code title="attr-contextmenu">contextmenu</code>
    <tr>
     <td> <code>HTMLOptionElement</code>
     <td> <code>option</code>
     <td> <code title="dom-option-text">text</code>
     <td> <code>textContent</code>
  </table>
  ( include option.text; textarea.defaultValue, and other attributes that "reflect" the element's textContent )
--><h3 class=no-num id=element-interfaces>Element Interfaces</h3>

  <p><i>This section is non-normative.</i></p>

  <table><caption>List of interfaces for elements</caption>
   <thead><tr><th> Element(s)
     <th> Interface(s)
   <tbody><tr><td> <code><a href=#the-a-element>a</a></code>
     <td> <code><a href=#htmlanchorelement>HTMLAnchorElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-abbr-element>abbr</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-address-element>address</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-area-element>area</a></code>
     <td> <code><a href=#htmlareaelement>HTMLAreaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-article-element>article</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-aside-element>aside</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-audio-element>audio</a></code>
     <td> <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> : <code><a href=#htmlmediaelement>HTMLMediaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-b-element>b</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-base-element>base</a></code>
     <td> <code><a href=#htmlbaseelement>HTMLBaseElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-bdi-element>bdi</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-bdo-element>bdo</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-blockquote-element>blockquote</a></code>
     <td> <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-body-element>body</a></code>
     <td> <code><a href=#htmlbodyelement>HTMLBodyElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-br-element>br</a></code>
     <td> <code><a href=#htmlbrelement>HTMLBRElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-button-element>button</a></code>
     <td> <code><a href=#htmlbuttonelement>HTMLButtonElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-canvas-element>canvas</a></code>
     <td> <code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-caption-element>caption</a></code>
     <td> <code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-cite-element>cite</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-code-element>code</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-col-element>col</a></code>
     <td> <code><a href=#htmltablecolelement>HTMLTableColElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-colgroup-element>colgroup</a></code>
     <td> <code><a href=#htmltablecolelement>HTMLTableColElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-menuitem-element>menuitem</a></code>
     <td> <code><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-data-element>data</a></code>
     <td> <code><a href=#htmldataelement>HTMLDataElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-datalist-element>datalist</a></code>
     <td> <code><a href=#htmldatalistelement>HTMLDataListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-dd-element>dd</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-del-element>del</a></code>
     <td> <code><a href=#htmlmodelement>HTMLModElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-details-element>details</a></code>
     <td> <code><a href=#htmldetailselement>HTMLDetailsElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-dfn-element>dfn</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-dialog-element>dialog</a></code>
     <td> <code><a href=#htmldialogelement>HTMLDialogElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-div-element>div</a></code>
     <td> <code><a href=#htmldivelement>HTMLDivElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-dl-element>dl</a></code>
     <td> <code><a href=#htmldlistelement>HTMLDListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-dt-element>dt</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-em-element>em</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-embed-element>embed</a></code>
     <td> <code><a href=#htmlembedelement>HTMLEmbedElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-fieldset-element>fieldset</a></code>
     <td> <code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-figcaption-element>figcaption</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-figure-element>figure</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-footer-element>footer</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-form-element>form</a></code>
     <td> <code><a href=#htmlformelement>HTMLFormElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
     <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>
     <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>
     <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>
     <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>
     <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
     <td> <code><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-head-element>head</a></code>
     <td> <code><a href=#htmlheadelement>HTMLHeadElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-header-element>header</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-hgroup-element>hgroup</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-hr-element>hr</a></code>
     <td> <code><a href=#htmlhrelement>HTMLHRElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-html-element>html</a></code>
     <td> <code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-i-element>i</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-iframe-element>iframe</a></code>
     <td> <code><a href=#htmliframeelement>HTMLIFrameElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-img-element>img</a></code>
     <td> <code><a href=#htmlimageelement>HTMLImageElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-input-element>input</a></code>
     <td> <code><a href=#htmlinputelement>HTMLInputElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-ins-element>ins</a></code>
     <td> <code><a href=#htmlmodelement>HTMLModElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-kbd-element>kbd</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-keygen-element>keygen</a></code>
     <td> <code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-label-element>label</a></code>
     <td> <code><a href=#htmllabelelement>HTMLLabelElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-legend-element>legend</a></code>
     <td> <code><a href=#htmllegendelement>HTMLLegendElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-li-element>li</a></code>
     <td> <code><a href=#htmllielement>HTMLLIElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-link-element>link</a></code>
     <td> <code><a href=#htmllinkelement>HTMLLinkElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-main-element>main</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-map-element>map</a></code>
     <td> <code><a href=#htmlmapelement>HTMLMapElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-mark-element>mark</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-menu-element>menu</a></code>
     <td> <code><a href=#htmlmenuelement>HTMLMenuElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-meta-element>meta</a></code>
     <td> <code><a href=#htmlmetaelement>HTMLMetaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-meter-element>meter</a></code>
     <td> <code><a href=#htmlmeterelement>HTMLMeterElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-nav-element>nav</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-noscript-element>noscript</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-object-element>object</a></code>
     <td> <code><a href=#htmlobjectelement>HTMLObjectElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-ol-element>ol</a></code>
     <td> <code><a href=#htmlolistelement>HTMLOListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-optgroup-element>optgroup</a></code>
     <td> <code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-option-element>option</a></code>
     <td> <code><a href=#htmloptionelement>HTMLOptionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-output-element>output</a></code>
     <td> <code><a href=#htmloutputelement>HTMLOutputElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-p-element>p</a></code>
     <td> <code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-param-element>param</a></code>
     <td> <code><a href=#htmlparamelement>HTMLParamElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-pre-element>pre</a></code>
     <td> <code><a href=#htmlpreelement>HTMLPreElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-progress-element>progress</a></code>
     <td> <code><a href=#htmlprogresselement>HTMLProgressElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-q-element>q</a></code>
     <td> <code><a href=#htmlquoteelement>HTMLQuoteElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-rp-element>rp</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-rt-element>rt</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-ruby-element>ruby</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-s-element>s</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-samp-element>samp</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-script-element>script</a></code>
     <td> <code><a href=#htmlscriptelement>HTMLScriptElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-section-element>section</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-select-element>select</a></code>
     <td> <code><a href=#htmlselectelement>HTMLSelectElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-small-element>small</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-source-element>source</a></code>
     <td> <code><a href=#htmlsourceelement>HTMLSourceElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-span-element>span</a></code>
     <td> <code><a href=#htmlspanelement>HTMLSpanElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-strong-element>strong</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-style-element>style</a></code>
     <td> <code><a href=#htmlstyleelement>HTMLStyleElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-sub-and-sup-elements>sub</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-summary-element>summary</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-sub-and-sup-elements>sup</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-table-element>table</a></code>
     <td> <code><a href=#htmltableelement>HTMLTableElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-tbody-element>tbody</a></code>
     <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-td-element>td</a></code>
     <td> <code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code> : <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-template-element>template</a></code>
     <td> <code><a href=#htmltemplateelement>HTMLTemplateElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-textarea-element>textarea</a></code>
     <td> <code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-tfoot-element>tfoot</a></code>
     <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-th-element>th</a></code>
     <td> <code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code> : <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-thead-element>thead</a></code>
     <td> <code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-time-element>time</a></code>
     <td> <code><a href=#htmltimeelement>HTMLTimeElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-title-element>title</a></code>
     <td> <code><a href=#htmltitleelement>HTMLTitleElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-tr-element>tr</a></code>
     <td> <code><a href=#htmltablerowelement>HTMLTableRowElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-track-element>track</a></code>
     <td> <code><a href=#htmltrackelement>HTMLTrackElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-u-element>u</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-ul-element>ul</a></code>
     <td> <code><a href=#htmlulistelement>HTMLUListElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-var-element>var</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-video-element>video</a></code>
     <td> <code><a href=#htmlvideoelement>HTMLVideoElement</a></code> : <code><a href=#htmlmediaelement>HTMLMediaElement</a></code> : <code><a href=#htmlelement>HTMLElement</a></code>

    <tr><td> <code><a href=#the-wbr-element>wbr</a></code>
     <td> <code><a href=#htmlelement>HTMLElement</a></code>

  </table><h3 class=no-num id=all-interfaces>All Interfaces</h3>

  <p><i>This section is non-normative.</i></p>

  <ul class="brief">
   <li><code><a href=#abstractworker>AbstractWorker</a></code>
   <li><code><a href=#applicationcache>ApplicationCache</a></code>
   <li><code><a href=#audiotrack>AudioTrack</a></code>
   <li><code><a href=#audiotracklist>AudioTrackList</a></code>
   <li><code><a href=#barprop>BarProp</a></code>
   <li><code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
   <li><code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
   <li><code><a href=#canvasgradient>CanvasGradient</a></code>
   <li><code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
   <li><code><a href=#canvaspattern>CanvasPattern</a></code>
   <li><code><a href=#canvasproxy>CanvasProxy</a></code>
   <li><code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
   <li><code><a href=#closeevent>CloseEvent</a></code>
   <li><code><a href=#domelementmap>DOMElementMap</a></code>
   <li><code><a href=#domstringmap>DOMStringMap</a></code>
   <li><code><a href=#datatransfer>DataTransfer</a></code>
   <li><code><a href=#datatransferitem>DataTransferItem</a></code>
   <li><code><a href=#datatransferitemlist>DataTransferItemList</a></code>
   <li><code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
   <li><code><a href=#document>Document</a></code>, <a href=#Document-partial>partial</a>
   <li><code><a href=#dragevent>DragEvent</a></code>
   <li><code><a href=#drawingstyle>DrawingStyle</a></code>
   <li><code><a href=#errorevent>ErrorEvent</a></code>
   <li><code><a href=#eventsource>EventSource</a></code>
   <li><code><a href=#external>External</a></code>
   <li><code><a href=#globaleventhandlers>GlobalEventHandlers</a></code>
   <li><code><a href=#htmlallcollection>HTMLAllCollection</a></code>
   <li><code><a href=#htmlanchorelement>HTMLAnchorElement</a></code>, <a href=#HTMLAnchorElement-partial>partial</a>
   <li><code><a href=#htmlappletelement>HTMLAppletElement</a></code>
   <li><code><a href=#htmlareaelement>HTMLAreaElement</a></code>, <a href=#HTMLAreaElement-partial>partial</a>
   <li><code><a href=#htmlaudioelement>HTMLAudioElement</a></code>
   <li><code><a href=#htmlbrelement>HTMLBRElement</a></code>, <a href=#HTMLBRElement-partial>partial</a>
   <li><code><a href=#htmlbaseelement>HTMLBaseElement</a></code>
   <li><code><a href=#htmlbodyelement>HTMLBodyElement</a></code>, <a href=#HTMLBodyElement-partial>partial</a>
   <li><code><a href=#htmlbuttonelement>HTMLButtonElement</a></code>
   <li><code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>
   <li><code><a href=#htmldlistelement>HTMLDListElement</a></code>, <a href=#HTMLDListElement-partial>partial</a>
   <li><code><a href=#htmldataelement>HTMLDataElement</a></code>
   <li><code><a href=#htmldatalistelement>HTMLDataListElement</a></code>
   <li><code><a href=#htmldetailselement>HTMLDetailsElement</a></code>
   <li><code><a href=#htmldialogelement>HTMLDialogElement</a></code>
   <li><code><a href=#htmldirectoryelement>HTMLDirectoryElement</a></code>
   <li><code><a href=#htmldivelement>HTMLDivElement</a></code>, <a href=#HTMLDivElement-partial>partial</a>
   <li><code><a href=#htmlelement>HTMLElement</a></code>
   <li><code><a href=#htmlembedelement>HTMLEmbedElement</a></code>, <a href=#HTMLEmbedElement-partial>partial</a>
   <li><code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code>
   <li><code><a href=#htmlfontelement>HTMLFontElement</a></code>
   <li><code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code>
   <li><code><a href=#htmlformelement>HTMLFormElement</a></code>
   <li><code><a href=#htmlframeelement>HTMLFrameElement</a></code>
   <li><code><a href=#htmlframesetelement>HTMLFrameSetElement</a></code>
   <li><code><a href=#htmlhrelement>HTMLHRElement</a></code>, <a href=#HTMLHRElement-partial>partial</a>
   <li><code><a href=#htmlheadelement>HTMLHeadElement</a></code>
   <li><code><a href=#htmlheadingelement>HTMLHeadingElement</a></code>, <a href=#HTMLHeadingElement-partial>partial</a>
   <li><code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code>, <a href=#HTMLHtmlElement-partial>partial</a>
   <li><code><a href=#htmliframeelement>HTMLIFrameElement</a></code>, <a href=#HTMLIFrameElement-partial>partial</a>
   <li><code><a href=#htmlimageelement>HTMLImageElement</a></code>, <a href=#HTMLImageElement-partial>partial</a>
   <li><code><a href=#htmlinputelement>HTMLInputElement</a></code>, <a href=#HTMLInputElement-partial>partial</a>
   <li><code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code>
   <li><code><a href=#htmllielement>HTMLLIElement</a></code>, <a href=#HTMLLIElement-partial>partial</a>
   <li><code><a href=#htmllabelelement>HTMLLabelElement</a></code>
   <li><code><a href=#htmllegendelement>HTMLLegendElement</a></code>, <a href=#HTMLLegendElement-partial>partial</a>
   <li><code><a href=#htmllinkelement>HTMLLinkElement</a></code>, <a href=#HTMLLinkElement-partial>partial</a>
   <li><code><a href=#htmlmapelement>HTMLMapElement</a></code>
   <li><code><a href=#htmlmarqueeelement>HTMLMarqueeElement</a></code>
   <li><code><a href=#htmlmediaelement>HTMLMediaElement</a></code>
   <li><code><a href=#htmlmenuelement>HTMLMenuElement</a></code>, <a href=#HTMLMenuElement-partial>partial</a>
   <li><code><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code>
   <li><code><a href=#htmlmetaelement>HTMLMetaElement</a></code>, <a href=#HTMLMetaElement-partial>partial</a>
   <li><code><a href=#htmlmeterelement>HTMLMeterElement</a></code>
   <li><code><a href=#htmlmodelement>HTMLModElement</a></code>
   <li><code><a href=#htmlolistelement>HTMLOListElement</a></code>, <a href=#HTMLOListElement-partial>partial</a>
   <li><code><a href=#htmlobjectelement>HTMLObjectElement</a></code>, <a href=#HTMLObjectElement-partial>partial</a>
   <li><code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code>
   <li><code><a href=#htmloptionelement>HTMLOptionElement</a></code>
   <li><code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code>
   <li><code><a href=#htmloutputelement>HTMLOutputElement</a></code>
   <li><code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code>, <a href=#HTMLParagraphElement-partial>partial</a>
   <li><code><a href=#htmlparamelement>HTMLParamElement</a></code>, <a href=#HTMLParamElement-partial>partial</a>
   <li><code><a href=#htmlpreelement>HTMLPreElement</a></code>, <a href=#HTMLPreElement-partial>partial</a>
   <li><code><a href=#htmlprogresselement>HTMLProgressElement</a></code>
   <li><code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code>
   <li><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code>
   <li><code><a href=#htmlscriptelement>HTMLScriptElement</a></code>, <a href=#HTMLScriptElement-partial>partial</a>
   <li><code><a href=#htmlselectelement>HTMLSelectElement</a></code>
   <li><code><a href=#htmlsourceelement>HTMLSourceElement</a></code>
   <li><code><a href=#htmlspanelement>HTMLSpanElement</a></code>
   <li><code><a href=#htmlstyleelement>HTMLStyleElement</a></code>
   <li><code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code>, <a href=#HTMLTableCaptionElement-partial>partial</a>
   <li><code><a href=#htmltablecellelement>HTMLTableCellElement</a></code>, <a href=#HTMLTableCellElement-partial>partial</a>
   <li><code><a href=#htmltablecolelement>HTMLTableColElement</a></code>, <a href=#HTMLTableColElement-partial>partial</a>
   <li><code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code>, <a href=#HTMLTableDataCellElement-partial>partial</a>
   <li><code><a href=#htmltableelement>HTMLTableElement</a></code>, <a href=#HTMLTableElement-partial>partial</a>
   <li><code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code>
   <li><code><a href=#htmltablerowelement>HTMLTableRowElement</a></code>, <a href=#HTMLTableRowElement-partial>partial</a>
   <li><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, <a href=#HTMLTableSectionElement-partial>partial</a>
   <li><code><a href=#htmltemplateelement>HTMLTemplateElement</a></code>
   <li><code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code>
   <li><code><a href=#htmltimeelement>HTMLTimeElement</a></code>
   <li><code><a href=#htmltitleelement>HTMLTitleElement</a></code>
   <li><code><a href=#htmltrackelement>HTMLTrackElement</a></code>
   <li><code><a href=#htmlulistelement>HTMLUListElement</a></code>, <a href=#HTMLUListElement-partial>partial</a>
   <li><code><a href=#htmlunknownelement>HTMLUnknownElement</a></code>
   <li><code><a href=#htmlvideoelement>HTMLVideoElement</a></code>
   <li><code><a href=#hashchangeevent>HashChangeEvent</a></code>
   <li><code><a href=#history-0>History</a></code>
   <li><code><a href=#imagebitmap>ImageBitmap</a></code>
   <li><code><a href=#imagebitmapfactories>ImageBitmapFactories</a></code>
   <li><code><a href=#imagedata>ImageData</a></code>
   <li><code><a href=#location>Location</a></code>
   <li><code><a href=#mediacontroller>MediaController</a></code>
   <li><code><a href=#mediaerror>MediaError</a></code>
   <li><code><a href=#messagechannel>MessageChannel</a></code>
   <li><code><a href=#messageevent>MessageEvent</a></code>
   <li><code><a href=#messageport>MessagePort</a></code>
   <li><code><a href=#mimetype>MimeType</a></code>
   <li><code><a href=#mimetypearray>MimeTypeArray</a></code>
   <li><code>MouseEvent</code>, <a href=#MouseEvent-partial>partial</a>
   <li><code><a href=#navigator>Navigator</a></code>
   <li><code><a href=#navigatorcontentutils>NavigatorContentUtils</a></code>
   <li><code><a href=#navigatorid>NavigatorID</a></code>
   <li><code><a href=#navigatorlanguage>NavigatorLanguage</a></code>
   <li><code><a href=#navigatoronline>NavigatorOnLine</a></code>
   <li><code><a href=#navigatorplugins>NavigatorPlugins</a></code>
   <li><code><a href=#navigatorstorageutils>NavigatorStorageUtils</a></code>
   <li><code><a href=#pagetransitionevent>PageTransitionEvent</a></code>
   <li><code><a href=#path>Path</a></code>
   <li><code><a href=#dom-plugin>Plugin</a></code>
   <li><code><a href=#pluginarray>PluginArray</a></code>
   <li><code><a href=#popstateevent>PopStateEvent</a></code>
   <li><code><a href=#portcollection>PortCollection</a></code>
   <li><code><a href=#propertynodelist>PropertyNodeList</a></code>
   <li><code><a href=#radionodelist>RadioNodeList</a></code>
   <li><code><a href=#relatedevent>RelatedEvent</a></code>
   <li><code>Screen</code>, <a href=#Screen-partial>partial</a>
   <li><code><a href=#sharedworker>SharedWorker</a></code>
   <li><code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
   <li><code><a href=#storage-0>Storage</a></code>
   <li><code><a href=#storageevent>StorageEvent</a></code>
   <li><code><a href=#textmetrics>TextMetrics</a></code>
   <li><code><a href=#texttrack>TextTrack</a></code>
   <li><code><a href=#texttrackcue>TextTrackCue</a></code>
   <li><code><a href=#texttrackcuelist>TextTrackCueList</a></code>
   <li><code><a href=#texttracklist>TextTrackList</a></code>
   <li><code><a href=#timeranges>TimeRanges</a></code>
   <li><code><a href=#trackevent>TrackEvent</a></code>
   <li><code><a href=#transferable>Transferable</a></code>
   <li><code><a href=#validitystate>ValidityState</a></code>
   <li><code><a href=#videotrack>VideoTrack</a></code>
   <li><code><a href=#videotracklist>VideoTrackList</a></code>
   <li><code><a href=#websocket>WebSocket</a></code>
   <li><code><a href=#window>Window</a></code>, <a href=#Window-partial>partial</a>
   <li><code><a href=#windowbase64>WindowBase64</a></code>
   <li><code><a href=#windoweventhandlers>WindowEventHandlers</a></code>
   <li><code><a href=#windowlocalstorage>WindowLocalStorage</a></code>
   <li><code><a href=#windowmodal>WindowModal</a></code>
   <li><code><a href=#windowsessionstorage>WindowSessionStorage</a></code>
   <li><code><a href=#windowtimers>WindowTimers</a></code>
   <li><code><a href=#worker>Worker</a></code>
   <li><code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, <a href=#WorkerGlobalScope-partial>partial</a>
   <li><code><a href=#workerlocation>WorkerLocation</a></code>
   <li><code><a href=#workernavigator>WorkerNavigator</a></code>
   <li><code>XMLDocument</code>, <a href=#xmldocument>partial</a>
  </ul>




  <h2 class=no-num id=references>References</h2><!--REFS-->

  <p>All references are normative unless marked "Non-normative".</p>

  <!-- Dates are only included for standards older than the Web, because the newer ones keep changing. -->

  <dl><dt id=refsABNF>[ABNF]</dt>
   <dd><cite><a href=http://www.ietf.org/rfc/std/std68.txt>Augmented BNF for Syntax Specifications: ABNF</a></cite>, D. Crocker, P. Overell. IETF.</dd>

   <dt id=refsABOUT>[ABOUT]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc6694>The 'about' URI scheme</a></cite>, S. Moonesamy. IETF.</dd>

   <dt id=refsAGIF>[AGIF]</dt>
   <dd>(Non-normative) <cite><a href=http://odur.let.rug.nl/~kleiweg/gif/netscape.html>GIF Application Extension: NETSCAPE2.0</a></cite>. R. Frazier.</dd> <!-- (rather a dubious reference; let me know if you know a better one) -->

   <dt id=refsAPNG>[APNG]</dt>
   <dd>(Non-normative) <cite><a href=https://wiki.mozilla.org/APNG_Specification>APNG Specification</a></cite>. S. Parmenter, V. Vukicevic, A. Smith. Mozilla.</dd>

   <dt id=refsARIA>[ARIA]</dt>
   <dd><cite><a href=http://www.w3.org/WAI/PF/aria/>Accessible Rich Internet Applications (WAI-ARIA)</a></cite>, J. Craig, M. Cooper, L. Pappas, R. Schwerdtfeger, L. Seeman. W3C.</dd>

   <dt id=refsARIAIMPL>[ARIAIMPL]</dt>
   <dd><cite><a href=http://www.w3.org/WAI/PF/aria-implementation/>WAI-ARIA 1.0 User Agent Implementation Guide</a></cite>, A. Snow-Weaver, M. Cooper. W3C.</dd>

   <dt id=refsATAG>[ATAG]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/ATAG20/>Authoring Tool Accessibility Guidelines (ATAG) 2.0</a></cite>, J. Richards, J. Spellman, J. Treviranus. W3C.</dd>

   <dt id=refsATOM>[ATOM]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc4287>The Atom Syndication Format</a></cite>, M. Nottingham, R. Sayre. IETF.</dd>

   <dt id=refsBCP47>[BCP47]</dt>
   <dd><cite><a href=http://www.ietf.org/rfc/bcp/bcp47.txt>Tags for Identifying Languages; Matching of Language Tags</a></cite>, A. Phillips, M. Davis. IETF.</dd>

   <dt id=refsBECSS>[BECSS]</dt>
   <dd><cite><a href=http://www.w3.org/TR/becss/>Behavioral Extensions to CSS</a></cite>, I. Hickson. W3C.</dd>

   <dt id=refsBEZIER>[BEZIER]</dt>
   <dd><cite>Courbes &agrave; poles</cite>, P. de Casteljau. INPI, 1959.</dd>

   <dt id=refsBIDI>[BIDI]</dt>
   <dd><cite><a href=http://www.unicode.org/reports/tr9/>UAX #9: Unicode Bidirectional Algorithm</a></cite>, M. Davis. Unicode Consortium.</dd>

   <dt id=refsBOCU1>[BOCU1]</dt>
   <dd>(Non-normative) <cite><a href=http://www.unicode.org/notes/tn6/>UTN #6: BOCU-1: MIME-Compatible Unicode Compression</a></cite>, M. Scherer, M. Davis. Unicode Consortium.</dd>

   <dt id=refsCESU8>[CESU8]</dt>
   <dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr26/>UTR #26: Compatibility Encoding Scheme For UTF-16: 8-BIT (CESU-8)</a></cite>, T. Phipps. Unicode Consortium.</dd>

   <dt id=refsCHARMOD>[CHARMOD]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/charmod/>Character Model for the World Wide Web 1.0: Fundamentals</a></cite>, M. D&uuml;rst, F. Yergeau, R. Ishida, M. Wolf, T. Texin. W3C.</dd>

   <dt id=refsCLDR>[CLDR]</dt>
   <dd><cite><a href=http://cldr.unicode.org/>Unicode Common Locale Data Repository</a></cite>. Unicode.</dd>

   <dt id=refsCOMPOSITE>[COMPOSITE]</dt>
   <dd><cite><a href=http://dev.w3.org/fxtf/compositing/>Compositing and Blending</a></cite>. R. Cabanier, N. Andronikos. W3C.</dd>

   <dt id=refsCOMPUTABLE>[COMPUTABLE]</dt>
   <dd>(Non-normative) <cite><a href=http://www.turingarchive.org/browse.php/B/12>On computable numbers, with an application to the Entscheidungsproblem</a></cite>, A. Turing. In <cite>Proceedings of the London Mathematical Society</cite>, series 2, volume 42, pages 230-265. London Mathematical Society, 1937.</dd>

   <dt id=refsCOOKIES>[COOKIES]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc6265>HTTP State Management Mechanism</a></cite>, A. Barth. IETF.</dd>

   <dt id=refsCORS>[CORS]</dt>
   <dd><cite><a href=http://fetch.spec.whatwg.org/>Cross-Origin Resource Sharing</a></cite>, A. van Kesteren. WHATWG.</dd>

   <dt id=refsCP50220>[CP50220]</dt>
   <dd>(Non-normative) <cite><a href=http://www.iana.org/assignments/charset-reg/CP50220>CP50220</a></cite>, Y. Naruse. IANA.</dd> <!-- really should be "NARUSE, Y." or some such, but there's a western bias to these references for consistency. sorry. -->

   <dt id=refsCSP>[CSP]</dt>
   <dd>(Non-normative) <cite><a href=http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html>Content Security Policy</a></cite>, B. Sterne, A. Barth. W3C.</dd>

   <dt id=refsCSS>[CSS]</dt>
   <dd><cite><a href=http://www.w3.org/TR/CSS2/>Cascading Style Sheets Level 2 Revision 1</a></cite>, B. Bos, T. &Ccedil;elik, I. Hickson, H. Lie. W3C.</dd>

   <dt id=refsCSSANIMATIONS>[CSSANIMATIONS]</dt>
   <dd>(Non-normative) <cite><a href=http://dev.w3.org/csswg/css3-animations/>CSS Animations</a></cite>, D. Jackson, D. Hyatt, C. Marrin, S. Galineau, L. Baron. W3C.</dd>

   <dt id=refsCSSATTR>[CSSATTR]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css-style-attr/>CSS Styling Attribute Syntax</a></cite>, T. &Ccedil;elik, E. Etemad. W3C.</dd>

   <dt id=refsCSSCOLOR>[CSSCOLOR]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css3-color/>CSS Color Module Level 3</a></cite>, T. &Ccedil;elik, C. Lilley, L. Baron. W3C.</dd>

   <dt id=refsCSSFONTLOAD>[CSSFONTLOAD]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css-font-load-events/>CSS Font Load Events</a></cite>, J. Daggett. W3C.</dd>

   <dt id=refsCSSFONTS>[CSSFONTS]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css3-fonts/>CSS Fonts</a></cite>, J. Daggett. W3C.</dd>

   <dt id=refsCSSIMAGES>[CSSIMAGES]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css-images/>CSS Image Values and Replaced Content Module</a></cite>, E. Etemad, T. Atkins. W3C.</dd>

   <dt id=refsCSSOM>[CSSOM]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/cssom/>Cascading Style Sheets Object Model (CSSOM)</a></cite>, S. Pieters, G. Adams. W3C.</dd>

   <dt id=refsCSSOMVIEW>[CSSOMVIEW]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/cssom-view/>CSSOM View Module</a></cite>, S. Pieters, G. Adams. W3C.</dd>

   <dt id=refsCSSRUBY>[CSSRUBY]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css3-ruby/>CSS3 Ruby Module</a></cite>, R. Ishida. W3C.</dd>

   <dt id=refsCSSTRANSITIONS>[CSSTRANSITIONS]</dt>
   <dd>(Non-normative) <cite><a href=http://dev.w3.org/csswg/css3-transitions/>CSS Transitions</a></cite>, D. Jackson, D. Hyatt, C. Marrin, L. Baron. W3C.</dd>

   <dt id=refsCSSUI>[CSSUI]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css3-ui/>CSS3 Basic User Interface Module</a></cite>, T. &Ccedil;elik. W3C.</dd>

   <!-- one day this reference will exist! then we can update this! -->
   <dt id=refsCSSSCOPED>[CSSSCOPED]</dt>
   <dd><cite>CSS Scoped Style Sheets</cite>, T. Atkins. Your Imagination.</dd>

   <dt id=refsCSSVALUES>[CSSVALUES]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css3-values/>CSS3 Values and Units</a></cite>, H. Lie, T. Atkins, E. Etemad. W3C.</dd>

   <dt id=refsDASH>[DASH]</dt>
   <dd><cite><a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=57623">Dynamic adaptive streaming over HTTP (DASH)</a></cite>. ISO.</dd>

   <dt id=refsDOM>[DOM]</dt>
   <dd><cite><a href=http://dom.spec.whatwg.org/>DOM</a></cite>, A. van Kesteren, A. Gregor, Ms2ger. WHATWG.</dd>

   <dt id=refsDOMEVENTS>[DOMEVENTS]</dt>
   <dd><cite><a href=http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html>Document Object Model (DOM) Level 3 Events Specification</a></cite>, T. Leithead, J. Rossi, D. Schepers, B. H&ouml;hrmann, P. Le H&eacute;garet, T. Pixley. W3C.</dd>

   <dt id=refsDOMPARSING>[DOMPARSING]</dt>
   <dd><cite><a href=http://domparsing.spec.whatwg.org/>DOM Parsing and Serialization</a></cite>, Ms2ger. WHATWG.</dd>

   <dt id=refsDOT>[DOT]</dt>
   <dd>(Non-normative) <cite><a href=http://www.graphviz.org/content/dot-language>The DOT Language</a></cite>. Graphviz.</dd>

   <dt id=refsE163>[E163]</dt>
   <dd><cite>Recommendation E.163 &mdash; Numbering Plan for The International Telephone Service</cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.</dd>

   <dt id=refsECMA262>[ECMA262]</dt>
   <dd><cite><a href=http://www.ecma-international.org/publications/standards/Ecma-262.htm>ECMAScript Language Specification</a></cite>. ECMA.</dd>

   <dt id=refsECMA357>[ECMA357]</dt>
   <dd>(Non-normative) <cite><a href=http://www.ecma-international.org/publications/standards/Ecma-357.htm>ECMAScript for XML (E4X) Specification</a></cite>. ECMA.</dd>

   <dt id=refsEDITING>[EDITING]</dt>
   <dd><cite><a href=http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html>HTML Editing APIs</a></cite>, A. Gregor. W3C Editing APIs CG.</dd>

   <dt id=refsENCODING>[ENCODING]</dt>
   <dd><cite><a href=http://encoding.spec.whatwg.org/>Encoding</a></cite>, A. van Kesteren, J. Bell. WHATWG.</dd>

   <dt id=refsFILEAPI>[FILEAPI]</dt>
   <dd><cite><a href=http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html>File API</a></cite>, A. Ranganathan. W3C.</dd>

   <dt id=refsFULLSCREEN>[FULLSCREEN]</dt>
   <dd><cite><a href=http://fullscreen.spec.whatwg.org/>Fullscreen</a></cite>, A. van Kesteren, T. &Ccedil;elik. WHATWG.</dd>

   <dt id=refsGIF>[GIF]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/Graphics/GIF/spec-gif89a.txt>Graphics Interchange Format</a></cite>. CompuServe.</dd>

   <dt id=refsGRAPHICS>[GRAPHICS]</dt>
   <dd>(Non-normative) <cite>Computer Graphics: Principles and Practice in C</cite>, Second Edition, J. Foley, A. van Dam, S. Feiner, J. Hughes. Addison-Wesley. ISBN 0-201-84840-6.</dd>
   <!--
   This book ("Computer Graphics: Principles and Practice in C")
   apparently does not make any references to literature in the
   bibliographic section to define the "even-odd" rule for polygon
   filling and hit testing. In the absence of such a reference, I
   guess that this book is the most authoritative reference.
   -->

   <dt id=refsGREGORIAN>[GREGORIAN]</dt>
   <dd>(Non-normative) <cite>Inter Gravissimas</cite>, A. Lilius, C. Clavius. Gregory XIII Papal Bull, February 1582.</dd>

   <dt id=refsHTTP>[HTTP]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2616>Hypertext Transfer Protocol &mdash; HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H.  Frystyk, L. Masinter, P. Leach, T. Berners-Lee. IETF.</dd>

   <dt id=refsHTTPS>[HTTPS]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc2818>HTTP Over TLS</a></cite>, E. Rescorla. IETF.</dd>

   <dt id=refsIANAPERMHEADERS>[IANAPERMHEADERS]</dt>
   <dd><cite><a href=http://www.iana.org/assignments/message-headers/perm-headers.html>Permanent Message Header Field Names</a></cite>. IANA.</dd>

   <dt id=refsISO3166>[ISO3166]</dt>
   <dd><cite><a href=http://www.iso.org/iso/home/standards/country_codes.htm>ISO 3166: Codes for the representation of names of countries and their subdivisions</a></cite>. ISO.</dd>

   <dt id=refsISO8601>[ISO8601]</dt>
   <dd>(Non-normative) <cite><a href="http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetch&amp;nodeid=4021199">ISO8601: Data elements and interchange formats &mdash; Information interchange &mdash; Representation of dates and times</a></cite>. ISO.</dd>

   <dt id=refsJLREQ>[JLREQ]</dt>
   <dd><cite><a href=http://www.w3.org/TR/jlreq/>Requirements for Japanese Text Layout</a></cite>. W3C.</dd> <!-- too many editors to list -->

   <dt id=refsJPEG>[JPEG]</dt>
   <dd><cite><a href=http://www.w3.org/Graphics/JPEG/jfif3.pdf>JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>

   <dt id=refsJSON>[JSON]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc4627>The application/json Media Type for JavaScript Object Notation (JSON)</a></cite>, D. Crockford. IETF.</dd>

   <dt id=refsJSURL>[JSURL]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/draft-hoehrmann-javascript-scheme>The 'javascript' resource identifier scheme</a></cite>, B. H&ouml;hrmann. IETF.
   <!-- Sadly this reference has been dead for a while. Unfortunately it's the closest thing we current have to a spec. -->
   </dd>

   <dt id=refsMAILTO>[MAILTO]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc6068>The 'mailto' URI scheme</a></cite>, M. Duerst, L. Masinter, J. Zawinski. IETF.</dd>

   <dt id=refsMATHML>[MATHML]</dt>
   <dd><cite><a href=http://www.w3.org/TR/MathML/>Mathematical Markup Language (MathML)</a></cite>, D. Carlisle, P. Ion, R. Miner, N. Poppelier. W3C.</dd>

   <dt id=refsMEDIAFRAG>[MEDIAFRAG]</dt>
   <dd><cite><a href=http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/>Media Fragments URI</a></cite>, R. Troncy, E. Mannens, S. Pfeiffer, D. Van Deursen. W3C.</dd>

   <dt id=refsMFREL>[MFREL]</dt>
   <dd><cite><a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>Microformats Wiki: existing rel values</a></cite>. Microformats.</dd>

   <dt id=refsMIMESNIFF>[MIMESNIFF]</dt>
   <dd><cite><a href=http://mimesniff.spec.whatwg.org/>MIME Sniffing</a></cite>, G. Hemsley. WHATWG.</dd>

   <dt id=refsMNG>[MNG]</dt>
   <dd><cite><a href=http://www.libpng.org/pub/mng/spec/>MNG (Multiple-image Network Graphics) Format</a></cite>. G. Randers-Pehrson.</dd>

   <dt id=refsMPEG2>[MPEG2]</dt>
   <dd><cite>ISO/IEC 13818-1: Information technology &mdash; Generic coding of moving pictures and associated audio information: Systems</cite>. ISO/IEC.</dd>
   <!-- search for ["bytes are removed from this buffer at a rate defined by sb_leak_rate"] to find it -->

   <dt id=refsMPEG4>[MPEG4]</dt>
   <dd><cite>ISO/IEC 14496-12: ISO base media file format</cite>. ISO/IEC.</dd>
   <!-- search for ["Box Structure was and subsequent clauses were re-organized"] to find it -->

   <dt id=refsMQ>[MQ]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/css3-mediaqueries/>Media Queries</a></cite>, H. Lie, T.  &Ccedil;elik, D. Glazman, A. van Kesteren. W3C.</dd>

   <dt id=refsNPAPI>[NPAPI]</dt>
   <dd>(Non-normative) <cite><a href=https://developer.mozilla.org/en/Gecko_Plugin_API_Reference>Gecko Plugin API Reference</a></cite>. Mozilla.</dd>

   <dt id=refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</dt>
   <dd><cite><a href=http://wiki.xiph.org/SkeletonHeaders>SkeletonHeaders</a></cite>. Xiph.Org.</dd>

   <dt id=refsOPENSEARCH>[OPENSEARCH]</dt>
   <dd><cite><a href=http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML>Autodiscovery in HTML/XHTML</a></cite>. In <cite>OpenSearch 1.1 Draft 4</cite>, Section 4.6.2. OpenSearch.org.</dd>

   <dt id=refsORIGIN>[ORIGIN]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc6454>The Web Origin Concept</a></cite>, A. Barth. IETF.</dd>   

   <dt id=refsPAGEVIS>[PAGEVIS]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3c-test.org/webperf/specs/PageVisibility/>Page Visibility</a></cite>, J. Mann, A. Jain. W3C.</dd>   

   <dt id=refsPDF>[PDF]</dt>
   <dd>(Non-normative) <cite><a href=http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf>Document management &mdash; Portable document format &mdash; Part 1: PDF</a></cite>. ISO.</dd>   

   <dt id=refsPINGBACK>[PINGBACK]</dt>
   <dd><cite><a href=http://www.hixie.ch/specs/pingback/pingback>Pingback 1.0</a></cite>, S. Langridge, I. Hickson.</dd>

   <dt id=refsPNG>[PNG]</dt>
   <dd><cite><a href=http://www.w3.org/TR/PNG/>Portable Network Graphics (PNG) Specification</a></cite>, D. Duce. W3C.</dd>

   <dt id=refsPOINTERLOCK>[POINTERLOCK]</dt>
   <dd><cite><a href=http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>Pointer Lock</a></cite>, V. Scheib. W3C.</dd>

   <dt id=refsPPUTF8>[PPUTF8]</dt>
   <dd>(Non-normative) <cite><a href=http://www.sw.it.aoyama.ac.jp/2012/pub/IUC11-UTF-8.pdf>The Properties and Promises <!-- Promizes (sic) --> of UTF-8</a></cite>, M. D&uuml;rst. University of Z&uuml;rich. In <cite>Proceedings of the 11th International Unicode Conference</cite>.</dd>

   <dt id=refsPSL>[PSL]</dt>
   <dd><cite><a href=http://publicsuffix.org/>Public Suffix List</a></cite>.
   Mozilla Foundation.</dd>

   <dt id=refsRFC1034>[RFC1034]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc1034>Domain Names - Concepts and Facilities</a></cite>, P. Mockapetris. IETF, November 1987.</dd>

   <dt id=refsRFC1123>[RFC1123]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc1123>Requirements for Internet Hosts -- Application and Support</a></cite>, R. Braden. IETF, October 1989.</dd>

   <dt id=refsRFC1345>[RFC1345]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1345>Character Mnemonics and Character Sets</a></cite>, K. Simonsen. IETF.</dd>

   <dt id=refsRFC1468>[RFC1468]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1468>Japanese Character Encoding for Internet Messages</a></cite>, J. Murai, M. Crispin, E. van der Poel. IETF.</dd>

   <dt id=refsRFC1554>[RFC1554]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1554>ISO-2022-JP-2: Multilingual Extension of ISO-2022-JP</a></cite>, M. Ohta, K. Handa. IETF.</dd>

   <dt id=refsRFC1557>[RFC1557]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1557>Korean Character Encoding for Internet Messages</a></cite>, U. Choi, K. Chon, H. Park. IETF.</dd>

   <dt id=refsRFC1842>[RFC1842]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1842>ASCII Printable Characters-Based Chinese Character Encoding for Internet Messages</a></cite>, Y. Wei, Y. Zhang, J. Li, J. Ding, Y. Jiang. IETF.</dd>

   <dt id=refsRFC1922>[RFC1922]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1922>Chinese Character Encoding for Internet Messages</a></cite>, HF. Zhu, DY. Hu, ZG. Wang, TC. Kao, WCH. Chang, M. Crispin. IETF.</dd>

   <dt id=refsRFC2046>[RFC2046]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2046>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N.  Borenstein. IETF.</dd> <!-- for text/plain and "Internet Media type"; not for definition of "valid MIME type". -->

   <dt id=refsRFC2119>[RFC2119]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2119>Key words for use in RFCs to Indicate Requirement Levels</a></cite>, S. Bradner. IETF.</dd>

   <dt id=refsRFC2237>[RFC2237]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc2237>Japanese Character Encoding for Internet Messages</a></cite>, K. Tamaru. IETF.</dd>

   <dt id=refsRFC2313>[RFC2313]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2313>PKCS #1: RSA Encryption</a></cite>, B. Kaliski. IETF.</dd>

   <dt id=refsRFC2318>[RFC2318]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2318>The text/css Media Type</a></cite>, H. Lie, B. Bos, C. Lilley. IETF.</dd>

   <dt id=refsRFC2388>[RFC2388]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2388>Returning Values from Forms: multipart/form-data</a></cite>, L. Masinter. IETF.</dd>

   <dt id=refsRFC2397>[RFC2397]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2397>The "data" URL scheme</a></cite>, L. Masinter. IETF.</dd>

   <dt id=refsRFC2445>[RFC2445]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2445>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</a></cite>, F. Dawson, D. Stenerson. IETF.</dd>

   <dt id=refsRFC2483>[RFC2483]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc2483>URI Resolution Services Necessary for URN Resolution</a></cite>, M. Mealling, R. Daniel. IETF.</dd>

   <dt id=refsRFC3676>[RFC3676]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc3676>The Text/Plain Format and DelSp Parameters</a></cite>, R. Gellens. IETF.</dd>

   <dt id=refsRFC3023>[RFC3023]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc3023>XML Media Types</a></cite>, M. Murata, S. St. Laurent, D. Kohn. IETF.</dd>

   <dt id=refsRFC3279>[RFC3279]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc3279>Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</a></cite>, W. Polk, R. Housley, L. Bassham. IETF.</dd>

   <dt id=refsRFC3490>[RFC3490]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc3490>Internationalizing Domain Names in Applications (IDNA)</a></cite>, P. Faltstrom, P. Hoffman, A. Costello. IETF.</dd>

   <dt id=refsRFC3629>[RFC3629]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc3629>UTF-8, a transformation format of ISO 10646</a></cite>, F. Yergeau. IETF.</dd>

   <dt id=refsRFC3864>[RFC3864]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc3864>Registration Procedures for Message Header Fields</a></cite>, G. Klyne, M. Nottingham, J. Mogul. IETF.</dd>

   <dt id=refsRFC4281>[RFC4281]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc4281>The Codecs Parameter for "Bucket" Media Types</a></cite>, R. Gellens, D. Singer, P. Frojdh. IETF.</dd>

   <dt id=refsRFC4329>[RFC4329]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc4329>Scripting Media Types</a></cite>, B. H&ouml;hrmann. IETF.</dd>

   <dt id=refsRFC4395>[RFC4395]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc4395>Guidelines and Registration Procedures for New URI Schemes</a></cite>, T. Hansen, T. Hardie, L. Masinter. IETF.</dd>

   <dt id=refsRFC4648>[RFC4648]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc4648>The Base16, Base32, and Base64 Data Encodings</a></cite>, S. Josefsson. IETF.</dd>

   <dt id=refsRFC5280>[RFC5280]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc5280>Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</a></cite>, D. Cooper, S. Santesson, S. Farrell, S. Boeyen, R. Housley, W. Polk. IETF.</dd>

   <dt id=refsRFC5322>[RFC5322]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc5322>Internet Message Format</a></cite>, P. Resnick. IETF.</dd>

   <dt id=refsRFC5724>[RFC5724]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc5724>URI Scheme for Global System for Mobile Communications (GSM) Short Message Service (SMS)</a></cite>, E. Wilde, A. Vaha-Sipila. IETF.</dd>

   <dt id=refsRFC6266>[RFC6266]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc6266>Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)</a></cite>, J. Reschke. IETF.</dd>

   <dt id=refsRFC6350>[RFC6350]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc6350>vCard Format Specification</a></cite>, S. Perreault. IETF.</dd>

   <dt id=refsSCSU>[SCSU]</dt>
   <dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr6/>UTR #6: A Standard Compression Scheme For Unicode</a></cite>, M. Wolf, K. Whistler, C. Wicksteed, M. Davis, A. Freytag, M. Scherer. Unicode Consortium.</dd>

   <dt id=refsSELECTORS>[SELECTORS]</dt>
   <dd><cite><a href=http://dev.w3.org/csswg/selectors/>Selectors</a></cite>, E. Etemad, T. &Ccedil;elik, D. Glazman, I. Hickson, P. Linss, J. Williams. W3C.</dd>

   <dt id=refsSRGB>[SRGB]</dt>
   <dd><cite lang=en-GB><a href="http://webstore.iec.ch/webstore/webstore.nsf/artnum/025408!OpenDocument&amp;Click=">IEC 61966-2-1: Multimedia systems and equipment &mdash; Colour measurement and management &mdash; Part 2-1: Colour management &mdash; Default RGB colour space &mdash; sRGB</a></cite>. IEC.</dd>

   <dt id=refsSVG>[SVG]</dt>
   <dd><cite><a href=http://www.w3.org/TR/SVGTiny12/>Scalable Vector Graphics (SVG) Tiny 1.2 Specification</a></cite>, O. Andersson, R. Berjon, E. Dahlstr&ouml;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.</dd>

   <dt id=refsTYPEDARRAY>[TYPEDARRAY]</dt>
   <dd><cite><a href=http://www.khronos.org/registry/typedarray/specs/latest/>Typed Array Specification</a></cite>, D. Herman, K. Russell. Khronos.</dd>

   <dt id=refsTZDATABASE>[TZDATABASE]</dt>
   <dd>(Non-normative) <cite><a href=http://www.iana.org/time-zones>Time Zone Database</a></cite>. IANA.</dd>

   <dt id=refsUAAG>[UAAG]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/UAAG20/>User Agent Accessibility Guidelines (UAAG) 2.0</a></cite>, J. Allan, K. Ford, J. Richards, J. Spellman. W3C.</dd>

   <dt id=refsUCA>[UCA]</dt>
   <dd><cite><a href=http://www.unicode.org/reports/tr10/>UTR #10: Unicode Collation Algorithm</a></cite>, M. Davis, K. Whistler. Unicode Consortium.</dd>

   <dt id=refsUNDO>[UNDO]</dt>
   <dd><cite><a href=http://rniwa.com/editing/undomanager.html>UndoManager and DOM Transaction</a></cite>, R. Niwa.</dd>

   <dt id=refsUNICODE>[UNICODE]</dt>
   <dd><cite><a href=http://www.unicode.org/versions/>The Unicode Standard</a></cite>. Unicode Consortium.</dd>

   <dt id=refsUNIVCHARDET>[UNIVCHARDET]</dt>
   <dd>(Non-normative) <cite><a href=http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html>A composite approach to language/encoding detection</a></cite>, S. Li, K. Momoi. Netscape. In <cite>Proceedings of the 19th International Unicode Conference</cite>.</dd>

   <dt id=refsURL>[URL]</dt>
   <dd><cite><a href=http://url.spec.whatwg.org/>URL</a></cite>, A. van Kesteren. WHATWG.</dd>

   <dt id=refsUTF7>[UTF7]</dt>
   <dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc2152>UTF-7: A Mail-Safe Transformation Format of Unicode</a></cite>, D. Goldsmith, M. Davis. IETF.</dd>

   <dt id=refsUTF8DET>[UTF8DET]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/International/questions/qa-forms-utf-8>Multilingual form encoding</a></cite>, M. D&uuml;rst. W3C.</dd>

   <dt id=refsUTR36>[UTR36]</dt>
   <dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr36/>UTR #36: Unicode Security Considerations</a></cite>, M. Davis, M. Suignard. Unicode Consortium.</dd>

   <dt id=refsWCAG>[WCAG]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/WCAG20/>Web Content Accessibility Guidelines (WCAG) 2.0</a></cite>, B. Caldwell, M. Cooper, L. Reid, G. Vanderheiden. W3C.</dd>

   <dt id=refsWEBGL>[WEBGL]</dt>
   <dd><cite><a href=http://www.khronos.org/registry/webgl/specs/latest/>WebGL Specification</a></cite>, D. Jackson. Khronos Group.</dd>

   <dt id=refsWEBIDL>[WEBIDL]</dt>
   <dd><cite><a href=http://dev.w3.org/2006/webapi/WebIDL/>Web IDL</a></cite>, C. McCormack. W3C.</dd>

   <dt id=refsWEBLINK>[WEBLINK]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc5988>Web Linking</a></cite>, M. Nottingham. IETF.</dd>

   <dt id=refsWEBMCG>[WEBMCG]</dt>
   <dd><cite><a href=http://www.webmproject.org/code/specs/container/>WebM Container Guidelines</a></cite>. The WebM Project.</dd>

   <dt id=refsWEBVTT>[WEBVTT]</dt>
   <dd><cite><a href=http://dev.w3.org/html5/webvtt/>WebVTT</a></cite>, I. Hickson. W3C.</dd>

   <dt id=refsWHATWGWIKI>[WHATWGWIKI]</dt>
   <dd><cite><a href=http://wiki.whatwg.org/>The WHATWG Wiki</a></cite>. WHATWG.</dd>

   <dt id=refsWSP>[WSP]</dt>
   <dd><cite><a href=http://tools.ietf.org/html/rfc6455>The WebSocket protocol</a></cite>, I. Fette, A. Melnikov. IETF.</dd>

   <dt id=refsX121>[X121]</dt>
   <dd><cite>Recommendation X.121 &mdash; International Numbering Plan for Public Data Networks</cite>, CCITT Blue Book, Fascicle VIII.3, pp. 317-332.</dd>

   <dt id=refsX690>[X690]</dt>
   <dd><cite><a href=http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf>Recommendation X.690 &mdash; Information Technology &mdash; ASN.1 Encoding Rules &mdash; Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER), and Distinguished Encoding Rules (DER)</a></cite>. International Telecommunication Union.</dd>

   <dt id=refsXFN>[XFN]</dt>
   <dd><cite><a href=http://gmpg.org/xfn/11>XFN 1.1 profile</a></cite>, T. &Ccedil;elik, M. Mullenweg, E. Meyer. GMPG.</dd>

   <dt id=refsXHR>[XHR]</dt>
   <dd><cite><a href=http://xhr.spec.whatwg.org/><code>XMLHttpRequest</code></a></cite>, A. van Kesteren. WHATWG.</dd>

   <dt id=refsXML>[XML]</dt>
   <dd><cite><a href=http://www.w3.org/TR/xml/>Extensible Markup Language</a></cite>, T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler, F. Yergeau. W3C.</dd>

   <dt id=refsXMLBASE>[XMLBASE]</dt>
   <dd><cite><a href=http://www.w3.org/TR/xmlbase/>XML Base</a></cite>, J. Marsh, R. Tobin. W3C.</dd>

   <dt id=refsXMLNS>[XMLNS]</dt>
   <dd><cite><a href=http://www.w3.org/TR/xml-names/>Namespaces in XML</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin. W3C.</dd>

   <dt id=refsXPATH10>[XPATH10]</dt>
   <dd><cite><a href=http://www.w3.org/TR/1999/REC-xpath-19991116>XML Path Language (XPath) Version 1.0</a></cite>, J. Clark, S. DeRose. W3C.</dd>

   <dt id=refsXSLT10>[XSLT10]</dt>
   <dd>(Non-normative) <cite><a href=http://www.w3.org/TR/1999/REC-xslt-19991116>XSL Transformations (XSLT) Version 1.0</a></cite>, J. Clark. W3C.</dd>

<!--(once XSLTProcessor is defined somewhere, update this and the place that references this)
   <dt id="refsXSLTP">[XSLTP]</dt>
   <dd>(Non-normative) <cite><a href=""></a></cite>, . .</dd>
-->

  </dl><h2 class=no-num id=acknowledgements>Acknowledgements</h2> <!-- ACKS -->

  <p>Thanks to Tim Berners-Lee for inventing HTML, without which none
  of this would exist.</p>

  <p>Thanks to

  Aankhen,
  Aaron Boodman,
  Aaron Leventhal,
  Adam Barth,
  Adam de Boor,
  Adam Hepton,
  Adam Klein,
  Adam Roben,
  Addison Phillips,
  Adele Peterson,
  Adrian Bateman,
  Adrian Sutton,
  Agust&iacute;n Fern&aacute;ndez,
  Aharon (Vladimir) Lanin,
  Ajai Tirumali,
  Akatsuki Kitamura,
  Alan Plum,
  Alastair Campbell,
  Alejandro G. Castro,
  Alex Bishop,
  Alex Nicolaou,
  Alex Rousskov,
  Alexander Farkas,
  Alexander J. Vincent,
  Alexandre Morgaut,
  Alexey Feldgendler,
  &Acy;&lcy;&iecy;&kcy;&scy;&iecy;&jcy; &Pcy;&rcy;&ocy;&scy;&kcy;&ucy;&rcy;&yacy;&kcy;&ocy;&vcy; (Alexey Proskuryakov),
  Alexis Deveria,
  Allan Clements,
  Amos Jeffries,
  Anders Carlsson,
  Andreas<!-- mqmq87 -->,
  Andreas Kling,
  Andrei Popescu,
  Andr&eacute; E. Veltstra,
  Andrew Barfield,
  Andrew Clover,
  Andrew Gove,
  Andrew Grieve,
  Andrew Oakley,
  Andrew Sidwell,
  Andrew Simons,
  Andrew Smith,
  Andrew W. Hagen,
  Andrey V. Lukyanov,
  Andy Earnshaw,
  Andy Heydon,
  Andy Palay,
  Anne van Kesteren,
  Anthony Boyd,
  Anthony Bryan,
  Anthony Hickson,
  Anthony Ricaud,
  Antti Koivisto,
  Arne Thomassen,
  Aron Spohr,
  Arphen Lin,
  Arthur Stolyar,
  Arun Patole,
  Aryeh Gregor,
  Asbj&oslash;rn Ulsberg,
  Ashley Gullen,
  Ashley Sheridan,
  Atsushi Takayama,
  Aurelien Levy,
  Ave Wrigley,
  Axel Dahmen,
  Ben Boyle,
  Ben Godfrey,
  Ben Lerner,
  Ben Leslie,
  Ben Meadowcroft,
  Ben Millard,
  Benjamin Carl Wiley Sittler,
  Benjamin Hawkes-Lewis,
  Benoit Ren,
  Bert Bos,
  Bijan Parsia,
  Bil Corry,
  Bill Mason,
  Bill McCoy,
  Billy Wong,
  Bjartur Thorlacius,
  Bj&ouml;rn H&ouml;hrmann,
  Blake Frantz,
  Bob Lund,
  Bob Owen,
  Boris Zbarsky,
  Brad Fults,
  Brad Neuberg,
  Brad Spencer,
  Brady Eidson,
  Brendan Eich,
  Brenton Simpson,
  Brett Wilson,
  Brett Zamir,
  Brian Campbell,
  Brian Korver,
  Brian Kuhn,
  Brian M. Dube,
  Brian Ryner,
  Brian Smith,
  Brian Wilson,
  Bryan Sullivan,
  Bruce D'Arcus,
  Bruce Lawson,
  Bruce Miller,
  C. Williams,
  Cameron McCormack,
  Cameron Zemek,
  Cao Yipeng,
  Carlos Gabriel Cardona,
  Carlos Perell&oacute; Mar&iacute;n,
  Chao Cai,
  &#xc724;&#xc11d;&#xcc2c; (Channy Yun),
  Charl van Niekerk,
  Charles Iliya Krempeaux,
  Charles McCathieNevile,
  Chris Apers,
  Chris Cressman,
  Chris Evans,
  Chris Morris,
  Chris Pearce,
  Chris Peterson,
  Chris Weber,
  Christian Biesinger,
  Christian Johansen,
  Christian Schmidt,
  Christoph P&auml;per,
  Christophe Dumez,
  Christopher Aillon,
  Christopher Ferris,
  Chriswa,
  Clark Buehler,
  Cole Robison,
  Colin Fine,
  Collin Jackson,
  Corprew Reed,
  Craig Cockburn,
  Csaba Gabor,
  Csaba Marton,
  Cynthia Shelly,
  Dan Yoder,
  Daniel Barclay,
  Daniel Bratell,
  Daniel Brooks,
  Daniel Brumbaugh Keeney,
  Daniel Cheng,
  Daniel Davis,
  Daniel Glazman,
  Daniel Peng,
  Daniel Schattenkirchner,
  Daniel Sp&aring;ng,
  Daniel Steinberg,
  Daniel Trebbien,
  Danny Sullivan,
  Darin Adler,
  Darin Fisher,
  Darxus,
  Dave Camp,
  Dave Hodder,
  Dave Lampton,
  Dave Singer,
  Dave Townsend<!-- Mossop on moz irc -->,
  David Baron,
  David Bloom,
  David Bruant,
  David Carlisle,
  David E. Cleary,
  David Egan Evans,
  David Flanagan,
  David Gerard,
  David H&aring;s&auml;ther,
  David Hyatt,
  David I. Lehn,
  David John Burrowes,
  David Kendal,
  David Matja,
  David Remahl,
  David Smith,
  David Woolley,
  DeWitt Clinton,
  Dean Edridge,
  Dean Edwards,
  Debi Orton,
  Derek Featherstone,
  Devarshi Pant,
  Devdatta,
  Dimitri Glazkov,
  Dimitry Golubovsky,
  Dirk Pranke,
  Dirk Schulze,
  Dirkjan Ochtman,
  Divya Manian,
  Dmitry Titov,
  dolphinling,
  Dominique Haza&euml;l-Massieux,
  Don Brutzman,
  Doron Rosenberg,
  Doug Kramer,
  Doug Simpkinson,
  Drew Wilson,
  Edmund Lai,
  Eduard Pascual,
  Eduardo Vela,
  Edward O'Connor,
  Edward Welbourne,
  Edward Z. Yang,
  Ehsan Akhgari,
  Eira Monstad,
  Eitan Adler,
  Eliot Graff,
  Elisabeth Robson,
  Elizabeth Castro,
  Elliott Sprehn,
  Elliotte Harold,
  Eric Carlson,
  Eric Lawrence,
  Eric Rescorla,
  Eric Semling,
  Erik Arvidsson,
  Erik Rose,
  Evan Martin,
  Evan Prodromou,
  Evert,
  fantasai,
  Felix Sasaki,
  Francesco Schwarz,
  Francis Brosnan Blazquez,
  Franck 'Shift' Qu&eacute;lain,
  Frank Barchard,
  &#x9d5c;&#x98fc;&#x6587;&#x654f; (Fumitoshi Ukai),
  Futomi Hatano,
  Gavin Carothers,
  Gavin Kistner,
  Gareth Rees,
  Garrett Smith,
  Geoff Richards,
  Geoffrey Garen,
  Geoffrey Sneddon,
  George Lund,
  Gianmarco Armellin,
  Giovanni Campagna,
  Giuseppe Pascale,
  Glenn Adams,
  Glenn Maynard,
  Graham Klyne,
  Greg Botten,
  Greg Houston,
  Greg Wilkins,
  Gregg Tavares,
  Gregory J. Rosmaita,
  Grey,
  Guilherme Johansson Tramontina,
  Gytis Jakutonis,
  H&aring;kon Wium Lie,
  Hallvord Reiar Michaelsen Steen,
  Hans S. T&oslash;mmerhalt,
  Hans Stimer,
  Harald Alvestrand,
  Henri Sivonen,
  Henrik Lied,
  Henry Mason,
  Hugh Guiney,
  Hugh Winkler,
  Ian Bicking,
  Ian Clelland,
  Ian Davis,
  Ian Fette,
  Ido Green,
  Ignacio Javier,
  Ivan Enderlin,
  Ivo Emanuel Gon&ccedil;alves,
  J. King,
  Jacob Davies,
  Jacques Distler,
  Jake Verbaten,
  James Craig,
  James Graham,
  James Greene,
  James Justin Harrell,
  James Kozianski,
  James M Snell,
  James Perrett,
  James Robinson,
  Jamie Lokier,
  Janusz Majnert,
  Jan-Klaas Kollhof,
  Jason Duell,
  Jason Kersey,
  Jason Lustig,
  Jason White,
  Jasper Bryant-Greene,
  Jasper St. Pierre,
  Jatinder Mann,
  Jed Hartman,
  Jeff Balogh,
  Jeff Cutsinger,
  Jeff Schiller,
  Jeff Walden,
  Jeffrey Zeldman,
  &#x80e1;&#x6167;&#x92d2; (Jennifer Braithwaite),
  Jens Bannmann,
  Jens Fendler,
  Jens Lindstr&ouml;m,
  Jens Meiert,
  Jeremey Hustman,
  Jeremy Keith,
  Jeremy Orlow,
  Jeroen van der Meer,
  Jian Li,
  Jim Jewett,
  Jim Ley,
  Jim Meehan,
  Jim Michaels,
  Jirka Kosek,
  Jjgod Jiang,
  Jo&atilde;o Eiras,
  Joe Clark,
  Joe Gregorio,
  Joel Spolsky,
  Johan Herland,
  John Boyer,
  John Bussjaeger,
  John Carpenter,
  John Daggett,
  John Fallows,
  John Foliot,
  John Harding,
  John Keiser,
  John Snyders,
  John Stockton,
  John-Mark Bell,
  Johnny Stenback,
  Jon Ferraiolo,
  Jon Gibbins,
  Jon Perlow,
  Jonas Sicking,
  Jonathan Cook,
  Jonathan Rees,
  Jonathan Watt,
  Jonathan Worent,
  Jonny Axelsson,
  Jordan Tucker,
  Jorgen Horstink,
  Jorunn Danielsen Newth,
  Joseph Kesselman,
  Joseph Mansfield,
  Joseph Pecoraro,
  Josh Aas,
  Josh Hart,
  Josh Levenberg,
  Joshua Bell,
  Joshua Randall,
  Jukka K. Korpela,
  Jules Cl&eacute;ment-Ripoche,
  Julian Reschke,
  J&uuml;rgen Jeka,
  Justin Lebar,
  Justin Novosad,
  Justin Schuh,
  Justin Sinclair,
  Kai Hendry,
  &#x5442;&#x5eb7;&#x8c6a; (KangHao Lu)<!-- Kenny, kennyluck-->,
  Kartikaya Gupta,
  Kathy Walton,
  Kelly Ford,
  Kelly Norton,
  Kevin Benson,
  Kevin Gadd,
  Kevin Cole,
  Korn&eacute;l P&aacute;l,
  Kornel Lesinski,
  Kris Northfield,
  Kristof Zelechovski,
  Krzysztof Maczy&nacute;ski,
  &#x9ed2;&#x6fa4;&#x525b;&#x5fd7; (Kurosawa Takeshi),
  Kyle Barnhart,
  Kyle Hofmann<!-- Ozob -->,
  Kyle Huey,
  L&eacute;onard Bouchet,
  L&eacute;onie Watson,
  Lachlan Hunt,
  Larry Masinter,
  Larry Page,
  Lars Gunther<!-- Keryx Web -->,
  Lars Solberg,
  Laura Carlson,
  Laura Granka,
  Laura L. Carlson,
  Laura Wisewell,
  Laurens Holst,
  Lawrence Forooghian,
  Lee Kowalkowski,
  Leif Halvard Silli,
  Lenny Domnitser,
  Leonard Rosenthol,
  Leons Petrazickis,
  Lobotom Dysmon,
  Logan<!-- on moz irc -->,
  Loune,
  Luke Kenneth Casson Leighton,
  Maciej Stachowiak,
  Magnus Kristiansen<!-- Dashiva -->,
  Maik Merten,
  Malcolm Rowe,
  Manish Tripathi,
  Marcus Bointon,
  Mark Birbeck,
  Mark Davis,
  Mark Miller,
  Mark Nottingham,
  Mark Pilgrim,
  Mark Rowe<!--bdash-->,
  Mark Schenk,
  Mark Vickers,
  Mark Wilton-Jones,
  Martijn Wargers,
  Martin Atkins,
  Martin D&uuml;rst,
  Martin Honnen,
  Martin Janecke,
  Martin Kutschker,
  Martin Nilsson,
  Martin Thomson,
  Masataka Yakura,
  Mathias Bynens,
  Mathieu Henri,
  Matias Larsson,
  Matt Falkenhagen,
  Matt Schmidt,
  Matt Wright,
  Matthew Gregan,
  Matthew Mastracci,
  Matthew Raymond,
  Matthew Thomas,
  Mattias Waldau,
  Max Romantschuk,
  Menno van Slooten,
  Micah Dubinko,
  Michael 'Ratt' Iannarelli,
  Michael A. Nachbaur,
  Michael A. Puls II<!--Shadow2531-->,
  Michael Carter,
  Michael Daskalov,
  Michael Day,
  Michael Dyck,
  Michael Enright,
  Michael Gratton,
  Michael Nordman,
  Michael Powers,
  Michael Rakowski,
  Michael(tm) Smith,
  Michal Zalewski,
  Michel Fortin,
  Michelangelo De Simone,
  Michiel van der Blonk,
  Mihai &Scedil;ucan<!-- from ROBO Design -->,
  Mihai Parparita,
  Mike Brown,
  Mike Dierken<!-- S. Mike Dierken -->,
  Mike Dixon,
  Mike Hearn,
  Mike Schinkel,
  Mike Shaver,
  Mikko Rantalainen,
  Mohamed Zergaoui<!-- Innovimax SARL -->,
  Mohammad Al Houssami,
  Mounir Lamouri,
  Ms2ger,
  NARUSE Yui,
  Neil Deakin,
  Neil Rashbrook,
  Neil Soiffer,
  Nicholas Shanks,
  Nicholas Stimpson,
  Nicholas Zakas,
  Nickolay Ponomarev,
  Nicolas Gallagher,
  Noah Mendelsohn,
  Noah Slater,
  Noel Gordon,
  Nolan Waite,
  NoozNooz42,
  Norbert Lindenberg,
  Ojan Vafai,
  Olaf Hoffmann,
  Olav Junker Kj&aelig;r,
  Old&rcaron;ich Vete&scaron;n&iacute;k,
  Oli Studholme,
  Oliver Hunt,
  Oliver Rigby,
  Olivier Gendrin,
  Olli Pettay,
  oSand, <!-- from reddit -->
  Pablo Flouret,
  Patrick Garies,
  Patrick H. Lauke,
  Patrik Persson,
  Paul Adenot,
  Paul Norman,
  Per-Erik Brodin,
  Perry Smith,
  Peter Beverloo,
  Peter Karlsson,
  Peter Kasting,
  Peter Moulder,
  Peter Occil,
  Peter Stark,
  Peter Van der Beken,
  Peter-Paul Koch,
  Phil Pickering,
  Philip J&auml;genstedt,
  Philip Taylor,
  Philip TAYLOR<!-- a different one -->,
  Philippe De Ryck,
  Prateek Rungta,
  Pravir Gupta,
  &#x674e;&#x666e;&#x541b; (Pujun Li)<!-- masa jack -->,
  Rachid Finge,
  Rafael Weinstein,
  Rafa&lstrok; Mi&lstrok;ecki,
  Raj Doshi,
  Rajas Moonka,
  Ralf Stoltze,
  Ralph Giles,
  Raphael Champeimont,
  Remci Mizkur,
  Remco,
  Remy Sharp,
  Rene Saarsoo,
  Rene Stach,
  Ric Hardacre,
  Rich Clark,
  Rich Doughty,
  Richard Ishida,
  Rigo Wenning,
  Rikkert Koppes,
  Rimantas Liubertas,
  Riona Macnamara,
  Rob Ennals,
  Rob Jellinghaus,
  Rob S,
  Robert Blaut,
  Robert Collins,
  Robert Kieffer,
  Robert Millan,
  Robert O'Callahan,
  Robert Sayre,
  Robin Berjon,
  Rodger Combs,
  Roland Steiner,
  Roma Matusevich,
  Roman Ivanov,
  Roy Fielding,
  Ruud Steltenpool,
  Ryan King,
  Ryosuke Niwa,
  S. Mike Dierken,
  Salvatore Loreto,
  Sam Dutton,
  Sam Kuper,
  Sam Ruby,
  Sam Weinig,
  Samuel Bronson,
  Samy Kamkar,
  Sander van Lambalgen,
  Sarven Capadisli,
  Scott Gonz&aacute;lez,
  Scott Hess,
  Sean Fraser,
  Sean Hayes,
  Sean Hogan,
  Sean Knapp,
  Sebastian Markb&aring;ge,
  Sebastian Schnitzenbaumer,
  Seth Call,
  Seth Dillingham,
  Shanti Rao,
  Shaun Inman,
  Shiki Okasaka,
  Sierk Bornemann,
  Sigbj&oslash;rn Vik,
  Silver Ghost, <!-- see bug 19614 -->
  Silvia Pfeiffer,
  &Scaron;ime Vidas,
  Simon Montagu,
  Simon Pieters,
  Simon Spiegel,
  skeww, <!-- on reddit -->
  Smylers,
  Stanton McCandlish,
  Stefan H&aring;kansson,
  Stefan Haustein,
  Stefan Santesson,
  Stefan Weiss,
  Steffen Meschkat,
  Stephen Ma,
  Stephen White,
  Steve Comstock,
  Steve Faulkner,
  Steve Runyon,
  Steven Bennett,
  Steven Garrity,
  Steven Tate,
  Stewart Brodie,
  Stuart Ballard,
  Stuart Langridge,
  Stuart Parmenter,
  Subramanian Peruvemba,
  Sunava Dutta,
  Susan Borgrink,
  Susan <!--G.--> Lesch,
  Sylvain Pasche,
  T. J. Crowder,
  Tab Atkins,
  Takeshi Yoshino,
  <span lang=tr title="">Tantek &Ccedil;elik</span>,
  &#x7530;&#x6751;&#x5065;&#x4eba; (TAMURA Kent),
  Ted Mielczarek,
  Terrence Wood,
  Thomas Broyer,
  Thomas Koetter,
  Thomas O'Connor,
  Tim Altman,
  Tim Johansson,
  TJ VanToll,
  Toby Inkster,
  Todd Moody,
  Tom Baker,
  Tom Pike,
  Tommy Thorsen,
  Tony Ross,
  Travis Leithead,
  Tyler Close,
  Victor Carbune,
  Vitya Muhachev,
  Vladimir Katardjiev,
  Vladimir Vuki&cacute;evi&cacute;,
  voracity,
  Wakaba,
  Wayne Carr,
  Wayne Pollock,
  Wellington Fernando de Macedo,
  Weston Ruter,
  Wilhelm Joys Andersen,
  Will Levine,
  William Swanson,
  Wladimir Palant,
  Wojciech Mach,
  Wolfram Kriesing,
  Xan Gregg,
  Yang Chen,
  Ye-Kui Wang,
  Yehuda Katz,
  Yi-An Huang,
  Yngve Nysaeter Pettersen,
  Yonathan Randolph,
  Yuzo Fujishima,
  Zhenbin Xu,
  Zoltan Herczeg,
  and
  &Oslash;istein E. Andersen,

  for their useful comments, both large and small, that have led to
  changes to this specification over the years.</p>

  <p>Thanks also to everyone who has ever posted about HTML to their
  blogs, public mailing lists, or forums, including all the
  contributors to the <a href=http://www.w3.org/html/wg/lists/>various W3C HTML WG
  lists</a> and the <a href=http://www.whatwg.org/mailing-list>various WHATWG lists</a>.

  <p>Special thanks to Richard Williamson for creating the first
  implementation of <code><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 title=attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>, and other
  features first widely deployed by the Windows Internet Explorer
  browser.</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>

  <div class=impl>

  <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>

  </div>

  <p>Thanks to the many sources that provided inspiration for the
  examples used in the specification.</p>

  

  <div itemscope="" itemtype=http://n.whatwg.org/work>
   <p>The image in the introduction is based on <a itemprop=work href=http://www.flickr.com/photos/wonderlane/2986252088/>a photo</a>
   by <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/wonderlane/>Wonderlane</a>.
   (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)
  </div>

  

  <div itemscope="" itemtype=http://n.whatwg.org/work>
   <p>The image of two cute kittens in a basket used in the context menu example is based on
   <a itemprop=work href=http://www.flickr.com/photos/digidreamgrafix/8370087640/>a photo</a>
   by <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/digidreamgrafix/>Alex G</a>.
   (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)
  </div>

  <div itemscope="" itemtype=http://n.whatwg.org/work>
   <p>The Blue Robot Player sprite used in the canvas demo is based on
   <a itemprop=work href=http://johncolburn.deviantart.com/art/Blue-Robot-Player-Sprite-323813997>a work</a> by
   <a itemprop=http://creativecommons.org/ns#attributionURL href=http://johncolburn.deviantart.com/>JohnColburn</a>.
   (<a itemprop=license href=http://creativecommons.org/licenses/by-sa/3.0/>CC BY-SA 3.0</a>)</p>
  </div>

  <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>

  <!-- Hopefully Kam won't notice he's covered by these
  acknowledgements three times! -->

<!--
 v2  * library of resources:
        var library = new ZipFile("data.zip");
        library.onload = function() {
          var sound1 = library.getAudio("sound1.wav"); // returns an Audio object
          var image1 = library.getImage("image1.png"); // returns an HTMLImageElement
          var doc1 = library.getXMLDocument("doc1.xml"); // returns a Document (XML Document mode)
          var doc2 = library.getHTMLDocument("doc1.html"); // returns a Document (HTML Document mode)
        }
       or:
        var library = new ResourceLoader("data.zip");
        library.add("moredata.zip");
        library.onload = function() { ... }
        library.onloading = function() {
          reportLoadProgress(library.progress); // 0.0 .. 1.0
        }
       or:
        var library = new AudioZip("sounds.zip");
        library.onload = function() {
          var sound1 = library["sound1.wav"];
          sound.play();
        }
 v2  * a fairly common situation for web authors is to have two lists, where
       the contents of the second depends on the value of the first. Is there
       any way we could extend the current model to include this functionality?
       (e.g. bugzilla product/component ui)
 v2  * quick-searchable select
 v2  * include/exclude selectors (two multi-select columns with arrows to
       move selected items) and that sort of thing.
       http://slashdot.org/comments.pl?sid=110240&cid=9357022
 v2  * Oh, and forms need a standardized Help widget/icon. I know I can
       turn my cursor into a question mark, but I'm looking for something
       simple and pervasive. Maybe you can wrap fields in a help tag, just
       as you do for fieldsets. And in that help tag, attributes are
       available that allow for a nice, formatted, clean, full help text
       popup/area/thing.
       http://slashdot.org/comments.pl?sid=110240&cid=9359006
 v2  * Validating only part of a form. - Anja Lehmann
 v2  * Reminder to add a way to expose access keys in buttons, i.e.
       Sub&mit where & signifies the m is the access key to use. Possibly
       automatic? <input accesskey="m" value="Submit"> browser would be
       smart enough to underline the first instance of the access key if
       it exists (case insensitive)? - kerz
       [or deprecate the lot (->web apps)]
 v2  * need an attribute that says "the children of this element are in
       their own tabbing universe, tabindex should be relative to each
       other, not to the document"
       -> web apps?
 v2  * make select widgets have multiple columns
       or ->web apps with list view
 v2  * required as a group (one of the following must be available):
       + i propose something like the following:
           <input type="text" group="contact" name="voicephone"> Voice phone
           <input type="text" group="contact" name="fax"> Fax
           <input type="text" group="contact" name="mobile"> Mobile phone
           <input type="text" group="contact" name="email"> E-mail
         if the user fills out none of the form fields in the "contact"
         group, an error message is shown and the form is not submitted.
         - Peter-Paul Koch
 v2  * formatting of number fields, text fields, etc, so that when the
       field is not focused, the value is displayed differently. Seems
       like this would also be useful e.g. for <output> or something so
       you can display localised dates, etc.
 v2  * being able to select date range (from day x to day y)
 v2  * ways of visualizing a linefeed in a <textarea> so it looks different
       from wrapping text
 v2  * all login systems have
         1. enter username and password
         2. create new account
         3. lost password
       some way of integrating this into one system, since it's so common
 v2  * way of identifying different sorts of mailadresses
         a) mailing-list
         b) person
         c) department in a company ("support", "marketing" and such)
         d) general mail (like "info", "mail", "contact" and such)
         e) other sorts of groupings
       (or ->web apps; this is talking about in mailto: links, I think)
 v2  * hotswapping login identities like in windows xp
         you are logged in on operamail.com, and you want to check the mail
         of another user. somehow, combined with the wand or whatever,
         the browser will remember the login page, and it can re-submit it
         without having to load the initial page (saving time)
 v2  * provide different measuring systems, like having the html indicate
       fluid in both fluid ounces and liters, and the browser can display
       one or the other based on regional settings in the browser or ui,
       display conversions in a tooltip, or let the user decide which
       format to display.
 v2  * indicate "x days ago" or "y days into the future" rather than date
 v2  * input control for anniversaries
 v2  * only submit fields that have changed, or a way to include in the
       submission a list of which form controls were changed from their
       default value
 v2  * type="time" value="now"
 v2  * add something to type="number" to support basic currency and unit
       formatting of input
 v2  * <fieldset enabled-if-checked="myCheckboxOrRadioButton">
       ...to allow sections to only be enabled if a radio button makes it
       relevant, for instance.
 v2  * Yan Morin proposed a multi-column dropdown <select> or <datalist>:
         _________________
        |_New_York______|V|_________________  <- input  with a table link and a down arrow
        |_City__________|_State_|_Country_|_| <- header of the table
        | Montreal      |  QC   | Canada  |A| <- top arrow of the scroll
        |>New York     <|  NY   | US      | | <- selected row
        | Washington    |  DC   | US      |X| <- cursor scroll
        | San Francisco |  CA   | US      | |
        |_Toronto_______|__ON___|_Canada__|V| <- bottom arrow of the scroll

 v2  * add for="" attribute to <input type="password"> so that you can
       link usernames and passwords. (Jonas Sicking)
 v2  * value for unchecked checkbox?
 v2  * A way to specify the default button - Michael Gratton
 v2  * <fieldset readonly>?
 v2  * dolphinling suggests having a way to mark certain parts of a
       form as being dependent on another (mutually exclusive parts of
       a form)
 v2  * expose the form data set, either as an object (on which one can
       invoke the JSON serialiser), or in the form of a method on
       HTMLFormElement that returns the form data set serialised
       according to a particular encoding (defaulting to the form's
       enctype="" one, probably). This would allow forms to be used
       with XHR-like systems without having to manually construct the
       form data set the way that is done today.
 v2  * expose the file upload progress when uploading files in a form
       (ideally using the same mechanism as XHR2?); ack Rob Evans

Consistency in editorial style:
 v2  * need to become consistent about whether or not to quote keyword
       ("<code title="">foo</code>" vs <code>foo</code>)
 v2  * make the spec consistent about whether the word "algorithm" is part of
       an algorithm's name or not ("</dfn> algorithm", "</span> algorithm")
 v2  * make the spec more consistent about its use of "hexadecimal"
       and "base-sixteen", the order that 0-9 A-Z a-z is mentioned,
       and the detail to which the spec explains how to interpret a
       string as a hexadecimal number.
 v2  * become more consistent about what markup we use to mark up
       productions (nothing? <i>? <code>?)
 v2  * use <code>Document</code> consistently instead of 'document'.
 v2  * be clearer about arrays/lists/collections being zero-based
       despite using the term "/index/th".
 v2  * use the sample widgets:
          <li><img alt="A text field with editable sections for each
          value, with a button to pop up a dialog showing a calendar or
          clock." src="sample-datetime-ui-2"></li>
          <li><img alt="A calendar grid with a clock in the upper right
          hand corner." src="sample-datetime-ui-3"></li>
-->
 
